pax_global_header00006660000000000000000000000064135720152200014507gustar00rootroot0000000000000052 comment=8fc57390bfb1f312094425a329ff52635b405c17 welle.io-2.1/000077500000000000000000000000001357201522000130675ustar00rootroot00000000000000welle.io-2.1/.appveyor.yml000066400000000000000000000040651357201522000155420ustar00rootroot00000000000000version: 1.0.{build} image: Visual Studio 2017 init: - set PATHORIG=%PATH% - set PATH=C:\Qt\5.13\mingw73_32\bin;C:\Qt\Tools\mingw730_32\bin;%PATH% - gcc -v before_build: # Create datetime - for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set datetime=%%G - set year=%datetime:~0,4% - set month=%datetime:~4,2% - set day=%datetime:~6,2% - set current_date=%year%%month%%day% # Create git hash - for /f %%i in ('git -C C:\projects\welle-io\ rev-parse --short HEAD') do set git_hash=%%i # Create version - set file_version=%current_date%_%git_hash% # Create a build directory - cd ..\ - md build # Get all headers and DLLs for the build - git clone https://github.com/AlbrechtL/welle.io-win-libs.git build_script: - cd build - qmake ..\welle-io - mingw32-make -j4 after_build: # Prepare welle binary files - md bin - copy src\welle-cli\release\welle-cli.exe bin - copy src\welle-gui\release\welle-io.exe bin - copy ..\welle-io\src\welle-cli\index.html bin - copy ..\welle-io\src\welle-cli\index.js bin # Create installer - cd ..\welle-io\windows\ - ps: .\create_installer.ps1 -welleExePath ..\..\build\bin -QTPath C:\Qt\5.13\mingw73_32\bin -ToolsPath C:\Qt\Tools\mingw730_32\bin -InstallerPath C:\Qt\Tools\QtInstallerFramework\3.0\bin # Add to artifact list - set PATH=%PATHORIG% - appveyor PushArtifact %welle_io_filename% #test_script: # - set PATH=%PATHORIG% # - cd installer\packages\io.welle.welle\data # - welle-io.exe --version deploy: # Upload it to BinTray - provider: BinTray username: albrechtl api_key: secure: i7ksq/PodhXDzjw7trN/y00EA6U4tZ9m4EGOFDv736Nrvb6lpvG8jtXwTV4cPOtV subject: albrechtl repo: welle.io package: welle.io_nightly version: '%file_version%' publish: true override: true explode: true after_deploy: # Backup: Upload it to transfer.sh # - curl -fsS --upload-file C:\projects\welle.io-win-libs\install\%filename% https://transfer.sh/%filename% welle.io-2.1/.bintray_delete_old_version.py000066400000000000000000000042151357201522000211160ustar00rootroot00000000000000# Copyright (C) 2018 # Albrecht Lohofener (albrechtloh@gmx.de) # # This file is part of the welle.io. # Many of the ideas as implemented in welle.io are derived from # other work, made available through the GNU general Public License. # All copyrights of the original authors are recognized. # # welle.io is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # welle.io is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with welle.io; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import requests import json import sys bintray_api = 'https://api.bintray.com' #bintray_user = 'albrechtl' #bintray_pass = '' #bintray_package = '/packages/albrechtl/welle.io/welle.io_next_nightly' #keep_last_version = 20 if len(sys.argv) != 4 + 1: print('Error: The number of parameters is != 4') exit(-1) bintray_user = sys.argv[1] bintray_pass = sys.argv[2] bintray_package = sys.argv[3] keep_last_version = int(sys.argv[4]) # Get all versions r = requests.get(bintray_api + bintray_package, auth=(bintray_user, bintray_pass)) # Decode data data = json.loads(r.text) # Extract versions versions = data['versions'] # Extract versions to delete delete_versions = versions[keep_last_version:len(versions)] # Iterate over all versions to delete for version in delete_versions: print('Deleting version ' + version) # Delete version r = requests.delete(bintray_api + bintray_package + '/versions/' + version, auth=(bintray_user, bintray_pass)) # Check status if r.status_code != 200: print('Error while deleting. Status {}'.format(r.status_code)) else: delete_status = json.loads(r.text) print('Status: ' + delete_status['message']) welle.io-2.1/.gitignore000066400000000000000000000003261357201522000150600ustar00rootroot00000000000000*~ /.idea/ /cmake-build-debug/ Makefile welle-io *.o moc*cpp .qmake.stash CMakeCache.txt CMakeFiles/ moc_predefs.h qrc_resources.cpp welle.io.pro.user cmake_install.cmake cmake_uninstall.cmake install_manifest.txt welle.io-2.1/.travis-bintray-deploy.json.template000066400000000000000000000006031357201522000221210ustar00rootroot00000000000000{ "package": { "name": "welle.io_nightly", // Bintray package name "repo": "welle.io", // Bintray repository name "subject": "albrechtl" // Bintray subject (user or organization) }, "version": { "name": "${VERSION}" }, "files": [ { "includePattern": ".(.*welle-io.*.AppImage)", "uploadPattern": "$1" } ], "publish": true } welle.io-2.1/.travis.yml000066400000000000000000000101441357201522000152000ustar00rootroot00000000000000dist: xenial language: cpp compiler: gcc sudo: require #python: # - "3.6" env: # "BINTRAY_KEY=" - secure: "AjycfSfIztFeat6AO3SETSFW9Xd0AUt17hg87sEo8pSPO3SILq6bKS5Pfe4Bdo3Za32BvGzeJaOZ9EEVtzweuYJwsBejVfk2lxiBH5RKoBVrHpJLXDNj7MUt2ezb734bjFFt3+lMG84vSCqioNMcYwlHcqCChiTT529NZhaGMsDFzF5NimJZl0LGcEQlaTxTfeCKwSk+apHw5rQes2I2Jf9icweUGe/VOOVmYjDTiPWKcBEwBvfV5vabr5btCgUY8zK5451x/35API2Hbq7o0hNxqvwQUFI54jZwqfR4DOA1V/Nk7rdc34Fe+xgKSoBmHC0RgCIbXw1erEkn31Y0+tLBVxa971FB+y7L+5ZEaqw9UolT0PM5LHZmWUA60A5JlvsFOr0urid8lk0g5mdGF4aHEy2O5rDOMbwE11MpTEkDDbgE6uSD0/aubTJYPu24yMlBrP1lz10Sltg+YLi5hshhzRmd4iWTKuEy4jly1SdOKjjdbLCzlAnsF9Ta0a/lfumOd2lmELhYKhFLuVTCWZFvjpJyziCIFLVs4refDbDrsdfE+CaJedP/uBDGoBp4Hg6aug+66zKPybVzODqR2uIa3I7ACM3l/GdJcGg+1AH1T/ievq4rQ52T3MspevFxQmevuA9vvgOVko79PDrW1xbp+oQPTk0/pODNjVvrZFk=" before_install: # QT - sudo add-apt-repository ppa:beineri/opt-qt-5.12.3-xenial -y # GCC 7 - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y # SoapySDR - sudo add-apt-repository ppa:myriadrf/drivers -y - sudo apt-get update -qq install: - sudo apt-get -y install gcc-7 g++-7 - sudo apt-get -y install libusb-1.0-0-dev pkg-config libmp3lame-dev libmpg123-dev qt512base qt512declarative qt512quickcontrols qt512quickcontrols2 qt512charts-no-lgpl qt512graphicaleffects qt512multimedia libpulse0 libfaad-dev libfftw3-dev libusb-1.0-0-dev mesa-common-dev libglu1-mesa-dev libpulse-dev libsoapysdr-dev - source /opt/qt512/bin/qt512-env.sh - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90 --slave /usr/bin/g++ g++ /usr/bin/g++-7 script: - DATE=`date +%Y%m%d` - GIT_HASH=`git rev-parse --short HEAD` # Compile airspy - # https://github.com/airspy/airspyone_host#how-to-build-the-host-software-on-linux - wget https://github.com/airspy/host/archive/master.zip - unzip master.zip - cd airspyone_host-master/ - mkdir build - cd build - cmake ../ -DINSTALL_UDEV_RULES=ON -DCMAKE_INSTALL_PREFIX=/usr - make -j 4 - sudo make install - sudo ldconfig - cd ../.. # Compile librtlsdr - git clone https://github.com/steve-m/librtlsdr.git - cd librtlsdr - mkdir build - cd build - cmake ../ -DDETACH_KERNEL_DRIVER=ON - make -j 4 - sudo make install - sudo ldconfig - cd ../.. # Compile welle.io - mkdir build - cd build - qmake PREFIX=/usr .. - make -j4 - # sudo make INSTALL_ROOT=../appdir install ; sudo chown -R $USER appdir ; find appdir/ - # "make install" seems not implemented, hence going though the following steps manually: - cd .. - find build/ - mkdir -p ./appdir/usr/share/applications - cp welle-io.desktop ./appdir/usr/share/applications - mkdir -p ./appdir/usr/bin - cp build/src/welle-gui/welle-io ./appdir/usr/bin - mkdir -p ./appdir/usr/lib - mkdir -p ./appdir/usr/share/icons/hicolor/512x512/apps/ - cp src/welle-gui/icons/icon.png appdir/usr/share/icons/hicolor/512x512/apps/welle-io.png after_success: - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" - chmod a+x linuxdeployqt*.AppImage - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH - ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -qmldir=. -bundle-non-qt-libs - ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -qmldir=. -appimage - find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq #- curl --upload-file ./welle*.AppImage https://transfer.sh/welle_io-git."$GIT_HASH"-x86_64.AppImage # Rename - mv welle.io-"$GIT_HASH"-x86_64.AppImage "$DATE"_"$GIT_HASH"_Linux_welle-io-x86_64.AppImage # Prepare bintray deploy - sed -e "s/\${VERSION}/"$DATE"_"$GIT_HASH"/" .travis-bintray-deploy.json.template >travis-bintray-deploy.json deploy: on: branch: next provider: bintray file: "travis-bintray-deploy.json" user: "albrechtl" skip_cleanup: true key: $BINTRAY_KEY after_deploy: # Delete old builds on bintray. Keep only the last 20 builds - python .bintray_delete_old_version.py albrechtl $BINTRAY_KEY /packages/albrechtl/welle.io/welle.io_nightly 20 welle.io-2.1/AUTHORS000066400000000000000000000012011357201522000141310ustar00rootroot00000000000000welle.io would like to acknowledge the following contributors: Maintainer ---------- Albrecht Lohofener Programming (alphabetical) -------------------------- Albrecht Lohofener Jan van Katwijk kgarrels Matthias P. Braendli Matthias Benesch probonopd Stefan Pöschel tenzap Viktor Verebelyi (viktorgino) Documentation ------------- Albrecht Lohofener Andreas Mikula Localization ------------ English - Albrecht Lohofener German - Albrecht Lohofener, Andreas Mikula Italian - Antonio Picone Hungarian - Tibor Kovács Norwegian - Andreas Myhren French - olilesp, tenzap Polish - Boguslaw Rychlik Russian - Ivan Karev Dutch - Dick Marinus welle.io-2.1/CMakeLists.txt000066400000000000000000000237241357201522000156370ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.2) project(Welle.Io VERSION 0.0.0 LANGUAGES C CXX) if(NOT WELLE-IO_VERSION) set(WELLE-IO_VERSION ${PROJECT_VERSION}) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 14) option(BUILD_WELLE_IO "Build Welle.io" ON ) option(BUILD_WELLE_CLI "Build welle-cli" ON ) option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON ) option(KISS_FFT "KISS FFT instead of FFTW" OFF ) option(PROFILING "Enable profiling (see README.md)" OFF ) option(AIRSPY "Compile with Airspy support" OFF ) option(RTLSDR "Compile with RTL-SDR support" OFF ) option(SOAPYSDR "Compile with SoapySDR support" OFF ) add_definitions(-Wall) add_definitions(-g) add_definitions(-DDABLIN_AAC_FAAD2) if(MINGW) add_definitions(-municode) endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") message(STATUS "Build type not specified: defaulting to release.") endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") #enable_testing() list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) if(APPLE AND WITH_APP_BUNDLE) if(NOT DEFINED BUNDLE_INSTALL_DIR) set(BUNDLE_INSTALL_DIR "/Applications") endif() set(GUI_INSTALL_DIR "${BUNDLE_INSTALL_DIR}") else() include(GNUInstallDirs) set(GUI_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") endif() if(BUILD_WELLE_IO) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) find_package(Qt5 COMPONENTS Widgets Quick QuickControls2 Multimedia Charts Qml REQUIRED) endif() if(PROFILING) add_definitions(-DWITH_PROFILING) endif() find_package(ALSA) if(ALSA_FOUND) add_definitions(-DHAVE_ALSA) endif() if(KISS_FFT) add_definitions(-DKISSFFT) set(fft_sources src/libs/kiss_fft/kiss_fft.c) set(KISS_INCLUDE_DIRS src/libs/kiss_fft) else() find_package(FFTW3f REQUIRED) set(fft_sources "") set(KISS_INCLUDE_DIRS "") endif() if(BUILD_WELLE_CLI) find_package(Lame REQUIRED) endif() find_package(Threads REQUIRED) find_package(Faad REQUIRED) find_package(MPG123 REQUIRED) if (RTLSDR) find_package(LibRTLSDR REQUIRED) endif() if (AIRSPY) find_package(LibAIRSPY REQUIRED) endif() if (SOAPYSDR) find_package(SoapySDR NO_MODULE REQUIRED) # Note: SoapySDRConfig.cmake sets C++11 standard so it needs to be reset to C++14 set(CMAKE_CXX_STANDARD 14) endif() include_directories( src src/backend src/output src/various src/input src/gui src/libs/fec ${FFTW3F_INCLUDE_DIRS} ${KISS_INCLUDE_DIRS} ${FAAD_INCLUDE_DIRS} ${LIBRTLSDR_INCLUDE_DIRS} ${SoapySDR_INCLUDE_DIRS} ) set(backend_sources src/backend/dab-audio.cpp src/backend/decoder_adapter.cpp src/backend/dab_decoder.cpp src/backend/dabplus_decoder.cpp src/backend/charsets.cpp src/backend/dab-constants.cpp src/backend/mot_manager.cpp src/backend/pad_decoder.cpp src/backend/eep-protection.cpp src/backend/fib-processor.cpp src/backend/fic-handler.cpp src/backend/msc-handler.cpp src/backend/freq-interleaver.cpp src/backend/ofdm-decoder.cpp src/backend/ofdm-processor.cpp src/backend/phasereference.cpp src/backend/phasetable.cpp src/backend/tii-decoder.cpp src/backend/protTables.cpp src/backend/radio-receiver.cpp src/backend/tools.cpp src/backend/uep-protection.cpp src/backend/viterbi.cpp src/various/Socket.cpp src/various/Xtan2.cpp src/various/channels.cpp src/various/fft.cpp src/various/profiling.cpp src/various/wavfile.c src/libs/fec/decode_rs_char.c src/libs/fec/encode_rs_char.c src/libs/fec/init_rs_char.c ) set(welle_io_sources src/welle-gui/main.cpp src/welle-gui/audio_output.cpp src/welle-gui/mot_image_provider.cpp src/welle-gui/gui_helper.cpp src/welle-gui/radio_controller.cpp src/welle-gui/debug_output.cpp src/welle-gui/waterfallitem.cpp ) set(welle_cli_sources src/welle-cli/welle-cli.cpp src/welle-cli/alsa-output.cpp src/welle-cli/webradiointerface.cpp src/welle-cli/webprogrammehandler.cpp src/welle-cli/tests.cpp ) set(input_sources src/input/input_factory.cpp src/input/null_device.cpp src/input/raw_file.cpp src/input/rtl_tcp.cpp ) if(LIBRTLSDR_FOUND) add_definitions (-DHAVE_RTLSDR) set(input_sources ${input_sources} src/input/rtl_sdr.cpp) endif() if(LIBAIRSPY_FOUND) add_definitions (-DHAVE_AIRSPY) set(input_sources ${input_sources} src/input/airspy_sdr.cpp) endif() if(SoapySDR_FOUND) add_definitions (-DHAVE_SOAPYSDR) set(input_sources ${input_sources} src/input/soapy_sdr.cpp) endif() if(NOT GIT_COMMIT_HASH) execute_process( COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() if(GIT_COMMIT_HASH) add_definitions("-DGITHASH=\"${GIT_COMMIT_HASH}\"") endif() if(NOT GIT_DESCRIBE) execute_process( COMMAND git describe --tags --long WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() if(GIT_DESCRIBE) add_definitions("-DGITDESCRIBE=\"${GIT_DESCRIBE}\"") endif() if(BUILD_WELLE_IO) set(executableName welle-io) add_executable (${executableName} ${welle_io_sources} ${backend_sources} ${input_sources} ${fft_sources} ${EXTRA_MOCS} src/welle-gui/resources.qrc) target_link_libraries (${executableName} ${LIBRTLSDR_LIBRARIES} ${LIBAIRSPY_LIBRARIES} ${FFTW3F_LIBRARIES} ${FAAD_LIBRARIES} ${SoapySDR_LIBRARIES} ${MPG123_LIBRARIES} Threads::Threads Qt5::Core Qt5::Widgets Qt5::Multimedia Qt5::Charts Qt5::Qml Qt5::Quick Qt5::QuickControls2 ) if(APPLE AND WITH_APP_BUNDLE) set(macOsIcon ${CMAKE_CURRENT_SOURCE_DIR}/src/welle-gui/icons/icon.icns) set_source_files_properties(${macOsIcon} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") target_sources(${executableName} PRIVATE ${macOsIcon}) set(SHORT_VERSION "${WELLE-IO_VERSION}") set(EXECUTABLE "${executableName}") set(TYPEINFO "io.welle.welle") set(PRODUCT_BUNDLE_IDENTIFIER "io.welle.welle") set_target_properties("${executableName}" PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/welle-io.plist ) INSTALL (TARGETS ${executableName} BUNDLE DESTINATION ${GUI_INSTALL_DIR}) else() INSTALL (TARGETS ${executableName} RUNTIME DESTINATION ${GUI_INSTALL_DIR}) if(UNIX AND NOT APPLE) INSTALL (FILES ${PROJECT_SOURCE_DIR}/welle-io.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/16x16/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/24x24/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/24x24/apps) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/32x32/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/48x48/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/128x128/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps) INSTALL (FILES ${PROJECT_SOURCE_DIR}/src/welle-gui/icons/256x256/welle-io.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps) endif() endif() endif() if(BUILD_WELLE_CLI) set(cliExecutableName welle-cli) add_executable (${cliExecutableName} ${welle_cli_sources} ${backend_sources} ${input_sources} ${fft_sources}) if(CMAKE_BUILD_TYPE MATCHES Debug) SET_TARGET_PROPERTIES(${cliExecutableName} PROPERTIES COMPILE_FLAGS "-O2 -fno-omit-frame-pointer -fsanitize=address") SET_TARGET_PROPERTIES(${cliExecutableName} PROPERTIES LINK_FLAGS "-fno-omit-frame-pointer -fsanitize=address") endif(CMAKE_BUILD_TYPE MATCHES Debug) target_link_libraries (${cliExecutableName} ${LIBRTLSDR_LIBRARIES} ${LIBAIRSPY_LIBRARIES} ${FFTW3F_LIBRARIES} ${FAAD_LIBRARIES} ${ALSA_LIBRARIES} ${LAME_LIBRARIES} ${SoapySDR_LIBRARIES} ${MPG123_LIBRARIES} Threads::Threads ) add_custom_command( TARGET ${cliExecutableName} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/welle-cli/index.html ${CMAKE_CURRENT_BINARY_DIR}/index.html) add_custom_command( TARGET ${cliExecutableName} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/welle-cli/index.js ${CMAKE_CURRENT_BINARY_DIR}/index.js) if(APPLE AND WITH_APP_BUNDLE) INSTALL (TARGETS ${cliExecutableName} RUNTIME DESTINATION ${GUI_INSTALL_DIR}/${executableName}.app/Contents/MacOS) INSTALL ( FILES ${PROJECT_SOURCE_DIR}/src/welle-cli/index.html ${PROJECT_SOURCE_DIR}/src/welle-cli/index.js DESTINATION ${GUI_INSTALL_DIR}/${executableName}.app/Contents/Resources/welle-cli ) elseif(UNIX) INSTALL (TARGETS ${cliExecutableName} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) INSTALL ( FILES ${PROJECT_SOURCE_DIR}/src/welle-cli/index.html ${PROJECT_SOURCE_DIR}/src/welle-cli/index.js DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/welle-io/html/ ) endif() endif() configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) welle.io-2.1/COPYING000066400000000000000000000430451357201522000141300ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. welle.io-2.1/HomebrewFormula/000077500000000000000000000000001357201522000161655ustar00rootroot00000000000000welle.io-2.1/HomebrewFormula/welle.io.rb000066400000000000000000000013631357201522000202330ustar00rootroot00000000000000class WelleIo < Formula desc "DAB/DAB+ Software Radio" homepage "https://www.welle.io" url "https://github.com/AlbrechtL/welle.io/archive/v2.0.tar.gz" sha256 "abfe999b6788ae57dfaaebea5e1db912565d60cc287c9eec4636b0e10eab4f9d" head "https://github.com/AlbrechtL/welle.io.git" depends_on "cmake" => :build depends_on "qt" depends_on "fftw" depends_on "faad2" depends_on "mpg123" depends_on "librtlsdr" depends_on "pothosware/homebrew-pothos/soapysdr" depends_on "pothosware/homebrew-pothos/soapyuhd" depends_on "libusb" def install system "cmake", ".", "-DRTLSDR=TRUE", "-DSOAPYSDR=TRUE", "-DBUILD_WELLE_CLI=OFF", *std_cmake_args system "make", "install" end test do system "#{bin}/welle-io", "-v" end end welle.io-2.1/RASPBERRY-PI.md000066400000000000000000000465231357201522000153020ustar00rootroot00000000000000welle.io on Raspberry Pi 2/3 ============================ This guide borrows parts from [Qt wiki](https://wiki.qt.io/RaspberryPi2EGLFS). This guide is a work in progress. If you have issues or something is completely wrong, please let us know at the [forums.](https://forum.welle.io/) --------------------------------------------------------------------------------- Table of contents ================= * [Description](#description) * [Hardware requirements](#hardware-requirements) * [Setup](#setup) * [Building](#building) * [Power supply](#power-supply) * [Troubleshooting](#troubleshooting) * [Known issues](#known-issues) Description =========== This guide will help you compile and run welle.io on your Raspberry Pi 2/3 using the [Qt environment](https://www.qt.io) with Qt Creator. Qt will be set up for cross compiling from a desktop Linux computer since Qt most likely will not be able to be natively compiled on a Raspberry Pi due to memory constraints. Tested configurations are: * Raspberry Pi 3 Model B * Qt 5.9.3 * Qt 5.10.0 * Ubuntu 17.10 x64 * Raspbian Stretch Hardware requirements --------------------- **Raspberry Pi:** * Raspberry Pi 2 or 3. The original Pi may, or may not work * [Adequate power supply](#power-supply) * 4GB or larger MicroSD card * A RTL2832U DVB-T stick to receive radio signals (If you are using an Airspy device, compile and install the airspy library.) (For details please see [here](https://github.com/airspy/host/#how-to-build-the-host-software-on-linux)) **Host computer:** * Desktop/laptop computer running Ubuntu or an equivalent Debian Linux system (Other distributions will work, but is not tested) * A way to read/write MicroSD cards on a computer * Wireless or wired connection between desktop computer and Raspberry Pi Setup ----- First we need to get Raspbian up and running on the Raspberry Pi. Only [Raspbian Stretch](https://www.raspberrypi.org/downloads/raspbian/) or newer will work, since Raspbian Jessie or older have a too old GCC/GLIBC version. The easiest way is to download [NOOBS.](https://www.raspberrypi.org/downloads/noobs/) 1. Download [NOOBS.](https://downloads.raspberrypi.org/NOOBS_latest) Make sure it's version 2.4.5 or later. 2. Follow the [official quick start guide](https://www.raspberrypi.org/learning/software-guide/quickstart/) for installing Raspian. ([Additional information](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)) ([Additional information](https://www.raspberrypi.org/documentation/installation/noobs.md)) **ON RASPBERRY PI:** 3. Update Raspbian and update to the latest packages. ``` sudo rpi-update sudo apt update sudo apt dist-upgrade ``` Reboot your Pi ``` sudo reboot ``` (Optional but highly recommended: Use raspi-config and set up SSH to your Pi so you can remote control it from another computer) (Optional: Use raspi-config and set GPU memory to 256) (More info about raspi-config [here](https://www.raspberrypi.org/documentation/configuration/raspi-config.md)) ``` sudo raspi-config ``` 4. Install the required packages for welle.io and RTL-SDR. ``` sudo apt install libfaad-dev libfftw3-dev librtlsdr-dev libusb-1.0-0-dev mesa-common-dev libglu1-mesa-dev libpulse-dev rtl-sdr ``` 5. Install a bunch of development files. (For simplicity we use build-dep, not everything is really needed, but it is easier this way.) Edit sources list in /etc/apt/sources.list and uncomment (remove #) the **deb-src** line: ``` sudo nano /etc/apt/sources.list ``` Run update again to include deb-src in the repository list: ``` sudo apt update ``` Install required libraries: ``` sudo apt-get build-dep qt4-x11 sudo apt-get build-dep qtbase-opensource-src ``` ``` sudo apt install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 ``` 6. Prepare our target directory ``` sudo mkdir /usr/local/qt5pi sudo chown pi:pi /usr/local/qt5pi ``` Now we need to set up the toolchain, environments and directories on our host computer. **ON HOST COMPUTER:** 7. Make a raspi folder. ``` mkdir ~/raspi cd ~/raspi ``` 8. Create a sysroot. Using rsync we can properly keep things synchronized in the future as well. Replace "raspberrypi.local" with the address of the Pi. Depending on your connection speed, this might take a while, since you are basically copying the entire contents of your Pi, to your host PC. It is important that you have already downloaded the required packages for welle.io on your Pi before you start rsync, because the cross compiling environment will use this sysroot folder as its source instead of the packages you might have installed on your host PC. ``` mkdir sysroot sysroot/usr sysroot/opt rsync -avz pi@raspberrypi.local:/lib sysroot rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt ``` 9. Adjust symlinks to be relative. Use provided script. ``` wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py chmod +x sysroot-relativelinks.py ./sysroot-relativelinks.py sysroot ``` 10. Get a GCC toolchain for ARM systems. ``` wget https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabihf/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz tar -xvf gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz ``` Or check the [website](https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabihf/) for the latest toolchain. If you are using a 32-bit system, download the 32-bit version. (i686) Building -------- 11. Get Qt source. We will use the entire Qt system instead of only qtbase, which is probably overkill, but makes it way easier to manage. (Additional information about building Qt from source [here.](https://wiki.qt.io/Building_Qt_5_from_Git)) The target directory is /usr/local/qt5pi on the Pi, the host tools like qmake will go to ~/raspi/qt5, while make install will target ~/raspi/qt5pi (this is what we will sync to the device). Don't forget to adjust paths if you changed that. For some reason the ~/ in the paths may not work, if this the case just use full paths. ``` git clone git://code.qt.io/qt/qt5.git cd qt5 git checkout 5.10 ``` Currently, Qt version 5.10 is working. If the branch version does not exist, try another/newer branch number. Branch information for Qt is located [here.](http://code.qt.io/cgit/qt/qt5.git/) Now we need to initialize the repository, which will download all the submodules we need for Qt. We will not download qtwebkit or qtwebengine since these modules tend to create problems later, and are not needed for welle.io anyway. ``` ./init-repository --module-subset=default,-qtwebkit,-qtwebkit-examples,-qtwebengine ``` If the init failed due to network errors or similar, run the command again, but append **-f** at the end. 12. Configure Qt. You need to change **rpi-version** with a proper Raspberry Pi version. Use: **linux-rasp-pi-g++** for RPi, **linux-rasp-pi2-g++** for RPi2 and **linux-rasp-pi3-g++** for RPi3. If your system is 32-bit you may also edit device option to: ``` -device-option CROSS_COMPILE=~/raspi/gcc-linaro-5.5.0-2017.10-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- ``` Now it's time to set up and configure Qt for cross compiling to the ARM platform. Don't forget to change **rpi-version**. ``` ./configure -release -opengl es2 -device -device-option CROSS_COMPILE=~/raspi/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -no-use-gold-linker -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v ``` 13. Compile Qt. (Optional: use switch **-j** to tell make how many cores your cpu has.) (Example, ***make -j4*** tells make to use four cpu cores, which greatly speeds up compile time.) ``` make make install ``` If anything failed, you can clean everything with: ``` git clean -dfx ``` 14. Deploy Qt to the device. We simply rsync everything from ~/raspi/qt5pi to the prefix we configured above. ``` cd .. rsync -avz qt5pi pi@raspberrypi.local:/usr/local ``` Now we will build an example to test if everything went well. After the building is complete, we will copy the executable example to the device. ``` cd qt5/qtbase/examples/opengl/qopenglwidget ~/raspi/qt5/bin/qmake make scp qopenglwidget pi@raspberrypi.local:/home/pi ``` Now we need to fix various links and issues on the Raspberry Pi. **ON RASPBERRY PI:** 15. Update the device to let the linker find the Qt libs: ``` echo /usr/local/qt5pi/lib | sudo tee /etc/ld.so.conf.d/qt5pi.conf sudo ldconfig ``` If you're facing issues with running the example, try to use 00-qt5pi.conf instead of qt5pi.conf, to introduce proper order. 16. Fix the EGL/GLES libraries. The device may have the Mesa version of libEGL and libGLESv2 in /usr/lib/arm-linux-gnueabihf, resulting Qt apps picking these instead of the real thing from /opt/vc/lib. This may be fine for X11 desktop apps not caring about OpenGL performance but is totally useless for windowing system-less, fullscreen embedded apps. You may want to save the originals somewhere, just in case. ``` sudo mv /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0_backup sudo mv /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0_backup sudo ln -s /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo ln -s /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 ``` Please make sure to also add missing symbolic links: ``` sudo ln -s /opt/vc/lib/libEGL.so /opt/vc/lib/libEGL.so.1 sudo ln -s /opt/vc/lib/libGLESv2.so /opt/vc/lib/libGLESv2.so.2 ``` 17. Run qopenglwidget example, that we've built before. At this point it should just work at fullscreen with 60 FPS and mouse, keyboard, and possibly touch support. ``` sudo chmod +x /home/pi/qopenglwidget ./qopenglwidget ``` If the example is running smoothly, (or rather, running at all), congratulations, you now have Qt 5 on your Raspberry Pi. This is only half the battle though. Now we continue on to set up our host computer for welle.io cross compiling. **ON HOST COMPUTER:** 18. We now need the Qt environment for our host computer, including Qt Creator. The easiest way to obtain this, is to download a precompiled Qt binary for our operating system. In this case, Ubuntu. Go to [Qt website](https://www1.qt.io/download-open-source/#section-2) and download the appropriate package for your system. For Ubuntu, Use [Online Installer Linux 64-bit.](http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run) Or the [32bit version](http://download.qt.io/official_releases/online_installers/qt-unified-linux-x86-online.run) if you have such a system. Before we begin, start another instance of terminal for a fresh start, or **cd ..** your way back to your home folder. ``` wget http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run sudo chmod +x qt-unified-linux-x64-online.run ./qt-unified-linux-x64-online.run ``` Follow the instructions and install Qt, including submodules and Qt Creator. Select version 5.9.3 or higher, and a QT Creator version. 19. Clone welle.io. ``` git clone https://github.com/AlbrechtL/welle.io.git ``` 20. Start Qt Creator. 21. Open project and select the welle.io folder that you just cloned and click on welle.io.pro. 22. When the **configure project** screen comes up, click on **manage kits** Then go to the **Qt Versions** tab and click **Add...** Move to the **~/raspi/qt5/bin/qmake** folder and select the qmake there. **Details** on the bottom should say something along the lines of "Qt version 5.9.3 for Embedded linux" Now, go over to the **Compilers** tab and add **GCC C** Name it "GCC ARM" or similar so we can easily identify it later. In **Compiler path** browse to ~/raspi/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin and select **arm-linux-gnueabihf-gcc** ABI should read "arm-linux-generic-elf-32bit" Once again, click on **Add** and add a **GCC C++** compiler. Name it "G++ ARM" or similar. Compiler path should be the same as the previous one, but select **arm-linux-gnueabihf-g++** instead of "arm-linux-gnueabihf-gcc" ABI should read "arm-linux-generic-elf-32bit", same as the previous one. The last thing we could set up is in the **Debuggers** tab. This one isn't really needed, but lets do it anyway. Press **Add** and name it "ARM GDB" or similar and the path should be the same as previous, but select **arm-linux-gnueabihf-gdb**. With all this done, we can make a new kit. Click on the **Kits** tab and **add**. Name it "Raspberry Pi" or similar. Device type: **Generic Linux Device** Sysroot: **~/raspi/sysroot** Compiler: C: **GCC ARM** (Or what you named your GCC compiler.) Compiler: C++: **G++ ARM** (Or what you named your G++ compiler.) Debugger: **ARM GDB** (Or what you named your GDB debugger.) Qt version: **Qt 5.9.3 (qt5)** (The one you made, not the default one which most likely already was present in the "Qt Versions" tab.) With all this done, click apply and ok. Now your newly created "Raspberry Pi" kit should appear in the **Configure project** section. Select it and press **configure project.** Stuff should happen and you should be greeted with a projects tree view and some other stuff, probably a Project "MESSAGE" message of some sort too. 23. In order to compile welle.io for Raspberry Pi successfully, we need to do one adjustment to the source code. Double click on **welle.io.pro** in the tree view, scroll down to where it says **unix:!macx:!android:** find the line which says **CONFIG += airspy** and comment it out by putting a **#** in front of it. (Unless you need Airspy support.) ``` #CONFIG += airspy ``` Save file (ctrl+s) 24. Now click on the monitor icon at the left hand side, most likely saying "welle.io debug" or similar, change the build to **release**. Wait a couple of seconds until the green arrows lights up again. 25. Click on the hammer icon, which means **build project**. Qt Creator will build welle.io and output the finished program into a "release" folder most likely named "build-welle-io-Raspberry_Pi-Release". 26. Open a new terminal and navigate to the release folder. Transfer the program over to the Raspberry Pi. ``` cd ~/build-welle-io-Raspberry_Pi-Release scp welle-io pi@raspberrypi.local:/home/pi ``` **ON RASPBERRY PI:** 27. Find the file **welle-io** and run it to enjoy welle.io on your Raspberry Pi. Open a new terminal and type: ``` ./welle-io --disable-splash ``` The **--disable-splash** argument is used because otherwise welle.io will crash on Raspberry Pi. See the troubleshooting section at the bottom for details. Power supply ============ Raspberry Pi 3 requires significantly more power than the original Pi, which could easily be run off a generic USB phone charger. The problem with such chargers is the fact that the USB cable is almost always too thin to reliably supply the required 5 volts the Pi 3 needs to run. Also, a phone charger is not necessarily a good power supply in general. Even powerful Apple 12W iPad chargers which outputs amps and amps of current, fails to deliver more than 4.6-4.8 volts to the Pi, which forces the Pi to go into "undervoltage" mode. In undervoltage mode, the Pi reduces the speed of the CPU and GPU, which affects the entire operation of the system. Hiccups in other parts of the system might occur, such as in RAM and I/O chips. Too low voltage is noticeable by a lightning bolt icon in the top right corner of the screen. More info about the power requirements [here](https://www.raspberrypi.org/help/faqs/#powerReqs). The official [Raspberry Pi universal power supply](https://www.raspberrypi.org/products/raspberry-pi-universal-power-supply/) is a more beefy (and proper) power supply that provides 5.1 volts over a thicker cable, which mitigates the power loss experienced in thinner generic USB cables. However, when running with lots of peripherals, like a touch screen, mouse, keyboard, gamepad, bluetooth dongle, Wi-Fi dongle, RTL-SDR dongle and whatnot, even an official power supply struggles. The solution is to somehow add another official power supply, or an even beefier power supply that can output 5.1 volt, 4+ amps. When the Pi goes into undervoltage mode, it may or may not affect the SDR dongle, and its operation with welle.io, causing random malfunctions in radio reception. The SD card might be corrupt if it is written to while the Pi experiences undervoltage. Using the Pi in undervoltage mode is not the end of the world, but expect the unexpected. Troubleshooting =============== * If you have no audio out when using an external sound card like a HiFiBerry DAC+, IQAudIO PiDAC+, PiMoroni pHAT DAC, JustBoom or any USB DAC, try installing Pulseaudio. ``` sudo apt install pulseaudio ``` * If you for some reason don't have any text in either the qopenglwidget example or in welle.io and get a message like this in the terminal: ``` QFontDatabase: Cannot find font directory /usr/local/qt5pi/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from http://dejavu-fonts.org for example) or switch to fontconfig. ``` It means the fonts folder for the Qt environment does not exist. To fix this, we simply make the folder and populate it with some fonts. ``` mkdir /usr/local/qt5pi/lib/fonts ``` Then we steal a font from the system font folder. ``` cp /usr/share/fonts/truetype/freefont/FreeSans.ttf /usr/local/qt5pi/lib/fonts/FreeSans.ttf ``` You can basically put any font you want in the fonts folder. * If your screen goes blank after a set time, have a look at the [official documentation](https://www.raspberrypi.org/documentation/configuration/screensaver.md) for screensavers. * Error: **EGLFS: OpenGL windows cannot be mixed with others.** appears, this means the splash screen is not working correctly on Raspberry Pi. To work around this issue, start welle.io with the argument **--disable-splash**. ``` ./welle-io --disable-splash ``` * When using VNC or another form of remote desktop software, OpenGLES will not output any Qt windows to the remote desktop, only a fullscreen window on an attached screen, such as HDMI or DSI port. To work around this issue, use argument **-platform xcb** when starting welle.io. You might have to install the proper xcb libraries if these are not present on your Raspberry Pi. ``` ./welle-io -platform xcb ``` Known issues ----------- * When using a touch screen, the user interface will be "transparent" to your screen touches. This means that you can accidentally click on icons on the desktop itself, behind the user interface of the program, while operating the program as normal. It is not known if this is a Qt issue, welle.io issue or a Raspbian driver issue. For now, take care when operating the user interface with a touch screen. welle.io-2.1/README.md000066400000000000000000000301451357201522000143510ustar00rootroot00000000000000[welle.io](https://www.welle.io) ===================== - Linux (Travis): [![Travis Build Status](https://travis-ci.org/AlbrechtL/welle.io.svg?branch=master)](https://travis-ci.org/AlbrechtL/welle.io) - Windows (AppVeyor): [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/yipsu95pb4ecdofe?svg=true)](https://ci.appveyor.com/project/AlbrechtL/welle-io) This repository contains the implementation of an SDR DAB/DAB+ receiver. Please see the project website https://www.welle.io for a user oriented documentation. welle.io is a fork from dab-rpi and sdr-j-dab which is now qt-dab https://github.com/JvanKatwijk/qt-dab. Table of contents ==== * [Download](#download) * [Usage](#usage) * [Supported Hardware](#supported-hardware) * [Building](#building) * [General Information](#general-information) * [Ubuntu Linux 18.04 LTS](#ubuntu-linux-1804-lts) * [Windows 10](#windows-10) * [macOS](#macos) * [CMake instead of Qt Creator (Windows, Linux, macOS)](#cmake-instead-of-qt-creator-windows-linux-macos) * [Android](#android) * [Raspberry Pi 2 and 3](#raspberry-pi-2-and-3) * [welle-cli](#welle-cli) * [Usage](#usage-of-welle-cli) * [Backend options](#backend-options) * [Examples](#examples) * [Limitations](#limitations) * [Development](#development) Download ======== Stable release can be found here: * ### [welle.io for Windows, Linux and Android (APK)](http://github.com/AlbrechtL/welle.io/releases) * ### [welle.io for Android at Google Play](https://play.google.com/store/apps/details?id=io.welle.welle) If you discovered an issue please open a new [issue](https://github.com/AlbrechtL/welle.io/issues). welle.io is under heavy development. You can also try the latest developer builds. But PLEASE BE WARNED the builds are automatically created and untested. * [welle.io nightly builds](https://bintray.com/albrechtl/welle.io/welle.io_nightly#files) To use it on macOS or on a Raspberry Pi you have to compile welle.io directly from the sources. See below for more information. Usage ===== The command-line parameters are: Parameter | Description ------ | ---------- -h, --help | Show help -v, --version | Show version --dump-file | Records DAB frames (*.mp2) or DAB+ superframes with RS coding (*.dab). This file can be used to analyse X-PAD data with XPADxpert (https://www.basicmaster.de/xpadxpert). --log-file | Log file name. Redirects all log output texts to a file. Supported Hardware ==================== The following SDR devices are supported * Airspy R2 and Airspy Mini (http://airspy.com/) * rtl-sdr (http://osmocom.org/projects/sdr/wiki/rtl-sdr) * rtl_tcp (http://osmocom.org/projects/sdr/wiki/rtl-sdr#rtl_tcp) * I/Q RAW file (https://www.welle.io/devices/rawfile) * All SDR-devices that are supported by SoapySDR, gr-osmosdr and uhd. These are too many devices to list them all. To see if your SDR is supported, have a look at the lists at [SoapySDR](https://github.com/pothosware/SoapySDR/wiki) and [SoapyOsmo](https://github.com/pothosware/SoapyOsmo/wiki). * Devices supported by gr-osmosdr are supported via [SoapyOsmo](https://github.com/pothosware/SoapyOsmo/wiki) * Devices supported by uhd are supported via [SoapyUHD](https://github.com/pothosware/SoapyUHD/wiki) * One limitation is of course that the SDR devices must be tunable to the DAB+ frequencies. SoapySDR Notes --- ### LimeSDR Connect the antenna to the RX1_W port and configured SoapySDR antenna option to `LNAW`. `SoapySDRUtil --probe=driver=lime` may show other possible options. ### USRP Configured SoapySDR driver arguments option to `driver=uhd`. Configure also antenna and clock source option. To list possible values for antenna and clock source use the command `SoapySDRUtil --probe=driver=uhd`. Building ==================== General Information --- The following libraries and their development files are needed: * Qt 5.10 (Qt 5.9 and below is not supported) * FFTW3f * libfaad * librtlsdr * libusb Ubuntu Linux 18.04 LTS --- This section shows how to compile welle.io on Ubuntu 16.04 LTS and Ubuntu 18.04 LTS. 1. Install Qt 5.10 including the Qt Charts module by using the the "Qt Online Installer for Linux" https://www.qt.io/download-open-source/ 2. Install the following packages ``` # sudo apt install libfaad-dev libmpg123-dev libmpg123-dev libfftw3-dev librtlsdr-dev libusb-1.0-0-dev mesa-common-dev libglu1-mesa-dev libpulse-dev libsoapysdr-dev libairspy-dev libmp3lame-dev ``` 3. Clone welle.io ``` # git clone https://github.com/AlbrechtL/welle.io.git ``` 4. Start Qt Creator and open the project file `welle.io.pro` inside the folder "welle.io". 5. Build welle.io 6. Run welle.io and enjoy it Windows 10 --- A compiled version can be found at the [release page](https://github.com/AlbrechtL/welle.io/releases) This sections shows how to compile welle.io on Windows 10. Windows 7 should also be possible but is not tested. 1. Install Qt 5.10 including the Qt Charts and mingw modules by using the the "Qt Online Installer for Windows" https://www.qt.io/download-open-source/ 2. Clone welle.io https://github.com/AlbrechtL/welle.io.git e.g. by using [TortoiseGit](https://tortoisegit.org). 3. Clone the welle.io Windows libraries https://github.com/AlbrechtL/welle.io-win-libs.git. 4. Start Qt Creator and open the project file `welle.io.pro` inside the folder "welle.io". 5. Build welle.io 6. Run welle.io and enjoy it macOS --- To build for macOS, you have have several options: Either you install everything incl. dependencies manually (not covered here and not recommended) or use Homebrew or MacPorts. ### Homebrew Assuming that you have [Homebrew](https://brew.sh/) installed, execute the following steps: 1. Use the welle.io repository as a "tap" (alternative package repository): ``` # brew tap AlbrechtL/welle_io https://github.com/AlbrechtL/welle.io ``` 2. Install welle.io (and dependencies): ``` # brew install AlbrechtL/welle_io/welle.io ``` ### MacPorts You can either use the welle.io port available in macports, or compile with QT Creator. #### use welle.io port This is the easiest way and will manage the dependencies for you. There are 3 variants all three being enabled by default. Each variant enables compilation with that specific input device library : "airspy" "rtlsdr" "soapysdr". ``` # sudo port install welle.io ``` With MacPorts, welle.io is installed as a bundle app in `/Applications/MacPorts`. #### compile with QT Creator You need to install the dependencies with MacPorts first, assuming you have [MacPorts](https://www.macports.org/) installed: ``` # sudo port install fftw-3-single faad2 rtl-sdr libusb mpg123 lame ``` 1. Install Qt 5.10 with Qt Creator directly from Qt website, not through MacPorts. 2. Clone welle.io ``` # git clone https://github.com/AlbrechtL/welle.io.git ``` 3. Open welle.io.pro with Qt Creator. 4. Make sure in Qt Creator, "Projects, Build&Run, Run" that the checkbox "Add build library path to DYLD..." is off. 5. Build and run. CMake instead of Qt Creator (Windows, Linux, macOS) --- As an alternative to Qt Creator, CMake can be used for building welle.io after installing dependencies and cloning the repository. On Linux, you can also use CMake to build [**welle-cli**](#welle-cli), the command-line backend testing tool that does not require Qt. 1. Create a build directory inside the repository and change into it ``` # mkdir build # cd build ``` 2. Run CMake. To enable support for RTL-SDR add the flag `-DRTLSDR=1` (requires librtlsdr) and for SoapySDR add `-DSOAPYSDR=1` (requires SoapySDR compiled with support for each desired hardware, e.g. UHD for Ettus USRP, LimeSDR, Airspy or HackRF). By default, CMake will build both welle-io and welle-cli. Use `-DBUILD_WELLE_IO=OFF` or `-DBUILD_WELLE_CLI=OFF` to compile only the one you need. ``` # cmake .. ``` or to enable support for both RTL-SDR and Soapy-SDR: ``` # cmake .. -DRTLSDR=1 -DSOAPYSDR=1 ``` If you wish to use KISS FFT instead of FFTW (e.g. to compare performance), use `-DKISS_FFT=ON`. 3. Run make (or use the created project file depending on the selected generator) ``` # make ``` 4. Install it (as super-user) ``` # make install ``` 5. Run welle.io and enjoy it Android --- A compiled version of welle.io (APK file) can be found at at the [Google Play store](https://play.google.com/store/apps/details?id=io.welle.welle) or at the [release page](https://github.com/AlbrechtL/welle.io/releases). welle.io uses the "RTL2832U driver" from Martin Marinov, to be found at the [Google play store](https://play.google.com/store/apps/details?id=marto.rtl_tcp_andro) or at [F-droid](https://f-droid.org/packages/marto.rtl_tcp_andro/). Also see ([sources](https://github.com/martinmarinov/rtl_tcp_andro-) or [APK file](https://github.com/martinmarinov/rtl_tcp_andro-/blob/master/app/app-release.apk)). Please note that a recent version of this driver is needed (v3.06 or above), otherwise welle.io will not find your stick. This sections shows how to compile welle.io for Android. 1. Install Qt 5.12 for Android including the Qt Charts and Qt Remote Objects modules by using the the "Qt Online Installer for Windows" https://www.qt.io/download-open-source/ 2. Follow the side https://doc.qt.io/qt-5/androidgs.html to install the Android build enviroment 3. Clone welle.io https://github.com/AlbrechtL/welle.io.git ``` # git clone https://github.com/AlbrechtL/welle.io.git ``` 4. Start Qt Creator and open the project file `welle.io.pro` inside the folder "welle.io". 5. Build welle.io 6. Run welle.io and enjoy it Raspberry Pi 2 and 3 --- To build and run welle.io on a Raspberry Pi 2 and 3 with GPU acceleration, please read [this guide](https://github.com/AlbrechtL/welle.io/blob/master/RASPBERRY-PI.md). welle-cli == If you compile welle-io with [`cmake`](#cmake-instead-of-qt-creator-windows-linux-macos) you will also get an executable called **welle-cli** which stands for welle-io **c**ommand **l**ine **i**nterface. Usage of welle-cli --- Receive using RTLSDR, and play with ALSA: welle-cli -c channel -p programme Read an IQ file and play with ALSA: (IQ file format is u8, unless the file ends with FORMAT.iq) welle-cli -f file -p programme Use -D to dump FIC and all programmes to files: welle-cli -c channel -D Use -w to enable webserver, decode a programme on demand: welle-cli -c channel -w port Use -Dw to enable webserver, decode all programmes: welle-cli -c channel -Dw port Use `-C 1 -w` to enable webserver, decode programmes one by one in a carousel. Use `-C N -w` to enable webserver, decode programmes N by N in a carousel. This is useful if your machine cannot decode all programmes simultaneously, but you still want to get an overview of the ensemble. By default welle-cli will switch every 10 seconds. With the `-P` option, welle-cli will switch once DLS and a slide were decoded, staying at most for 80 seconds on a given programme. welle-cli -c channel -C 1 -w port welle-cli -c channel -PC 1 -w port Example: `welle-cli -c 12A -C 1 -w 7979` enables the webserver on channel 12A, please then go to http://localhost:7979/ where you can observe all necessary details for every service ID in the ensemble, see the slideshows, stream the audio (by clicking on the Play-Button), check spectrum, constellation, TII information and CIR peak diagramme. Backend options --- `-u` disable coarse corrector, for receivers who have a low frequency offset. Use `-t [test_number]` to run a test. To understand what the tests do, please see source code. Examples: --- welle-cli -c 10B -p GRRIF welle-cli -f ./ofdm.iq -p GRRIF welle-cli -f ./ofdm.iq -t 1 Limitations === * Windows 8 and older are not offically supported Development === You can join the welle.io development. Please visit the [wiki](https://github.com/AlbrechtL/welle.io/wiki) to find more information. Profiling --- If you build with cmake and add `-DPROFILING=ON`, welle-io will generate a few `.csv` files and a graphviz `.dot` file that can be used to analyse and understand which parts of the backend use CPU resources. Use `dot -Tpdf profiling.dot > profiling.pdf` to generate a graph visualisation. Search source code for the `PROFILE()` macro to see where the profiling marks are placed. welle.io-2.1/THANKS000066400000000000000000000035141357201522000140050ustar00rootroot00000000000000welle.io uses external and internal libraries and make extensive use of the following persons' or companies' code: QT - Copyright (c) The Qt Company, www.qt.io - LGPL Version 2.1 FFTW3 - www.fftw.org - GPLv2 license or later Kiss FFT - www.sourceforge.net/projects/kissfft - Mark Borgerding - BSD 3-clause license MPG123 - Copyright (c) 1995-2018 by Michael Hipp and others - LGPL Version 2.1 FAAD2 - Copyright (c) Nero AG, www.nero.com" - GPLv2 license or later rtl-sdr - https://osmocom.org/projects/sdr/wiki/rtl-sdr - GPLv2 license or later airspy - https://github.com/airspy/airspyone_host - GPLv2 or later and BSD 3-clause license fec - Copyright 2003 Phil Karn, KA9Q - LGPL Version 2.1 frequency-analyzer - https://github.com/Venemo/frequency-analyzer, Timur Kristóf - MIT license welle.io uses parts from the following programs - qt-dab Copyright (c) 2009-2017 Jan van Katwijk Lazy Chair Computing (J.vanKatwijk@gmail.com) https://github.com/JvanKatwijk/qt-dab - dablin Copyright (c) 2016 Stefan Pöschel https://github.com/Opendigitalradio/dablin - headunit-dekstop https://github.com/viktorgino/headunit-desktop Icons: - Navigation icons made by Gregor Cresnar from www.flaticon.com (License CC 3.0 BY) (http://www.flaticon.com/authors/gregor-cresnar) - Speaker icons made by smashicons from www.flaticon.com (License CC 3.0 BY) (https://smashicons.com) - Antenna icon made by photo3idea_studio from www.flaticon.com (License CC 3.0 BY) (https://www.flaticon.com/authors/photo3idea-studio) - Application icon made by Freepik from www.flaticon.com (License CC 3.0 BY) (http://www.freepik.com) Other: Notice some of these images are derived from Google applications resources. They were provided under the following license: You may use the materials in this directory without restriction to develop your apps and to use in your apps. welle.io-2.1/cmake/000077500000000000000000000000001357201522000141475ustar00rootroot00000000000000welle.io-2.1/cmake/Modules/000077500000000000000000000000001357201522000155575ustar00rootroot00000000000000welle.io-2.1/cmake/Modules/FindFFTW3f.cmake000066400000000000000000000024641357201522000203670ustar00rootroot00000000000000# http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake # Modified to use pkg config and use standard var names # Find single-precision (float) version of FFTW3 if(NOT FFTW3F_FOUND) include(FindPkgConfig) pkg_check_modules(PC_FFTW3F "fftw3f >= 3.0") find_path( FFTW3F_INCLUDE_DIRS NAMES fftw3.h HINTS $ENV{FFTW3_DIR}/include ${PC_FFTW3F_INCLUDE_DIR} PATHS /usr/local/include /usr/include ) find_library( FFTW3F_LIBRARIES NAMES fftw3f libfftw3f HINTS $ENV{FFTW3_DIR}/lib ${PC_FFTW3F_LIBDIR} PATHS /usr/local/lib /usr/lib /usr/lib64 ) find_library( FFTW3F_THREADS_LIBRARIES NAMES fftw3f_threads libfftw3f_threads HINTS $ENV{FFTW3_DIR}/lib ${PC_FFTW3F_LIBDIR} PATHS /usr/local/lib /usr/lib /usr/lib64 ) if(FFTW3F_INCLUDE_DIRS AND FFTW3F_LIBRARIES) set(FFTW3F_FOUND TRUE CACHE INTERNAL "FFTW3f found") message(STATUS "Found FFTW3f: ${FFTW3F_INCLUDE_DIRS}, ${FFTW3F_LIBRARIES}") else() set(FFTW3F_FOUND FALSE CACHE INTERNAL "FFTW3f found") message(STATUS "FFTW3f not found.") endif() mark_as_advanced(FFTW3F_INCLUDE_DIRS FFTW3F_LIBRARIES FFTW3F_THREADS_LIBRARIES) endif() welle.io-2.1/cmake/Modules/FindFaad.cmake000066400000000000000000000021501357201522000202130ustar00rootroot00000000000000# Try to find FAAD library and include path. # Once done this will define # # FAAD_INCLUDE_DIRS - where to find faad.h, etc. # FAAD_LIBRARIES - List of libraries when using libfaad. # FAAD_FOUND - True if libfaad found. find_path(FAAD_INCLUDE_DIR faad.h DOC "The directory where faad.h resides") find_library(FAAD_LIBRARY NAMES faad DOC "The libfaad library") if(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) set(FAAD_FOUND 1) set(FAAD_LIBRARIES ${FAAD_LIBRARY}) set(FAAD_INCLUDE_DIRS ${FAAD_INCLUDE_DIR}) else(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) set(FAAD_FOUND 0) set(FAAD_LIBRARIES) set(FAAD_INCLUDE_DIRS) endif(FAAD_INCLUDE_DIR AND FAAD_LIBRARY) mark_as_advanced(FAAD_INCLUDE_DIR) mark_as_advanced(FAAD_LIBRARY) mark_as_advanced(FAAD_FOUND) if(NOT FAAD_FOUND) set(FAAD_DIR_MESSAGE "libfaad was not found. Make sure FAAD_LIBRARY and FAAD_INCLUDE_DIR are set.") if(NOT FAAD_FIND_QUIETLY) message(STATUS "${FAAD_DIR_MESSAGE}") else(NOT FAAD_FIND_QUIETLY) if(FAAD_FIND_REQUIRED) message(FATAL_ERROR "${FAAD_DIR_MESSAGE}") endif(FAAD_FIND_REQUIRED) endif(NOT FAAD_FIND_QUIETLY) endif(NOT FAAD_FOUND) welle.io-2.1/cmake/Modules/FindLame.cmake000066400000000000000000000007671357201522000202520ustar00rootroot00000000000000# - Try to find LAME # Once done this will define # # LAME_FOUND - system has liblame # LAME_INCLUDE_DIRS - the liblame include directory # LAME_LIBRARIES - The liblame libraries find_path(LAME_INCLUDE_DIRS lame/lame.h) find_library(LAME_LIBRARIES mp3lame) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Lame DEFAULT_MSG LAME_INCLUDE_DIRS LAME_LIBRARIES) list(APPEND LAME_DEFINITIONS -DHAVE_LIBMP3LAME=1) mark_as_advanced(LAME_INCLUDE_DIRS LAME_LIBRARIES LAME_DEFINITIONS) welle.io-2.1/cmake/Modules/FindLibAIRSPY.cmake000066400000000000000000000015631357201522000210250ustar00rootroot00000000000000if(NOT LIBAIRSPY_FOUND) include(FindPkgConfig) pkg_check_modules (LIBAIRSPY_PKG libairspy) find_path(LIBAIRSPY_INCLUDE_DIR NAMES libairspy/airspy.h PATHS ${LIBAIRSPY_PKG_INCLUDE_DIRS} /usr/include /usr/local/include ) find_library(LIBAIRSPY_LIBRARIES NAMES airspy PATHS ${LIBAIRSPY_PKG_LIBRARY_DIRS} /usr/lib /usr/local/lib ) if(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES) set(LIBAIRSPY_FOUND TRUE CACHE INTERNAL "libairspy found") message(STATUS "Found libairspy: ${LIBAIRSPY_INCLUDE_DIR}, ${LIBAIRSPY_LIBRARIES}") else(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES) set(LIBAIRSPY_FOUND FALSE CACHE INTERNAL "libairspy found") message(STATUS "libairspy not found.") endif(LIBAIRSPY_INCLUDE_DIR AND LIBAIRSPY_LIBRARIES) mark_as_advanced(LIBAIRSPY_INCLUDE_DIR LIBAIRSPY_LIBRARIES) endif(NOT LIBAIRSPY_FOUND) welle.io-2.1/cmake/Modules/FindLibRTLSDR.cmake000066400000000000000000000013601357201522000210230ustar00rootroot00000000000000if(NOT LIBRTLSDR_FOUND) include(FindPkgConfig) pkg_check_modules(LIBRTLSDR_PKG librtlsdr) find_path(LIBRTLSDR_INCLUDE_DIRS NAMES rtl-sdr.h PATHS ${LIBRTLSDR_PKG_INCLUDE_DIRS} /usr/include /usr/local/include ) find_library(LIBRTLSDR_LIBRARIES NAMES rtlsdr PATHS ${LIBRTLSDR_PKG_LIBRARY_DIRS} /usr/lib /usr/lib64 /usr/local/lib ) if(LIBRTLSDR_INCLUDE_DIRS AND LIBRTLSDR_LIBRARIES) set(LIBRTLSDR_FOUND TRUE CACHE INTERNAL "librtlsdr found") message(STATUS "Found librtlsdr: ${LIBRTLSDR_INCLUDE_DIRS}, ${LIBRTLSDR_LIBRARIES}") else() set(LIBRTLSDR_FOUND FALSE CACHE INTERNAL "librtlsdr found") message(STATUS "librtlsdr not found.") endif() mark_as_advanced(LIBRTLSDR_INCLUDE_DIRS LIBRTLSDR_LIBRARIES) endif() welle.io-2.1/cmake/Modules/FindMPG123.cmake000066400000000000000000000016261357201522000202400ustar00rootroot00000000000000# - Find mpg123 # Find the native mpg123 includes and library # # MPG123_INCLUDE_DIR - where to find mpg123.h # MPG123_LIBRARIES - List of libraries when using mpg123. # MPG123_FOUND - True if mpg123 found. IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) # Already in cache, be silent SET(MPG123_FIND_QUIETLY TRUE) ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) FIND_PATH(MPG123_INCLUDE_DIR mpg123.h PATHS "${MPG123_DIR}" PATH_SUFFIXES include ) FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0 PATHS "${MPG123_DIR}" PATH_SUFFIXES lib ) # MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR) # handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR) welle.io-2.1/cmake/cmake_uninstall.cmake.in000066400000000000000000000020131357201522000207230ustar00rootroot00000000000000if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") endif(NOT "${rm_retval}" STREQUAL 0) else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File $ENV{DESTDIR}${file} does not exist.") endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") endforeach(file) welle.io-2.1/src/000077500000000000000000000000001357201522000136565ustar00rootroot00000000000000welle.io-2.1/src/backend.pri000066400000000000000000000213461357201522000157670ustar00rootroot00000000000000CONFIG += c++14 Release: QMAKE_CFLAGS += -ffast-math -O3 Release: QMAKE_CXXFLAGS += -ffast-math -O3 Release: QMAKE_LFLAGS += -O3 DEFINES += DABLIN_AAC_FAAD2 unix:!macx:!android: { INCLUDEPATH += /usr/local/include LIBS += -lfftw3f LIBS += -lusb-1.0 LIBS += -ldl LIBS += -lfaad LIBS += -lmp3lame LIBS += -lmpg123 CONFIG += airspy CONFIG += rtl_sdr CONFIG += soapysdr # CONFIG += mpg123_builtin # CONFIG += libfaad_builtin # CONFIG += kiss_fft_builtin } win32: { INCLUDEPATH += ../../../welle.io-win-libs/include LIBS += -L../../../welle.io-win-libs/x86 LIBS += -lfftw3f-3 LIBS += -lole32 LIBS += -lwinpthread LIBS += -lwinmm LIBS += -lstdc++ LIBS += -lws2_32 LIBS += -llibfaad LIBS += -lmp3lame LIBS += -lmpg123-0 LIBS += -lusb-1.0 LIBS += -lws2_32 CONFIG += airspy CONFIG += rtl_sdr #CONFIG += soapysdr } macx { INCLUDEPATH += /opt/local/include INCLUDEPATH += /usr/local/include LIBS += -L/opt/local/lib LIBS += -L/usr/local/lib LIBS += -lfftw3f LIBS += -lusb-1.0 LIBS += -ldl LIBS += -lfaad LIBS += -lmpg123 LIBS += -lmp3lame CONFIG += airspy CONFIG += rtl_sdr #CONFIG += soapysdr } android { CONFIG += kiss_fft_builtin CONFIG += libfaad_builtin CONFIG += mpg123_builtin } DEPENDPATH += \ $$PWD \ $$PWD/backend \ $$PWD/audio \ $$PWD/data \ $$PWD/ofdm \ $$PWD/various \ $$PWD/input \ $$PWD/libs/fec INCLUDEPATH += \ $$PWD \ $$PWD/backend \ $$PWD/audio \ $$PWD/data \ $$PWD/ofdm \ $$PWD/various \ $$PWD/input \ $$PWD/libs/fec HEADERS += \ $$PWD/backend/dab-audio.h \ $$PWD/backend/dab_decoder.h \ $$PWD/backend/dabplus_decoder.h \ $$PWD/backend/subchannel_sink.h \ $$PWD/backend/charsets.h \ $$PWD/backend/dab-constants.h \ $$PWD/backend/dab-processor.h \ $$PWD/backend/dab-virtual.h \ $$PWD/backend/mot_manager.h \ $$PWD/backend/pad_decoder.h \ $$PWD/backend/eep-protection.h \ $$PWD/backend/energy_dispersal.h \ $$PWD/backend/fib-processor.h \ $$PWD/backend/fic-handler.h \ $$PWD/backend/msc-handler.h \ $$PWD/backend/freq-interleaver.h \ $$PWD/backend/ofdm-decoder.h \ $$PWD/backend/ofdm-processor.h \ $$PWD/backend/phasereference.h \ $$PWD/backend/phasetable.h \ $$PWD/backend/tii-decoder.h \ $$PWD/backend/protTables.h \ $$PWD/backend/protection.h \ $$PWD/backend/radio-controller.h \ $$PWD/backend/radio-receiver.h \ $$PWD/backend/tools.h \ $$PWD/backend/uep-protection.h \ $$PWD/backend/viterbi.h \\ $$PWD/various/fft.h \ $$PWD/various/ringbuffer.h \ $$PWD/various/Xtan2.h \ $$PWD/various/channels.h \ $$PWD/various/wavfile.h \ $$PWD/various/Socket.h \ $$PWD/various/MathHelper.h \ $$PWD/various/fft.h \ $$PWD/various/ringbuffer.h \ $$PWD/various/Xtan2.h \ $$PWD/various/channels.h \ $$PWD/various/wavfile.h \ $$PWD/various/Socket.h \ $$PWD/various/MathHelper.h \ $$PWD/libs/fec/char.h \ $$PWD/libs/fec/decode_rs.h \ $$PWD/libs/fec/encode_rs.h \ $$PWD/libs/fec/fec.h \ $$PWD/libs/fec/init_rs.h \ $$PWD/libs/fec/rs-common.h \ $$PWD/backend/decoder_adapter.h \ $$PWD/input/input_factory.h \ $$PWD/input/null_device.h \ $$PWD/input/raw_file.h \ $$PWD/input/virtual_input.h \ $$PWD/input/rtl_tcp.h SOURCES += \ $$PWD/backend/dab-audio.cpp \ $$PWD/backend/dab_decoder.cpp \ $$PWD/backend/dabplus_decoder.cpp \ $$PWD/backend/charsets.cpp \ $$PWD/backend/dab-constants.cpp \ $$PWD/backend/mot_manager.cpp \ $$PWD/backend/pad_decoder.cpp \ $$PWD/backend/eep-protection.cpp \ $$PWD/backend/fib-processor.cpp \ $$PWD/backend/fic-handler.cpp \ $$PWD/backend/msc-handler.cpp \ $$PWD/backend/freq-interleaver.cpp \ $$PWD/backend/ofdm-decoder.cpp \ $$PWD/backend/ofdm-processor.cpp \ $$PWD/backend/phasereference.cpp \ $$PWD/backend/phasetable.cpp \ $$PWD/backend/tii-decoder.cpp \ $$PWD/backend/protTables.cpp \ $$PWD/backend/radio-receiver.cpp \ $$PWD/backend/tools.cpp \ $$PWD/backend/uep-protection.cpp \ $$PWD/backend/viterbi.cpp \ $$PWD/various/Xtan2.cpp \ $$PWD/various/channels.cpp \ $$PWD/various/fft.cpp \ $$PWD/various/wavfile.c \ $$PWD/various/Socket.cpp \ $$PWD/libs/fec/encode_rs_char.c \ $$PWD/libs/fec/decode_rs_char.c \ $$PWD/libs/fec/init_rs_char.c \ $$PWD/backend/decoder_adapter.cpp \ $$PWD/input/input_factory.cpp \ $$PWD/input/null_device.cpp \ $$PWD/input/raw_file.cpp \ $$PWD/input/rtl_tcp.cpp #### Built-in libraries #### kiss_fft_builtin { DEFINES += KISSFFT INCLUDEPATH += $$PWD/libs/kiss_fft HEADERS += \ $$PWD/libs/kiss_fft/kiss_fft.h \ $$PWD/libs/kiss_fft/_kiss_fft_guts.h SOURCES += $$PWD/libs/kiss_fft/kiss_fft.c } libfaad_builtin { DEFINES += HAVE_CONFIG_H # Dangerous but libfaad produces a lot of warnings QMAKE_CFLAGS += -Wno-unused-parameter QMAKE_CFLAGS += -Wno-unused-function QMAKE_CFLAGS += -Wno-unused-variable QMAKE_CFLAGS += -Wno-unused-but-set-variable QMAKE_CFLAGS += -Wno-old-style-declaration QMAKE_CFLAGS += -Wno-missing-braces INCLUDEPATH += \ $$PWD/libs/faad2 \ $$PWD/libs/faad2/libfaad \ $$PWD/libs/faad2/libfaad/codebook \ $$PWD/libs/faad2/include HEADERS += \ $$PWD/libs/faad2/config.h \ $$PWD/libs/faad2/include/faad.h \ $$PWD/libs/faad2/include/neaacdec.h SOURCES += \ $$PWD/libs/faad2/libfaad/bits.c \ $$PWD/libs/faad2/libfaad/cfft.c \ $$PWD/libs/faad2/libfaad/common.c \ $$PWD/libs/faad2/libfaad/decoder.c \ $$PWD/libs/faad2/libfaad/drc.c \ $$PWD/libs/faad2/libfaad/drm_dec.c \ $$PWD/libs/faad2/libfaad/error.c \ $$PWD/libs/faad2/libfaad/filtbank.c \ $$PWD/libs/faad2/libfaad/hcr.c \ $$PWD/libs/faad2/libfaad/huffman.c \ $$PWD/libs/faad2/libfaad/ic_predict.c \ $$PWD/libs/faad2/libfaad/is.c \ $$PWD/libs/faad2/libfaad/lt_predict.c \ $$PWD/libs/faad2/libfaad/mdct.c \ $$PWD/libs/faad2/libfaad/mp4.c \ $$PWD/libs/faad2/libfaad/ms.c \ $$PWD/libs/faad2/libfaad/output.c \ $$PWD/libs/faad2/libfaad/pns.c \ $$PWD/libs/faad2/libfaad/ps_dec.c \ $$PWD/libs/faad2/libfaad/ps_syntax.c \ $$PWD/libs/faad2/libfaad/pulse.c \ $$PWD/libs/faad2/libfaad/rvlc.c \ $$PWD/libs/faad2/libfaad/sbr_dct.c \ $$PWD/libs/faad2/libfaad/sbr_dec.c \ $$PWD/libs/faad2/libfaad/sbr_e_nf.c \ $$PWD/libs/faad2/libfaad/sbr_fbt.c \ $$PWD/libs/faad2/libfaad/sbr_hfadj.c \ $$PWD/libs/faad2/libfaad/sbr_hfgen.c \ $$PWD/libs/faad2/libfaad/sbr_huff.c \ $$PWD/libs/faad2/libfaad/sbr_qmf.c \ $$PWD/libs/faad2/libfaad/sbr_syntax.c \ $$PWD/libs/faad2/libfaad/sbr_tf_grid.c \ $$PWD/libs/faad2/libfaad/specrec.c \ $$PWD/libs/faad2/libfaad/ssr.c \ $$PWD/libs/faad2/libfaad/ssr_fb.c \ $$PWD/libs/faad2/libfaad/ssr_ipqf.c \ $$PWD/libs/faad2/libfaad/syntax.c \ $$PWD/libs/faad2/libfaad/tns.c } mpg123_builtin { # DEFINES += MPG123 DEFINES += OPT_GENERIC INCLUDEPATH += $$PWD/libs/mpg123 HEADERS += \ $$PWD/libs/mpg123/mpg123.h SOURCES += \ $$PWD/libs/mpg123/compat.c \ $$PWD/libs/mpg123/compat_str.c \ $$PWD/libs/mpg123/parse.c \ $$PWD/libs/mpg123/frame.c \ $$PWD/libs/mpg123/format.c \ $$PWD/libs/mpg123/dct64.c \ $$PWD/libs/mpg123/equalizer.c \ $$PWD/libs/mpg123/id3.c \ $$PWD/libs/mpg123/icy.c \ $$PWD/libs/mpg123/icy2utf8.c \ $$PWD/libs/mpg123/optimize.c \ $$PWD/libs/mpg123/readers.c \ $$PWD/libs/mpg123/tabinit.c \ $$PWD/libs/mpg123/libmpg123.c \ $$PWD/libs/mpg123/index.c \ $$PWD/libs/mpg123/layer1.c \ $$PWD/libs/mpg123/layer2.c \ $$PWD/libs/mpg123/layer3.c \ $$PWD/libs/mpg123/dither.c \ $$PWD/libs/mpg123/feature.c \ $$PWD/libs/mpg123/synth.c \ $$PWD/libs/mpg123/synth_real.c \ $$PWD/libs/mpg123/ntom.c \ $$PWD/libs/mpg123/synth_8bit.c \ $$PWD/libs/mpg123/synth_s32.c \ $$PWD/libs/mpg123/stringbuf.c } #### Devices #### airspy { DEFINES += HAVE_AIRSPY HEADERS += $$PWD/input/airspy_sdr.h SOURCES += $$PWD/input/airspy_sdr.cpp # The same lib for unix and Windows LIBS += -lairspy } rtl_sdr { DEFINES += HAVE_RTLSDR HEADERS += $$PWD/input/rtl_sdr.h SOURCES += $$PWD/input/rtl_sdr.cpp # The same lib for unix and Windows LIBS += -lrtlsdr } soapysdr { DEFINES += HAVE_SOAPYSDR HEADERS += $$PWD/input/soapy_sdr.h SOURCES += $$PWD/input/soapy_sdr.cpp # The same lib for unix and Windows LIBS += -lSoapySDR } welle.io-2.1/src/backend/000077500000000000000000000000001357201522000152455ustar00rootroot00000000000000welle.io-2.1/src/backend/charsets.cpp000066400000000000000000000157471357201522000176030ustar00rootroot00000000000000/* * Copyright (C) 2015 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * This charset handling was kindly added by Przemyslaw Wegrzyn * all rights acknowledged */ #include "charsets.h" #include #include #include /** * This table maps "EBU Latin" charset to corresponding * Unicode (UCS2-encoded) characters. * See ETSI TS 101 756 v1.8.1, Annex C */ static const unsigned short ebuLatinToUcs2[] = { /* 0x00 - 0x07 */ 0x00, 0x118, 0x12e, 0x172, 0x102, 0x116, 0x10e, 0x218, /* 0x8 - 0xf */ 0x21a, 0x10a, 0xa, 0xb, 0x120, 0x139, 0x17b, 0x143, /* 0x10 - 0x17 */ 0x105, 0x119, 0x12f, 0x173, 0x103, 0x117, 0x10f, 0x219, /* 0x18 - 0x1f */ 0x21b, 0x10b, 0x147, 0x11a, 0x121, 0x13a, 0x17c, 0x82, /* 0x20 - 0x27 */ 0x20, 0x21, 0x22, 0x23, 0x142, 0x25, 0x26, 0x27, /* 0x28 - 0x2f */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x30 - 0x37 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x38 - 0x3f */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x40 - 0x47 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x48 - 0x4f */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x50 - 0x57 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x58 - 0x5f */ 0x58, 0x59, 0x5a, 0x5b, 0x16e, 0x5d, 0x141, 0x5f, /* 0x60 - 0x67 */ 0x104, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x68 - 0x6f */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x70 - 0x77 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x78 - 0x7f */ 0x78, 0x79, 0x7a, 0xab, 0x16f, 0xbb, 0x13d, 0x126, /* 0x80 - 0x87 */ 0xe1, 0xe0, 0xe9, 0xe8, 0xed, 0xec, 0xf3, 0xf2, /* 0x88 - 0x8f */ 0xfa, 0xf9, 0xd1, 0xc7, 0x15e, 0xdf, 0xa1, 0x178, /* 0x90 - 0x97 */ 0xe2, 0xe4, 0xea, 0xeb, 0xee, 0xef, 0xf4, 0xf6, /* 0x98 - 0x9f */ 0xfb, 0xfc, 0xf1, 0xe7, 0x15f, 0x11f, 0x131, 0xff, /* 0xa0 - 0xa7 */ 0x136, 0x145, 0xa9, 0x122, 0x11e, 0x11b, 0x148, 0x151, /* 0xa8 - 0xaf */ 0x150, 0x20ac, 0xa3, 0x24, 0x100, 0x112, 0x12a, 0x16a, /* 0xb0 - 0xb7 */ 0x137, 0x146, 0x13b, 0x123, 0x13c, 0x130, 0x144, 0x171, /* 0xb8 - 0xbf */ 0x170, 0xbf, 0x13e, 0xb0, 0x101, 0x113, 0x12b, 0x16b, /* 0xc0 - 0xc7 */ 0xc1, 0xc0, 0xc9, 0xc8, 0xcd, 0xcc, 0xd3, 0xd2, /* 0xc8 - 0xcf */ 0xda, 0xd9, 0x158, 0x10c, 0x160, 0x17d, 0xd0, 0x13f, /* 0xd0 - 0xd7 */ 0xc2, 0xc4, 0xca, 0xcb, 0xce, 0xcf, 0xd4, 0xd6, /* 0xd8 - 0xdf */ 0xdb, 0xdc, 0x159, 0x10d, 0x161, 0x17e, 0x111, 0x140, /* 0xe0 - 0xe7 */ 0xc3, 0xc5, 0xc6, 0x152, 0x177, 0xdd, 0xd5, 0xd8, /* 0xe8 - 0xef */ 0xde, 0x14a, 0x154, 0x106, 0x15a, 0x179, 0x164, 0xf0, /* 0xf0 - 0xf7 */ 0xe3, 0xe5, 0xe6, 0x153, 0x175, 0xfd, 0xf5, 0xf8, /* 0xf8 - 0xff */ 0xfe, 0x14b, 0x155, 0x107, 0x15b, 0x17a, 0x165, 0x127 }; //The above table can be automatically generated from the table in ODR-PadEnc (ODR-PadEnc/src/charset.cpp) using the following source code: // Compile like this: g++ -fPIC -DODRTABLE -I /usr/include/x86_64-linux-gnu/qt5/ -I /usr/include/x86_64-linux-gnu/qt5/QtCore/ -lQt5Core -o chartable charsets.cpp #ifdef ODRTABLE #include #include #include #include "../../../ODR-PadEnc/src/charset.cpp" int main(){ std::wstring_convert, char16_t> ucs2conv; std::cout << "/* 0x00 - 0x07 */ 0x00, "; std::cout << std::setbase(16) << std::setfill(' '); for (int i=0;i, char16_t> utf8conv; if (num_bytes == 0) { std::u16string buffer_char16(reinterpret_cast(buffer)); return utf8conv.to_bytes(buffer_char16); } else { const char16_t* start = reinterpret_cast(buffer); const char16_t* end = start + num_bytes/2; std::u16string buffer_char16(start, end); return utf8conv.to_bytes(buffer_char16); } } break; case CharacterSet::UnicodeUtf8: { if (num_bytes == 0) { std::string buffer_char8(reinterpret_cast(buffer)); return buffer_char8; } else { const char* start = reinterpret_cast(buffer); const char* end = start + num_bytes; std::string buffer_char8(start, end); return buffer_char8; } } break; case CharacterSet::EbuLatin: default: { std::u16string s; const uint8_t* buf = reinterpret_cast(buffer); std::wstring_convert, char16_t> utf8conv; if (num_bytes == 0) { while (*buf) { s += ebuLatinToUcs2[*buf]; buf++; } } else { for (size_t i = 0; i < num_bytes; i++) { s += ebuLatinToUcs2[buf[i]]; } } return utf8conv.to_bytes(s); } } } welle.io-2.1/src/backend/charsets.h000066400000000000000000000031241357201522000172320ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * This charset handling was kindly added by Przemyslaw Wegrzyn * all rights acknowledged */ #ifndef __CHARSETS_H #define __CHARSETS_H #include #include /* * Codes assigned to character sets, as defined * in ETSI TS 101 756 v1.6.1, section 5.2. */ enum class CharacterSet : uint8_t { EbuLatin = 0x00, // Complete EBU Latin based repertoire - see annex C UnicodeUcs2 = 0x06, UnicodeUtf8 = 0x0F, Undefined, }; /** * Converts the string from the given charset to a UTF-8 * encoded string. * * If num_bytes is nonzero, the buffer must be zero * terminated. */ std::string toUtf8StringUsingCharset(const void* buffer, CharacterSet charset, size_t num_bytes = 0); #endif // CHARSETS_H welle.io-2.1/src/backend/dab-audio.cpp000066400000000000000000000114561357201522000176050ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "dab-constants.h" #include "dab-audio.h" #include "decoder_adapter.h" #include "eep-protection.h" #include "uep-protection.h" #include "profiling.h" // As an experiment a version of the backend is created // that will be running in a separate thread. Might be // useful for multicore processors. // // Interleaving is - for reasons of simplicity - done // inline rather than through a special class-object //static //int8_t interleaveDelays[] = { // 15, 7, 11, 3, 13, 5, 9, 1, 14, 6, 10, 2, 12, 4, 8, 0}; // // // fragmentsize == Length * CUSize DabAudio::DabAudio( AudioServiceComponentType dabModus, int16_t fragmentSize, int16_t bitRate, ProtectionSettings protection, ProgrammeHandlerInterface& phi, const std::string& dumpFileName) : myProgrammeHandler(phi), mscBuffer(64 * 32768), dumpFileName(dumpFileName) { this->dabModus = dabModus; this->fragmentSize = fragmentSize; this->bitRate = bitRate; outV.resize(bitRate * 24); for (int i = 0; i < 16; i ++) { interleaveData[i].resize(fragmentSize); } using std::make_unique; if (protection.shortForm) { protectionHandler = make_unique(bitRate, protection.uepLevel); } else { const bool profile_is_eep_a = protection.eepProfile == EEPProtectionProfile::EEP_A; protectionHandler = make_unique( bitRate, profile_is_eep_a, (int)protection.eepLevel); } our_dabProcessor = make_unique( myProgrammeHandler, bitRate, dabModus, dumpFileName); running = true; ourThread = std::thread(&DabAudio::run, this); } DabAudio::~DabAudio() { running = false; if (ourThread.joinable()) { mscDataAvailable.notify_all(); ourThread.join(); } } int32_t DabAudio::process(const softbit_t *v, int16_t cnt) { int32_t fr; if (mscBuffer.GetRingBufferWriteAvailable () < cnt) fprintf (stderr, "dab-concurrent: buffer full\n"); while ((fr = mscBuffer.GetRingBufferWriteAvailable ()) <= cnt) { if (!running) return 0; std::this_thread::sleep_for(std::chrono::microseconds(1)); } mscBuffer.putDataIntoBuffer(v, cnt); mscDataAvailable.notify_all(); return fr; } const int16_t interleaveMap[] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15}; void DabAudio::run() { int16_t i; int16_t countforInterleaver = 0; int16_t interleaverIndex = 0; softbit_t Data[fragmentSize]; softbit_t tempX[fragmentSize]; while (running) { std::unique_lock lock(ourMutex); while (running && mscBuffer.GetRingBufferReadAvailable() <= fragmentSize) { mscDataAvailable.wait(lock); } if (!running) break; // mscBuffer is threadsafe to access, no need to keep the lock lock.unlock(); PROFILE(DAGetMSCData); mscBuffer.getDataFromBuffer(Data, fragmentSize); PROFILE(DADeinterleave); for (i = 0; i < fragmentSize; i ++) { tempX[i] = interleaveData[(interleaverIndex + interleaveMap[i & 017]) & 017][i]; interleaveData[interleaverIndex][i] = Data[i]; } interleaverIndex = (interleaverIndex + 1) & 0x0F; // only continue when de-interleaver is filled if (countforInterleaver <= 15) { countforInterleaver ++; continue; } PROFILE(DADeconvolve); protectionHandler->deconvolve(tempX, fragmentSize, outV.data()); PROFILE(DADispersal); // and the inline energy dispersal energyDispersal.dedisperse(outV); if (our_dabProcessor) { PROFILE(DADecode); our_dabProcessor->addtoFrame(outV.data()); } PROFILE(DADone); } } welle.io-2.1/src/backend/dab-audio.h000066400000000000000000000047321357201522000172510ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __DAB_AUDIO #define __DAB_AUDIO #include "dab-virtual.h" #include #include #include #include #include #include #include #include "ringbuffer.h" #include "energy_dispersal.h" #include "radio-controller.h" class DabProcessor; class Protection; class DabAudio : public DabVirtual { public: DabAudio(AudioServiceComponentType dabModus, int16_t fragmentSize, int16_t bitRate, ProtectionSettings protection, ProgrammeHandlerInterface& phi, const std::string& dumpFileName); ~DabAudio(void); DabAudio(const DabAudio&) = delete; DabAudio& operator=(const DabAudio&) = delete; int32_t process(const softbit_t *v, int16_t cnt); protected: ProgrammeHandlerInterface& myProgrammeHandler; private: void run(void); std::atomic running; AudioServiceComponentType dabModus; int16_t fragmentSize; int16_t bitRate; std::vector outV; std::vector interleaveData[16]; EnergyDispersal energyDispersal; std::condition_variable mscDataAvailable; std::mutex ourMutex; std::thread ourThread; std::unique_ptr protectionHandler; std::unique_ptr our_dabProcessor; RingBuffer mscBuffer; const std::string dumpFileName; }; #endif welle.io-2.1/src/backend/dab-constants.cpp000066400000000000000000000444751357201522000205270ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "dab-constants.h" #include #include #include // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TR_NOOP(x) (x) #endif using namespace std; // Table ETSI EN 300 401 Page 50 // Table is copied from the work of Michael Hoehn const int ProtLevel[64][3] = { {16,5,32}, // Index 0 {21,4,32}, {24,3,32}, {29,2,32}, {35,1,32}, // Index 4 {24,5,48}, {29,4,48}, {35,3,48}, {42,2,48}, {52,1,48}, // Index 9 {29,5,56}, {35,4,56}, {42,3,56}, {52,2,56}, {32,5,64}, // Index 14 {42,4,64}, {48,3,64}, {58,2,64}, {70,1,64}, {40,5,80}, // Index 19 {52,4,80}, {58,3,80}, {70,2,80}, {84,1,80}, {48,5,96}, // Index 24 {58,4,96}, {70,3,96}, {84,2,96}, {104,1,96}, {58,5,112}, // Index 29 {70,4,112}, {84,3,112}, {104,2,112}, {64,5,128}, {84,4,128}, // Index 34 {96,3,128}, {116,2,128}, {140,1,128}, {80,5,160}, {104,4,160}, // Index 39 {116,3,160}, {140,2,160}, {168,1,160}, {96,5,192}, {116,4,192}, // Index 44 {140,3,192}, {168,2,192}, {208,1,192}, {116,5,224}, {140,4,224}, // Index 49 {168,3,224}, {208,2,224}, {232,1,224}, {128,5,256}, {168,4,256}, // Index 54 {192,3,256}, {232,2,256}, {280,1,256}, {160,5,320}, {208,4,320}, // index 59 {280,2,320}, {192,5,384}, {280,3,384}, {416,1,384}}; static std::string flag_to_shortlabel(const std::string& label, uint16_t flag) { stringstream shortlabel; for (size_t i = 0; i < label.size(); ++i) { if (flag & 0x8000 >> i) { shortlabel << label[i]; } } return shortlabel.str(); } string DabLabel::utf8_label() const { const auto fig2 = fig2_label(); if (not fig2.empty()) { return fig2; } else { return fig1_label_utf8(); } } string DabLabel::fig1_label_utf8() const { return toUtf8StringUsingCharset(fig1_label.c_str(), charset); } string DabLabel::fig1_shortlabel_utf8() const { const string shortlabel = flag_to_shortlabel(fig1_label, fig1_flag); return toUtf8StringUsingCharset(shortlabel.c_str(), charset); } void DabLabel::setCharset(uint8_t charset_id) { charset = static_cast(charset_id); } string DabLabel::fig2_label() const { vector segments_cat; for (size_t i = 0; i < segment_count; i++) { if (segments.count(i) == 0) { return ""; } else { const auto& s = segments.at(i); copy(s.begin(), s.end(), back_inserter(segments_cat)); } } switch (extended_label_charset) { case CharacterSet::EbuLatin: std::clog << "DABConstants: FIG2 label encoded in EBU Latin is not allowed." << std::endl; return ""; // Fallback to FIG1 case CharacterSet::UnicodeUtf8: return string(segments_cat.begin(), segments_cat.end()); case CharacterSet::UnicodeUcs2: return toUtf8StringUsingCharset( segments_cat.data(), CharacterSet::UnicodeUcs2, segments_cat.size()); case CharacterSet::Undefined: return ""; } throw logic_error("invalid extended label charset " + to_string((int)extended_label_charset)); } const char* DABConstants::getProgramTypeName(int type) { const char* typeName = ""; switch (type) { case 0: typeName = ""; break; case 1: typeName = QT_TR_NOOP("News"); break; case 2: typeName = QT_TR_NOOP("Current Affairs"); break; case 3: typeName = QT_TR_NOOP("Information"); break; case 4: typeName = QT_TR_NOOP("Sport"); break; case 5: typeName = QT_TR_NOOP("Education"); break; case 6: typeName = QT_TR_NOOP("Drama"); break; case 7: typeName = QT_TR_NOOP("Arts"); break; case 8: typeName = QT_TR_NOOP("Science"); break; case 9: typeName = QT_TR_NOOP("Talk"); break; case 10: typeName = QT_TR_NOOP("Pop Music"); break; case 11: typeName = QT_TR_NOOP("Rock Music"); break; case 12: typeName = QT_TR_NOOP("Easy Listening"); break; case 13: typeName = QT_TR_NOOP("Light classical"); break; case 14: typeName = QT_TR_NOOP("Classical Music"); break; case 15: typeName = QT_TR_NOOP("Other Music"); break; case 16: typeName = QT_TR_NOOP("Weather"); break; case 17: typeName = QT_TR_NOOP("Finance"); break; case 18: typeName = QT_TR_NOOP("Children\'s"); break; case 19: typeName = QT_TR_NOOP("Factual"); break; case 20: typeName = QT_TR_NOOP("Religion"); break; case 21: typeName = QT_TR_NOOP("Phone In"); break; case 22: typeName = QT_TR_NOOP("Travel"); break; case 23: typeName = QT_TR_NOOP("Leisure"); break; case 24: typeName = QT_TR_NOOP("Jazz and Blues"); break; case 25: typeName = QT_TR_NOOP("Country Music"); break; case 26: typeName = QT_TR_NOOP("National Music"); break; case 27: typeName = QT_TR_NOOP("Oldies Music"); break; case 28: typeName = QT_TR_NOOP("Folk Music"); break; case 29: typeName = QT_TR_NOOP("Documentary"); break; case 30: typeName = QT_TR_NOOP("entry 30 not used"); break; case 31: typeName = QT_TR_NOOP("entry 31 not used"); break; default: typeName = QT_TR_NOOP("UNKNOWN"); std::clog << "DABConstants: Unknown program type" << std::endl; break; } return typeName; } const char* DABConstants::getLanguageName(int language) { const char* languageName = ""; switch (language) { case 0: languageName = ""; break; case 1: languageName = QT_TR_NOOP("Albanian"); break; case 2: languageName = QT_TR_NOOP("Breton"); break; case 3: languageName = QT_TR_NOOP("Catalan"); break; case 4: languageName = QT_TR_NOOP("Croatian"); break; case 5: languageName = QT_TR_NOOP("Welsh"); break; case 6: languageName = QT_TR_NOOP("Czech"); break; case 7: languageName = QT_TR_NOOP("Danish"); break; case 8: languageName = QT_TR_NOOP("German"); break; case 9: languageName = QT_TR_NOOP("English"); break; case 10: languageName = QT_TR_NOOP("Spanish"); break; case 11: languageName = QT_TR_NOOP("Esperanto"); break; case 12: languageName = QT_TR_NOOP("Estonian"); break; case 13: languageName = QT_TR_NOOP("Basque"); break; case 14: languageName = QT_TR_NOOP("Faroese"); break; case 15: languageName = QT_TR_NOOP("French"); break; case 16: languageName = QT_TR_NOOP("Frisian"); break; case 17: languageName = QT_TR_NOOP("Irish"); break; case 18: languageName = QT_TR_NOOP("Gaelic"); break; case 19: languageName = QT_TR_NOOP("Galician"); break; case 20: languageName = QT_TR_NOOP("Icelandic"); break; case 21: languageName = QT_TR_NOOP("Italian"); break; case 22: languageName = QT_TR_NOOP("Lappish"); break; case 23: languageName = QT_TR_NOOP("Latin"); break; case 24: languageName = QT_TR_NOOP("Latvian"); break; case 25: languageName = QT_TR_NOOP("Luxembourgian"); break; case 26: languageName = QT_TR_NOOP("Lithuanian"); break; case 27: languageName = QT_TR_NOOP("Hungarian"); break; case 28: languageName = QT_TR_NOOP("Maltese"); break; case 29: languageName = QT_TR_NOOP("Dutch"); break; case 30: languageName = QT_TR_NOOP("Norwegian"); break; case 31: languageName = QT_TR_NOOP("Occitan"); break; case 32: languageName = QT_TR_NOOP("Polish"); break; case 33: languageName = QT_TR_NOOP("Portuguese"); break; case 34: languageName = QT_TR_NOOP("Romanian"); break; case 35: languageName = QT_TR_NOOP("Romansh"); break; case 36: languageName = QT_TR_NOOP("Serbian"); break; case 37: languageName = QT_TR_NOOP("Slovak"); break; case 38: languageName = QT_TR_NOOP("Slovene"); break; case 39: languageName = QT_TR_NOOP("Finnish"); break; case 40: languageName = QT_TR_NOOP("Swedish"); break; case 41: languageName = QT_TR_NOOP("Turkish"); break; case 42: languageName = QT_TR_NOOP("Flemish"); break; case 43: languageName = QT_TR_NOOP("Walloon"); break; case 64: languageName = QT_TR_NOOP("Background sound/clean feed"); break; case 69: languageName = QT_TR_NOOP("Zulu"); break; case 70: languageName = QT_TR_NOOP("Vietnamese"); break; case 71: languageName = QT_TR_NOOP("Uzbek"); break; case 72: languageName = QT_TR_NOOP("Urdu"); break; case 73: languageName = QT_TR_NOOP("Ukranian"); break; case 74: languageName = QT_TR_NOOP("Thai"); break; case 75: languageName = QT_TR_NOOP("Telugu"); break; case 76: languageName = QT_TR_NOOP("Tatar"); break; case 77: languageName = QT_TR_NOOP("Tamil"); break; case 78: languageName = QT_TR_NOOP("Tadzhik"); break; case 79: languageName = QT_TR_NOOP("Swahili"); break; case 80: languageName = QT_TR_NOOP("Sranan Tongo"); break; case 81: languageName = QT_TR_NOOP("Somali"); break; case 82: languageName = QT_TR_NOOP("Sinhalese"); break; case 83: languageName = QT_TR_NOOP("Shona"); break; case 84: languageName = QT_TR_NOOP("Serbo-Croat"); break; case 85: languageName = QT_TR_NOOP("Rusyn"); break; case 86: languageName = QT_TR_NOOP("Russian"); break; case 87: languageName = QT_TR_NOOP("Quechua"); break; case 88: languageName = QT_TR_NOOP("Pushtu"); break; case 89: languageName = QT_TR_NOOP("Punjabi"); break; case 90: languageName = QT_TR_NOOP("Persian"); break; case 91: languageName = QT_TR_NOOP("Papiamento"); break; case 92: languageName = QT_TR_NOOP("Oriya"); break; case 93: languageName = QT_TR_NOOP("Nepali"); break; case 94: languageName = QT_TR_NOOP("Ndebele"); break; case 95: languageName = QT_TR_NOOP("Marathi"); break; case 96: languageName = QT_TR_NOOP("Moldavian"); break; case 97: languageName = QT_TR_NOOP("Malaysian"); break; case 98: languageName = QT_TR_NOOP("Malagasay"); break; case 99: languageName = QT_TR_NOOP("Macedonian"); break; case 100: languageName = QT_TR_NOOP("Laotian"); break; case 101: languageName = QT_TR_NOOP("Korean"); break; case 102: languageName = QT_TR_NOOP("Khmer"); break; case 103: languageName = QT_TR_NOOP("Kazakh"); break; case 104: languageName = QT_TR_NOOP("Kannada"); break; case 105: languageName = QT_TR_NOOP("Japanese"); break; case 106: languageName = QT_TR_NOOP("Indonesian"); break; case 107: languageName = QT_TR_NOOP("Hindi"); break; case 108: languageName = QT_TR_NOOP("Hebrew"); break; case 109: languageName = QT_TR_NOOP("Hausa"); break; case 110: languageName = QT_TR_NOOP("Gurani"); break; case 111: languageName = QT_TR_NOOP("Gujurati"); break; case 112: languageName = QT_TR_NOOP("Greek"); break; case 113: languageName = QT_TR_NOOP("Georgian"); break; case 114: languageName = QT_TR_NOOP("Fulani"); break; case 115: languageName = QT_TR_NOOP("Dari"); break; case 116: languageName = QT_TR_NOOP("Chuvash"); break; case 117: languageName = QT_TR_NOOP("Chinese"); break; case 118: languageName = QT_TR_NOOP("Burmese"); break; case 119: languageName = QT_TR_NOOP("Bulgarian"); break; case 120: languageName = QT_TR_NOOP("Bengali"); break; case 121: languageName = QT_TR_NOOP("Belorussian"); break; case 122: languageName = QT_TR_NOOP("Bambora"); break; case 123: languageName = QT_TR_NOOP("Azerbaijani"); break; case 124: languageName = QT_TR_NOOP("Assamese"); break; case 125: languageName = QT_TR_NOOP("Armenian"); break; case 126: languageName = QT_TR_NOOP("Arabic"); break; case 127: languageName = QT_TR_NOOP("Amharic"); break; default: languageName = QT_TR_NOOP("UNKNOWN"); std::clog << "DABConstants: Unknown language type: " << language << std::endl; break; } return languageName; } DABParams::DABParams(int mode) { setMode(mode); } void DABParams::setMode(int mode) { switch (mode) { case 1: dabMode = 1; L = 76; K = 1536; T_F = 196608; T_null = 2656; T_s = 2552; T_u = 2048; guardLength = 504; carrierDiff = 1000; break; case 2: dabMode = 2; L = 76; K = 384; T_null = 664; T_F = 49152; T_s = 638; T_u = 512; guardLength = 126; carrierDiff = 4000; break; case 3: dabMode = 3; L = 153; K = 192; T_F = 49152; T_null = 345; T_s = 319; T_u = 256; guardLength = 63; carrierDiff = 2000; break; case 4: dabMode = 4; L = 76; K = 768; T_F = 98304; T_null = 1328; T_s = 1276; T_u = 1024; guardLength = 252; carrierDiff = 2000; break; default: throw out_of_range("Unknown mode " + to_string(mode)); } } int Subchannel::bitrate() const { const auto& ps = protectionSettings; if (ps.shortForm) { return ProtLevel[ps.uepTableIndex][2]; } else { // EEP switch (ps.eepProfile) { case EEPProtectionProfile::EEP_A: switch (ps.eepLevel) { case EEPProtectionLevel::EEP_1: return length / 12 * 8; case EEPProtectionLevel::EEP_2: return length / 8 * 8; case EEPProtectionLevel::EEP_3: return length / 6 * 8; case EEPProtectionLevel::EEP_4: return length / 4 * 8; } break; case EEPProtectionProfile::EEP_B: switch (ps.eepLevel) { case EEPProtectionLevel::EEP_1: return length / 27 * 32; case EEPProtectionLevel::EEP_2: return length / 21 * 32; case EEPProtectionLevel::EEP_3: return length / 18 * 32; case EEPProtectionLevel::EEP_4: return length / 15 * 32; } break; } } throw std::runtime_error("Unsupported protection"); } int Subchannel::numCU() const { const auto& ps = protectionSettings; if (ps.shortForm) { return ProtLevel[ps.uepTableIndex][0]; } else { switch (ps.eepProfile) { case EEPProtectionProfile::EEP_A: switch (ps.eepLevel) { case EEPProtectionLevel::EEP_1: return (bitrate() * 12) >> 3; case EEPProtectionLevel::EEP_2: return bitrate(); case EEPProtectionLevel::EEP_3: return (bitrate() * 6) >> 3; case EEPProtectionLevel::EEP_4: return (bitrate() >> 1); } break; case EEPProtectionProfile::EEP_B: switch (ps.eepLevel) { case EEPProtectionLevel::EEP_1: return (bitrate() * 27) >> 5; case EEPProtectionLevel::EEP_2: return (bitrate() * 21) >> 5; case EEPProtectionLevel::EEP_3: return (bitrate() * 18) >> 5; case EEPProtectionLevel::EEP_4: return (bitrate() * 15) >> 5; } break; } } return -1; } string Subchannel::protection() const { string prot; const auto& ps = protectionSettings; if (ps.shortForm) { prot = "UEP " + to_string((int)ps.uepLevel); } else { // EEP prot = "EEP "; switch (ps.eepProfile) { case EEPProtectionProfile::EEP_A: prot += to_string((int)ps.eepLevel) + "-A"; break; case EEPProtectionProfile::EEP_B: prot += to_string((int)ps.eepLevel) + "-B"; break; } } return prot; } TransportMode ServiceComponent::transportMode() const { if (TMid == 0) { return TransportMode::Audio; } else if (TMid == 1) { return TransportMode::StreamData; } else if (TMid == 2) { return TransportMode::FIDC; } else if (TMid == 3) { return TransportMode::PacketData; } throw std::logic_error("Illegal TMid!"); } AudioServiceComponentType ServiceComponent::audioType() const { if (ASCTy == 0) { return AudioServiceComponentType::DAB; } else if (ASCTy == 63) { return AudioServiceComponentType::DABPlus; } else { return AudioServiceComponentType::Unknown; } } welle.io-2.1/src/backend/dab-constants.h000066400000000000000000000136651357201522000201710ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Common definitions and includes for the DAB decoder #ifndef __DAB_CONSTANTS #define __DAB_CONSTANTS #include "charsets.h" #include #include #include #include #include #include #include #include #include using DSPFLOAT = float; using DSPCOMPLEX = std::complex; using softbit_t = int8_t; enum class AudioServiceComponentType { DAB, DABPlus, Unknown }; enum class TransportMode { Audio, StreamData, FIDC, PacketData }; #define INPUT_RATE 2048000 #define BANDWIDTH 1536000 #define SYNCED 01 #define LONG_HIGH 02 #define LONG_LOW 03 #define UNSYNCED 04 namespace DABConstants { const char* getProgramTypeName(int type); const char* getLanguageName(int language); } extern const int ProtLevel[64][3]; class DABParams { public: DABParams(int mode); void setMode(int mode); // To access directly the members is ugly but it was the easiest for the existing code uint8_t dabMode; int16_t L; // symbols per transmission frame int16_t K; // Number of FFT carriers with power int16_t T_null; // null symbol length int32_t T_F; // samples per transmission frame int16_t T_s; // symbol length including cyclic prefix int16_t T_u; // Size of the FFT == symbol length without cyclic prefix int16_t guardLength; int16_t carrierDiff; }; struct DabLabel { // Label from FIG 1 /* FIG 1 labels are usually in EBU Latin encoded */ CharacterSet charset = CharacterSet::EbuLatin; std::string fig1_label; // encoded according to charset uint16_t fig1_flag = 0x0000; // describes the short label /* If necessary, convert the label to UTF8 */ std::string fig1_label_utf8() const; std::string fig1_shortlabel_utf8() const; void setCharset(uint8_t charset_id); // Extended Label from FIG 2 /* FIG 2 labels are either in UTF-8 or UCS2. We store them as segments and build * a UTF-8 string when needed. */ std::map > segments; size_t segment_count = 0; // number if actual segments (not segment count as in spec) CharacterSet extended_label_charset = CharacterSet::Undefined; uint8_t toggle_flag = 0; bool fig2_rfu = false; // draftETSI TS 103 176 v2.2.1 gives this a new meaning // Assemble all segments into a UTF-8 string. Returns an // empty string if not all segments received. std::string fig2_label() const; // Common to FIG 1 and FIG 2 /* If FIG 2 label available, use that one, otherwise take the FIG 1 label */ std::string utf8_label() const; }; struct Service { Service(uint32_t sid) : serviceId(sid) {} uint32_t serviceId = 0; DabLabel serviceLabel; int16_t language = 0; int16_t programType = 0; // PTy, FIG0/17 }; // The service component describes the actual service // It really should be a union struct ServiceComponent { int8_t TMid = 0; // the transport mode uint32_t SId = 0; // belongs to the service int16_t componentNr = 0; // component DabLabel componentLabel; int16_t ASCTy = 0; // used for audio int16_t PS_flag = 0; // use for both audio and packet int16_t subchannelId = 0; // used in both audio and packet uint16_t SCId = 0; // used in packet uint8_t CAflag = 0; // used in packet (or not at all) int16_t DSCTy = 0; // used in packet uint8_t DGflag = 0; // used for TDC int16_t packetAddress = 0; // used in packet TransportMode transportMode(void) const; AudioServiceComponentType audioType(void) const; }; enum class EEPProtectionProfile { EEP_A, EEP_B, }; enum class EEPProtectionLevel { EEP_1 = 1, EEP_2 = 2, EEP_3 = 3, EEP_4 = 4, }; struct ProtectionSettings { bool shortForm = false; // when short-form, UEP: int16_t uepTableIndex = 0; int16_t uepLevel = 0; // when long-form, EEP: EEPProtectionProfile eepProfile = EEPProtectionProfile::EEP_A; EEPProtectionLevel eepLevel = EEPProtectionLevel::EEP_3; }; struct Subchannel { int32_t subChId = -1; int32_t startAddr = 0; int32_t length = 0; bool programmeNotData = true; ProtectionSettings protectionSettings; int16_t language = 0; // For subchannels carrying packet-mode service components int16_t fecScheme = 0; // 0=no FEC, 1=FEC, 2=Rfu, 3=Rfu // Calculate the effective subchannel bitrate int bitrate(void) const; // Calculate number of CUs this subchannel consumes int numCU(void) const; std::string protection(void) const; inline bool valid() const { return subChId != -1; } }; #endif welle.io-2.1/src/backend/dab-processor.h000066400000000000000000000022571357201522000201670ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef DAB_PROCESSOR #define DAB_PROCESSOR #include #include // virtual class, just for providing a common base // for the real decoder classes class DabProcessor { public: virtual ~DabProcessor() = default; virtual void addtoFrame(uint8_t *) = 0; }; #endif welle.io-2.1/src/backend/dab-virtual.h000066400000000000000000000021721357201522000176320ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _DAB_VIRTUAL #define _DAB_VIRTUAL #include #include "dab-constants.h" #define CUSize (4 * 16) class DabVirtual { public: virtual ~DabVirtual() {} virtual int32_t process(const softbit_t *v, int16_t cnt) = 0; }; #endif welle.io-2.1/src/backend/dab_decoder.cpp000066400000000000000000000233671357201522000201770ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "dab_decoder.h" // --- MP2Decoder ----------------------------------------------------------------- // from ETSI TS 103 466, table 4 (= ISO/IEC 11172-3, table B.2a): const int MP2Decoder::table_nbal_48a[] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2 }; // from ETSI TS 103 466, table 5 (= ISO/IEC 11172-3, table B.2c): const int MP2Decoder::table_nbal_48b[] = { 4, 4, 3, 3, 3, 3, 3, 3 }; // from ETSI TS 103 466, table 6 (= ISO/IEC 13818-3, table B.1): const int MP2Decoder::table_nbal_24[] = { 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; const int* MP2Decoder::tables_nbal[] = { table_nbal_48a, table_nbal_48b, table_nbal_24 }; const int MP2Decoder::sblimits[] = { sizeof(table_nbal_48a) / sizeof(int), sizeof(table_nbal_48b) / sizeof(int), sizeof(table_nbal_24) / sizeof(int), }; MP2Decoder::MP2Decoder(SubchannelSinkObserver* observer, bool float32) : SubchannelSink(observer, "mp2") { this->float32 = float32; scf_crc_len = -1; lsf = false; int mpg_result; // init mpg_result = mpg123_init(); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_init: " + std::string(mpg123_plain_strerror(mpg_result))); // ensure features if(!mpg123_feature(MPG123_FEATURE_OUTPUT_32BIT)) throw std::runtime_error("MP2Decoder: no 32bit output support!"); if(!mpg123_feature(MPG123_FEATURE_DECODE_LAYER2)) throw std::runtime_error("MP2Decoder: no Layer II decode support!"); handle = mpg123_new(nullptr, &mpg_result); if(!handle) throw std::runtime_error("MP2Decoder: error while mpg123_new: " + std::string(mpg123_plain_strerror(mpg_result))); fprintf(stderr, "MP2Decoder: using decoder '%s'.\n", mpg123_current_decoder(handle)); // set allowed formats mpg_result = mpg123_format_none(handle); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_format_none: " + std::string(mpg123_plain_strerror(mpg_result))); mpg_result = mpg123_format(handle, 48000, MPG123_MONO | MPG123_STEREO, float32 ? MPG123_ENC_FLOAT_32 : MPG123_ENC_SIGNED_16); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_format #1: " + std::string(mpg123_plain_strerror(mpg_result))); mpg_result = mpg123_format(handle, 24000, MPG123_MONO | MPG123_STEREO, float32 ? MPG123_ENC_FLOAT_32 : MPG123_ENC_SIGNED_16); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_format #2: " + std::string(mpg123_plain_strerror(mpg_result))); // disable resync limit mpg_result = mpg123_param(handle, MPG123_RESYNC_LIMIT, -1, 0); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_param: " + std::string(mpg123_plain_strerror(mpg_result))); mpg_result = mpg123_open_feed(handle); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_open_feed: " + std::string(mpg123_plain_strerror(mpg_result))); } MP2Decoder::~MP2Decoder() { if(handle) { int mpg_result = mpg123_close(handle); if(mpg_result != MPG123_OK) fprintf(stderr, "MP2Decoder: error while mpg123_close: %s\n", mpg123_plain_strerror(mpg_result)); } mpg123_delete(handle); mpg123_exit(); } void MP2Decoder::Feed(const uint8_t *data, size_t len) { int mpg_result = mpg123_feed(handle, data, len); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_feed: " + std::string(mpg123_plain_strerror(mpg_result))); do { // go to next frame mpg_result = mpg123_framebyframe_next(handle); switch(mpg_result) { case MPG123_NEED_MORE: break; // loop left below case MPG123_NEW_FORMAT: ProcessFormat(); // fall through - as MPG123_NEW_FORMAT implies MPG123_OK case MPG123_OK: { // forward decoded frame, if applicable uint8_t *frame_data; size_t frame_len = DecodeFrame(&frame_data); if(frame_len) observer->PutAudio(frame_data, frame_len); break; } default: throw std::runtime_error("MP2Decoder: error while mpg123_framebyframe_next: " + std::string(mpg123_plain_strerror(mpg_result))); } } while (mpg_result != MPG123_NEED_MORE); } size_t MP2Decoder::DecodeFrame(uint8_t **data) { int mpg_result; if(scf_crc_len == -1) throw std::runtime_error("MP2Decoder: ScF-CRC len not yet set at PAD extraction!"); // derive PAD data from frame unsigned long header; uint8_t *body_data; size_t body_bytes; mpg_result = mpg123_framedata(handle, &header, &body_data, &body_bytes); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_framedata: " + std::string(mpg123_plain_strerror(mpg_result))); // forwarding the whole frame (except ScF-CRC + F-PAD) as X-PAD, as we don't know the X-PAD len here observer->ProcessPAD(body_data, body_bytes - FPAD_LEN - scf_crc_len, false, body_data + body_bytes - FPAD_LEN); // check CRC (MP2's CRC only - not DAB's ScF-CRC) if(!CheckCRC(header, body_data, body_bytes)) { observer->AudioError("CRC"); // no PAD reset, as not covered by CRC return 0; } ProcessUntouchedStream(header, body_data, body_bytes); size_t frame_len; mpg_result = mpg123_framebyframe_decode(handle, nullptr, data, &frame_len); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_framebyframe_decode: " + std::string(mpg123_plain_strerror(mpg_result))); return frame_len; } void MP2Decoder::ProcessUntouchedStream(const unsigned long& header, const uint8_t *body_data, size_t body_bytes) { std::lock_guard lock(uscs_mutex); if(uscs.empty()) return; // adjust buffer size, if needed if(frame.size() != body_bytes + 4) frame.resize(body_bytes + 4); // reassemble MP2 frame frame[0] = (header >> 24) & 0xFF; frame[1] = (header >> 16) & 0xFF; frame[2] = (header >> 8) & 0xFF; frame[3] = header & 0xFF; memcpy(&frame[4], body_data, body_bytes); ForwardUntouchedStream(&frame[0], frame.size(), lsf ? 48 : 24); } bool MP2Decoder::CheckCRC(const unsigned long& header, const uint8_t *body_data, const size_t& body_bytes) { mpg123_frameinfo info; int mpg_result = mpg123_info(handle, &info); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_info: " + std::string(mpg123_plain_strerror(mpg_result))); // abort, if no CRC present (though required by DAB) if(!(info.flags & MPG123_CRC)) return false; // select matching nbal table int nch = info.mode == MPG123_M_MONO ? 1 : 2; int table_index = info.version == MPG123_1_0 ? ((info.bitrate / nch) >= 56 ? 0 : 1) : 2; const int* table_nbal = tables_nbal[table_index]; // count body bits covered by CRC (= allocation + ScFSI) BitReader br(body_data + CalcCRC::CRCLen, body_bytes - CalcCRC::CRCLen); size_t body_crc_len = 0; int sblimit = sblimits[table_index]; int bound = info.mode == MPG123_M_JOINT ? (info.mode_ext + 1) * 4 : sblimit; for(int sb = 0; sb < bound; sb++) { for(int ch = 0; ch < nch; ch++) { int nbal = table_nbal[sb]; body_crc_len += nbal; int index; if(!br.GetBits(index, nbal)) return false; if(index) body_crc_len += 2; } } for(int sb = bound; sb < sblimit; sb++) { int nbal = table_nbal[sb]; body_crc_len += nbal; int index; if(!br.GetBits(index, nbal)) return false; for(int ch = 0; ch < nch; ch++) { if(index) body_crc_len += 2; } } // calc CRC uint16_t crc_stored = (body_data[0] << 8) + body_data[1]; uint16_t crc_calced; CalcCRC::CalcCRC_CRC16_IBM.Initialize(crc_calced); CalcCRC::CalcCRC_CRC16_IBM.ProcessByte(crc_calced, (header & 0x0000FF00) >> 8); CalcCRC::CalcCRC_CRC16_IBM.ProcessByte(crc_calced, header & 0x000000FF); CalcCRC::CalcCRC_CRC16_IBM.ProcessBits(crc_calced, body_data + CalcCRC::CRCLen, body_crc_len); CalcCRC::CalcCRC_CRC16_IBM.Finalize(crc_calced); return crc_stored == crc_calced; } void MP2Decoder::ProcessFormat() { mpg123_frameinfo info; int mpg_result = mpg123_info(handle, &info); if(mpg_result != MPG123_OK) throw std::runtime_error("MP2Decoder: error while mpg123_info: " + std::string(mpg123_plain_strerror(mpg_result))); scf_crc_len = (info.version == MPG123_1_0 && info.bitrate < (info.mode == MPG123_M_MONO ? 56 : 112)) ? 2 : 4; // output format std::string version = "unknown"; switch(info.version) { case MPG123_1_0: version = "1.0"; break; case MPG123_2_0: version = "2.0"; break; case MPG123_2_5: version = "2.5"; break; } lsf = info.version != MPG123_1_0; std::string layer = "unknown"; switch(info.layer) { case 1: layer = "I"; break; case 2: layer = "II"; break; case 3: layer = "III"; break; } std::string mode = "unknown"; switch(info.mode) { case MPG123_M_STEREO: mode = "Stereo"; break; case MPG123_M_JOINT: mode = "Joint Stereo"; break; case MPG123_M_DUAL: mode = "Dual Channel"; break; case MPG123_M_MONO: mode = "Mono"; break; } AUDIO_SERVICE_FORMAT format; format.codec = "MPEG " + version + " Layer " + layer; format.samplerate_khz = info.rate / 1000; format.mode = mode; format.bitrate_kbps = info.bitrate; observer->FormatChange(format); observer->StartAudio(info.rate, info.mode != MPG123_M_MONO ? 2 : 1, float32); } welle.io-2.1/src/backend/dab_decoder.h000066400000000000000000000036671357201522000176450ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef DAB_DECODER_H_ #define DAB_DECODER_H_ #include #include #include #include #include #include #define MPG123_NO_LARGENAME // disable large file API here #include "mpg123.h" #if MPG123_API_VERSION < 36 # error "At least version 1.14.0 (API version 36) of mpg123 is required!" #endif #include "subchannel_sink.h" #include "tools.h" // --- MP2Decoder ----------------------------------------------------------------- class MP2Decoder : public SubchannelSink { private: bool float32; mpg123_handle *handle; int scf_crc_len; bool lsf; std::vector frame; void ProcessFormat(); void ProcessUntouchedStream(const unsigned long& header, const uint8_t *body_data, size_t body_bytes); size_t DecodeFrame(uint8_t **data); bool CheckCRC(const unsigned long& header, const uint8_t *body_data, const size_t& body_bytes); static const int table_nbal_48a[]; static const int table_nbal_48b[]; static const int table_nbal_24[]; static const int* tables_nbal[]; static const int sblimits[]; public: MP2Decoder(SubchannelSinkObserver* observer, bool float32); ~MP2Decoder(); void Feed(const uint8_t *data, size_t len); }; #endif /* DAB_DECODER_H_ */ welle.io-2.1/src/backend/dabplus_decoder.cpp000066400000000000000000000403321357201522000210720ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "dabplus_decoder.h" // --- SuperframeFilter ----------------------------------------------------------------- SuperframeFilter::SuperframeFilter(SubchannelSinkObserver* observer, bool decode_audio, bool enable_float32) : SubchannelSink(observer, "aac") { this->decode_audio = decode_audio; this->enable_float32 = enable_float32; aac_dec = nullptr; frame_len = 0; frame_count = 0; sync_frames = 0; sf_raw = nullptr; sf = nullptr; sf_len = 0; sf_format_set = false; sf_format_raw = 0; num_aus = 0; } SuperframeFilter::~SuperframeFilter() { delete[] sf_raw; delete[] sf; delete aac_dec; } void SuperframeFilter::Feed(const uint8_t *data, size_t len) { // check frame len if(frame_len) { if(frame_len != len) { fprintf(stderr, "SuperframeFilter: different frame len %zu (should be: %zu) - frame ignored!\n", len, frame_len); return; } } else { if(len < 10) { fprintf(stderr, "SuperframeFilter: frame len %zu too short - frame ignored!\n", len); return; } if((5 * len) % 120) { fprintf(stderr, "SuperframeFilter: resulting Superframe len of len %zu not divisible by 120 - frame ignored!\n", len); return; } frame_len = len; sf_len = 5 * frame_len; sf_raw = new uint8_t[sf_len]; sf = new uint8_t[sf_len]; } if(frame_count == 5) { // shift previous frames for(int i = 0; i < 4; i++) memcpy(sf_raw + i * frame_len, sf_raw + (i + 1) * frame_len, frame_len); } else { frame_count++; } // copy frame memcpy(sf_raw + (frame_count - 1) * frame_len, data, frame_len); if(frame_count < 5) return; int total_corr_count; bool uncorr_errors; // append RS coding on copy memcpy(sf, sf_raw, sf_len); rs_dec.DecodeSuperframe(sf, sf_len, total_corr_count, uncorr_errors); // forward statistics if errors present if(total_corr_count || uncorr_errors) observer->FECInfo(total_corr_count, uncorr_errors); if(!CheckSync()) { if(sync_frames == 0) fprintf(stderr, "SuperframeFilter: Superframe sync started...\n"); sync_frames++; return; } if(sync_frames) { fprintf(stderr, "SuperframeFilter: Superframe sync succeeded after %d frame(s)\n", sync_frames); sync_frames = 0; } // check announced format if(!sf_format_set || sf_format_raw != sf[2]) { sf_format_raw = sf[2]; sf_format_set = true; ProcessFormat(); } // decode frames for(int i = 0; i < num_aus; i++) { uint8_t *au_data = sf + au_start[i]; size_t au_len = au_start[i+1] - au_start[i]; uint16_t au_crc_stored = au_data[au_len-2] << 8 | au_data[au_len-1]; uint16_t au_crc_calced = CalcCRC::CalcCRC_CRC16_CCITT.Calc(au_data, au_len - 2); if(au_crc_stored != au_crc_calced) { observer->AudioError("AU #" + std::to_string(i)); continue; } au_len -= 2; if(aac_dec) aac_dec->DecodeFrame(au_data, au_len); CheckForPAD(au_data, au_len); ProcessUntouchedStream(au_data, au_len); } // ensure getting a complete new Superframe frame_count = 0; } void SuperframeFilter::CheckForPAD(const uint8_t *data, size_t len) { bool present = false; // check for PAD (embedded into Data Stream Element) if(len >= 3 && (data[0] >> 5) == 4) { size_t pad_start = 2; size_t pad_len = data[1]; if(pad_len == 255) { pad_len += data[2]; pad_start++; } if(pad_len >= 2 && len >= pad_start + pad_len) { observer->ProcessPAD(data + pad_start, pad_len - FPAD_LEN, true, data + pad_start + pad_len - FPAD_LEN); present = true; } } // assume zero bytes F-PAD, if no DSE present if(!present) { uint8_t zero_fpad[FPAD_LEN] = {0x00}; observer->ProcessPAD(nullptr, 0, true, zero_fpad); } } bool SuperframeFilter::CheckSync() { // abort, if au_start is kind of zero (prevent sync on complete zero array) if(sf[3] == 0x00 && sf[4] == 0x00) return false; // TODO: use fire code for error correction // try to sync on fire code uint16_t crc_stored = sf[0] << 8 | sf[1]; uint16_t crc_calced = CalcCRC::CalcCRC_FIRE_CODE.Calc(sf + 2, 9); if(crc_stored != crc_calced) return false; // handle format sf_format.dac_rate = sf[2] & 0x40; sf_format.sbr_flag = sf[2] & 0x20; sf_format.aac_channel_mode = sf[2] & 0x10; sf_format.ps_flag = sf[2] & 0x08; sf_format.mpeg_surround_config = sf[2] & 0x07; // determine number/start of AUs num_aus = sf_format.dac_rate ? (sf_format.sbr_flag ? 3 : 6) : (sf_format.sbr_flag ? 2 : 4); au_start[0] = sf_format.dac_rate ? (sf_format.sbr_flag ? 6 : 11) : (sf_format.sbr_flag ? 5 : 8); au_start[num_aus] = sf_len / 120 * 110; // pseudo-next AU (w/o RS coding) au_start[1] = sf[3] << 4 | sf[4] >> 4; if(num_aus >= 3) au_start[2] = (sf[4] & 0x0F) << 8 | sf[5]; if(num_aus >= 4) au_start[3] = sf[6] << 4 | sf[7] >> 4; if(num_aus == 6) { au_start[4] = (sf[7] & 0x0F) << 8 | sf[8]; au_start[5] = sf[9] << 4 | sf[10] >> 4; } // simple plausi check for correct order of start offsets for(int i = 0; i < num_aus; i++) if(au_start[i] >= au_start[i+1]) return false; return true; } void SuperframeFilter::ProcessFormat() { // output format std::string core_mode = (sf_format.aac_channel_mode || sf_format.ps_flag) ? "Stereo" : "Mono"; std::string surround_mode; switch(sf_format.mpeg_surround_config) { case 0: // no surround break; case 1: surround_mode = "Surround 5.1"; break; case 2: surround_mode = "Surround 7.1"; break; default: surround_mode = "Surround (unknown)"; break; } AUDIO_SERVICE_FORMAT format; format.codec = sf_format.sbr_flag ? (sf_format.ps_flag ? "HE-AAC v2" : "HE-AAC") : "AAC-LC"; format.samplerate_khz = sf_format.dac_rate ? 48 : 32; format.mode = !surround_mode.empty() ? (surround_mode + " (" + core_mode + " core)") : core_mode; format.bitrate_kbps = sf_len / 120 * 8; observer->FormatChange(format); if(decode_audio) { delete aac_dec; #ifdef DABLIN_AAC_FAAD2 aac_dec = new AACDecoderFAAD2(observer, sf_format, enable_float32); #endif #ifdef DABLIN_AAC_FDKAAC aac_dec = new AACDecoderFDKAAC(observer, sf_format); #endif } } void SuperframeFilter::ProcessUntouchedStream(const uint8_t *data, size_t len) { std::lock_guard lock(uscs_mutex); if(uscs.empty()) return; au_bw.Reset(); // AudioSyncStream() au_bw.AddBits(0x2B7, 11); // syncword au_bw.AddBits(0, 13); // audioMuxLengthBytes - written later // AudioMuxElement(1) au_bw.AddBits(0, 1); // useSameStreamMux // StreamMuxConfig() au_bw.AddBits(0, 1); // audioMuxVersion au_bw.AddBits(1, 1); // allStreamsSameTimeFraming au_bw.AddBits(0, 6); // numSubFrames au_bw.AddBits(0, 4); // numProgram au_bw.AddBits(0, 3); // numLayer // AudioSpecificConfig() - PS signalling only implicit if(sf_format.IsSBR()) { au_bw.AddBits(0b00101, 5); // SBR au_bw.AddBits(sf_format.GetCoreSrIndex(), 4); // samplingFrequencyIndex au_bw.AddBits(sf_format.GetCoreChConfig(), 4); // channelConfiguration au_bw.AddBits(sf_format.GetExtensionSrIndex(), 4); // extensionSamplingFrequencyIndex au_bw.AddBits(0b00010, 5); // AAC LC au_bw.AddBits(0b100, 3); // GASpecificConfig() with 960 transform } else { au_bw.AddBits(0b00010, 5); // AAC LC au_bw.AddBits(sf_format.GetCoreSrIndex(), 4); // samplingFrequencyIndex au_bw.AddBits(sf_format.GetCoreChConfig(), 4); // channelConfiguration au_bw.AddBits(0b100, 3); // GASpecificConfig() with 960 transform } au_bw.AddBits(0b000, 3); // frameLengthType au_bw.AddBits(0xFF, 8); // latmBufferFullness au_bw.AddBits(0, 1); // otherDataPresent au_bw.AddBits(0, 1); // crcCheckPresent // PayloadLengthInfo() for(size_t i = 0; i < len / 255; i++) au_bw.AddBits(0xFF, 8); au_bw.AddBits(len % 255, 8); // PayloadMux() au_bw.AddBytes(data, len); // catch up on LATM frame len au_bw.WriteAudioMuxLengthBytes(); const std::vector latm_data = au_bw.GetData(); ForwardUntouchedStream(&latm_data[0], latm_data.size(), sf_format.GetAULengthMs()); } // --- RSDecoder ----------------------------------------------------------------- RSDecoder::RSDecoder() { rs_handle = init_rs_char(8, 0x11D, 0, 1, 10, 135); if(!rs_handle) throw std::runtime_error("RSDecoder: error while init_rs_char"); } RSDecoder::~RSDecoder() { free_rs_char(rs_handle); } void RSDecoder::DecodeSuperframe(uint8_t *sf, size_t sf_len, int& total_corr_count, bool& uncorr_errors) { // // insert errors for test // sf[0] ^= 0xFF; // sf[10] ^= 0xFF; // sf[20] ^= 0xFF; int subch_index = sf_len / 120; total_corr_count = 0; uncorr_errors = false; // process all RS packets for(int i = 0; i < subch_index; i++) { for(int pos = 0; pos < 120; pos++) rs_packet[pos] = sf[pos * subch_index + i]; // detect errors int corr_count = decode_rs_char(rs_handle, rs_packet, corr_pos, 0); if(corr_count == -1) uncorr_errors = true; else total_corr_count += corr_count; // correct errors for(int j = 0; j < corr_count; j++) { int pos = corr_pos[j] - 135; if(pos < 0) continue; // fprintf(stderr, "j: %d, pos: %d, sf-index: %d\n", j, pos, pos * subch_index + i); sf[pos * subch_index + i] = rs_packet[pos]; } } } // --- AACDecoder ----------------------------------------------------------------- AACDecoder::AACDecoder(std::string decoder_name, SubchannelSinkObserver* observer, SuperframeFormat sf_format) { fprintf(stderr, "AACDecoder: using decoder '%s'\n", decoder_name.c_str()); this->observer = observer; /* AudioSpecificConfig structure (the only way to select 960 transform here!) * * 00010 = AudioObjectType 2 (AAC LC) * xxxx = (core) sample rate index * xxxx = (core) channel config * 100 = GASpecificConfig with 960 transform * * SBR: explicit signaling (backwards-compatible), adding: * 01010110111 = sync extension for SBR * 00101 = AudioObjectType 5 (SBR) * 1 = SBR present flag * xxxx = extension sample rate index * * PS: explicit signaling (backwards-compatible), adding: * 10101001000 = sync extension for PS * 1 = PS present flag * * Note: * libfaad2 does not support non backwards-compatible PS signaling (AOT 29); * it detects PS only by implicit signaling. */ // AAC LC asc_len = 0; asc[asc_len++] = 0b00010 << 3 | sf_format.GetCoreSrIndex() >> 1; asc[asc_len++] = (sf_format.GetCoreSrIndex() & 0x01) << 7 | sf_format.GetCoreChConfig() << 3 | 0b100; if(sf_format.sbr_flag) { // add SBR asc[asc_len++] = 0x56; asc[asc_len++] = 0xE5; asc[asc_len++] = 0x80 | (sf_format.GetExtensionSrIndex() << 3); if(sf_format.ps_flag) { // add PS asc[asc_len - 1] |= 0x05; asc[asc_len++] = 0x48; asc[asc_len++] = 0x80; } } } #ifdef DABLIN_AAC_FAAD2 // --- AACDecoderFAAD2 ----------------------------------------------------------------- AACDecoderFAAD2::AACDecoderFAAD2(SubchannelSinkObserver* observer, SuperframeFormat sf_format, bool float32) : AACDecoder("FAAD2", observer, sf_format) { this->float32 = float32; // ensure features unsigned long cap = NeAACDecGetCapabilities(); if(!(cap & LC_DEC_CAP)) throw std::runtime_error("AACDecoderFAAD2: no LC decoding support!"); handle = NeAACDecOpen(); if(!handle) throw std::runtime_error("AACDecoderFAAD2: error while NeAACDecOpen"); // set general config NeAACDecConfigurationPtr config = NeAACDecGetCurrentConfiguration(handle); if(!config) throw std::runtime_error("AACDecoderFAAD2: error while NeAACDecGetCurrentConfiguration"); config->outputFormat = float32 ? FAAD_FMT_FLOAT : FAAD_FMT_16BIT; config->dontUpSampleImplicitSBR = 0; if(NeAACDecSetConfiguration(handle, config) != 1) throw std::runtime_error("AACDecoderFAAD2: error while NeAACDecSetConfiguration"); // init decoder unsigned long output_sr; unsigned char output_ch; long int init_result = NeAACDecInit2(handle, asc, asc_len, &output_sr, &output_ch); if(init_result != 0) throw std::runtime_error("AACDecoderFAAD2: error while NeAACDecInit2: " + std::string(NeAACDecGetErrorMessage(-init_result))); observer->StartAudio(output_sr, output_ch, float32); } AACDecoderFAAD2::~AACDecoderFAAD2() { NeAACDecClose(handle); } void AACDecoderFAAD2::DecodeFrame(uint8_t *data, size_t len) { // decode audio uint8_t* output_frame = (uint8_t*) NeAACDecDecode(handle, &dec_frameinfo, data, len); if(dec_frameinfo.error) observer->AudioWarning("AAC"); // abort, if no output at all if(dec_frameinfo.bytesconsumed == 0 && dec_frameinfo.samples == 0) return; if(dec_frameinfo.bytesconsumed != len) throw std::runtime_error("AACDecoderFAAD2: NeAACDecDecode did not consume all bytes"); observer->PutAudio(output_frame, dec_frameinfo.samples * (float32 ? 4 : 2)); } #endif #ifdef DABLIN_AAC_FDKAAC // --- AACDecoderFDKAAC ----------------------------------------------------------------- AACDecoderFDKAAC::AACDecoderFDKAAC(SubchannelSinkObserver* observer, SuperframeFormat sf_format) : AACDecoder("FDK-AAC", observer, sf_format) { handle = aacDecoder_Open(TT_MP4_RAW, 1); if(!handle) throw std::runtime_error("AACDecoderFDKAAC: error while aacDecoder_Open"); int channels = sf_format.aac_channel_mode || sf_format.ps_flag ? 2 : 1; AAC_DECODER_ERROR init_result; /* Restrict output channel count to actual input channel count. * * Just using the parameter value -1 (no up-/downmix) does not work, as with * SBR and Mono the lib assumes possibly present PS and then outputs Stereo! * * Note: * Older lib versions use a combined parameter for the output channel count. * As the headers of these didn't define the version, branch accordingly. */ #if !defined(AACDECODER_LIB_VL0) && !defined(AACDECODER_LIB_VL1) && !defined(AACDECODER_LIB_VL2) init_result = aacDecoder_SetParam(handle, AAC_PCM_OUTPUT_CHANNELS, channels); if(init_result != AAC_DEC_OK) throw std::runtime_error("AACDecoderFDKAAC: error while setting parameter AAC_PCM_OUTPUT_CHANNELS: " + std::to_string(init_result)); #else init_result = aacDecoder_SetParam(handle, AAC_PCM_MIN_OUTPUT_CHANNELS, channels); if(init_result != AAC_DEC_OK) throw std::runtime_error("AACDecoderFDKAAC: error while setting parameter AAC_PCM_MIN_OUTPUT_CHANNELS: " + std::to_string(init_result)); init_result = aacDecoder_SetParam(handle, AAC_PCM_MAX_OUTPUT_CHANNELS, channels); if(init_result != AAC_DEC_OK) throw std::runtime_error("AACDecoderFDKAAC: error while setting parameter AAC_PCM_MAX_OUTPUT_CHANNELS: " + std::to_string(init_result)); #endif uint8_t* asc_array[1] {asc}; const unsigned int asc_sizeof_array[1] {(unsigned int) asc_len}; init_result = aacDecoder_ConfigRaw(handle, asc_array, asc_sizeof_array); if(init_result != AAC_DEC_OK) throw std::runtime_error("AACDecoderFDKAAC: error while aacDecoder_ConfigRaw: " + std::to_string(init_result)); output_frame_len = 960 * 2 * channels * (sf_format.sbr_flag ? 2 : 1); output_frame = new uint8_t[output_frame_len]; observer->StartAudio(sf_format.dac_rate ? 48000 : 32000, channels, false); } AACDecoderFDKAAC::~AACDecoderFDKAAC() { aacDecoder_Close(handle); delete[] output_frame; } void AACDecoderFDKAAC::DecodeFrame(uint8_t *data, size_t len) { uint8_t* input_buffer[1] {data}; const unsigned int input_buffer_size[1] {(unsigned int) len}; unsigned int bytes_valid = len; // fill internal input buffer AAC_DECODER_ERROR result = aacDecoder_Fill(handle, input_buffer, input_buffer_size, &bytes_valid); if(result != AAC_DEC_OK) throw std::runtime_error("AACDecoderFDKAAC: error while aacDecoder_Fill: " + std::to_string(result)); if(bytes_valid) throw std::runtime_error("AACDecoderFDKAAC: aacDecoder_Fill did not consume all bytes"); // decode audio result = aacDecoder_DecodeFrame(handle, (short int*) output_frame, output_frame_len / 2, 0); if(result != AAC_DEC_OK) observer->AudioWarning("AAC"); if(!IS_OUTPUT_VALID(result)) return; observer->PutAudio(output_frame, output_frame_len); } #endif welle.io-2.1/src/backend/dabplus_decoder.h000066400000000000000000000101221357201522000205310ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef DABPLUS_DECODER_H_ #define DABPLUS_DECODER_H_ #include #include #include #include #include #if !(defined(DABLIN_AAC_FAAD2) ^ defined(DABLIN_AAC_FDKAAC)) #error "You must select a AAC decoder by defining either DABLIN_AAC_FAAD2 or DABLIN_AAC_FDKAAC!" #endif #ifdef DABLIN_AAC_FAAD2 #include #endif #ifdef DABLIN_AAC_FDKAAC #include #endif extern "C" { #include } #include "subchannel_sink.h" #include "tools.h" struct SuperframeFormat { bool dac_rate; bool sbr_flag; bool aac_channel_mode; bool ps_flag; int mpeg_surround_config; int GetCoreSrIndex() { return dac_rate ? (sbr_flag ? 6 : 3) : (sbr_flag ? 8 : 5); // 24/48/16/32 kHz } int GetCoreChConfig() { return aac_channel_mode ? 2 : 1; } int GetExtensionSrIndex() { return dac_rate ? 3 : 5; // 48/32 kHz } bool IsSBR() { return sbr_flag; } size_t GetAULengthMs() { return dac_rate ? (sbr_flag ? 40 : 20) : (sbr_flag ? 60 : 30); // 24/48/16/32 kHz } }; // --- RSDecoder ----------------------------------------------------------------- class RSDecoder { private: void *rs_handle; uint8_t rs_packet[120]; int corr_pos[10]; public: RSDecoder(); ~RSDecoder(); void DecodeSuperframe(uint8_t *sf, size_t sf_len, int& total_corr_count, bool& uncorr_errors); }; // --- AACDecoder ----------------------------------------------------------------- class AACDecoder { protected: SubchannelSinkObserver* observer; uint8_t asc[7]; size_t asc_len; public: AACDecoder(std::string decoder_name, SubchannelSinkObserver* observer, SuperframeFormat sf_format); virtual ~AACDecoder() {} virtual void DecodeFrame(uint8_t *data, size_t len) = 0; }; #ifdef DABLIN_AAC_FAAD2 // --- AACDecoderFAAD2 ----------------------------------------------------------------- class AACDecoderFAAD2 : public AACDecoder { private: bool float32; NeAACDecHandle handle; NeAACDecFrameInfo dec_frameinfo; public: AACDecoderFAAD2(SubchannelSinkObserver* observer, SuperframeFormat sf_format, bool float32); ~AACDecoderFAAD2(); void DecodeFrame(uint8_t *data, size_t len); }; #endif #ifdef DABLIN_AAC_FDKAAC // --- AACDecoderFDKAAC ----------------------------------------------------------------- class AACDecoderFDKAAC : public AACDecoder { private: HANDLE_AACDECODER handle; uint8_t *output_frame; size_t output_frame_len; public: AACDecoderFDKAAC(SubchannelSinkObserver* observer, SuperframeFormat sf_format); ~AACDecoderFDKAAC(); void DecodeFrame(uint8_t *data, size_t len); }; #endif // --- SuperframeFilter ----------------------------------------------------------------- class SuperframeFilter : public SubchannelSink { private: bool decode_audio; bool enable_float32; RSDecoder rs_dec; AACDecoder *aac_dec; size_t frame_len; int frame_count; int sync_frames; uint8_t *sf_raw; uint8_t *sf; size_t sf_len; bool sf_format_set; uint8_t sf_format_raw; SuperframeFormat sf_format; int num_aus; int au_start[6+1]; // +1 for end of last AU BitWriter au_bw; bool CheckSync(); void ProcessFormat(); void ProcessUntouchedStream(const uint8_t *data, size_t len); void CheckForPAD(const uint8_t *data, size_t len); public: SuperframeFilter(SubchannelSinkObserver* observer, bool decode_audio, bool enable_float32); ~SuperframeFilter(); void Feed(const uint8_t *data, size_t len); }; #endif /* DABPLUS_DECODER_H_ */ welle.io-2.1/src/backend/decoder_adapter.cpp000066400000000000000000000117701357201522000210640ustar00rootroot00000000000000/* * Copyright (C) 2018 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "decoder_adapter.h" DecoderAdapter::DecoderAdapter(ProgrammeHandlerInterface &mr, int16_t bitRate, AudioServiceComponentType &dabModus, const std::string &dumpFileName): bitRate(bitRate), myInterface(mr), padDecoder(this, true) { if (dabModus == AudioServiceComponentType::DAB) decoder = std::make_unique(this, false); else if (dabModus == AudioServiceComponentType::DABPlus) decoder = std::make_unique(this, true, false); else throw std::runtime_error("DecoderAdapter: Unkonwn service component"); // Open a dump file (XPADxpert) if the user defined it if (!dumpFileName.empty()) { FILE *fd = fopen(dumpFileName.c_str(), "wb"); // w for write, b for binary if (fd != nullptr) { dumpFile.reset(fd); } } // MOT, start of X-PAD data group, see EN 301 234 padDecoder.SetMOTAppType(12); } void DecoderAdapter::addtoFrame(uint8_t *v) { size_t length = 24 * bitRate / 8; uint8_t data [24 * bitRate / 8]; // Convert 8 bits (stored in one uint8) into one uint8 for (int i = 0; i < 24 * bitRate / 8; i ++) { data [i] = 0; for (int j = 0; j < 8; j ++) { data [i] <<= 1; data [i] |= v [8 * i + j] & 01; } } decoder->Feed(data, length); if (dumpFile) { fwrite(data, length, 1, dumpFile.get()); } myInterface.onFrameErrors(frameErrorCounter); frameErrorCounter = 0; } void DecoderAdapter::FormatChange(const AUDIO_SERVICE_FORMAT& format) { audioFormat = format.GetSummary(); } void DecoderAdapter::StartAudio(int samplerate, int channels, bool float32) { if (float32 == true) throw std::runtime_error("DecoderAdapter: Float32 audio samples are not supported"); audioSamplerate = samplerate; audioChannels = channels; } void DecoderAdapter::PutAudio(const uint8_t *data, size_t len) { // Then len is given in bytes. For stereo it is the double times of mono. // But we need two channels even if we have mono. // Mono: len = len / 2 * 2 We have len to devide by 2 and for two channels we have multiply by two // Stereo: len = len / 2 We just need to devide by 2 because it is stereo size_t bufferSize = audioChannels == 2 ? len/2 : len; std::vector audio(bufferSize); // Convert two uint8 into a int16 sample for(size_t i=0; i #include #include #include #include #include "dab-processor.h" #include "pad_decoder.h" #include "radio-controller.h" #include "subchannel_sink.h" #include "dab_decoder.h" #include "dabplus_decoder.h" class DecoderAdapter: public DabProcessor, public SubchannelSinkObserver, public PADDecoderObserver { public: DecoderAdapter(ProgrammeHandlerInterface& mr, int16_t bitRate, AudioServiceComponentType &dabModus, const std::string& dumpFileName); virtual void addtoFrame(uint8_t *v); // SubchannelSinkObserver impl virtual void FormatChange(const AUDIO_SERVICE_FORMAT& /*format*/); virtual void StartAudio(int /*samplerate*/, int /*channels*/, bool /*float32*/); virtual void PutAudio(const uint8_t* /*data*/, size_t /*len*/); virtual void ProcessPAD(const uint8_t* /*xpad_data*/, size_t /*xpad_len*/, bool /*exact_xpad_len*/, const uint8_t* /*fpad_data*/); virtual void AudioError(const std::string& /*hint*/); virtual void AudioWarning(const std::string& /*hint*/); virtual void FECInfo(int /*total_corr_count*/, bool /*uncorr_errors*/); // PADDecoderObserver impl virtual void PADChangeDynamicLabel(const DL_STATE& dl); virtual void PADChangeSlide(const MOT_FILE& slide); virtual void PADLengthError(size_t announced_xpad_len, size_t xpad_len); private: int16_t bitRate; int frameErrorCounter = 0; ProgrammeHandlerInterface& myInterface; std::unique_ptr decoder; PADDecoder padDecoder; struct FILEDeleter{ void operator()(FILE* fd){ if (fd) fclose(fd); }}; std::unique_ptr dumpFile; int audioSamplerate = 0; int audioChannels = 0; std::string audioFormat; }; #endif // DECODER_ADAPTER_H welle.io-2.1/src/backend/eep-protection.cpp000066400000000000000000000110321357201522000207030ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * The eep handling */ #include "dab-constants.h" #include "eep-protection.h" #include "protTables.h" /** * \brief eep_deconvolve * equal error protection, bitRate and protLevel * define the puncturing table */ EEPProtection::EEPProtection(int16_t bitRate, bool profile_is_eep_a, int level) : Viterbi(24 * bitRate), outSize(24 * bitRate), viterbiBlock(outSize * 4 + 24) { if (profile_is_eep_a) { switch (level) { case 1: L1 = 6 * bitRate / 8 - 3; L2 = 3; PI1 = getPCodes(24 - 1); PI2 = getPCodes(23 - 1); break; case 2: if (bitRate == 8) { L1 = 5; L2 = 1; PI1 = getPCodes(13 - 1); PI2 = getPCodes(12 - 1); } else { L1 = 2 * bitRate / 8 - 3; L2 = 4 * bitRate / 8 + 3; PI1 = getPCodes(14 - 1); PI2 = getPCodes(13 - 1); } break; case 3: L1 = 6 * bitRate / 8 - 3; L2 = 3; PI1 = getPCodes(8 - 1); PI2 = getPCodes(7 - 1); break; case 4: L1 = 4 * bitRate / 8 - 3; L2 = 2 * bitRate / 8 + 3; PI1 = getPCodes(3 - 1); PI2 = getPCodes(2 - 1); break; default: throw std::logic_error("Invalid EEP_A level"); } } else { switch (level) { case 4: L1 = 24 * bitRate / 32 - 3; L2 = 3; PI1 = getPCodes(2 - 1); PI2 = getPCodes(1 - 1); break; case 3: L1 = 24 * bitRate / 32 - 3; L2 = 3; PI1 = getPCodes(4 - 1); PI2 = getPCodes(3 - 1); break; case 2: L1 = 24 * bitRate / 32 - 3; L2 = 3; PI1 = getPCodes(6 - 1); PI2 = getPCodes(5 - 1); break; case 1: L1 = 24 * bitRate / 32 - 3; L2 = 3; PI1 = getPCodes(10 - 1); PI2 = getPCodes(9 - 1); break; default: throw std::logic_error("Invalid EEP_A level"); } } } bool EEPProtection::deconvolve(const softbit_t *v, int32_t size, uint8_t *outBuffer) { int16_t i, j; int32_t inputCounter = 0; int32_t viterbiCounter = 0; (void)size; // currently unused memset(viterbiBlock.data(), 0, (outSize * 4 + 24) * sizeof(softbit_t)); // // according to the standard we process the logical frame // with a pair of tuples // (L1, PI1), (L2, PI2) // for (i = 0; i < L1; i ++) { for (j = 0; j < 128; j ++) { if (PI1 [j % 32] != 0) viterbiBlock[viterbiCounter] = v [inputCounter ++]; viterbiCounter++; } } for (i = 0; i < L2; i ++) { for (j = 0; j < 128; j ++) { if (PI2 [j % 32] != 0) viterbiBlock[viterbiCounter] = v [inputCounter ++]; viterbiCounter++; } } // we had a final block of 24 bits with puncturing according to PI_X // This block constitues the 6 * 4 bits of the register itself. for (i = 0; i < 24; i ++) { if (PI_X [i] != 0) viterbiBlock[viterbiCounter] = v [inputCounter ++]; viterbiCounter++; } Viterbi::deconvolve(viterbiBlock.data(), outBuffer); return true; } welle.io-2.1/src/backend/eep-protection.h000066400000000000000000000026641357201522000203630ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef EEP_PROTECTION #define EEP_PROTECTION #include #include #include #include "protection.h" #include "viterbi.h" class EEPProtection: public Protection, public Viterbi { public: EEPProtection(int16_t bitRate, bool profile_is_eep_a, int level); bool deconvolve(const softbit_t *v, int32_t size, uint8_t *outBuffer); private: int16_t L1; int16_t L2; const int8_t *PI1; const int8_t *PI2; int32_t outSize; std::vector viterbiBlock; }; #endif welle.io-2.1/src/backend/energy_dispersal.h000066400000000000000000000036331357201522000207620ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __ENERGY_DISPERSAL #define __ENERGY_DISPERSAL #include #include #include #include class EnergyDispersal { public: void dedisperse(std::vector& data) { if (dispersalVector.size() != data.size()) { std::vector shiftRegister(9, 1); dispersalVector.resize(data.size()); for (size_t i = 0; i < data.size(); i++) { uint8_t b = shiftRegister[8] ^ shiftRegister[4]; for (int j = 8; j > 0; j--) shiftRegister[j] = shiftRegister[j - 1]; shiftRegister[0] = b; dispersalVector[i] ^= b; } } for (size_t i = 0; i < data.size(); i++) { data[i] ^= dispersalVector[i]; } } private: std::vector dispersalVector; }; #endif // __ENERGY_DISPERSAL welle.io-2.1/src/backend/fib-processor.cpp000066400000000000000000001201321357201522000205250ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2014 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * fib and fig processor */ #include #include #include #include #include "fib-processor.h" #include "charsets.h" #include "MathHelper.h" FIBProcessor::FIBProcessor(RadioControllerInterface& mr) : myRadioInterface(mr) { clearEnsemble(); } // FIB's are segments of 256 bits. When here, we already // passed the crc and we start unpacking into FIGs // This is merely a dispatcher void FIBProcessor::processFIB(uint8_t *p, uint16_t fib) { int8_t processedBytes = 0; uint8_t *d = p; std::lock_guard lock(mutex); (void)fib; while (processedBytes < 30) { const uint8_t FIGtype = getBits_3 (d, 0); switch (FIGtype) { case 0: process_FIG0(d); break; case 1: process_FIG1(d); break; case 2: process_FIG2(d); break; case 7: return; default: //std::clog << "FIG%d present" << FIGtype << std::endl; break; } // Thanks to Ronny Kunze, who discovered that I used // a p rather than a d processedBytes += getBits_5 (d, 3) + 1; d = p + processedBytes * 8; } } // // Handle ensemble is all through FIG0 // void FIBProcessor::process_FIG0 (uint8_t *d) { uint8_t extension = getBits_5 (d, 8 + 3); //uint8_t CN = getBits_1 (d, 8 + 0); switch (extension) { case 0: FIG0Extension0 (d); break; case 1: FIG0Extension1 (d); break; case 2: FIG0Extension2 (d); break; case 3: FIG0Extension3 (d); break; case 5: FIG0Extension5 (d); break; case 8: FIG0Extension8 (d); break; case 9: FIG0Extension9 (d); break; case 10: FIG0Extension10 (d); break; case 14: FIG0Extension14 (d); break; case 13: FIG0Extension13 (d); break; case 17: FIG0Extension17 (d); break; case 18: FIG0Extension18 (d); break; case 19: FIG0Extension19 (d); break; case 21: FIG0Extension21 (d); break; case 22: FIG0Extension22 (d); break; default: // std::clog << "fib-processor:" << "FIG0/%d passed by\n", extension) << std::endl; break; } } // FOG0/0 indicated a change in channel organization // we are not equipped for that, so we just return // control to the init void FIBProcessor::FIG0Extension0 (uint8_t *d) { uint8_t changeflag; uint16_t highpart, lowpart; int16_t occurrenceChange; uint8_t CN = getBits_1 (d, 8 + 0); (void)CN; uint16_t eId = getBits(d, 16, 16); if (ensembleId != eId) { ensembleId = eId; myRadioInterface.onNewEnsemble(ensembleId); } changeflag = getBits_2 (d, 16 + 16); if (changeflag == 0) return; highpart = getBits_5 (d, 16 + 19) % 20; (void)highpart; lowpart = getBits_8 (d, 16 + 24) % 250; (void)lowpart; occurrenceChange = getBits_8 (d, 16 + 32); (void)occurrenceChange; // if (changeflag == 1) { // std::clog << "fib-processor:" << "Changes in sub channel organization\n") << std::endl; // std::clog << "fib-processor:" << "cifcount = %d\n", highpart * 250 + lowpart) << std::endl; // std::clog << "fib-processor:" << "Change happening in %d CIFs\n", occurrenceChange) << std::endl; // } // else if (changeflag == 3) { // std::clog << "fib-processor:" << "Changes in subchannel and service organization\n") << std::endl; // std::clog << "fib-processor:" << "cifcount = %d\n", highpart * 250 + lowpart) << std::endl; // std::clog << "fib-processor:" << "Change happening in %d CIFs\n", occurrenceChange) << std::endl; // } std::clog << "fib-processor: " << "changes in config not supported, choose again" << std::endl; } // FIG0 extension 1 creates a mapping between the // sub channel identifications and the positions in the // relevant CIF. void FIBProcessor::FIG0Extension1 (uint8_t *d) { int16_t used = 2; // offset in bytes int16_t Length = getBits_5 (d, 3); uint8_t PD_bit = getBits_1 (d, 8 + 2); //uint8_t CN = getBits_1 (d, 8 + 0); while (used < Length - 1) used = HandleFIG0Extension1 (d, used, PD_bit); } // defining the channels int16_t FIBProcessor::HandleFIG0Extension1( uint8_t *d, int16_t offset, uint8_t pd) { int16_t bitOffset = offset * 8; const int16_t subChId = getBits_6 (d, bitOffset); const int16_t startAdr = getBits(d, bitOffset + 6, 10); subChannels[subChId].programmeNotData = pd; subChannels[subChId].subChId = subChId; subChannels[subChId].startAddr = startAdr; if (getBits_1 (d, bitOffset + 16) == 0) { // UEP, short form int16_t tableIx = getBits_6 (d, bitOffset + 18); auto& ps = subChannels[subChId].protectionSettings; ps.uepTableIndex = tableIx; ps.shortForm = true; ps.uepLevel = ProtLevel[tableIx][1]; subChannels[subChId].length = ProtLevel[tableIx][0]; bitOffset += 24; } else { // EEP, long form auto& ps = subChannels[subChId].protectionSettings; ps.shortForm = false; int16_t option = getBits_3(d, bitOffset + 17); if (option == 0) { ps.eepProfile = EEPProtectionProfile::EEP_A; } else if (option == 1) { ps.eepProfile = EEPProtectionProfile::EEP_B; } if (option == 0 or // EEP-A protection option == 1) { // EEP-B protection int16_t protLevel = getBits_2(d, bitOffset + 20); switch (protLevel) { case 0: ps.eepLevel = EEPProtectionLevel::EEP_1; break; case 1: ps.eepLevel = EEPProtectionLevel::EEP_2; break; case 2: ps.eepLevel = EEPProtectionLevel::EEP_3; break; case 3: ps.eepLevel = EEPProtectionLevel::EEP_4; break; default: std::clog << "Warning, FIG0/1 for " << subChId << " has invalid EEP protection level " << protLevel << std::endl; break; } int16_t subChanSize = getBits(d, bitOffset + 22, 10); subChannels[subChId].length = subChanSize; } else { std::clog << "Warning, FIG0/1 for " << subChId << " has invalid protection option " << option << std::endl; } bitOffset += 32; } return bitOffset / 8; // we return bytes } void FIBProcessor::FIG0Extension2 (uint8_t *d) { int16_t used = 2; // offset in bytes int16_t Length = getBits_5 (d, 3); uint8_t PD_bit = getBits_1 (d, 8 + 2); uint8_t CN = getBits_1 (d, 8 + 0); while (used < Length) { used = HandleFIG0Extension2(d, used, CN, PD_bit); } } // Note Offset is in bytes // With FIG0/2 we bind the channels to Service Ids int16_t FIBProcessor::HandleFIG0Extension2( uint8_t *d, int16_t offset, uint8_t cn, uint8_t pd) { (void)cn; int16_t lOffset = 8 * offset; int16_t i; uint8_t ecc; uint8_t cId; uint32_t SId; int16_t numberofComponents; if (pd == 1) { // long Sid ecc = getBits_8(d, lOffset); (void)ecc; cId = getBits_4(d, lOffset + 1); SId = getBits(d, lOffset, 32); lOffset += 32; } else { cId = getBits_4(d, lOffset); (void)cId; SId = getBits(d, lOffset + 4, 12); SId = getBits(d, lOffset, 16); lOffset += 16; } // Keep track how often we see a service using a saturating counter. // Every time a service is signalled, we increment the counter. // If the counter is >= 2, we consider the service. Every second, we // decrement all counters by one. // This avoids that misdecoded services appear and stay in the list. using namespace std::chrono; const auto now = steady_clock::now(); if (timeLastServiceDecrement + seconds(1) < now) { auto it = serviceRepeatCount.begin(); while (it != serviceRepeatCount.end()) { if (it->second > 0) { it->second--; ++it; } else if (it->second == 0) { dropService(it->second); it = serviceRepeatCount.erase(it); } else { ++it; } } timeLastServiceDecrement = now; #if 0 std::stringstream ss; ss << "Counters: "; for (auto& c : serviceRepeatCount) { ss << " " << c.first << ":" << (int)c.second; } std::cerr << ss.str() << std::endl; #endif } if (serviceRepeatCount[SId] < 4) { serviceRepeatCount[SId]++; } if (findServiceId(SId) == nullptr and serviceRepeatCount[SId] >= 2) { services.emplace_back(SId); myRadioInterface.onServiceDetected(SId); } numberofComponents = getBits_4(d, lOffset + 4); lOffset += 8; for (i = 0; i < numberofComponents; i ++) { uint8_t TMid = getBits_2 (d, lOffset); if (TMid == 00) { // Audio uint8_t ASCTy = getBits_6 (d, lOffset + 2); uint8_t SubChId = getBits_6 (d, lOffset + 8); uint8_t PS_flag = getBits_1 (d, lOffset + 14); bindAudioService(TMid, SId, i, SubChId, PS_flag, ASCTy); } else if (TMid == 1) { // MSC stream data uint8_t DSCTy = getBits_6 (d, lOffset + 2); uint8_t SubChId = getBits_6 (d, lOffset + 8); uint8_t PS_flag = getBits_1 (d, lOffset + 14); bindDataStreamService(TMid, SId, i, SubChId, PS_flag, DSCTy); } else if (TMid == 3) { // MSC packet data int16_t SCId = getBits (d, lOffset + 2, 12); uint8_t PS_flag = getBits_1 (d, lOffset + 14); uint8_t CA_flag = getBits_1 (d, lOffset + 15); bindPacketService(TMid, SId, i, SCId, PS_flag, CA_flag); } else { // reserved } lOffset += 16; } return lOffset / 8; // in Bytes } // The Extension 3 of FIG type 0 (FIG 0/3) gives // additional information about the service component // description in packet mode. // manual: page 55 void FIBProcessor::FIG0Extension3 (uint8_t *d) { int16_t used = 2; int16_t Length = getBits_5 (d, 3); while (used < Length) used = HandleFIG0Extension3 (d, used); } // DSCTy DataService Component Type int16_t FIBProcessor::HandleFIG0Extension3(uint8_t *d, int16_t used) { int16_t SCId = getBits (d, used * 8, 12); //int16_t CAOrgflag = getBits_1 (d, used * 8 + 15); int16_t DGflag = getBits_1 (d, used * 8 + 16); int16_t DSCTy = getBits_6 (d, used * 8 + 18); int16_t SubChId = getBits_6 (d, used * 8 + 24); int16_t packetAddress = getBits (d, used * 8 + 30, 10); //uint16_t CAOrg = getBits (d, used * 8 + 40, 16); ServiceComponent *packetComp = findPacketComponent(SCId); used += 56 / 8; if (packetComp == NULL) // no ServiceComponent yet return used; packetComp->subchannelId = SubChId; packetComp->DSCTy = DSCTy; packetComp->DGflag = DGflag; packetComp->packetAddress = packetAddress; return used; } void FIBProcessor::FIG0Extension5 (uint8_t *d) { int16_t used = 2; // offset in bytes int16_t Length = getBits_5 (d, 3); while (used < Length) { used = HandleFIG0Extension5 (d, used); } } int16_t FIBProcessor::HandleFIG0Extension5(uint8_t* d, int16_t offset) { int16_t loffset = offset * 8; uint8_t lsFlag = getBits_1 (d, loffset); int16_t subChId, serviceComp, language; if (lsFlag == 0) { // short form if (getBits_1 (d, loffset + 1) == 0) { subChId = getBits_6 (d, loffset + 2); language = getBits_8 (d, loffset + 8); subChannels[subChId].language = language; } loffset += 16; } else { // long form serviceComp = getBits (d, loffset + 4, 12); language = getBits_8 (d, loffset + 16); loffset += 24; } (void)serviceComp; return loffset / 8; } void FIBProcessor::FIG0Extension8 (uint8_t *d) { int16_t used = 2; // offset in bytes int16_t Length = getBits_5 (d, 3); uint8_t PD_bit = getBits_1 (d, 8 + 2); while (used < Length) { used = HandleFIG0Extension8 (d, used, PD_bit); } } int16_t FIBProcessor::HandleFIG0Extension8( uint8_t *d, int16_t used, uint8_t pdBit) { int16_t lOffset = used * 8; uint32_t SId = getBits(d, lOffset, pdBit == 1 ? 32 : 16); uint8_t lsFlag; uint16_t SCIds; int16_t SCid; int16_t MSCflag; int16_t SubChId; uint8_t extensionFlag; lOffset += pdBit == 1 ? 32 : 16; extensionFlag = getBits_1 (d, lOffset); SCIds = getBits_4 (d, lOffset + 4); lOffset += 8; lsFlag = getBits_1 (d, lOffset + 8); if (lsFlag == 1) { SCid = getBits (d, lOffset + 4, 12); lOffset += 16; // if (findPacketComponent ((SCIds << 4) | SCid) != NULL) { // std::clog << "fib-processor:" << "packet component bestaat !!\n") << std::endl; // } } else { MSCflag = getBits_1 (d, lOffset + 1); SubChId = getBits_6 (d, lOffset + 2); lOffset += 8; } if (extensionFlag) lOffset += 8; // skip Rfa (void)SId; (void)SCIds; (void)SCid; (void)SubChId; (void)MSCflag; return lOffset / 8; } // FIG0/9 and FIG0/10 are copied from the work of // Michael Hoehn void FIBProcessor::FIG0Extension9(uint8_t *d) { int16_t offset = 16; dateTime.hourOffset = (getBits_1 (d, offset + 2) == 1) ? -1 * getBits_4 (d, offset + 3): getBits_4 (d, offset + 3); dateTime.minuteOffset = (getBits_1 (d, offset + 7) == 1) ? 30 : 0; timeOffsetReceived = true; ensembleEcc = getBits(d, offset + 8, 8); } void FIBProcessor::FIG0Extension10(uint8_t *fig) { int16_t offset = 16; int32_t mjd = getBits(fig, offset + 1, 17); // Convert Modified Julian Date (according to wikipedia) int32_t J = mjd + 2400001; int32_t j = J + 32044; int32_t g = j / 146097; int32_t dg = j % 146097; int32_t c = ((dg / 36524) + 1) * 3 / 4; int32_t dc = dg - c * 36524; int32_t b = dc / 1461; int32_t db = dc%1461; int32_t a = ((db / 365) + 1) * 3 / 4; int32_t da = db - a * 365; int32_t y = g * 400 + c * 100 + b * 4 + a; int32_t m = ((da * 5 + 308) / 153) - 2; int32_t d = da - ((m + 4) * 153 / 5) + 122; int32_t Y = y - 4800 + ((m + 2) / 12); int32_t M = ((m + 2) % 12) + 1; int32_t D = d + 1; dateTime.year = Y; dateTime.month = M; dateTime.day = D; dateTime.hour = getBits_5(fig, offset + 21); if (getBits_6(fig, offset + 26) != dateTime.minutes) dateTime.seconds = 0; // handle overflow dateTime.minutes = getBits_6(fig, offset + 26); if (fig [offset + 20] == 1) { dateTime.seconds = getBits_6(fig, offset + 32); } if (timeOffsetReceived) { myRadioInterface.onDateTimeUpdate(dateTime); } } void FIBProcessor::FIG0Extension13 (uint8_t *d) { int16_t used = 2; // offset in bytes int16_t Length = getBits_5 (d, 3); uint8_t PD_bit = getBits_1 (d, 8 + 2); while (used < Length) { used = HandleFIG0Extension13 (d, used, PD_bit); } } int16_t FIBProcessor::HandleFIG0Extension13( uint8_t *d, int16_t used, uint8_t pdBit) { int16_t lOffset = used * 8; uint32_t SId = getBits(d, lOffset, pdBit == 1 ? 32 : 16); uint16_t SCIds; int16_t NoApplications; int16_t i; lOffset += pdBit == 1 ? 32 : 16; SCIds = getBits_4 (d, lOffset); NoApplications = getBits_4 (d, lOffset + 4); lOffset += 8; for (i = 0; i < NoApplications; i++) { int16_t appType = getBits (d, lOffset, 11); int16_t length = getBits_5 (d, lOffset + 11); lOffset += (11 + 5 + 8 * length); switch (appType) { case 0x000: // reserved for future use case 0x001: // not used break; case 0x002: // MOT slideshow case 0x003: // MOT Broadcast Web Site case 0x004: // TPEG case 0x005: // DGPS case 0x006: // TMC case 0x007: // EPG case 0x008: // DAB Java break; case 0x44a: // Journaline // std::clog << "fib-processor:" << "Journaline\n") << std::endl; break; default: break; } } (void)SId; (void)SCIds; return lOffset / 8; } void FIBProcessor::FIG0Extension14 (uint8_t *d) { int16_t length = getBits_5 (d, 3); // in Bytes int16_t used = 2; // in Bytes while (used < length) { int16_t subChId = getBits_6 (d, used * 8); uint8_t fecScheme = getBits_2 (d, used * 8 + 6); used = used + 1; for (int i = 0; i < 64; i++) { if (subChannels[i].subChId == subChId) { subChannels[i].fecScheme = fecScheme; } } } } void FIBProcessor::FIG0Extension17(uint8_t *d) { int16_t length = getBits_5 (d, 3); int16_t offset = 16; Service *s; while (offset < length * 8) { uint16_t SId = getBits (d, offset, 16); bool L_flag = getBits_1 (d, offset + 18); bool CC_flag = getBits_1 (d, offset + 19); int16_t type; int16_t Language = 0x00; // init with unknown language s = findServiceId(SId); if (L_flag) { // language field present Language = getBits_8 (d, offset + 24); if (s) { s->language = Language; } offset += 8; } type = getBits_5 (d, offset + 27); if (s) { s->programType = type; } if (CC_flag) { // cc flag offset += 40; } else { offset += 32; } } } void FIBProcessor::FIG0Extension18(uint8_t *d) { int16_t offset = 16; // bits uint16_t SId, AsuFlags; int16_t Length = getBits_5 (d, 3); while (offset / 8 < Length - 1 ) { int16_t NumClusters = getBits_5 (d, offset + 35); SId = getBits (d, offset, 16); AsuFlags = getBits (d, offset + 16, 16); // std::clog << "fib-processor:" << "Announcement %d for SId %d with %d clusters\n", // AsuFlags, SId, NumClusters) << std::endl; offset += 40 + NumClusters * 8; } (void)SId; (void)AsuFlags; } void FIBProcessor::FIG0Extension19(uint8_t *d) { int16_t offset = 16; // bits int16_t Length = getBits_5 (d, 3); uint8_t region_Id_Lower; while (offset / 8 < Length - 1) { uint8_t clusterId = getBits_8 (d, offset); bool new_flag = getBits_1(d, offset + 24); bool region_flag = getBits_1 (d, offset + 25); uint8_t subChId = getBits_6 (d, offset + 26); uint16_t aswFlags = getBits (d, offset + 8, 16); // std::clog << "fib-processor:" << // "%s %s Announcement %d for Cluster %2u on SubCh %2u ", // ((new_flag==1)?"new":"old"), // ((region_flag==1)?"regional":""), // aswFlags, clusterId,subChId) << std::endl; if (region_flag) { region_Id_Lower = getBits_6 (d, offset + 34); offset += 40; // fprintf(stderr,"for region %u",region_Id_Lower); } else { offset += 32; } // fprintf(stderr,"\n"); (void)clusterId; (void)new_flag; (void)subChId; (void)aswFlags; } (void)region_Id_Lower; } void FIBProcessor::FIG0Extension21(uint8_t *d) { // std::clog << "fib-processor:" << "Frequency information\n") << std::endl; (void)d; } void FIBProcessor::FIG0Extension22(uint8_t *d) { int16_t Length = getBits_5 (d, 3); int16_t offset = 16; // on bits int16_t used = 2; while (used < Length) { used = HandleFIG0Extension22 (d, used); } (void)offset; } int16_t FIBProcessor::HandleFIG0Extension22(uint8_t *d, int16_t used) { uint8_t MS; int16_t mainId; int16_t noSubfields; mainId = getBits_7 (d, used * 8 + 1); (void)mainId; MS = getBits_1 (d, used * 8); if (MS == 0) { // fixed size int16_t latitudeCoarse = getBits (d, used * 8 + 8, 16); int16_t longitudeCoarse = getBits (d, used * 8 + 24, 16); // std::clog << "fib-processor:" << "Id = %d, (%d %d)\n", mainId, // latitudeCoarse, longitudeCoarse) << std::endl; (void)latitudeCoarse; (void)longitudeCoarse; return used + 48 / 6; } // MS == 1 noSubfields = getBits_3 (d, used * 8 + 13); // std::clog << "fib-processor:" << "Id = %d, subfields = %d\n", mainId, noSubfields) << std::endl; used += (16 + noSubfields * 48) / 8; return used; } // FIG 1 - Labels void FIBProcessor::process_FIG1(uint8_t *d) { uint32_t SId = 0; int16_t offset = 0; Service *service; ServiceComponent *component; uint8_t pd_flag; uint8_t SCidS; char label[17]; // FIG 1 first byte const uint8_t charSet = getBits_4(d, 8); const uint8_t oe = getBits_1(d, 8 + 4); const uint8_t extension = getBits_3(d, 8 + 5); label[16] = 0x00; if (oe == 1) { return; } switch (extension) { case 0: // ensemble label { const uint32_t EId = getBits(d, 16, 16); offset = 32; for (int i = 0; i < 16; i ++) { label[i] = getBits_8 (d, offset); offset += 8; } // std::clog << "fib-processor:" << "Ensemblename: " << label << std::endl; if (!oe and EId == ensembleId) { ensembleLabel.fig1_flag = getBits(d, offset, 16); ensembleLabel.fig1_label = label; ensembleLabel.setCharset(charSet); myRadioInterface.onSetEnsembleLabel(ensembleLabel); } break; } case 1: // 16 bit Identifier field for service label SId = getBits(d, 16, 16); offset = 32; service = findServiceId(SId); if (service) { for (int i = 0; i < 16; i++) { label[i] = getBits_8(d, offset); offset += 8; } service->serviceLabel.fig1_flag = getBits(d, offset, 16); service->serviceLabel.fig1_label = label; service->serviceLabel.setCharset(charSet); // std::clog << "fib-processor:" << "FIG1/1: SId = %4x\t%s\n", SId, label) << std::endl; } break; /* case 3: // Region label //uint8_t region_id = getBits_6 (d, 16 + 2); offset = 24; for (int i = 0; i < 16; i ++) { label[i] = getBits_8 (d, offset + 8 * i); } // std::clog << "fib-processor:" << "FIG1/3: RegionID = %2x\t%s\n", region_id, label) << std::endl; break; */ case 4: // Component label pd_flag = getBits(d, 16, 1); SCidS = getBits(d, 20, 4); if (pd_flag) { // 32 bit identifier field for service component label SId = getBits(d, 24, 32); offset = 56; } else { // 16 bit identifier field for service component label SId = getBits(d, 24, 16); offset = 40; } for (int i = 0; i < 16; i ++) { label[i] = getBits_8 (d, offset); offset += 8; } component = findComponent(SId, SCidS); if (component) { component->componentLabel.fig1_flag = getBits(d, offset, 16); component->componentLabel.setCharset(charSet); component->componentLabel.fig1_label = label; } // std::clog << "fib-processor:" << "FIG1/4: Sid = %8x\tp/d=%d\tSCidS=%1X\tflag=%8X\t%s\n", // SId, pd_flag, SCidS, flagfield, label) << std::endl; break; case 5: // 32 bit Identifier field for service label SId = getBits(d, 16, 32); offset = 48; service = findServiceId(SId); if (service) { for (int i = 0; i < 16; i ++) { label[i] = getBits_8(d, offset); offset += 8; } service->serviceLabel.fig1_flag = getBits(d, offset, 16); service->serviceLabel.fig1_label = label; service->serviceLabel.setCharset(charSet); #ifdef MSC_DATA__ myRadioInterface.onServiceDetected(SId); #endif } break; /* case 6: // XPAD label uint8_t XPAD_aid; pd_flag = getBits(d, 16, 1); SCidS = getBits(d, 20, 4); if (pd_flag) { // 32 bits identifier for XPAD label SId = getBits(d, 24, 32); XPAD_aid = getBits(d, 59, 5); offset = 64; } else { // 16 bit identifier for XPAD label SId = getBits(d, 24, 16); XPAD_aid = getBits(d, 43, 5); offset = 48; } for (int i = 0; i < 16; i ++) { label[i] = getBits_8 (d, offset + 8 * i); } // fprintf(stderr, "fib-processor:" // "FIG1/6: SId = %8x\tp/d = %d\t SCidS = %1X\tXPAD_aid = %2u\t%s\n", // SId, pd_flag, SCidS, XPAD_aid, label) << std::endl; break; */ default: // std::clog << "fib-processor:" << "FIG1/%d: not handled now\n", extension) << std::endl; break; } } static void handle_ext_label_data_field(const uint8_t *f, uint8_t len_bytes, bool toggle_flag, uint8_t segment_index, uint8_t rfu, DabLabel& label) { if (label.toggle_flag != toggle_flag) { label.segments.clear(); label.extended_label_charset = CharacterSet::Undefined; label.toggle_flag = toggle_flag; } size_t len_character_field = len_bytes; if (segment_index == 0) { // Only if it's the first segment const uint8_t encoding_flag = (f[0] & 0x80) >> 7; const uint8_t segment_count = (f[0] & 0x70) >> 4; label.segment_count = segment_count + 1; if (encoding_flag) { label.extended_label_charset = CharacterSet::UnicodeUcs2; } else { label.extended_label_charset = CharacterSet::UnicodeUtf8; } if (rfu == 0) { // const uint8_t rfa = (f[0] & 0x0F); // const uint16_t char_flag = f[1] * 256 + f[2]; if (len_bytes <= 3) { throw std::runtime_error("FIG2 label length too short"); } f += 3; len_character_field -= 3; } else { // ETSI TS 103 176 draft V2.2.1 (2018-08) gives a new meaning to rfu // TODO const uint8_t text_control = (f[0] & 0x0F); if (len_bytes <= 1) { throw std::runtime_error("FIG2 label length too short"); } f += 1; len_character_field -= 1; } label.fig2_rfu = rfu; } std::vector labelbytes(f, f + len_character_field); label.segments[segment_index] = labelbytes; } // UTF-8 or UCS2 Labels void FIBProcessor::process_FIG2(uint8_t *d) { // In order to reuse code with etisnoop, convert // the bit-vector into a byte-vector std::vector fig_bytes; for (size_t i = 0; i < 30; i++) { fig_bytes.push_back(getBits_8(d, 8*i)); } uint8_t *f = fig_bytes.data(); const uint8_t figlen = f[0] & 0x1F; f++; const uint8_t toggle_flag = (f[0] & 0x80) >> 7; const uint8_t segment_index = (f[0] & 0x70) >> 4; const uint16_t rfu = (f[0] & 0x08) >> 3; const uint16_t ext = f[0] & 0x07; size_t identifier_len; switch (ext) { case 0: // Ensemble label identifier_len = 2; break; case 1: // Programme service label identifier_len = 2; break; case 4: // Service component label { uint8_t pd = (f[1] & 0x80) >> 7; identifier_len = (pd == 0) ? 3 : 5; break; } case 5: // Data service label identifier_len = 4; break; default: return; // Unsupported } const size_t header_length = 1; // FIG data field header const uint8_t *figdata = f + header_length + identifier_len; const size_t data_len_bytes = figlen - header_length - identifier_len; // ext is followed by Identifier field of Type 2 field, // whose length depends on ext switch (ext) { case 0: // Ensemble label { // ETSI EN 300 401 8.1.13 uint16_t eid = f[1] * 256 + f[2]; if (figlen <= header_length + identifier_len) { std::clog << "FIG2/0 length error " << (int)figlen << std::endl; } else if (eid == ensembleId) { handle_ext_label_data_field(figdata, data_len_bytes, toggle_flag, segment_index, rfu, ensembleLabel); } } break; case 1: // Programme service label { // ETSI EN 300 401 8.1.14.1 uint16_t sid = f[1] * 256 + f[2]; if (figlen <= header_length + identifier_len) { std::clog << "FIG2/1 length error " << (int)figlen << std::endl; } else { auto *service = findServiceId(sid); if (service) { handle_ext_label_data_field(figdata, data_len_bytes, toggle_flag, segment_index, rfu, service->serviceLabel); } } } break; case 4: // Service component label { // ETSI EN 300 401 8.1.14.3 uint32_t sid; uint8_t pd = (f[1] & 0x80) >> 7; uint8_t SCIdS = f[1] & 0x0F; if (pd == 0) { sid = f[2] * 256 + \ f[3]; } else { sid = ((uint32_t)f[2] << 24) | ((uint32_t)f[3] << 16) | ((uint32_t)f[4] << 8) | ((uint32_t)f[5]); } if (figlen <= header_length + identifier_len) { std::clog << "FIG2/4 length error " << (int)figlen << std::endl; } else { auto *component = findComponent(sid, SCIdS); if (component) { handle_ext_label_data_field(figdata, data_len_bytes, toggle_flag, segment_index, rfu, component->componentLabel); } } } break; case 5: // Data service label { // ETSI EN 300 401 8.1.14.2 const uint32_t sid = ((uint32_t)f[1] << 24) | ((uint32_t)f[2] << 16) | ((uint32_t)f[3] << 8) | ((uint32_t)f[4]); if (figlen <= header_length + identifier_len) { std::clog << "FIG2/5 length error " << (int)figlen << std::endl; } else { auto *service = findServiceId(sid); if (service) { handle_ext_label_data_field(figdata, data_len_bytes, toggle_flag, segment_index, rfu, service->serviceLabel); } } } break; } } // locate a reference to the entry for the Service serviceId Service *FIBProcessor::findServiceId(uint32_t serviceId) { for (size_t i = 0; i < services.size(); i++) { if (services[i].serviceId == serviceId) { return &services[i]; } } return nullptr; } ServiceComponent *FIBProcessor::findComponent(uint32_t serviceId, int16_t SCIdS) { auto comp = std::find_if(components.begin(), components.end(), [&](const ServiceComponent& sc) { return sc.SId == serviceId && sc.componentNr == SCIdS; }); if (comp == components.end()) { return nullptr; } else { return &(*comp); } } ServiceComponent *FIBProcessor::findPacketComponent(int16_t SCId) { for (auto& component : components) { if (component.TMid != 03) { continue; } if (component.SCId == SCId) { return &component; } } return nullptr; } // bindAudioService is the main processor for - what the name suggests - // connecting the description of audioservices to a SID void FIBProcessor::bindAudioService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t subChId, int16_t ps_flag, int16_t ASCTy) { Service *s = findServiceId(SId); if (!s) return; if (std::find_if(components.begin(), components.end(), [&](const ServiceComponent& sc) { return sc.SId == s->serviceId && sc.componentNr == compnr; }) == components.end()) { ServiceComponent newcomp; newcomp.TMid = TMid; newcomp.componentNr = compnr; newcomp.SId = SId; newcomp.subchannelId = subChId; newcomp.PS_flag = ps_flag; newcomp.ASCTy = ASCTy; components.push_back(newcomp); // std::clog << "fib-processor:" << "service %8x (comp %d) is audio\n", SId, compnr) << std::endl; } } void FIBProcessor::bindDataStreamService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t subChId, int16_t ps_flag, int16_t DSCTy) { Service *s = findServiceId(SId); if (!s) return; if (std::find_if(components.begin(), components.end(), [&](const ServiceComponent& sc) { return sc.SId == s->serviceId && sc.componentNr == compnr; }) == components.end()) { ServiceComponent newcomp; newcomp.TMid = TMid; newcomp.SId = SId; newcomp.subchannelId = subChId; newcomp.componentNr = compnr; newcomp.PS_flag = ps_flag; newcomp.DSCTy = DSCTy; components.push_back(newcomp); // std::clog << "fib-processor:" << "service %8x (comp %d) is packet\n", SId, compnr) << std::endl; } } // bindPacketService is the main processor for - what the name suggests - // connecting the service component defining the service to the SId, /// Note that the subchannel is assigned through a FIG0/3 void FIBProcessor::bindPacketService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t SCId, int16_t ps_flag, int16_t CAflag) { Service *s = findServiceId(SId); if (!s) return; if (std::find_if(components.begin(), components.end(), [&](const ServiceComponent& sc) { return sc.SId == s->serviceId && sc.componentNr == compnr; }) == components.end()) { ServiceComponent newcomp; newcomp.TMid = TMid; newcomp.SId = SId; newcomp.componentNr = compnr; newcomp.SCId = SCId; newcomp.PS_flag = ps_flag; newcomp.CAflag = CAflag; components.push_back(newcomp); // std::clog << "fib-processor:" << "service %8x (comp %d) is packet\n", SId, compnr) << std::endl; } } void FIBProcessor::dropService(uint32_t SId) { std::stringstream ss; ss << "Dropping service " << SId; services.erase(std::remove_if(services.begin(), services.end(), [&](const Service& s) { return s.serviceId == SId; } ), services.end()); components.erase(std::remove_if(components.begin(), components.end(), [&](const ServiceComponent& c) { const bool drop = c.SId == SId; if (drop) { ss << ", comp " << c.componentNr; } return drop; } ), components.end()); // Check for orphaned subchannels for (auto& sub : subChannels) { if (sub.subChId == -1) { continue; } auto c_it = std::find_if(components.begin(), components.end(), [&](const ServiceComponent& c) { return c.subchannelId == sub.subChId; }); const bool drop = c_it == components.end(); if (drop) { ss << ", subch " << sub.subChId; sub.subChId = -1; } } std::clog << ss.str() << std::endl; } void FIBProcessor::clearEnsemble() { std::lock_guard lock(mutex); components.clear(); subChannels.resize(64); services.clear(); serviceRepeatCount.clear(); timeLastServiceDecrement = std::chrono::steady_clock::now(); } std::vector FIBProcessor::getServiceList() const { std::lock_guard lock(mutex); return services; } Service FIBProcessor::getService(uint32_t sId) const { std::lock_guard lock(mutex); auto srv = std::find_if(services.begin(), services.end(), [&](const Service& s) { return s.serviceId == sId; }); if (srv != services.end()) { return *srv; } else { return Service(0); } } std::list FIBProcessor::getComponents(const Service& s) const { std::list c; std::lock_guard lock(mutex); for (const auto& component : components) { if (component.SId == s.serviceId) { c.push_back(component); } } return c; } Subchannel FIBProcessor::getSubchannel(const ServiceComponent& sc) const { std::lock_guard lock(mutex); return subChannels.at(sc.subchannelId); } uint16_t FIBProcessor::getEnsembleId() const { std::lock_guard lock(mutex); return ensembleId; } uint8_t FIBProcessor::getEnsembleEcc() const { std::lock_guard lock(mutex); return ensembleEcc; } DabLabel FIBProcessor::getEnsembleLabel() const { std::lock_guard lock(mutex); return ensembleLabel; } welle.io-2.1/src/backend/fib-processor.h000066400000000000000000000110371357201522000201750ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef FIB_PROCESSOR #define FIB_PROCESSOR #include #include #include #include #include #include #include #include #include "msc-handler.h" #include "radio-controller.h" class FIBProcessor { public: FIBProcessor(RadioControllerInterface& mr); // called from the demodulator void processFIB(uint8_t *p, uint16_t fib); void clearEnsemble(); // Called from the frontend uint16_t getEnsembleId() const; uint8_t getEnsembleEcc() const; DabLabel getEnsembleLabel() const; std::vector getServiceList() const; Service getService(uint32_t sId) const; std::list getComponents(const Service& s) const; Subchannel getSubchannel(const ServiceComponent& sc) const; private: RadioControllerInterface& myRadioInterface; Service *findServiceId(uint32_t serviceId); ServiceComponent *findComponent(uint32_t serviceId, int16_t SCIdS); ServiceComponent *findPacketComponent(int16_t SCId); void bindAudioService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t subChId, int16_t ps_flag, int16_t ASCTy); void bindDataStreamService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t subChId, int16_t ps_flag, int16_t DSCTy); void bindPacketService( int8_t TMid, uint32_t SId, int16_t compnr, int16_t SCId, int16_t ps_flag, int16_t CAflag); void dropService(uint32_t SId); void process_FIG0(uint8_t *); void process_FIG1(uint8_t *); void process_FIG2(uint8_t *); void FIG0Extension0(uint8_t *); void FIG0Extension1(uint8_t *); void FIG0Extension2(uint8_t *); void FIG0Extension3(uint8_t *); void FIG0Extension5(uint8_t *); void FIG0Extension8(uint8_t *); void FIG0Extension9(uint8_t *); void FIG0Extension10(uint8_t *); void FIG0Extension13(uint8_t *); void FIG0Extension14(uint8_t *); void FIG0Extension16(uint8_t *); void FIG0Extension17(uint8_t *); void FIG0Extension18(uint8_t *); void FIG0Extension19(uint8_t *); void FIG0Extension21(uint8_t *); void FIG0Extension22(uint8_t *); int16_t HandleFIG0Extension1(uint8_t *d, int16_t offset, uint8_t pd); int16_t HandleFIG0Extension2( uint8_t *d, int16_t offset, uint8_t cn, uint8_t pd); int16_t HandleFIG0Extension3(uint8_t *d, int16_t used); int16_t HandleFIG0Extension5(uint8_t *d, int16_t offset); int16_t HandleFIG0Extension8(uint8_t *d, int16_t used, uint8_t pdBit); int16_t HandleFIG0Extension13(uint8_t *d, int16_t used, uint8_t pdBit); int16_t HandleFIG0Extension22(uint8_t *d, int16_t used); bool timeOffsetReceived = false; dab_date_time_t dateTime = {}; mutable std::mutex mutex; uint16_t ensembleId = 0; uint8_t ensembleEcc = 0; DabLabel ensembleLabel; std::vector subChannels; std::vector components; std::vector services; std::unordered_map serviceRepeatCount; std::chrono::steady_clock::time_point timeLastServiceDecrement; }; #endif welle.io-2.1/src/backend/fic-handler.cpp000066400000000000000000000162661357201522000201400ustar00rootroot00000000000000/* * Copyright (C) 2019 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Computing * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "fic-handler.h" #include "msc-handler.h" #include "protTables.h" // The 3072 bits of the serial motherword shall be split into // 24 blocks of 128 bits each. // The first 21 blocks shall be subjected to // puncturing (per 32 bits) according to PI_16 // The next three blocks shall be subjected to // puncturing (per 32 bits) according to PI_15 // The last 24 bits shall be subjected to puncturing // according to the table X uint8_t PI_X [24] = { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 }; /** * \class FicHandler * We get in - through get_ficBlock - the FIC data * in units of 768 bits. * We follow the standard and apply conv coding and * puncturing. * The data is sent through to the fic processor */ FicHandler::FicHandler(RadioControllerInterface& mr) : Viterbi(768), fibProcessor(mr), myRadioInterface(mr), bitBuffer_out(768), ofdm_input(2304), viterbiBlock(3072 + 24) { PI_15 = getPCodes(15 - 1); PI_16 = getPCodes(16 - 1); std::vector shiftRegister(9, 1); for (int i = 0; i < 768; i++) { PRBS[i] = shiftRegister[8] ^ shiftRegister[4]; for (int j = 8; j > 0; j--) { shiftRegister[j] = shiftRegister[j - 1]; } shiftRegister[0] = PRBS[i]; } } /** * \brief setBitsperBlock * The number of bits to be processed per incoming block * is 2 * p -> K, which still depends on the Mode. * for Mode I it is 2 * 1536, for Mode II, it is 2 * 384, * for Mode III it is 192, Mode IV gives 2 * 768. * for Mode II we will get the 2304 bits after having read * the 3 FIC blocks, * for Mode IV we will get 3 * 2 * 768 = 4608, i.e. two resulting blocks * Note that Mode III is NOT supported */ void FicHandler::setBitsperBlock(int16_t b) { if ( (b == 2 * 384) || (b == 2 * 768) || (b == 2 * 1536)) { bitsperBlock = b; } index = 0; ficno = 0; } /** * \brief processFicBlock * The number of bits to be processed per incoming block * is 2 * p -> K, which still depends on the Mode. * for Mode I it is 2 * 1536, for Mode II, it is 2 * 384, * for Mode III it is 192, Mode IV gives 2 * 768. * for Mode II we will get the 2304 bits after having read * the 3 FIC blocks, each with 768 bits. * for Mode IV we will get 3 * 2 * 768 = 4608, i.e. two resulting blocks * Note that Mode III is NOT supported * * The function is called with a blkno. This should be 1, 2 or 3 * for each time 2304 bits are in, we call processFicInput */ void FicHandler::processFicBlock(const softbit_t *data, int16_t blkno) { if (blkno == 1) { index = 0; ficno = 0; } if ((1 <= blkno) && (blkno <= 3)) { for (int i = 0; i < bitsperBlock; i ++) { ofdm_input[index ++] = data[i]; if (index >= 2304) { processFicInput(ofdm_input.data(), ficno); index = 0; ficno++; } } } else { fprintf(stderr, "You should not call ficBlock here\n"); } // we are pretty sure now that after block 4, we end up // with index = 0 } /** * \brief processFicInput * we have a vector of 2304 (0 .. 2303) soft bits that has * to be de-punctured and de-conv-ed into a block of 768 bits * In this approach we first create the full 3072 block (i.e. * we first depuncture, and then we apply the deconvolution * In the next coding step, we will combine this function with the * one above */ void FicHandler::processFicInput(const softbit_t *ficblock, int16_t ficno) { int16_t input_counter = 0; int16_t i, k; int32_t local = 0; memset(viterbiBlock.data(), 0, viterbiBlock.size() * sizeof(*viterbiBlock.data())); /** * a block of 2304 bits is considered to be a codeword * In the first step we have 21 blocks with puncturing according to PI_16 * each 128 bit block contains 4 subblocks of 32 bits * on which the given puncturing is applied */ for (i = 0; i < 21; i ++) { for (k = 0; k < 32 * 4; k ++) { if (PI_16 [k % 32] != 0) { viterbiBlock[local] = ficblock[input_counter ++]; } local ++; } } /** * In the second step * we have 3 blocks with puncturing according to PI_15 * each 128 bit block contains 4 subblocks of 32 bits * on which the given puncturing is applied */ for (i = 0; i < 3; i ++) { for (k = 0; k < 32 * 4; k ++) { if (PI_15 [k % 32] != 0) { viterbiBlock[local] = ficblock[input_counter ++]; } local++; } } /** * we have a final block of 24 bits with puncturing according to PI_X * This block constitues the 6 * 4 bits of the register itself. */ for (k = 0; k < 24; k ++) { if (PI_X [k] != 0) { viterbiBlock[local] = ficblock[input_counter++]; } local ++; } /** * Now we have the full word ready for deconvolution * deconvolution is according to DAB standard section 11.2 */ deconvolve(viterbiBlock.data(), bitBuffer_out.data()); /** * if everything worked as planned, we now have a * 768 bit vector containing three FIB's * * first step: energy dispersal according to the DAB standard * We use a predefined vector PRBS */ for (i = 0; i < 768; i ++) { bitBuffer_out[i] ^= PRBS[i]; } /** * each of the fib blocks is protected by a crc * (we know that there are three fib blocks each time we are here * we keep track of the successrate */ for (i = ficno * 3; i < ficno * 3 + 3; i ++) { uint8_t *p = &bitBuffer_out[(i % 3) * 256]; const bool crcvalid = check_CRC_bits(p, 256); myRadioInterface.onFIBDecodeSuccess(crcvalid, p); if (crcvalid) { fibProcessor.processFIB(p, ficno); if (fic_decode_success_ratio < 10) { fic_decode_success_ratio++; } } else if (fic_decode_success_ratio > 0) { fic_decode_success_ratio--; } } } void FicHandler::clearEnsemble() { fibProcessor.clearEnsemble(); } int FicHandler::getFicDecodeRatioPercent() { return fic_decode_success_ratio * 10; } welle.io-2.1/src/backend/fic-handler.h000066400000000000000000000041411357201522000175720ustar00rootroot00000000000000/* * Copyright (C) 2019 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * FIC data */ #ifndef __FIC_HANDLER #define __FIC_HANDLER #include #include #include #include "viterbi.h" #include "fib-processor.h" #include "radio-controller.h" class FicHandler: public Viterbi { public: FicHandler(RadioControllerInterface& mr); void processFicBlock(const softbit_t *data, int16_t blkno); void setBitsperBlock(int16_t b); void clearEnsemble(); int getFicDecodeRatioPercent(); FIBProcessor fibProcessor; private: RadioControllerInterface& myRadioInterface; void processFicInput(const softbit_t *ficblock, int16_t ficno); const int8_t *PI_15; const int8_t *PI_16; std::vector bitBuffer_out; std::vector ofdm_input; std::vector viterbiBlock; int16_t index = 0; int16_t bitsperBlock = 2 * 1536; int16_t ficno = 0; uint8_t PRBS[768]; // Saturating up/down-counter in range [0, 10] corresponding // to the number of FICs with correct CRC int fic_decode_success_ratio = 0; }; #endif welle.io-2.1/src/backend/freq-interleaver.cpp000066400000000000000000000051441357201522000212300ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "freq-interleaver.h" /** * \brief createMapper * create the mapping table for the (de-)interleaver * formulas according to section 14.6 (Frequency interleaving) * of the DAB standard */ static std::vector createMapper(int16_t T_u, int16_t V1, int16_t lwb, int16_t upb) { std::vector tmp(T_u); std::vector v(T_u); int16_t index = 0; int16_t i; tmp[0] = 0; for (i = 1; i < T_u; i ++) { tmp[i] = (13 * tmp[i - 1] + V1) % T_u; } for (i = 0; i < T_u; i ++) { if (tmp[i] == T_u / 2) continue; if ((tmp[i] < lwb) || (tmp[i] > upb)) continue; // we now have a table with values from lwb .. upb v[index ++] = tmp[i] - T_u / 2; // we now have a table with values from lwb - T_u / 2 .. lwb + T_u / 2 } return v; } FrequencyInterleaver::FrequencyInterleaver(const DABParams& param) { switch (param.dabMode) { case 1: default: // shouldn't happen permTable = createMapper (param.T_u, 511, 256, 256 + param.K); break; case 2: permTable = createMapper (param.T_u, 127, 64, 64 + param.K); break; case 3: permTable = createMapper (param.T_u, 63, 32, 32 + param.K); break; case 4: permTable = createMapper (param.T_u, 255, 128, 128 + param.K); break; } } // according to the standard, the map is a function from // 0 .. 1535->-768 .. 768 (with exclusion of {0}) int16_t FrequencyInterleaver::mapIn(int16_t n) { return permTable[n]; } welle.io-2.1/src/backend/freq-interleaver.h000066400000000000000000000026001357201522000206670ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __FREQ_INTERLEAVER__ #define __FREQ_INTERLEAVER__ #include #include #include "dab-constants.h" /** * \class FrequencyInterleaver * Implements frequency interleaving according to section 14.6 * of the DAB standard */ class FrequencyInterleaver { public: FrequencyInterleaver(const DABParams& param); int16_t mapIn(int16_t); private: std::vector permTable; }; #endif welle.io-2.1/src/backend/mot_manager.cpp000066400000000000000000000212371357201522000202470ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2016-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "mot_manager.h" // --- MOTEntity ----------------------------------------------------------------- void MOTEntity::AddSeg(int seg_number, bool last_seg, const uint8_t* data, size_t len) { if(last_seg) last_seg_number = seg_number; if(segs.find(seg_number) != segs.end()) return; // copy data segs[seg_number] = seg_t(len); memcpy(&segs[seg_number][0], data, len); size += len; } bool MOTEntity::IsFinished() { if(last_seg_number == -1) return false; // check if all segments are available for(int i = 0; i <= last_seg_number; i++) if(segs.find(i) == segs.end()) return false; return true; } std::vector MOTEntity::GetData() { std::vector result(size); size_t offset = 0; // concatenate all segments for(int i = 0; i <= last_seg_number; i++) { seg_t& seg = segs[i]; memcpy(&result[offset], &seg[0], seg.size()); offset += seg.size(); } return result; } // --- MOTObject ----------------------------------------------------------------- void MOTObject::AddSeg(bool dg_type_header, int seg_number, bool last_seg, const uint8_t* data, size_t len) { (dg_type_header ? header : body).AddSeg(seg_number, last_seg, data, len); } bool MOTObject::ParseCheckHeader(MOT_FILE& target_file) { MOT_FILE file = target_file; std::vector data = header.GetData(); // parse/check header core if(data.size() < 7) return false; size_t body_size = (data[0] << 20) | (data[1] << 12) | (data[2] << 4) | (data[3] >> 4); size_t header_size = ((data[3] & 0x0F) << 9) | (data[4] << 1) | (data[5] >> 7); int content_type = (data[5] & 0x7F) >> 1; int content_sub_type = ((data[5] & 0x01) << 8) | data[6]; // fprintf(stderr, "body_size: %5zu, header_size: %3zu, content_type: 0x%02X, content_sub_type: 0x%03X\n", // body_size, header_size, content_type, content_sub_type); if(header_size != header.GetSize()) return false; bool header_update = content_type == MOT_FILE::CONTENT_TYPE_MOT_TRANSPORT && content_sub_type == MOT_FILE::CONTENT_SUB_TYPE_HEADER_UPDATE; // abort, if neither none nor both conditions (header received/update) apply if(header_received != header_update) return false; if(!header_update) { // store core info file.body_size = body_size; file.content_type = content_type; file.content_sub_type = content_sub_type; } std::string old_content_name = file.content_name; std::string new_content_name; // parse/check header extension for(size_t offset = 7; offset < data.size();) { int pli = data[offset] >> 6; int param_id = data[offset] & 0x3F; offset++; // get parameter len size_t data_len; switch(pli) { case 0b00: data_len = 0; break; case 0b01: data_len = 1; break; case 0b10: data_len = 4; break; case 0b11: if(offset >= data.size()) return false; bool ext = data[offset] & 0x80; data_len = data[offset] & 0x7F; offset++; if(ext) { if(offset >= data.size()) return false; data_len = (data_len << 8) + data[offset]; offset++; } break; } if(offset + data_len - 1 >= data.size()) return false; // process parameter switch(param_id) { case 0x05: // TriggerTime if(data_len < 4) return false; // TODO: not only distinguish between Now or not file.trigger_time_now = !(data[offset] & 0x80); // fprintf(stderr, "TriggerTime: %s\n", file.trigger_time_now ? "Now" : "(not Now)"); break; case 0x0C: // ContentName if(data_len == 0) return false; //file.content_name = CharsetTools::ConvertTextToUTF8(&data[offset + 1], data_len - 1, data[offset] >> 4, true, &file.content_name_charset); file.content_name = toUtf8StringUsingCharset ( (const char *)&data[offset + 1], (CharacterSet) (data[offset] >> 4), data_len - 1); new_content_name = file.content_name; // fprintf(stderr, "ContentName: '%s'\n", file.content_name.c_str()); break; case 0x26: // CategoryTitle file.category_title = std::string((char*) &data[offset], data_len); // already UTF-8 // fprintf(stderr, "CategoryTitle: '%s'\n", file.category_title.c_str()); break; case 0x27: // ClickThroughURL file.click_through_url = std::string((char*) &data[offset], data_len); // already UTF-8 // fprintf(stderr, "ClickThroughURL: '%s'\n", file.click_through_url.c_str()); break; } offset += data_len; } if(!header_update) { // ensure actual header is processed only once header_received = true; } else { // ensure matching content name if(new_content_name != old_content_name) return false; } target_file = file; return true; } bool MOTObject::IsToBeShown() { // abort, if already shown if(shown) return false; // try to process finished header if(header.IsFinished()) { // parse/check MOT header bool result = ParseCheckHeader(result_file); header.Reset(); // allow for header updates if(!result) return false; } // abort, if incomplete/not yet triggered if(!header_received) return false; if(!body.IsFinished() || result_file.body_size != body.GetSize()) return false; if(!result_file.trigger_time_now) return false; // add body data result_file.data = body.GetData(); shown = true; return true; } // --- MOTManager ----------------------------------------------------------------- MOTManager::MOTManager() { Reset(); } void MOTManager::Reset() { object = MOTObject(); current_transport_id = -1; } bool MOTManager::ParseCheckDataGroupHeader(const std::vector& dg, size_t& offset, int& dg_type) { // parse/check Data Group header if(dg.size() < (offset + 2)) return false; bool extension_flag = dg[offset] & 0x80; bool crc_flag = dg[offset] & 0x40; bool segment_flag = dg[offset] & 0x20; bool user_access_flag = dg[offset] & 0x10; dg_type = dg[offset] & 0x0F; offset += 2 + (extension_flag ? 2 : 0); if(!crc_flag) return false; if(!segment_flag) return false; if(!user_access_flag) return false; if(dg_type != 3 && dg_type != 4) // only accept MOT header/body return false; return true; } bool MOTManager::ParseCheckSessionHeader(const std::vector& dg, size_t& offset, bool& last_seg, int& seg_number, int& transport_id) { // parse/check session header if(dg.size() < (offset + 3)) return false; last_seg = dg[offset] & 0x80; seg_number = ((dg[offset] & 0x7F) << 8) | dg[offset + 1]; bool transport_id_flag = dg[offset + 2] & 0x10; size_t len_indicator = dg[offset + 2] & 0x0F; offset += 3; if(!transport_id_flag) return false; if(len_indicator < 2) return false; // handle transport ID if(dg.size() < (offset + len_indicator)) return false; transport_id = (dg[offset] << 8) | dg[offset + 1]; offset += len_indicator; return true; } bool MOTManager::ParseCheckSegmentationHeader(const std::vector& dg, size_t& offset, size_t& seg_size) { // parse/check segmentation header (MOT) if(dg.size() < (offset + 2)) return false; seg_size = ((dg[offset] & 0x1F) << 8) | dg[offset + 1]; offset += 2; // compare announced/actual segment size if(seg_size != dg.size() - offset - CalcCRC::CRCLen) return false; return true; } bool MOTManager::HandleMOTDataGroup(const std::vector& dg) { size_t offset = 0; // parse/check headers int dg_type; bool last_seg; int seg_number; int transport_id; size_t seg_size; if(!ParseCheckDataGroupHeader(dg, offset, dg_type)) return false; if(!ParseCheckSessionHeader(dg, offset, last_seg, seg_number, transport_id)) return false; if(!ParseCheckSegmentationHeader(dg, offset, seg_size)) return false; // add segment to MOT object (reset if necessary) if(current_transport_id != transport_id) { current_transport_id = transport_id; object = MOTObject(); } object.AddSeg(dg_type == 3, seg_number, last_seg, &dg[offset], seg_size); // check if object shall be shown bool display = object.IsToBeShown(); // fprintf(stderr, "dg_type: %d, seg_number: %2d%s, transport_id: %5d, size: %4zu; display: %s\n", // dg_type, seg_number, last_seg ? " (LAST)" : "", transport_id, seg_size, display ? "true" : "false"); // if object shall be shown, update it return display; } welle.io-2.1/src/backend/mot_manager.h000066400000000000000000000064271357201522000177200ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2016-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef MOT_MANAGER_H_ #define MOT_MANAGER_H_ #include #include #include #include #include #include #include "charsets.h" #include "tools.h" // --- MOT_FILE ----------------------------------------------------------------- struct MOT_FILE { std::vector data; // from header core size_t body_size; int content_type; int content_sub_type; // from header extension std::string content_name; std::string content_name_charset; std::string category_title; std::string click_through_url; bool trigger_time_now; static const int CONTENT_TYPE_IMAGE = 0x02; static const int CONTENT_TYPE_MOT_TRANSPORT = 0x05; static const int CONTENT_SUB_TYPE_JFIF = 0x001; static const int CONTENT_SUB_TYPE_PNG = 0x003; static const int CONTENT_SUB_TYPE_HEADER_UPDATE = 0x000; MOT_FILE() : body_size(-1), content_type(-1), content_sub_type(-1), trigger_time_now(false) {} }; typedef std::vector seg_t; typedef std::map segs_t; // --- MOTEntity ----------------------------------------------------------------- class MOTEntity { private: segs_t segs; int last_seg_number; size_t size; public: MOTEntity() {Reset();} void Reset() { segs.clear(); last_seg_number = -1; size = 0; } void AddSeg(int seg_number, bool last_seg, const uint8_t* data, size_t len); bool IsFinished(); size_t GetSize() {return size;} std::vector GetData(); }; // --- MOTObject ----------------------------------------------------------------- class MOTObject { private: MOTEntity header; MOTEntity body; bool header_received; bool shown; MOT_FILE result_file; bool ParseCheckHeader(MOT_FILE& target_file); public: MOTObject(): header_received(false), shown(false) {} void AddSeg(bool dg_type_header, int seg_number, bool last_seg, const uint8_t* data, size_t len); bool IsToBeShown(); MOT_FILE GetFile() {return result_file;} }; // --- MOTManager ----------------------------------------------------------------- class MOTManager { private: MOTObject object; int current_transport_id; bool ParseCheckDataGroupHeader(const std::vector& dg, size_t& offset, int& dg_type); bool ParseCheckSessionHeader(const std::vector& dg, size_t& offset, bool& last_seg, int& seg_number, int& transport_id); bool ParseCheckSegmentationHeader(const std::vector& dg, size_t& offset, size_t& seg_size); public: MOTManager(); void Reset(); bool HandleMOTDataGroup(const std::vector& dg); MOT_FILE GetFile() {return object.GetFile();} }; #endif /* MOT_MANAGER_H_ */ welle.io-2.1/src/backend/msc-handler.cpp000066400000000000000000000116171357201522000201540ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "dab-constants.h" #include "msc-handler.h" #include "dab-virtual.h" #include "dab-audio.h" // Interface program for processing the MSC. // Merely a dispatcher for the selected service // // The ofdm processor assumes the existence of an msc-handler, whether // a service is selected or not. #define CUSize (4 * 16) // Note CIF counts from 0 .. 3 MscHandler::MscHandler( const DABParams& p, bool show_crcErrors) : bitsperBlock(2 * p.K), show_crcErrors(show_crcErrors), cifVector(864 * CUSize) { if (p.dabMode == 4) { // 2 CIFS per 76 blocks numberofblocksperCIF = 36; } else { if (p.dabMode == 1) { // 4 CIFS per 76 blocks numberofblocksperCIF = 18; } else { if (p.dabMode == 2) // 1 CIF per 76 blocks numberofblocksperCIF = 72; else // shouldnot/cannot happen numberofblocksperCIF = 18; } } } bool MscHandler::addSubchannel( ProgrammeHandlerInterface& handler, AudioServiceComponentType ascty, const std::string& dumpFileName, const Subchannel& sub) { std::lock_guard lock(mutex); // check not already in list for (const auto& stream : streams) { if (stream.subCh.subChId == sub.subChId) { return true; } } SelectedStream s(handler, ascty, dumpFileName, sub); s.dabHandler = std::make_shared( ascty, sub.length * CUSize, sub.bitrate(), sub.protectionSettings, handler, dumpFileName); /* TODO dealing with data s.dabHandler = std::make_shared(radioInterface, new_DSCTy, new_packetAddress, subChannel.length * CUSize, subChannel.bitrate(), subChannel.shortForm, subChannel.protLevel, new_DGflag, new_FEC_scheme, show_crcErrors); */ streams.push_back(std::move(s)); work_to_be_done = true; return true; } bool MscHandler::removeSubchannel(const Subchannel& sub) { std::lock_guard lock(mutex); auto it = std::find_if(streams.begin(), streams.end(), [&](const SelectedStream& stream) { return stream.subCh.subChId == sub.subChId; } ); if (it != streams.end()) { streams.erase(it); return true; } return false; } // add blocks. First is (should be) block 5, last is (should be) 76 // Note that this method is called from within the ofdm-processor thread // while the set_xxx methods are called from within the // gui thread // // Any change in the selected service will only be active // during te next processMscBlock call. void MscHandler::processMscBlock(const softbit_t *fbits, int16_t blkno) { std::lock_guard lock(mutex); if (!work_to_be_done) return; int16_t currentblk = (blkno - 4) % numberofblocksperCIF; // and the normal operation is: memcpy(&cifVector[currentblk * bitsperBlock], fbits, bitsperBlock * sizeof(softbit_t)); if (currentblk < numberofblocksperCIF - 1) return; // OK, now we have a full CIF blkCount = 0; cifCount = (cifCount + 1) & 03; for (auto& stream : streams) { softbit_t *myBegin = &cifVector[stream.subCh.startAddr * CUSize]; if (stream.dabHandler) { (void)stream.dabHandler->process(myBegin, stream.subCh.length * CUSize); } else { throw std::logic_error("No dabHandler!"); } } } void MscHandler::stopProcessing() { std::lock_guard lock(mutex); work_to_be_done = false; streams.clear(); } welle.io-2.1/src/backend/msc-handler.h000066400000000000000000000054201357201522000176140ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * MSC data */ #ifndef MSC_HANDLER #define MSC_HANDLER #include #include #include #include #include #include #include #include "dab-constants.h" #include "ringbuffer.h" #include "radio-controller.h" class DabVirtual; class MscHandler { public: MscHandler(const DABParams& p, bool show_crcErrors); // Stop processing and remove all subchannels void stopProcessing(void); bool addSubchannel( ProgrammeHandlerInterface& handler, AudioServiceComponentType ascty, const std::string& dumpFileName, const Subchannel& sub); bool removeSubchannel(const Subchannel& sub); private: friend class OfdmDecoder; void processMscBlock(const softbit_t *fbits, int16_t blkno); struct SelectedStream { SelectedStream( ProgrammeHandlerInterface& handler, AudioServiceComponentType ascty, const std::string& dumpFileName, const Subchannel& subCh) : handler(handler), audioType(ascty), dumpFileName(dumpFileName), subCh(subCh) {} ProgrammeHandlerInterface& handler; AudioServiceComponentType audioType; const std::string dumpFileName; const Subchannel subCh; std::shared_ptr dabHandler; }; std::mutex mutex; std::list streams; const int16_t bitsperBlock; int16_t numberofblocksperCIF; bool show_crcErrors; std::vector cifVector; int16_t cifCount = 0; // msc blocks in CIF int16_t blkCount = 0; bool work_to_be_done = false; }; #endif welle.io-2.1/src/backend/ofdm-decoder.cpp000066400000000000000000000170661357201522000203130ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 2015 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Once the bits are "in", interpretation and manipulation * should reconstruct the data symbols. * Ofdm_decoder is called once every Ts samples, and * its invocation results in 2 * Tu bits */ #include #include "ofdm-decoder.h" #include "various/profiling.h" #include /** * \brief OfdmDecoder * The class OfdmDecoder is - when implemented in a separate thread - * taking the data from the ofdmProcessor class in, and * will extract the Tu samples, do an FFT and extract the * carriers and map them on (soft) bits */ OfdmDecoder::OfdmDecoder( const DABParams& p, RadioControllerInterface& mr, FicHandler& ficHandler, MscHandler& mscHandler) : params(p), radioInterface(mr), ficHandler(ficHandler), mscHandler(mscHandler), pending_symbols(params.L), phaseReference(params.T_u), fft_handler(p.T_u), interleaver(p), ibits(2 * params.K) { T_g = params.T_s - params.T_u; fft_buffer = fft_handler.getVector(); /** * When implemented in a thread, the thread controls the * reading in of the data and processing the data through * functions for handling symbol 0, FIC symbols and MSC symbols. */ thread = std::thread(&OfdmDecoder::workerthread, this); } OfdmDecoder::~OfdmDecoder() { running = false; pending_symbols_cv.notify_all(); if (thread.joinable()) { thread.join(); } } void OfdmDecoder::reset() { running = false; pending_symbols_cv.notify_all(); if (thread.joinable()) { thread.join(); } thread = std::thread(&OfdmDecoder::workerthread, this); } /** * The code in the thread executes a simple loop, * waiting for the next symbols and executing the interpretation * operation for that symbols. */ void OfdmDecoder::workerthread() { int currentSym = 0; running = true; while (running) { std::unique_lock lock(mutex); pending_symbols_cv.wait_for(lock, std::chrono::milliseconds(100)); if (currentSym == 0) { constellationPoints.clear(); constellationPoints.reserve( (params.L-1) * params.K / constellationDecimation); } while (num_pending_symbols > 0 && running) { if (currentSym == 0) processPRS(); else decodeDataSymbol(currentSym); currentSym = (currentSym + 1) % (params.L); num_pending_symbols -= 1; if (currentSym == 0) { radioInterface.onConstellationPoints( std::move(constellationPoints)); constellationPoints.clear(); constellationPoints.reserve( (params.L-1) * params.K / constellationDecimation); } } } std::clog << "OFDM-decoder:" << "closing down now" << std::endl; } void OfdmDecoder::pushAllSymbols(std::vector >&& syms) { std::unique_lock lock(mutex); pending_symbols = std::move(syms); num_pending_symbols = pending_symbols.size(); pending_symbols_cv.notify_one(); } /** * handle symbol 0 as collected from the buffer */ void OfdmDecoder::processPRS() { PROFILE(ProcessPRS); memcpy (fft_buffer, pending_symbols[0].data(), params.T_u * sizeof(DSPCOMPLEX)); fft_handler.do_FFT (); /** * The SNR is determined by looking at a segment of bins * within the signal region and bits outside. * It is just an indication */ snr = 0.7 * snr + 0.3 * get_snr(fft_buffer); if (++snrCount > 10) { radioInterface.onSNR(snr); snrCount = 0; } /** * we are now in the frequency domain, and we keep the carriers * as coming from the FFT as phase reference. */ memcpy(phaseReference.data(), fft_buffer, params.T_u * sizeof (DSPCOMPLEX)); } /** * For the other symbols, the first step is to go from * time to frequency domain, to get the carriers. * * \brief decodeDataSymbol * do the transforms and hand over the result to the fichandler or mschandler */ void OfdmDecoder::decodeDataSymbol(int32_t sym_ix) { PROFILE(ProcessSymbol); memcpy (fft_buffer, pending_symbols[sym_ix].data() + T_g, params.T_u * sizeof (DSPCOMPLEX)); //fftlabel: /** * first step: do the FFT */ fft_handler.do_FFT(); /** * a little optimization: we do not interchange the * positive/negative frequencies to their right positions. * The de-interleaving understands this */ PROFILE(Deinterleaver); /** * Note that from here on, we are only interested in the * K useful carriers of the FFT output */ for (int16_t i = 0; i < params.K; i ++) { int16_t index = interleaver.mapIn(i); if (index < 0) index += params.T_u; /** * decoding is computing the phase difference between * carriers with the same index in subsequent symbols. * The carrier of a symbols is the reference for the carrier * on the same position in the next symbols */ const DSPCOMPLEX r1 = fft_buffer[index] * conj (phaseReference[index]); phaseReference[index] = fft_buffer[index]; const DSPFLOAT ab1 = 127.0f / l1_norm(r1); /// split the real and the imaginary part and scale it ibits[i] = -real (r1) * ab1; ibits[params.K + i] = -imag (r1) * ab1; if (i % constellationDecimation == 0) { constellationPoints.push_back(r1); } } if (sym_ix < 4) { PROFILE(FICHandler); ficHandler.processFicBlock(ibits.data(), sym_ix); } else { PROFILE(MSCHandler); mscHandler.processMscBlock(ibits.data(), sym_ix); } PROFILE(SymbolProcessed); } /** * for the snr we have a full T_u wide vector, with in the middle * K carriers. * Just get the strength from the selected carriers compared * to the strength of the carriers outside that region */ int16_t OfdmDecoder::get_snr(DSPCOMPLEX *v) { int16_t i; DSPFLOAT noise = 0; DSPFLOAT signal = 0; const auto T_u = params.T_u; int16_t low = T_u / 2 - params.K / 2; int16_t high = low + params.K; for (i = 10; i < low - 20; i ++) noise += abs (v[(T_u / 2 + i) % T_u]); for (i = high + 20; i < T_u - 10; i ++) noise += abs (v[(T_u / 2 + i) % T_u]); noise /= (low - 30 + T_u - high - 30); for (i = T_u / 2 - params.K / 4; i < T_u / 2 + params.K / 4; i ++) signal += abs (v[(T_u / 2 + i) % T_u]); return get_db_over_256(signal / (params.K / 2)) - get_db_over_256(noise); } welle.io-2.1/src/backend/ofdm-decoder.h000066400000000000000000000055141357201522000177530ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __OFDM_DECODER #define __OFDM_DECODER #include #include #include #include #include #include #include #include "fft.h" #include "dab-constants.h" #include "freq-interleaver.h" #include "radio-controller.h" #include "fic-handler.h" #include "msc-handler.h" class OfdmDecoder { public: OfdmDecoder( const DABParams& p, RadioControllerInterface& mr, FicHandler& ficHandler, MscHandler& mscHandler); ~OfdmDecoder(); void pushAllSymbols(std::vector >&& sym); void reset(); private: int16_t get_snr(DSPCOMPLEX *); const DABParams& params; RadioControllerInterface& radioInterface; FicHandler& ficHandler; MscHandler& mscHandler; std::atomic running = ATOMIC_VAR_INIT(false); std::condition_variable pending_symbols_cv; std::mutex mutex; int num_pending_symbols = 0; std::vector > pending_symbols; std::thread thread; void workerthread(void); void processPRS(); void decodeDataSymbol(int32_t n); int32_t T_g; std::vector phaseReference; fft::Forward fft_handler; DSPCOMPLEX *fft_buffer; FrequencyInterleaver interleaver; std::vector ibits; int16_t snrCount = 0; int16_t snr = 0; const double mer_alpha = 1e-7; std::atomic mer = ATOMIC_VAR_INIT(0.0); public: // Plotting all points is too costly, we decimate the number of points. // The decimation factor should divide K for all transmission modes. static const size_t constellationDecimation = 96; private: std::vector constellationPoints; }; #endif welle.io-2.1/src/backend/ofdm-processor.cpp000066400000000000000000000543041357201522000207210ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "ofdm-processor.h" #include "various/profiling.h" #include // #define SEARCH_RANGE (2 * 36) #define CORRELATION_LENGTH 24 /** * \brief OFDMProcessor * The OFDMProcessor class is the driver of the processing * of the samplestream. * It takes as parameter (a.o) the handler for the * input device as well as the interpreters for * FIC symbols and for MSC symbols. * Local is a class ofdmDecoder that will - as the name suggests - * map samples to bits and that will pass on the bits * to the interpreters for FIC and MSC */ OFDMProcessor::OFDMProcessor( InputInterface& inputInterface, const DABParams& params, RadioControllerInterface& ri, MscHandler& msc, FicHandler& fic, RadioReceiverOptions rro) : radioInterface(ri), input(inputInterface), params(params), ficHandler(fic), decodeTII(rro.decodeTII), tiiDecoder(params, ri), T_null(params.T_null), T_u(params.T_u), T_s(params.T_s), T_F(params.T_F), oscillatorTable(INPUT_RATE), disableCoarseCorrector(rro.disable_coarse_corrector), freqsyncMethod(rro.freqsyncMethod), phaseRef(params, rro.fftPlacementMethod), ofdmDecoder(params, ri, fic, msc), fft_handler(params.T_u), fft_buffer(fft_handler.getVector()) { /** * the class phaseReference will take a number of samples * and indicate - using some threshold - whether there is * a strong correlation or not. * It is used to decide on the first non-null sample * of the frame. * The size of the symbols handed over for inspection * is T_u */ /** * the ofdmDecoder takes time domain samples, will do an FFT, * map the result on (soft) bits and hand over control for handling * the decoded symbols */ for (int i = 0; i < INPUT_RATE; i ++) oscillatorTable[i] = DSPCOMPLEX(cos(2.0 * M_PI * i / INPUT_RATE), sin(2.0 * M_PI * i / INPUT_RATE)); // and for the correlation refArg.resize(CORRELATION_LENGTH); for (int i = 0; i < CORRELATION_LENGTH; i ++) { refArg[i] = arg(phaseRef[(T_u + i) % T_u] * conj(phaseRef[(T_u + i + 1) % T_u])); } correlationVector.resize(SEARCH_RANGE + CORRELATION_LENGTH); } OFDMProcessor::~OFDMProcessor() { running = false; if (threadHandle.joinable()) { threadHandle.join(); } } void OFDMProcessor::start() { std::clog << "OFDM-processor:" << "start" << std::endl; coarseCorrector = 0; fineCorrector = 0; syncBufferIndex = 0; sLevel = 0; localPhase = 0; input.restart(); running = true; threadHandle = std::thread(&OFDMProcessor::run, this); } class InputFailure { }; class NotRunningAnymore { }; /** * \brief getSample * Profiling shows that getting a sample, together * with the frequency shift, is a real performance killer. * we therefore distinguish between getting a single sample * and getting a vector full of samples */ DSPCOMPLEX OFDMProcessor::getSample(int32_t phase) { DSPCOMPLEX temp; if (!running) throw NotRunningAnymore(); /// bufferContent is an indicator for the value of ...->Samples () if (bufferContent == 0) { bufferContent = input.getSamplesToRead (); while ((bufferContent == 0) && running) { if (not input.is_ok()) { throw InputFailure(); } std::this_thread::sleep_for(std::chrono::microseconds(10)); bufferContent = input.getSamplesToRead (); } } if (!running) throw NotRunningAnymore(); // // so here, bufferContent > 0 input.getSamples (&temp, 1); bufferContent --; // // OK, we have a sample!! // first: adjust frequency. We need Hz accuracy localPhase -= phase; localPhase = (localPhase + INPUT_RATE) % INPUT_RATE; temp *= oscillatorTable[localPhase]; sLevel = 0.00001 * l1_norm(temp) + (1 - 0.00001) * sLevel; #define N 5 sampleCnt ++; if (++ sampleCnt > INPUT_RATE / N) { radioInterface.onFrequencyCorrectorChange( fineCorrector, coarseCorrector); sampleCnt = 0; } return temp; } void OFDMProcessor::getSamples(DSPCOMPLEX *v, int16_t n, int32_t phase) { int32_t i; if (!running) throw NotRunningAnymore(); if (n > bufferContent) { bufferContent = input.getSamplesToRead (); while ((bufferContent < n) && running) { if (not input.is_ok()) { throw InputFailure(); } std::this_thread::sleep_for(std::chrono::microseconds(10)); bufferContent = input.getSamplesToRead(); } } if (!running) throw NotRunningAnymore(); // // so here, bufferContent >= n n = input.getSamples (v, n); bufferContent -= n; // OK, we have samples!! // first: adjust frequency. We need Hz accuracy for (i = 0; i < n; i ++) { localPhase -= phase; localPhase = (localPhase + INPUT_RATE) % INPUT_RATE; v[i] *= oscillatorTable[localPhase]; sLevel = 0.00001 * l1_norm(v[i]) + (1 - 0.00001) * sLevel; } sampleCnt += n; if (sampleCnt > INPUT_RATE / N) { radioInterface.onFrequencyCorrectorChange( fineCorrector, coarseCorrector); sampleCnt = 0; } } /*** * \brief run * The main thread, reading samples, * time synchronization and frequency synchronization * Identifying symbols in the DAB frame * and sending them to the ofdmDecoder who will transfer the results * Finally, estimating the small freqency error */ void OFDMProcessor::run() { int32_t startIndex; int32_t i; int32_t counter; float currentStrength; int32_t syncBufferSize = 32768; int32_t syncBufferMask = syncBufferSize - 1; float envBuffer [syncBufferSize]; std::vector ofdmBuffer(params.L * params.T_s); std::vector > allSymbols; /*running = true; fineCorrector = 0; sLevel = 0;*/ try { //Initing: /// first, we need samples to get a reasonable sLevel sLevel = 0; for (i = 0; i < T_F / 2; i ++) { l1_norm(getSample (0)); } notSynced: PROFILE(NotSynced); if (scanMode && ++attempts > 5) { radioInterface.onSignalPresence(false); scanMode = false; attempts = 0; } syncBufferIndex = 0; currentStrength = 0; // read in T_s samples for a next attempt; syncBufferIndex = 0; currentStrength = 0; for (i = 0; i < 50; i ++) { DSPCOMPLEX sample = getSample (0); envBuffer [syncBufferIndex] = l1_norm(sample); currentStrength += envBuffer [syncBufferIndex]; syncBufferIndex ++; } /** * We now have initial values for currentStrength (i.e. the sum * over the last 50 samples) and sLevel, the long term average. */ //SyncOnNull: /** * here we start looking for the null level, i.e. a dip */ counter = 0; radioInterface.onSyncChange(false); while (currentStrength / 50 > 0.50 * sLevel) { DSPCOMPLEX sample = getSample (coarseCorrector + fineCorrector); envBuffer [syncBufferIndex] = l1_norm(sample); // update the levels currentStrength += envBuffer [syncBufferIndex] - envBuffer [(syncBufferIndex - 50) & syncBufferMask]; syncBufferIndex = (syncBufferIndex + 1) & syncBufferMask; counter ++; if (counter > T_F) { // hopeless // fprintf (stderr, "%f %f\n", currentStrength / 50, sLevel); goto notSynced; } } /** * It seemed we found a dip that started app 65/100 * 50 samples earlier. * We now start looking for the end of the null period. */ counter = 0; //SyncOnEndNull: PROFILE(SyncOnEndNull); while (currentStrength / 50 < 0.75 * sLevel) { DSPCOMPLEX sample = getSample (coarseCorrector + fineCorrector); envBuffer [syncBufferIndex] = l1_norm(sample); // update the levels currentStrength += envBuffer [syncBufferIndex] - envBuffer [(syncBufferIndex - 50) & syncBufferMask]; syncBufferIndex = (syncBufferIndex + 1) & syncBufferMask; counter ++; // if (counter > T_null + 50) { // hopeless std::clog << "ofdm-processor: " << "SyncOnEndNull failed" << std::endl; goto notSynced; } } /** * The end of the null period is identified, probably about 40 * samples earlier. */ SyncOnPhase: PROFILE(SyncOnPhase); /** * We now have to find the exact first sample of the non-null period. * We use a correlation that will find the first sample after the * cyclic prefix. * When in "sync", i.e. pretty sure that we know were we are, * we skip the "dip" identification and come here right away. * * now read in Tu samples. The precise number is not really important * as long as we can be sure that the first sample to be identified * is part of the samples read. */ getSamples(ofdmBuffer.data(), T_u, coarseCorrector + fineCorrector); // /// and then, call upon the phase synchronizer to verify/compute /// the real "first" sample startIndex = phaseRef.findIndex(ofdmBuffer.data(), impulseResponseBuffer); PROFILE(FindIndex); radioInterface.onNewImpulseResponse(std::move(impulseResponseBuffer)); impulseResponseBuffer.clear(); if (startIndex < 0) { // no sync, try again std::clog << "ofdm-processor: " << "SyncOnPhase failed" << std::endl; goto notSynced; } if (scanMode) { radioInterface.onSignalPresence(true); scanMode = false; attempts = 0; } /** * Once here, we are synchronized, we need to copy the data we * used for synchronization for the PRS */ memmove(ofdmBuffer.data(), &ofdmBuffer[startIndex], (params.T_u - startIndex) * sizeof (DSPCOMPLEX)); ofdmBufferIndex = params.T_u - startIndex; //Symbol 0: Phase reference symbol symbol /** * Symbol 0 is special in that it is used for fine time synchronization * and its content is used as a reference for decoding the * first data symbol. * We read the missing samples in the ofdm buffer */ radioInterface.onSyncChange(true); getSamples(&ofdmBuffer[ofdmBufferIndex], T_u - ofdmBufferIndex, coarseCorrector + fineCorrector); std::vector prs; if (decodeTII) { prs.resize(T_u); std::copy(ofdmBuffer.begin(), ofdmBuffer.begin() + T_u, prs.begin()); } // Here we look only at the PRS when we need a coarse // frequency synchronization. // The width is limited to 2 * 35 kHz (i.e. positive and negative) // // We inhibit touching the coarse corrector if more than 50% of // FICs had correct CRC, because enabling the coarse corrector during a short // reception glitch might provoke a long delay until it resyncs properly. // As long as some FICs have correct CRC, we assume the coarse corrector cannot // be off. if (!disableCoarseCorrector and ficHandler.getFicDecodeRatioPercent() < 50) { if (!coarseSyncCounter) { std::clog << "ofdm-processor: " << "Lost coarse sync (coarseCorrector: " << lastValidCoarseCorrector << "; fineCorrector: " << lastValidFineCorrector << ")" << std::endl; } coarseSyncCounter++; int correction = processPRS(ofdmBuffer.data()); if (correction != 100) { coarseCorrector += correction * params.carrierDiff; if (abs (coarseCorrector) > kHz(35)) coarseCorrector = 0; } } else { if (coarseSyncCounter) { std::clog << "ofdm-processor: " << "Found sync (coarseCorrector: " << lastValidCoarseCorrector << "; fineCorrector: " << lastValidFineCorrector << " after " << coarseSyncCounter << " frames)" << std::endl; } coarseSyncCounter = 0; lastValidFineCorrector = fineCorrector; lastValidCoarseCorrector = coarseCorrector; } allSymbols.resize(params.L); allSymbols[0] = move(ofdmBuffer); ofdmBuffer.resize(params.L * params.T_s); /** * after symbol 0, we will just read in the other (params.L - 1) symbols */ //Data_symbols: PROFILE(DataSymbols); /** * The first ones are the FIC symbols, followed by all MSC * symbols. We immediately start with building up an average of the * phase difference between the samples in the cyclic prefix and the * corresponding samples in the datapart. */ DSPCOMPLEX FreqCorr = DSPCOMPLEX(0, 0); for (int sym = 1; sym < params.L; sym ++) { auto& buf = allSymbols[sym]; buf.resize(T_s); getSamples(buf.data(), T_s, coarseCorrector + fineCorrector); for (int i = T_u; i < T_s; i ++) FreqCorr += buf[i] * conj(buf[i - T_u]); } PROFILE(PushAllSymbols); ofdmDecoder.pushAllSymbols(move(allSymbols)); //NewOffset: /// we integrate the newly found frequency error with the /// existing frequency error. fineCorrector += 0.1 * arg(FreqCorr) / M_PI * (params.carrierDiff / 2); // /** * OK, here we are at the end of the frame * Assume everything went well and skip T_null samples */ syncBufferIndex = 0; currentStrength = 0; PROFILE(DecodeTII); // The NULL is interesting to save because it carries the TII. std::vector nullSymbol(T_null); getSamples(nullSymbol.data(), T_null, coarseCorrector + fineCorrector); if (decodeTII) { tiiDecoder.pushSymbols(nullSymbol, prs); } PROFILE(OnNewNull); radioInterface.onNewNullSymbol(std::move(nullSymbol)); /** * The first sample to be found for the next frame should be T_g * samples ahead * Here we just check the fineCorrector */ counter = 0; if (fineCorrector > params.carrierDiff / 2) { coarseCorrector += params.carrierDiff; fineCorrector -= params.carrierDiff; } else if (fineCorrector < -params.carrierDiff / 2) { coarseCorrector -= params.carrierDiff; fineCorrector += params.carrierDiff; } //ReadyForNewFrame: /// and off we go, up to the next frame PROFILE_FRAME_DECODED(); goto SyncOnPhase; } catch (const NotRunningAnymore&) { std::clog << "OFDM-processor: closing down" << std::endl; } catch (const InputFailure&) { std::clog << "OFDM-processor: input not ok, closing down" << std::endl; radioInterface.onInputFailure(); } running = false; } void OFDMProcessor::reset() { std::clog << "OFDM-processor: reset (" << running << ")" << std::endl; if (running) { running = false; threadHandle.join(); } start(); } void OFDMProcessor::stop() { running = false; } void OFDMProcessor::resetCoarseCorrector() { coarseCorrector = 0; } void OFDMProcessor::setReceiverOptions(const RadioReceiverOptions rro) { bool need_reset = (disableCoarseCorrector != rro.disable_coarse_corrector); decodeTII = rro.decodeTII; disableCoarseCorrector = rro.disable_coarse_corrector; freqsyncMethod = rro.freqsyncMethod; phaseRef.selectFFTWindowPlacement(rro.fftPlacementMethod); if (need_reset) { reset(); } } void OFDMProcessor::set_scanMode(bool b) { scanMode = b; } #define RANGE 36 int16_t OFDMProcessor::processPRS(DSPCOMPLEX *v) { int16_t i, j, index = 100; memcpy(fft_buffer, v, T_u * sizeof(DSPCOMPLEX)); fft_handler.do_FFT(); switch (freqsyncMethod) { case FreqsyncMethod::GetMiddle: return getMiddle(fft_buffer); case FreqsyncMethod::CorrelatePRS: { // The "best" approach for computing the coarse frequency // offset is to look at the spectrum of symbol 0 and relate that // with the spectrum as it should be, i.e. the refTable // However, since there might be // a pretty large phase offset between the incoming data and // the reference table data, we correlate the // phase differences between the subsequent carriers rather // than the values in the segments themselves. // It seems to work pretty well // // The phase differences are computed once for (i = 0; i < SEARCH_RANGE + CORRELATION_LENGTH; i ++) { int16_t baseIndex = T_u - SEARCH_RANGE / 2 + i; correlationVector[i] = arg(fft_buffer[baseIndex % T_u] * conj(fft_buffer[(baseIndex + 1) % T_u])); } float MMax = 0; for (i = 0; i < SEARCH_RANGE; i ++) { float sum = 0; for (j = 0; j < CORRELATION_LENGTH; j ++) { sum += abs(refArg [j] * correlationVector[i + j]); if (sum > MMax) { MMax = sum; index = i; } } } // Now map the index back to the right carrier return T_u - SEARCH_RANGE / 2 + index - T_u; } case FreqsyncMethod::PatternOfZeros: { // An alternative way is to look at a special pattern consisting // of zeros in the row of args between successive carriers. float Mmin = 1000; for (i = T_u - SEARCH_RANGE / 2; i < T_u + SEARCH_RANGE / 2; i ++) { float a1 = abs (abs (arg (fft_buffer [(i + 1) % T_u] * conj (fft_buffer [(i + 2) % T_u])) / M_PI) - 1); float a2 = abs (abs (arg (fft_buffer [(i + 2) % T_u] * conj (fft_buffer [(i + 3) % T_u])) / M_PI) - 1); float a3 = abs (arg (fft_buffer [(i + 3) % T_u] * conj (fft_buffer [(i + 4) % T_u]))); float a4 = abs (arg (fft_buffer [(i + 4) % T_u] * conj (fft_buffer [(i + 5) % T_u]))); float a5 = abs (arg (fft_buffer [(i + 5) % T_u] * conj (fft_buffer [(i + 6) % T_u]))); float b1 = abs (abs (arg (fft_buffer [(i + 16 + 1) % T_u] * conj (fft_buffer [(i + 16 + 3) % T_u])) / M_PI) - 1); float b2 = abs (arg (fft_buffer [(i + 16 + 3) % T_u] * conj (fft_buffer [(i + 16 + 4) % T_u]))); float b3 = abs (arg (fft_buffer [(i + 16 + 4) % T_u] * conj (fft_buffer [(i + 16 + 5) % T_u]))); float b4 = abs (arg (fft_buffer [(i + 16 + 5) % T_u] * conj (fft_buffer [(i + 16 + 6) % T_u]))); float sum = a1 + a2 + a3 + a4 + a5 + b1 + b2 + b3 + b4; if (sum < Mmin) { Mmin = sum; index = i; } } return index - T_u; } } throw std::logic_error("Unimplemented freqsyncMethod"); } int16_t OFDMProcessor::getMiddle (DSPCOMPLEX *v) { int16_t i; DSPFLOAT sum = 0; int16_t maxIndex = 0; DSPFLOAT oldMax = 0; // // basic sum over K carriers that are - most likely - // in the range // The range in which the carrier should be is // T_u / 2 - K / 2 .. T_u / 2 + K / 2 // We first determine an initial sum over params.K carriers for (i = 40; i < params.K + 40; i ++) sum += abs (v [(T_u / 2 + i) % T_u]); // // Now a moving sum, look for a maximum within a reasonable // range (around (T_u - K) / 2, the start of the useful frequencies) for (i = 40; i < T_u - (params.K - 40); i ++) { sum -= abs (v [(T_u / 2 + i) % T_u]); sum += abs (v [(T_u / 2 + i + params.K) % T_u]); if (sum > oldMax) { sum = oldMax; maxIndex = i; } } return maxIndex - (T_u - params.K) / 2; } welle.io-2.1/src/backend/ofdm-processor.h000066400000000000000000000072101357201522000203600ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __OFDM_PROCESSOR__ #define __OFDM_PROCESSOR__ #include "dab-constants.h" #include #include #include #include "phasereference.h" #include "ofdm-decoder.h" #include "tii-decoder.h" #include "virtual_input.h" #include "fft.h" #include "radio-controller.h" #include "radio-receiver-options.h" #include "fic-handler.h" #include "msc-handler.h" class OFDMProcessor { // Identifier "interface" is already defined in the w32api header basetype.h public: OFDMProcessor(InputInterface& inputInterface, const DABParams& params, RadioControllerInterface& ri, MscHandler& msc, FicHandler& fic, RadioReceiverOptions rro); ~OFDMProcessor(); void reset(); void stop(); void resetCoarseCorrector(); void setReceiverOptions(const RadioReceiverOptions rro); void set_scanMode(bool); void start(); private: std::thread threadHandle; int32_t syncBufferIndex = 0; RadioControllerInterface& radioInterface; InputInterface& input; const DABParams& params; FicHandler& ficHandler; std::vector impulseResponseBuffer; bool decodeTII; TIIDecoder tiiDecoder; std::atomic running = ATOMIC_VAR_INIT(false); int32_t T_null; int32_t T_u; int32_t T_s; int32_t T_F; int32_t coarseSyncCounter = 0; std::vector oscillatorTable; int32_t localPhase = 0; float sLevel = 0; int32_t sampleCnt = 0; int16_t lastValidFineCorrector = 0; int32_t lastValidCoarseCorrector = 0; int16_t fineCorrector = 0; int32_t coarseCorrector = 0; bool disableCoarseCorrector; FreqsyncMethod freqsyncMethod; uint32_t ofdmBufferIndex = 0; PhaseReference phaseRef; OfdmDecoder ofdmDecoder; std::vector correlationVector; std::vector refArg; bool scanMode = false; int attempts = 0; int32_t bufferContent = 0; fft::Forward fft_handler; DSPCOMPLEX *fft_buffer; // of size T_u DSPCOMPLEX getSample(int32_t); void getSamples(DSPCOMPLEX *, int16_t, int32_t); void run(void); int16_t processPRS(DSPCOMPLEX *v); int16_t getMiddle(DSPCOMPLEX *); }; #endif welle.io-2.1/src/backend/pad_decoder.cpp000066400000000000000000000257031357201522000202110ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2019 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "pad_decoder.h" // --- XPAD_CI ----------------------------------------------------------------- const size_t XPAD_CI::lens[] = {4, 6, 8, 12, 16, 24, 32, 48}; // --- PADDecoder ----------------------------------------------------------------- void PADDecoder::Reset() { mot_app_type = -1; last_xpad_ci.Reset(); dl_decoder.Reset(); dgli_decoder.Reset(); mot_decoder.Reset(); mot_manager.Reset(); } void PADDecoder::Process(const uint8_t *xpad_data, size_t xpad_len, bool exact_xpad_len, const uint8_t* fpad_data) { // undo reversed byte order + trim long MP2 frames size_t used_xpad_len = std::min(xpad_len, sizeof(xpad)); for(size_t i = 0; i < used_xpad_len; i++) xpad[i] = xpad_data[xpad_len - 1 - i]; xpad_cis_t xpad_cis; size_t xpad_cis_len = -1; int fpad_type = fpad_data[0] >> 6; int xpad_ind = (fpad_data[0] & 0x30) >> 4; bool ci_flag = fpad_data[1] & 0x02; XPAD_CI prev_xpad_ci = last_xpad_ci; last_xpad_ci.Reset(); // build CI list if(fpad_type == 0b00) { if(ci_flag) { switch(xpad_ind) { case 0b01: { // short X-PAD if(xpad_len < 1) return; int type = xpad[0] & 0x1F; // skip end marker if(type != 0x00) { xpad_cis_len = 1; xpad_cis.emplace_back(3, type); } break; } case 0b10: // variable size X-PAD xpad_cis_len = 0; for(size_t i = 0; i < 4; i++) { if(xpad_len < i + 1) return; uint8_t ci_raw = xpad[i]; xpad_cis_len++; // break on end marker if((ci_raw & 0x1F) == 0x00) break; xpad_cis.emplace_back(ci_raw); } break; } } else { switch(xpad_ind) { case 0b01: // short X-PAD case 0b10: // variable size X-PAD // if there is a previous CI, append it if(prev_xpad_ci.type != -1) { xpad_cis_len = 0; xpad_cis.push_back(prev_xpad_ci); } break; } } } // fprintf(stderr, "PADDecoder: -----\n"); if(xpad_cis.empty()) { /* The CI list may be omitted if the (last) subfield of the X-PAD of the * previous frame/AU is continued (see §7.4.2.1f in ETSI EN 300 401). * However there are PAD encoders which wrongly assume that "previous" * only takes frames/AUs containing X-PAD into account. * This non-compliant encoding can generously be addressed by still * keeping the necessary CI info. */ if(loose) last_xpad_ci = prev_xpad_ci; return; } size_t announced_xpad_len = xpad_cis_len; for(const XPAD_CI& xpad_ci : xpad_cis) announced_xpad_len += xpad_ci.len; // abort, if the announced X-PAD len exceeds the available one if(announced_xpad_len > xpad_len) return; if(exact_xpad_len && !loose && announced_xpad_len < xpad_len) { /* If the announced X-PAD len falls below the available one (which can * only happen with DAB+), a decoder shall discard the X-PAD (see §5.4.3 * in ETSI TS 102 563). * This behaviour can be disabled in order to process the X-PAD anyhow. */ observer->PADLengthError(announced_xpad_len, xpad_len); return; } // process CIs size_t xpad_offset = xpad_cis_len; int xpad_ci_type_continued = -1; for(const XPAD_CI& xpad_ci : xpad_cis) { // len only valid for the *immediate* next data group after the DGLI! size_t dgli_len = dgli_decoder.GetDGLILen(); // handle Data Subfield switch(xpad_ci.type) { case 1: // Data Group Length Indicator dgli_decoder.ProcessDataSubfield(ci_flag, xpad + xpad_offset, xpad_ci.len); xpad_ci_type_continued = 1; break; case 2: // Dynamic Label segment (start) case 3: // Dynamic Label segment (continuation) // if new label available, append it if(dl_decoder.ProcessDataSubfield(xpad_ci.type == 2, xpad + xpad_offset, xpad_ci.len)) observer->PADChangeDynamicLabel(dl_decoder.GetLabel()); xpad_ci_type_continued = 3; break; default: // MOT, X-PAD data group (start/continuation) if(mot_app_type != -1 && (xpad_ci.type == mot_app_type || xpad_ci.type == mot_app_type + 1)) { bool start = xpad_ci.type == mot_app_type; if(start) mot_decoder.SetLen(dgli_len); // if new Data Group available, append it if(mot_decoder.ProcessDataSubfield(start, xpad + xpad_offset, xpad_ci.len)) { // if new slide available, show it if(mot_manager.HandleMOTDataGroup(mot_decoder.GetMOTDataGroup())) { const MOT_FILE new_slide = mot_manager.GetFile(); // check file type bool show_slide = true; if(new_slide.content_type != MOT_FILE::CONTENT_TYPE_IMAGE) show_slide = false; switch(new_slide.content_sub_type) { case MOT_FILE::CONTENT_SUB_TYPE_JFIF: case MOT_FILE::CONTENT_SUB_TYPE_PNG: break; default: show_slide = false; } if(show_slide) observer->PADChangeSlide(new_slide); } } xpad_ci_type_continued = mot_app_type + 1; } break; } // fprintf(stderr, "PADDecoder: Data Subfield: type: %2d, len: %2zu\n", it->type, it->len); xpad_offset += xpad_ci.len; } // set last CI last_xpad_ci.len = xpad_offset; last_xpad_ci.type = xpad_ci_type_continued; } // --- DataGroup ----------------------------------------------------------------- DataGroup::DataGroup(size_t dg_size_max) { dg_raw.resize(dg_size_max); Reset(); } void DataGroup::Reset() { dg_size = 0; dg_size_needed = GetInitialNeededSize(); } bool DataGroup::ProcessDataSubfield(bool start, const uint8_t *data, size_t len) { if(start) { Reset(); } else { // ignore Data Group continuation without previous start if(dg_size == 0) return false; } // abort, if needed size already reached (except needed size not yet set) if(dg_size >= dg_size_needed) return false; // abort, if maximum size already reached if(dg_size == dg_raw.size()) return false; // append Data Subfield size_t copy_len = dg_raw.size() - dg_size; if(len < copy_len) copy_len = len; memcpy(&dg_raw[dg_size], data, copy_len); dg_size += copy_len; // abort, if needed size not yet reached if(dg_size < dg_size_needed) return false; return DecodeDataGroup(); } bool DataGroup::EnsureDataGroupSize(size_t desired_dg_size) { dg_size_needed = desired_dg_size; return dg_size >= dg_size_needed; } bool DataGroup::CheckCRC(size_t len) { // ensure needed size reached if(dg_size < len + CalcCRC::CRCLen) return false; uint16_t crc_stored = dg_raw[len] << 8 | dg_raw[len + 1]; uint16_t crc_calced = CalcCRC::CalcCRC_CRC16_CCITT.Calc(&dg_raw[0], len); return crc_stored == crc_calced; } // --- DGLIDecoder ----------------------------------------------------------------- void DGLIDecoder::Reset() { DataGroup::Reset(); dgli_len = 0; } bool DGLIDecoder::DecodeDataGroup() { // abort on invalid CRC if(!CheckCRC(2)) { DataGroup::Reset(); return false; } dgli_len = (dg_raw[0] & 0x3F) << 8 | dg_raw[1]; DataGroup::Reset(); // fprintf(stderr, "DGLIDecoder: dgli_len: %5zu\n", dgli_len); return true; } size_t DGLIDecoder::GetDGLILen() { size_t result = dgli_len; dgli_len = 0; return result; } // --- DynamicLabelDecoder ----------------------------------------------------------------- void DynamicLabelDecoder::Reset() { DataGroup::Reset(); dl_sr.Reset(); label.Reset(); } bool DynamicLabelDecoder::DecodeDataGroup() { bool command = dg_raw[0] & 0x10; size_t field_len = 0; bool cmd_remove_label = false; // handle command/segment if(command) { switch(dg_raw[0] & 0x0F) { case 0x01: // remove label cmd_remove_label = true; break; default: // ignore command DataGroup::Reset(); return false; } } else { field_len = (dg_raw[0] & 0x0F) + 1; } size_t real_len = 2 + field_len; if(!EnsureDataGroupSize(real_len + CalcCRC::CRCLen)) return false; // abort on invalid CRC if(!CheckCRC(real_len)) { DataGroup::Reset(); return false; } // on Remove Label command, display empty label if(cmd_remove_label) { label.Reset(); return true; } // create new segment DL_SEG dl_seg; memcpy(dl_seg.prefix, &dg_raw[0], 2); dl_seg.chars.insert(dl_seg.chars.begin(), dg_raw.begin() + 2, dg_raw.begin() + 2 + field_len); DataGroup::Reset(); // fprintf(stderr, "DynamicLabelDecoder: segnum %d, toggle: %s, chars_len: %2d%s\n", dl_seg.SegNum(), dl_seg.Toggle() ? "Y" : "N", dl_seg.chars.size(), dl_seg.Last() ? " [LAST]" : ""); // try to add segment if(!dl_sr.AddSegment(dl_seg)) return false; // append new label label.raw = dl_sr.label_raw; label.charset = dl_sr.dl_segs[0].prefix[1] >> 4; return true; } // --- DL_SEG_REASSEMBLER ----------------------------------------------------------------- void DL_SEG_REASSEMBLER::Reset() { dl_segs.clear(); label_raw.clear(); } bool DL_SEG_REASSEMBLER::AddSegment(DL_SEG &dl_seg) { dl_segs_t::const_iterator it; // if there are already segments with other toggle value in cache, first clear it it = dl_segs.cbegin(); if(it != dl_segs.cend() && it->second.Toggle() != dl_seg.Toggle()) dl_segs.clear(); // if the segment is already there, abort it = dl_segs.find(dl_seg.SegNum()); if(it != dl_segs.cend()) return false; // add segment dl_segs[dl_seg.SegNum()] = dl_seg; // check for complete label return CheckForCompleteLabel(); } bool DL_SEG_REASSEMBLER::CheckForCompleteLabel() { dl_segs_t::const_iterator it; // check if all segments are in cache int segs = 0; for(int i = 0; i < 8; i++) { it = dl_segs.find(i); if(it == dl_segs.cend()) return false; segs++; if(it->second.Last()) break; if(i == 7) return false; } // append complete label label_raw.clear(); for(int i = 0; i < segs; i++) label_raw.insert(label_raw.end(), dl_segs[i].chars.begin(), dl_segs[i].chars.end()); // std::string label((const char*) &label_raw[0], label_raw.size()); // fprintf(stderr, "DL_SEG_REASSEMBLER: new label: '%s'\n", label.c_str()); return true; } // --- MOTDecoder ----------------------------------------------------------------- void MOTDecoder::Reset() { DataGroup::Reset(); mot_len = 0; } bool MOTDecoder::DecodeDataGroup() { // ignore too short lens if(mot_len < CalcCRC::CRCLen) return false; // only DGs with CRC are supported here! // abort on invalid CRC if(!CheckCRC(mot_len - CalcCRC::CRCLen)) { DataGroup::Reset(); return false; } DataGroup::Reset(); // fprintf(stderr, "MOTDecoder: mot_len: %5zu\n", mot_len); return true; } std::vector MOTDecoder::GetMOTDataGroup() { std::vector result(mot_len); memcpy(&result[0], &dg_raw[0], mot_len); return result; } welle.io-2.1/src/backend/pad_decoder.h000066400000000000000000000117361357201522000176570ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2019 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef PAD_DECODER_H_ #define PAD_DECODER_H_ #include #include #include #include #include #include #include #include "mot_manager.h" #include "tools.h" // --- DL_SEG ----------------------------------------------------------------- struct DL_SEG { uint8_t prefix[2]; std::vector chars; bool Toggle() const {return prefix[0] & 0x80;} bool First() const {return prefix[0] & 0x40;} bool Last() const {return prefix[0] & 0x20;} int SegNum() const {return First() ? 0 : ((prefix[1] & 0x70) >> 4);} }; // --- DataGroup ----------------------------------------------------------------- class DataGroup { protected: std::vector dg_raw; size_t dg_size; size_t dg_size_needed; virtual size_t GetInitialNeededSize() {return 0;} virtual bool DecodeDataGroup() = 0; bool EnsureDataGroupSize(size_t desired_dg_size); bool CheckCRC(size_t len); void Reset(); public: DataGroup(size_t dg_size_max); virtual ~DataGroup() {} bool ProcessDataSubfield(bool start, const uint8_t *data, size_t len); }; // --- DGLIDecoder ----------------------------------------------------------------- class DGLIDecoder : public DataGroup { private: size_t dgli_len; size_t GetInitialNeededSize() {return 2 + CalcCRC::CRCLen;} // DG len + CRC bool DecodeDataGroup(); public: DGLIDecoder() : DataGroup(2 + CalcCRC::CRCLen) {Reset();} void Reset(); size_t GetDGLILen(); }; typedef std::map dl_segs_t; // --- DL_SEG_REASSEMBLER ----------------------------------------------------------------- struct DL_SEG_REASSEMBLER { dl_segs_t dl_segs; std::vector label_raw; bool AddSegment(DL_SEG &dl_seg); bool CheckForCompleteLabel(); void Reset(); }; // --- DL_STATE ----------------------------------------------------------------- struct DL_STATE { std::vector raw; int charset; DL_STATE() {Reset();} void Reset() { raw.clear(); charset = -1; } }; // --- DynamicLabelDecoder ----------------------------------------------------------------- class DynamicLabelDecoder : public DataGroup { private: DL_SEG_REASSEMBLER dl_sr; DL_STATE label; size_t GetInitialNeededSize() {return 2 + CalcCRC::CRCLen;} // at least prefix + CRC bool DecodeDataGroup(); public: DynamicLabelDecoder() : DataGroup(2 + 16 + CalcCRC::CRCLen) {Reset();} void Reset(); DL_STATE GetLabel() {return label;} }; // --- MOTDecoder ----------------------------------------------------------------- class MOTDecoder : public DataGroup { private: size_t mot_len; size_t GetInitialNeededSize() {return mot_len;} // MOT len + CRC (or zero!) bool DecodeDataGroup(); public: MOTDecoder() : DataGroup(16384) {Reset();} // = 2^14 void Reset(); void SetLen(size_t mot_len) {this->mot_len = mot_len;} std::vector GetMOTDataGroup(); }; // --- XPAD_CI ----------------------------------------------------------------- struct XPAD_CI { size_t len; int type; static const size_t lens[]; XPAD_CI() {Reset();} XPAD_CI(uint8_t ci_raw) { len = lens[ci_raw >> 5]; type = ci_raw & 0x1F; } XPAD_CI(size_t len, int type) : len(len), type(type) {} void Reset() { len = 0; type = -1; } }; typedef std::list xpad_cis_t; // --- PADDecoderObserver ----------------------------------------------------------------- class PADDecoderObserver { public: virtual ~PADDecoderObserver() {} virtual void PADChangeDynamicLabel(const DL_STATE& /*dl*/) {} virtual void PADChangeSlide(const MOT_FILE& /*slide*/) {} virtual void PADLengthError(size_t /*announced_xpad_len*/, size_t /*xpad_len*/) {} }; // --- PADDecoder ----------------------------------------------------------------- class PADDecoder { private: PADDecoderObserver *observer; bool loose; std::atomic mot_app_type; uint8_t xpad[196]; // longest possible X-PAD XPAD_CI last_xpad_ci; DynamicLabelDecoder dl_decoder; DGLIDecoder dgli_decoder; MOTDecoder mot_decoder; MOTManager mot_manager; public: PADDecoder(PADDecoderObserver *observer, bool loose) : observer(observer), loose(loose), mot_app_type(-1) {} void SetMOTAppType(int mot_app_type) {this-> mot_app_type = mot_app_type;} void Process(const uint8_t *xpad_data, size_t xpad_len, bool exact_xpad_len, const uint8_t* fpad_data); void Reset(); }; #endif /* PAD_DECODER_H_ */ welle.io-2.1/src/backend/phasereference.cpp000066400000000000000000000201111357201522000207230ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "phasereference.h" #include "string.h" #include #include #include /** * \class phaseReference * Implements the correlation that is used to identify * the "first" element (following the cyclic prefix) of * the first non-null block of a frame * The class inherits from the phaseTable. */ PhaseReference::PhaseReference(const DABParams& p, FFTPlacementMethod fft_placement_method) : PhaseTable(p.dabMode), fft_placement(fft_placement_method), fft_processor(p.T_u), res_processor(p.T_u) { DSPFLOAT phi_k; refTable.resize(p.T_u); fft_buffer = fft_processor.getVector(); res_buffer = res_processor.getVector(); for (int i = 1; i <= p.K / 2; i ++) { phi_k = get_Phi(i); refTable[i] = DSPCOMPLEX(cos(phi_k), sin(phi_k)); phi_k = get_Phi(-i); refTable[p.T_u - i] = DSPCOMPLEX(cos(phi_k), sin(phi_k)); } } DSPCOMPLEX PhaseReference::operator[](size_t ix) { return refTable.at(ix); } void PhaseReference::selectFFTWindowPlacement(FFTPlacementMethod new_fft_placement) { fft_placement = new_fft_placement; } /** * \brief findIndex * the vector v contains "Tu" samples that are believed to * belong to the first non-null block of a DAB frame. * We correlate the data in this vector with the predefined * data, and if the maximum exceeds a threshold value, * we believe that that indicates the first sample we were * looking for. */ int32_t PhaseReference::findIndex(DSPCOMPLEX *v, std::vector& impulseResponseBuffer) { int32_t maxIndex = -1; float sum = 0; size_t Tu = refTable.size(); memcpy(fft_buffer, v, Tu * sizeof(DSPCOMPLEX)); fft_processor.do_FFT(); // back into the frequency domain, now correlate for (size_t i = 0; i < Tu; i++) res_buffer[i] = fft_buffer[i] * conj(refTable[i]); // and, again, back into the time domain res_processor.do_IFFT(); impulseResponseBuffer.resize(Tu); switch (fft_placement) { case FFTPlacementMethod::StrongestPeak: { const float threshold = 3; /** * We compute the average signal value ... */ for (size_t i = 0; i < Tu; i++) sum += abs(res_buffer[i]); DSPFLOAT max = -10000; for (size_t i = 0; i < Tu; i++) { const float value = abs(res_buffer[i]); impulseResponseBuffer[i] = value; if (value > max) { maxIndex = i; max = value; } } /** * that gives us a basis for defining the threshold */ if (max < threshold * sum / Tu) return -std::abs(max * Tu / sum) - 1; else return maxIndex; } case FFTPlacementMethod::EarliestPeakWithBinning: { /* Calculate peaks over bins of 25 samples, keep the * 4 bins with the highest peaks, take the index from the peak * in the earliest bin, but not any earlier than 500 samples. * * Goal: avoid that the receiver locks onto the strongest peak * in case earlier peaks are present. * See https://tech.ebu.ch/docs/techreports/tr024.pdf part 2.4 * for more details. */ using namespace std; struct peak_t { int index = -1; float value = 0; }; vector bins; float mean = 0; constexpr int bin_size = 20; constexpr size_t num_bins_to_keep = 4; for (size_t i = 0; i + bin_size < Tu; i += bin_size) { peak_t peak; for (size_t j = 0; j < bin_size; j++) { const float value = abs(res_buffer[i + j]); mean += value; impulseResponseBuffer[i + j] = value; if (value > peak.value) { peak.value = value; peak.index = i + j; } } bins.push_back(move(peak)); } mean /= Tu; if (bins.size() < num_bins_to_keep) { throw logic_error("Sync err, not enough bins"); } // Sort bins by highest peak sort(bins.begin(), bins.end(), [&](const peak_t& lhs, const peak_t& rhs) { return lhs.value > rhs.value; }); // Keep only bins that are not too far from highest peak const int peak_index = bins.front().index; constexpr int max_subpeak_distance = 500; bins.erase( remove_if(bins.begin(), bins.end(), [&](const peak_t& p) { return abs(p.index - peak_index) > max_subpeak_distance; }), bins.end()); if (bins.size() > num_bins_to_keep) { bins.resize(num_bins_to_keep); } const auto thresh = 3 * mean; // Keep only bins where the peak is above the threshold bins.erase( remove_if(bins.begin(), bins.end(), [&](const peak_t& p) { return p.value < thresh; }), bins.end()); if (bins.empty()) { return -1; } else { // Take first bin const auto earliest_bin = min_element(bins.begin(), bins.end(), [&](const peak_t& lhs, const peak_t& rhs) { return lhs.index < rhs.index; }); return earliest_bin->index; } } case FFTPlacementMethod::ThresholdBeforePeak: { using namespace std; for (size_t i = 0; i < Tu; i++) { const float v = abs(res_buffer[i]); impulseResponseBuffer[i] = v; sum += v; } const size_t windowsize = 100; vector peak_averages(Tu); float global_max = -10000; for (size_t i = 0; i + windowsize < Tu; i++) { float max = -10000; for (size_t j = 0; j < windowsize; j++) { const float value = impulseResponseBuffer[i + j]; if (value > max) { max = value; } } peak_averages[i] = max; if (max > global_max) { global_max = max; } } // First verify that there is a peak const float required_peak_over_average = 3; if (global_max > required_peak_over_average * sum / Tu) { const float thresh = global_max / 2; for (size_t i = 0; i + windowsize < Tu; i++) { if (peak_averages[i + windowsize] > thresh) { return i; } } } return -1; } } throw std::logic_error("Unhandled FFTPlacementMethod"); } welle.io-2.1/src/backend/phasereference.h000066400000000000000000000033271357201522000204020ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __PHASEREFERENCE #define __PHASEREFERENCE #include "fft.h" #include #include #include #include #include "phasetable.h" #include "dab-constants.h" #include "radio-receiver-options.h" class PhaseReference : public PhaseTable { public: PhaseReference(const DABParams& p, FFTPlacementMethod fft_placement_method); int32_t findIndex(DSPCOMPLEX *v, std::vector& impulseResponseBuffer); DSPCOMPLEX operator[](size_t ix); void selectFFTWindowPlacement(FFTPlacementMethod new_fft_placement); private: std::vector refTable; FFTPlacementMethod fft_placement; fft::Forward fft_processor; DSPCOMPLEX *fft_buffer; fft::Backward res_processor; DSPCOMPLEX *res_buffer; }; #endif welle.io-2.1/src/backend/phasetable.cpp000066400000000000000000000115731357201522000200700ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "phasetable.h" static const PhasetableElement modeI_table[] = { {-768, -737, 0, 1}, {-736, -705, 1, 2}, {-704, -673, 2, 0}, {-672, -641, 3, 1}, {-640, -609, 0, 3}, {-608, -577, 1, 2}, {-576, -545, 2, 2}, {-544, -513, 3, 3}, {-512, -481, 0, 2}, {-480, -449, 1, 1}, {-448, -417, 2, 2}, {-416, -385, 3, 3}, {-384, -353, 0, 1}, {-352, -321, 1, 2}, {-320, -289, 2, 3}, {-288, -257, 3, 3}, {-256, -225, 0, 2}, {-224, -193, 1, 2}, {-192, -161, 2, 2}, {-160, -129, 3, 1}, {-128, -97, 0, 1}, {-96, -65, 1, 3}, {-64, -33, 2, 1}, {-32, -1, 3, 2}, { 1, 32, 0, 3}, { 33, 64, 3, 1}, { 65, 96, 2, 1}, // { 97, 128, 2, 1}, found bug 2014-09-03 Jorgen Scott { 97, 128, 1, 1}, { 129, 160, 0, 2}, { 161, 192, 3, 2}, { 193, 224, 2, 1}, { 225, 256, 1, 0}, { 257, 288, 0, 2}, { 289, 320, 3, 2}, { 321, 352, 2, 3}, { 353, 384, 1, 3}, { 385, 416, 0, 0}, { 417, 448, 3, 2}, { 449, 480, 2, 1}, { 481, 512, 1, 3}, { 513, 544, 0, 3}, { 545, 576, 3, 3}, { 577, 608, 2, 3}, { 609, 640, 1, 0}, { 641, 672, 0, 3}, { 673, 704, 3, 0}, { 705, 736, 2, 1}, { 737, 768, 1, 1}, { -1000, -1000, 0, 0} }; static const PhasetableElement modeII_table[] = { {-192, -161, 0, 2}, {-160, -129, 1, 3}, {-128, -97, 2, 2}, {-96, -65, 3, 2}, {-64, -33, 0, 1}, {-32, -1, 1, 2}, {1, 32, 2, 0}, {33, 64, 1, 2}, {65, 96, 0, 2}, {97, 128, 3, 1}, {129, 160, 2, 0}, {161, 192, 1, 3}, {-1000, -1000, 0, 0} }; static const PhasetableElement modeIV_table[] = { {-384, -353, 0, 0}, {-352, -321, 1, 1}, {-320, -289, 2, 1}, {-288, -257, 3, 2}, {-256, -225, 0, 2}, {-224, -193, 1, 2}, {-192, -161, 2, 0}, {-160, -129, 3, 3}, {-128, -97, 0, 3}, {-96, -65, 1, 1}, {-64, -33, 2, 3}, {-32, -1, 3, 2}, { 1, 32, 0, 0}, { 33, 64, 3, 1}, { 65, 96, 2, 0}, { 97, 128, 1, 2}, { 129, 160, 0, 0}, { 161, 192, 3, 1}, { 193, 224, 2, 2}, { 225, 256, 1, 2}, { 257, 288, 0, 2}, { 289, 320, 3, 1}, { 321, 352, 2, 3}, { 353, 384, 1, 0}, {-1000, -1000, 0, 0} }; PhaseTable::PhaseTable(int16_t transmission_mode) : mode(transmission_mode) { switch (mode) { case 1: currentTable = modeI_table; break; case 2: currentTable = modeII_table; break; case 4: currentTable = modeIV_table; break; default: throw std::runtime_error("Invalid mode selected"); } } static const int8_t h0[] = { 0, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1, 0, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 2, 2, 1, 1}; static const int8_t h1[] = { 0, 3, 2, 3, 0, 1, 3, 0, 2, 1, 2, 3, 2, 3, 3, 0, 0, 3, 2, 3, 0, 1, 3, 0, 2, 1, 2, 3, 2, 3, 3, 0}; static const int8_t h2[] = { 0, 0, 0, 2, 0, 2, 1, 3, 2, 2, 0, 2, 2, 0, 1, 3, 0, 0, 0, 2, 0, 2, 1, 3, 2, 2, 0, 2, 2, 0, 1, 3}; static const int8_t h3[] = { 0, 1, 2, 1, 0, 3, 3, 2, 2, 3, 2, 1, 2, 1, 3, 2, 0, 1, 2, 1, 0, 3, 3, 2, 2, 3, 2, 1, 2, 1, 3, 2}; int32_t PhaseTable::h_table(int32_t i, int32_t j) { switch (i) { case 0: return h0[j]; case 1: return h1[j]; case 2: return h2[j]; case 3: return h3[j]; default: throw std::logic_error("Invalid i in h_table"); } } DSPFLOAT PhaseTable::get_Phi(int32_t k) { for (int j = 0; currentTable[j].kmin != -1000; j++) { if ((currentTable[j].kmin <= k) && (k <= currentTable[j].kmax)) { int k_prime = currentTable[j].kmin; int i = currentTable[j].i; int n = currentTable[j].n; return M_PI / 2.0f * (h_table(i, k - k_prime) + n); } } throw std::logic_error("Invalid k in get_Phi"); } welle.io-2.1/src/backend/phasetable.h000066400000000000000000000025051357201522000175300ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __PHASE_TABLE #define __PHASE_TABLE #include #include #include "dab-constants.h" struct PhasetableElement { int32_t kmin, kmax; int32_t i; int32_t n; }; class PhaseTable { public: PhaseTable(int16_t transmission_mode); DSPFLOAT get_Phi(int32_t); private: const PhasetableElement *currentTable; int16_t mode; int32_t h_table(int32_t i, int32_t j); }; #endif welle.io-2.1/src/backend/protTables.cpp000066400000000000000000000057261357201522000201020ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "protTables.h" static const int8_t p_codes[24][32] = { { 1,1,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0},// 1 { 1,1,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0},// 2 { 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0},// 3 { 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0},// 4 { 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,0,0},// 5 { 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,0,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,0,0,0},// 6 { 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,0,0,0},// 7 { 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0},// 8 { 1,1,1,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,0,0},// 9 { 1,1,1,0, 1,1,0,0, 1,1,0,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,0,0, 1,1,0,0},// 10 { 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,0,0, 1,1,0,0},// 11 { 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0},// 12 { 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,0,0},// 13 { 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,0,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,0,0},// 14 { 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,0,0},// 15 { 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0},// 16 { 1,1,1,1, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,0},// 17 { 1,1,1,1, 1,1,1,0, 1,1,1,0, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,0, 1,1,1,0},// 18 { 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,0, 1,1,1,0},// 19 { 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0},// 20 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,0},// 21 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0},// 22 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,0},// 23 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1} // 24 }; const int8_t *getPCodes(int16_t x) { return p_codes[x]; } welle.io-2.1/src/backend/protTables.h000066400000000000000000000017411357201522000175400ustar00rootroot00000000000000/* * * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef PROTTABLES #define PROTTABLES #include const int8_t *getPCodes(int16_t); #endif welle.io-2.1/src/backend/protection.h000066400000000000000000000023051357201522000176040ustar00rootroot00000000000000/* * Copyright (C) 2017 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * Simple base class for combining uep and eep deconvolvers */ #ifndef __PROTECTION #define __PROTECTION #include #include "dab-constants.h" extern uint8_t PI_X[]; class Protection { public: virtual ~Protection() = default; virtual bool deconvolve(const softbit_t *, int32_t, uint8_t *) = 0; }; #endif welle.io-2.1/src/backend/radio-controller.h000066400000000000000000000161411357201522000207000ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef RADIOCONTROLLER_H #define RADIOCONTROLLER_H #include #include #include #include #include "dab-constants.h" struct dab_date_time_t { int year = 0; int month = 0; int day = 0; int hour = 0; int minutes = 0; int seconds = 0; // Information decoded from local time offset in FIG 0/9 int hourOffset = 0; int minuteOffset = 0; }; struct tii_measurement_t { int comb = 0; int pattern = 0; float error = 0; int delay_samples = 0; float getDelayKm(void) const; }; enum class message_level_t { Information, Error }; /* Definition of the interface all radio controllers must implement. * The RadioController handles events that are common to all programmes * being listened to. * All functions starting with "on" are callbacks for the backend. */ class RadioControllerInterface { public: /* Signal-to-Noise Ratio was calculated. snr is a value in dB. */ virtual void onSNR(int snr) = 0; /* The frequency corrector estimated a new correction. The frequency * correction consists of a coarse and a fine value, both having the * same units, measured in number of samples. */ virtual void onFrequencyCorrectorChange(int fine, int coarse) = 0; /* Indicate if receive signal synchronisation was acquired or lost. */ virtual void onSyncChange(char isSync) = 0; /* Indicate if a signal is suspected on the currently tuned frequency. * This is useful to accelerate the scan. */ virtual void onSignalPresence(bool isSignal) = 0; /* A new service with service ID sId was detected. */ virtual void onServiceDetected(uint32_t sId) = 0; /* When the ensemble changes */ virtual void onNewEnsemble(uint16_t eId) = 0; /* When the ensemble label changes */ virtual void onSetEnsembleLabel(DabLabel& label) = 0; virtual void onDateTimeUpdate(const dab_date_time_t& dateTime) = 0; /* For every FIB, tell if the CRC check passed. fib points to a bit-vector with 256 bits of FIB data */ virtual void onFIBDecodeSuccess(bool crcCheckOk, const uint8_t* fib) = 0; /* When a new channel impulse response vector was calculated */ virtual void onNewImpulseResponse(std::vector&& data) = 0; /* When new constellation points are available. data contains * (L-1) * K / OfdmDecoder::constellationDecimation points. */ virtual void onConstellationPoints(std::vector&& data) = 0; /* When a new null symbol vector was received. * Data contains the samples of the complete NULL symbol. */ virtual void onNewNullSymbol(std::vector&& data) = 0; /* When TII information for a comb/pattern pair is available */ virtual void onTIIMeasurement(tii_measurement_t&& m) = 0; /* When a information or warning message should be printed */ virtual void onMessage(message_level_t level, const std::string& text, const std::string& text2 = std::string()) = 0; /* The receiver has shutdown due to a failure in the input device */ virtual void onInputFailure(void) { }; }; /* A Programme Hander is associated to each tuned programme in the ensemble. */ class ProgrammeHandlerInterface { public: /* Count the number of frame errors from the MP2, AAC or data * decoder. */ virtual void onFrameErrors(int frameErrors) = 0; /* New audio data is available. The sampleRate and the * stereo indicator may change at any time. * mode is an information related to the audio encoding * used. */ virtual void onNewAudio(std::vector&& audioData, int sampleRate, const std::string& mode) = 0; /* (DAB+ only) Reed-Solomon decoding error indicator, and * number of corrected errors. * The function will also be called in the absence of errors, * with an count of 0. */ virtual void onRsErrors(bool uncorrectedErrors, int numCorrectedErrors) = 0; /* (DAB+ only) Audio Decoder error */ virtual void onAacErrors(int aacErrors) = 0; /* A new Dynamic Label was decoded. * label is utf-8 encoded. */ virtual void onNewDynamicLabel(const std::string& label) = 0; /* A slide was decoded. data contains the raw bytes, and subtype * defines the data format: * 0x01 for JPEG, 0x03 for PNG */ virtual void onMOT(const std::vector& data, int subtype) = 0; /* Called when the PAD decoder notices a mismatch between announced * and effective X-PAD length. */ virtual void onPADLengthError(size_t announced_xpad_len, size_t xpad_len) = 0; }; enum class DeviceParam { BiasTee, SoapySDRAntenna, SoapySDRDriverArgs, SoapySDRClockSource, }; /* Definition of the interface all input devices must implement */ class InputInterface { public: virtual ~InputInterface() {} virtual void setFrequency(int frequency) = 0; virtual int getFrequency(void) const = 0; virtual bool is_ok(void) = 0; virtual bool restart(void) = 0; virtual void stop(void) = 0; virtual void reset(void) = 0; virtual int32_t getSamples(DSPCOMPLEX* buffer, int32_t size) = 0; virtual std::vector getSpectrumSamples(int size) = 0; virtual int32_t getSamplesToRead(void) = 0; virtual float setGain(int gain) = 0; virtual float getGain(void) const = 0; virtual int getGainCount(void) = 0; virtual void setAgc(bool agc) = 0; virtual std::string getDescription(void) = 0; virtual bool setDeviceParam(DeviceParam param, int value) { (void)param; (void)value; return false; } virtual bool setDeviceParam(DeviceParam param, const std::string& value) { (void)param; (void)value; return false; } }; #endif welle.io-2.1/src/backend/radio-receiver-options.h000066400000000000000000000062541357201522000220160ustar00rootroot00000000000000/* * Copyright (C) 2019 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #pragma once // see OFDMProcessor::processPRS() for more information about these methods enum class FreqsyncMethod { GetMiddle = 0, CorrelatePRS = 1, PatternOfZeros = 2 }; enum class FFTPlacementMethod { /* Old method: places the FFT on the strongest peak, which must be at least * 3 times as high as the average. * * Issues: can lock on a peak that is not the earlisest peak (multipath) */ StrongestPeak, /* Calculate peaks over bins of 25 samples, keep the 4 bins with the * highest peaks, take the index from the peak in the earliest bin, but not * any earlier than 500 samples. * * Issues: sometimes loses lock even in good receive conditions. */ EarliestPeakWithBinning, /* Apply a windowing function that selects the peak correlation, then * place the FFT where the correlation goes above a threshold earliest. * * Issues: performance not yet assessed. */ ThresholdBeforePeak, }; // Default uses the old algorithm until the issues of the new one are solved. constexpr auto DEFAULT_FFT_PLACEMENT = FFTPlacementMethod::ThresholdBeforePeak; // Configuration for the backend struct RadioReceiverOptions { // Select the algorithm used in the OFDMProcessor PRS sync logic // to place the FFT window for demodulation. // // Issues: initial lock can take longer than with original algorithm. FFTPlacementMethod fftPlacementMethod = DEFAULT_FFT_PLACEMENT; // Set to true to enable the TII decoder. Default is false because it is // consumes CPU resources. bool decodeTII = false; // Good receivers with accurate clocks do not need the coarse corrector. // Disabling it can accelerate lock. bool disable_coarse_corrector = false; // Which method to use for the freqsyncmethod used in the coarse corrector. // Has no effect when coarse corrector is disabled. FreqsyncMethod freqsyncMethod = FreqsyncMethod::PatternOfZeros; }; welle.io-2.1/src/backend/radio-receiver.cpp000066400000000000000000000146161357201522000206610ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include "radio-receiver.h" using namespace std; const char* fftPlacementMethodToString(FFTPlacementMethod fft_placement) { switch (fft_placement) { case FFTPlacementMethod::EarliestPeakWithBinning: return "EarliestPeakWithBinning"; case FFTPlacementMethod::StrongestPeak: return "StrongestPeak"; case FFTPlacementMethod::ThresholdBeforePeak: return "ThresholdBeforePeak"; } throw std::logic_error("Unhandled fft placement"); } const char* freqSyncMethodToString(FreqsyncMethod method) { switch (method) { case FreqsyncMethod::CorrelatePRS: return "CorrelatePRS"; case FreqsyncMethod::GetMiddle: return "GetMiddle"; case FreqsyncMethod::PatternOfZeros: return "PatternOfZeros"; } throw std::logic_error("Unhandled freqsyncMethod placement"); } RadioReceiver::RadioReceiver( RadioControllerInterface& rci, InputInterface& input, RadioReceiverOptions rro, int transmission_mode) : params(transmission_mode), mscHandler(params, false), ficHandler(rci), ofdmProcessor(input, params, rci, mscHandler, ficHandler, rro) { } void RadioReceiver::restart(bool doScan) { ofdmProcessor.set_scanMode(doScan); mscHandler.stopProcessing(); ficHandler.clearEnsemble(); ofdmProcessor.reset(); } void RadioReceiver::restart_decoder() { mscHandler.stopProcessing(); ficHandler.clearEnsemble(); } void RadioReceiver::setReceiverOptions(const RadioReceiverOptions rro) { string fsm; switch (rro.freqsyncMethod) { case FreqsyncMethod::GetMiddle: fsm = "GetMiddle"; break; case FreqsyncMethod::CorrelatePRS: fsm = "CorrelatePRS"; break; case FreqsyncMethod::PatternOfZeros: fsm = "PatternOfZeros"; break; } clog << "New Receiver Options: " << "TII: " << rro.decodeTII << " disable coarse corr: " << rro.disable_coarse_corrector << " freqsync: " << fsm << " fft placement: " << fftPlacementMethodToString(rro.fftPlacementMethod) << endl; ofdmProcessor.setReceiverOptions(rro); } bool RadioReceiver::playSingleProgramme(ProgrammeHandlerInterface& handler, const std::string& dumpFileName, const Service& s) { return playProgramme(handler, s, dumpFileName, true); } bool RadioReceiver::addServiceToDecode(ProgrammeHandlerInterface& handler, const std::string& dumpFileName, const Service& s) { return playProgramme(handler, s, dumpFileName, false); } bool RadioReceiver::removeServiceToDecode(const Service& s) { const auto comps = ficHandler.fibProcessor.getComponents(s); for (const auto& sc : comps) { if (sc.transportMode() == TransportMode::Audio) { const auto& subch = ficHandler.fibProcessor.getSubchannel(sc); if (subch.valid()) { return mscHandler.removeSubchannel(subch); } } } return false; } bool RadioReceiver::playProgramme(ProgrammeHandlerInterface& handler, const Service& s, const std::string& dumpFileName, bool unique) { const auto comps = ficHandler.fibProcessor.getComponents(s); for (const auto& sc : comps) { if (sc.transportMode() == TransportMode::Audio) { const auto& subch = ficHandler.fibProcessor.getSubchannel(sc); if (subch.valid()) { if (unique) { mscHandler.stopProcessing(); } if (sc.audioType() == AudioServiceComponentType::DAB || sc.audioType() == AudioServiceComponentType::DABPlus) { mscHandler.addSubchannel( handler, sc.audioType(), dumpFileName, subch); return true; } } } } return false; } uint16_t RadioReceiver::getEnsembleId(void) const { return ficHandler.fibProcessor.getEnsembleId(); } uint8_t RadioReceiver::getEnsembleEcc(void) const { return ficHandler.fibProcessor.getEnsembleEcc(); } DabLabel RadioReceiver::getEnsembleLabel(void) const { return ficHandler.fibProcessor.getEnsembleLabel(); } std::vector RadioReceiver::getServiceList(void) const { return ficHandler.fibProcessor.getServiceList(); } Service RadioReceiver::getService(uint32_t sId) const { return ficHandler.fibProcessor.getService(sId); } std::list RadioReceiver::getComponents(const Service& s) const { return ficHandler.fibProcessor.getComponents(s); } bool RadioReceiver::serviceHasAudioComponent(const Service& s) const { for (const auto& sc : getComponents(s)) { if (sc.transportMode() == TransportMode::Audio and (sc.audioType() == AudioServiceComponentType::DAB or sc.audioType() == AudioServiceComponentType::DABPlus)) { return true; } } return false; } Subchannel RadioReceiver::getSubchannel(const ServiceComponent& sc) const { return ficHandler.fibProcessor.getSubchannel(sc); } DABParams& RadioReceiver::getParams() { return params; } welle.io-2.1/src/backend/radio-receiver.h000066400000000000000000000074621357201522000203270ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef RADIO_RECEIVER_H #define RADIO_RECEIVER_H #include #include #include "radio-controller.h" #include "radio-receiver-options.h" #include "fic-handler.h" #include "msc-handler.h" #include "ofdm-processor.h" const char* fftPlacementMethodToString(FFTPlacementMethod fft_placement); const char* freqSyncMethodToString(FreqsyncMethod method); class RadioReceiver { public: RadioReceiver( RadioControllerInterface& rci, InputInterface& input, RadioReceiverOptions rro, int transmission_mode = 1); /* Restart the receiver, and specify if we want * to scan or receive. */ void restart(bool doScan); /* Keep the demodulator running, but clear the data * decoders (both FIC and MSC) */ void restart_decoder(); /* Update the currently running receiver with new configuration */ void setReceiverOptions(const RadioReceiverOptions rro); /* Play the audio component of the service. Returns true if an * audio subchannel was found and tuned to. */ bool playSingleProgramme(ProgrammeHandlerInterface& handler, const std::string& dumpFileName, const Service& s); bool addServiceToDecode(ProgrammeHandlerInterface& handler, const std::string& dumpFileName, const Service& s); bool removeServiceToDecode(const Service& s); uint16_t getEnsembleId(void) const; uint8_t getEnsembleEcc(void) const; DabLabel getEnsembleLabel(void) const; std::vector getServiceList(void) const; /* Returns a service with sid 0 in case it is missing */ // TODO use std::optional once using C++17 makes sense Service getService(uint32_t sId) const; std::list getComponents(const Service& s) const; bool serviceHasAudioComponent(const Service& s) const; /* Return the subchannel corresponding to the given component. * This can fail, in which case the Subchannel returned has * subch field equals to -1 */ Subchannel getSubchannel(const ServiceComponent& sc) const; DABParams& getParams(void); private: bool playProgramme(ProgrammeHandlerInterface& handler, const Service& s, const std::string& dumpFileName, bool unique); DABParams params; // Defaults to TM1 parameters MscHandler mscHandler; FicHandler ficHandler; OFDMProcessor ofdmProcessor; }; #endif welle.io-2.1/src/backend/subchannel_sink.h000066400000000000000000000067211357201522000205720ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2019 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef SUBCHANNEL_SINK_H_ #define SUBCHANNEL_SINK_H_ #include #include #include #include #define FPAD_LEN 2 // --- AUDIO_SERVICE_FORMAT ----------------------------------------------------------------- struct AUDIO_SERVICE_FORMAT { std::string codec; size_t samplerate_khz; std::string mode; size_t bitrate_kbps; AUDIO_SERVICE_FORMAT() : samplerate_khz(0), bitrate_kbps(0) {} std::string GetSummary() const { return codec + ", " + std::to_string(samplerate_khz) + " kHz " + mode + " @ " + std::to_string(bitrate_kbps) + " kBit/s"; } }; // --- SubchannelSinkObserver ----------------------------------------------------------------- class SubchannelSinkObserver { public: virtual ~SubchannelSinkObserver() {} virtual void FormatChange(const AUDIO_SERVICE_FORMAT& /*format*/) {} virtual void StartAudio(int /*samplerate*/, int /*channels*/, bool /*float32*/) {} virtual void PutAudio(const uint8_t* /*data*/, size_t /*len*/) {} virtual void ProcessPAD(const uint8_t* /*xpad_data*/, size_t /*xpad_len*/, bool /*exact_xpad_len*/, const uint8_t* /*fpad_data*/) {} virtual void AudioError(const std::string& /*hint*/) {} virtual void AudioWarning(const std::string& /*hint*/) {} virtual void FECInfo(int /*total_corr_count*/, bool /*uncorr_errors*/) {} }; // --- UntouchedStreamConsumer ----------------------------------------------------------------- class UntouchedStreamConsumer { public: virtual ~UntouchedStreamConsumer() {} virtual void ProcessUntouchedStream(const uint8_t* /*data*/, size_t /*len*/, size_t /*duration_ms*/) = 0; }; // --- SubchannelSink ----------------------------------------------------------------- class SubchannelSink { protected: SubchannelSinkObserver* observer; std::string untouched_stream_file_extension; std::mutex uscs_mutex; std::set uscs; void ForwardUntouchedStream(const uint8_t *data, size_t len, size_t duration_ms) { // mutex must already be locked! for(UntouchedStreamConsumer* usc : uscs) usc->ProcessUntouchedStream(data, len, duration_ms); } public: SubchannelSink(SubchannelSinkObserver* observer, std::string untouched_stream_file_extension) : observer(observer), untouched_stream_file_extension(untouched_stream_file_extension) {} virtual ~SubchannelSink() {} virtual void Feed(const uint8_t *data, size_t len) = 0; std::string GetUntouchedStreamFileExtension() {return untouched_stream_file_extension;} void AddUntouchedStreamConsumer(UntouchedStreamConsumer* consumer) { std::lock_guard lock(uscs_mutex); uscs.insert(consumer); } void RemoveUntouchedStreamConsumer(UntouchedStreamConsumer* consumer) { std::lock_guard lock(uscs_mutex); uscs.erase(consumer); } }; #endif /* SUBCHANNEL_SINK_H_ */ welle.io-2.1/src/backend/tii-decoder.cpp000066400000000000000000000263541357201522000201530ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * This file is part of the welle.io. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "tii-decoder.h" using namespace std; static const int tii_pattern[70][8] = { // {{{ {0,0,0,0,1,1,1,1}, {0,0,0,1,0,1,1,1}, {0,0,0,1,1,0,1,1}, {0,0,0,1,1,1,0,1}, {0,0,0,1,1,1,1,0}, {0,0,1,0,0,1,1,1}, {0,0,1,0,1,0,1,1}, {0,0,1,0,1,1,0,1}, {0,0,1,0,1,1,1,0}, {0,0,1,1,0,0,1,1}, {0,0,1,1,0,1,0,1}, {0,0,1,1,0,1,1,0}, {0,0,1,1,1,0,0,1}, {0,0,1,1,1,0,1,0}, {0,0,1,1,1,1,0,0}, {0,1,0,0,0,1,1,1}, {0,1,0,0,1,0,1,1}, {0,1,0,0,1,1,0,1}, {0,1,0,0,1,1,1,0}, {0,1,0,1,0,0,1,1}, {0,1,0,1,0,1,0,1}, {0,1,0,1,0,1,1,0}, {0,1,0,1,1,0,0,1}, {0,1,0,1,1,0,1,0}, {0,1,0,1,1,1,0,0}, {0,1,1,0,0,0,1,1}, {0,1,1,0,0,1,0,1}, {0,1,1,0,0,1,1,0}, {0,1,1,0,1,0,0,1}, {0,1,1,0,1,0,1,0}, {0,1,1,0,1,1,0,0}, {0,1,1,1,0,0,0,1}, {0,1,1,1,0,0,1,0}, {0,1,1,1,0,1,0,0}, {0,1,1,1,1,0,0,0}, {1,0,0,0,0,1,1,1}, {1,0,0,0,1,0,1,1}, {1,0,0,0,1,1,0,1}, {1,0,0,0,1,1,1,0}, {1,0,0,1,0,0,1,1}, {1,0,0,1,0,1,0,1}, {1,0,0,1,0,1,1,0}, {1,0,0,1,1,0,0,1}, {1,0,0,1,1,0,1,0}, {1,0,0,1,1,1,0,0}, {1,0,1,0,0,0,1,1}, {1,0,1,0,0,1,0,1}, {1,0,1,0,0,1,1,0}, {1,0,1,0,1,0,0,1}, {1,0,1,0,1,0,1,0}, {1,0,1,0,1,1,0,0}, {1,0,1,1,0,0,0,1}, {1,0,1,1,0,0,1,0}, {1,0,1,1,0,1,0,0}, {1,0,1,1,1,0,0,0}, {1,1,0,0,0,0,1,1}, {1,1,0,0,0,1,0,1}, {1,1,0,0,0,1,1,0}, {1,1,0,0,1,0,0,1}, {1,1,0,0,1,0,1,0}, {1,1,0,0,1,1,0,0}, {1,1,0,1,0,0,0,1}, {1,1,0,1,0,0,1,0}, {1,1,0,1,0,1,0,0}, {1,1,0,1,1,0,0,0}, {1,1,1,0,0,0,0,1}, {1,1,1,0,0,0,1,0}, {1,1,1,0,0,1,0,0}, {1,1,1,0,1,0,0,0}, {1,1,1,1,0,0,0,0} }; // }}} bool operator==(const CombPattern& lhs, const CombPattern& rhs) { return lhs.comb == rhs.comb and lhs.pattern == rhs.pattern; } std::vector CombPattern::generateCarriers() const { std::vector carriers; carriers.reserve(32); for (carrier_t k = 0; k < 384; k++) { for (int b = 0; b < 8; b++) { if (k == 1 + 2*comb + 48*b and tii_pattern[pattern][b]) { carriers.push_back(k - 769); carriers.push_back(k - 769 + 1); carriers.push_back(k - 385); carriers.push_back(k - 385 + 1); carriers.push_back(k); carriers.push_back(k + 1); carriers.push_back(k + 384); carriers.push_back(k + 384 + 1); } } } sort(carriers.begin(), carriers.end()); return carriers; } float tii_measurement_t::getDelayKm(void) const { constexpr float km_per_sample = 3e8f / 1000.0f / 2048000.0f; return delay_samples * km_per_sample; } TIIDecoder::TIIDecoder(const DABParams& params, RadioControllerInterface& ri) : m_radioInterface(ri), m_params(params), m_fft_null(params.T_u), m_fft_prs(params.T_u) { if (m_params.dabMode != 1) { clog << "TII decoder does not support mode " << m_params.dabMode << endl; return; } for (int c = 0; c < 24; c++) { for (int p = 0; p < 70; p++) { for (carrier_t k = 0; k < 384; k++) { for (int b = 0; b < 8; b++) { if (k == 1 + 2*c + 48*b and tii_pattern[p][b]) { m_cp_per_carrier[k].emplace(c, p); } } } } } m_thread = thread(&TIIDecoder::run, this); } TIIDecoder::~TIIDecoder() { unique_lock lock(m_state_mutex); m_state = State::Abort; lock.unlock(); m_state_changed.notify_all(); if (m_thread.joinable()) { m_thread.join(); } } void TIIDecoder::pushSymbols( const std::vector& null, const std::vector& prs) { unique_lock lock(m_state_mutex); if (m_state == State::Idle) { m_prs = prs; m_null = null; m_state = State::NullPrsReady; } lock.unlock(); m_state_changed.notify_all(); } void TIIDecoder::run() { const size_t spacing = m_params.T_u; const size_t nullsize = m_params.T_null; while (true) { unique_lock lock(m_state_mutex); while (not (m_state == State::NullPrsReady or m_state == State::Abort)) { m_state_changed.wait(lock); } if (m_state == State::Abort) { break; } lock.unlock(); // We are in NullPrsReady state, and the state will not change now // Take the NULL symbol from that frame, but skip the cyclic prefix and // truncate size_t null_skip = nullsize - spacing; if (m_null.size() != nullsize) { throw out_of_range("NULL length: " + to_string(m_prs.size()) + " vs " + to_string(nullsize)); } copy(m_null.begin() + null_skip, m_null.begin() + null_skip + spacing, m_fft_null.getVector()); m_fft_null.do_FFT(); // The phase reference symbol, assume cyclic prefix absent if (m_prs.size() < spacing) { throw out_of_range("PRS length: " + to_string(m_prs.size()) + " vs " + to_string(spacing)); } copy(m_prs.begin(), m_prs.begin() + spacing, m_fft_prs.getVector()); m_fft_prs.do_FFT(); /* In TM1, the carriers repeat four times: * [-768, -384[ * [-384, 0[ * ]0, 384] * ]384, 768] * A consequence of the fact that the 0 bin is never used is that the * first carrier of each pair is even for negative k, odd for positive k * * We multiply the first carrier of the pair with the conjugate of the second * carrier in the pair. As they have the same phase, this will make them * correlate, whereas noise will not correlate. Also, we accumulate the * measurements over the four blocks. */ vector blocks_multiplied(192); vector prs_power_sq(192); /* Equivalent numpy code blocks = [null_fft[-768:-384], null_fft[-384:], null_fft[1:385], null_fft[385:769]] blocks_multiplied = np.zeros(384//2, dtype=np.complex128) for block in blocks: even_odd = block.reshape(-1, 2) b = even_odd[...,0] * np.conj(even_odd[...,1]) blocks_multiplied += b */ for (size_t i = 0; i < 192; i++) { const complexf *p = m_fft_prs.getVector(); prs_power_sq[i] = norm(p[1 + 2*i]); } const size_t k_start[] = {2048 - 768, 2048 - 384, 1, 385}; const complexf *n = m_fft_null.getVector(); for (size_t k : k_start) { for (size_t i = 0; i < 192; i++) { // The two consecutive carriers should have the // same phase. By multiplying with the conjugate, // we should get a value with low imaginary component. // In terms of units, this resembles a norm. blocks_multiplied[i] += n[k+2*i] * conj(n[k+2*i+1]); } } auto ix_to_k = [](int ix) -> carrier_t { if (ix <= 1024) return ix; else return ix - 2048; }; const float threshold_factor = 0.4f; vector carriers; for (size_t i = 0; i < 192; i++) { const float threshold = prs_power_sq[i] * threshold_factor; if (abs(blocks_multiplied[i]) > threshold) { // Convert back from "pair index" to k const carrier_t k = ix_to_k(i*2 + 1); carriers.push_back(k); } } unordered_map cp_count; for (const carrier_t k : carriers) { if (m_cp_per_carrier.count(k)) { for (const auto& cps : m_cp_per_carrier[k]) { cp_count[cps]++; } } } size_t num_likely_cps = 0; for (const auto& cp : cp_count) { if (cp.second >= 4) { num_likely_cps++; } } // Sometimes the number of likely CPs is huge because // the threshold is wrong. Skip these cases. if (num_likely_cps < 10) { for (const auto& cp : cp_count) { if (cp.second >= 4) { analyse_phase(cp.first); } } } lock.lock(); m_state = State::Idle; lock.unlock(); } } void TIIDecoder::analyse_phase(const CombPattern& cp) { const auto carriers = cp.generateCarriers(); const complexf *n = m_fft_null.getVector(); const complexf *p = m_fft_prs.getVector(); auto k_to_ix = [](carrier_t k) -> int { if (k < 0) return 2048 + k; else return k; }; // Both TII carriers take the phase from the first PRS frequency of the pair. // This assumes carriers is sorted. vector phases_prs(carriers.size()); for (size_t i = 0; i < carriers.size(); i += 2) { const int ix = k_to_ix(carriers[i]); phases_prs[i] = arg(p[ix]); phases_prs[i+1] = arg(p[ix]); } auto& meas = m_error_per_correction[cp]; for (int err = -4; err < 500; err++) { float abs_err = 0; for (size_t j = 0; j < carriers.size(); j++) { const int ix = k_to_ix(carriers[j]); constexpr float pi = M_PI; complexf rotator = polar(1.0f, 2.0f * pi * err * carriers[j] / 2048.0f); float delta = arg(n[ix] * rotator) - phases_prs[j]; abs_err += abs(delta); } meas.error_per_correction[err] += abs_err; } meas.num_measurements++; if (meas.num_measurements >= 5) { auto best = min_element( meas.error_per_correction.begin(), meas.error_per_correction.end(), [](const pair& lhs, const pair& rhs) { return lhs.second < rhs.second; }); if (best != meas.error_per_correction.end()) { tii_measurement_t m; m.error = best->second; m.delay_samples = best->first; m.comb = cp.comb; m.pattern = cp.pattern; m_radioInterface.onTIIMeasurement(move(m)); } meas.error_per_correction.clear(); meas.num_measurements = 0; } } welle.io-2.1/src/backend/tii-decoder.h000066400000000000000000000062321357201522000176110ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * This file is part of the welle.io. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "dab-constants.h" #include #include #include #include #include #include #include #include #include "fft.h" #include "radio-controller.h" using complexf = std::complex; // We use this to distinguish between carriers k as given in the spec // (-768 to 768) and FFT bins (0 to 2048) using carrier_t = int; struct CombPattern { CombPattern() = default; CombPattern(int c, int p) : comb(c), pattern(p) {} int comb = 0; // From 0 to 24 int pattern = 0; // From 0 to 70 std::vector generateCarriers(void) const; }; // Make CombPattern satisfy Hash and Compare bool operator==(const CombPattern& lhs, const CombPattern& rhs); namespace std { template<> struct hash { typedef CombPattern argument_type; typedef std::size_t result_type; result_type operator()(argument_type const& cp) const noexcept { return cp.comb * 100 + cp.pattern; } }; } class TIIDecoder { public: TIIDecoder(const DABParams& params, RadioControllerInterface& ri); ~TIIDecoder(); TIIDecoder(const TIIDecoder& other) = delete; TIIDecoder& operator=(const TIIDecoder& other) = delete; void pushSymbols( const std::vector& null, const std::vector& prs); private: void run(void); void analyse_phase(const CombPattern& cp); RadioControllerInterface& m_radioInterface; const DABParams& m_params; std::vector m_null; std::vector m_prs; std::unordered_map > m_cp_per_carrier; enum class State { Idle, NullPrsReady, Abort }; std::thread m_thread; std::mutex m_state_mutex; std::condition_variable m_state_changed; State m_state = State::Idle; fft::Forward m_fft_null; fft::Forward m_fft_prs; struct cp_error_measurement_t { std::unordered_map error_per_correction; size_t num_measurements = 0; }; std::unordered_map m_error_per_correction; }; welle.io-2.1/src/backend/tools.cpp000066400000000000000000000145311357201522000171150ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "tools.h" // --- MiscTools ----------------------------------------------------------------- string_vector_t MiscTools::SplitString(const std::string &s, const char delimiter) { string_vector_t result; std::stringstream ss(s); std::string part; while(std::getline(ss, part, delimiter)) result.push_back(part); return result; } // --- CalcCRC ----------------------------------------------------------------- CalcCRC CalcCRC::CalcCRC_CRC16_CCITT(true, true, 0x1021); // 0001 0000 0010 0001 (16, 12, 5, 0) CalcCRC CalcCRC::CalcCRC_CRC16_IBM(true, false, 0x8005); // 1000 0000 0000 0101 (16, 15, 2, 0) CalcCRC CalcCRC::CalcCRC_FIRE_CODE(false, false, 0x782F); // 0111 1000 0010 1111 (16, 14, 13, 12, 11, 5, 3, 2, 1, 0) size_t CalcCRC::CRCLen = 2; CalcCRC::CalcCRC(bool initial_invert, bool final_invert, uint16_t gen_polynom) { this->initial_invert = initial_invert; this->final_invert = final_invert; this->gen_polynom = gen_polynom; FillLUT(); } void CalcCRC::FillLUT() { for(int value = 0; value < 256; value++) { uint16_t crc = value << 8; for(int i = 0; i < 8; i++) { if(crc & 0x8000) crc = (crc << 1) ^ gen_polynom; else crc = crc << 1; } crc_lut[value] = crc; } } uint16_t CalcCRC::Calc(const uint8_t *data, size_t len) { uint16_t crc; Initialize(crc); for(size_t offset = 0; offset < len; offset++) ProcessByte(crc, data[offset]); Finalize(crc); return crc; } void CalcCRC::ProcessBits(uint16_t& crc, const uint8_t *data, size_t len) { // byte-aligned start only size_t bytes = len / 8; size_t bits = len % 8; for(size_t offset = 0; offset < bytes; offset++) ProcessByte(crc, data[offset]); for(size_t bit = 0; bit < bits; bit++) ProcessBit(crc, data[bytes] & (0x80 >> bit)); } // --- CircularBuffer ----------------------------------------------------------------- CircularBuffer::CircularBuffer(size_t capacity) { buffer = new uint8_t[capacity]; this->capacity = capacity; Clear(); } CircularBuffer::~CircularBuffer() { delete[] buffer; } size_t CircularBuffer::Write(const uint8_t *data, size_t bytes) { size_t real_bytes = std::min(bytes, capacity - size); // split task on index rollover if(real_bytes <= capacity - index_end) { memcpy(buffer + index_end, data, real_bytes); } else { size_t first_bytes = capacity - index_end; memcpy(buffer + index_end, data, first_bytes); memcpy(buffer, data + first_bytes, real_bytes - first_bytes); } index_end = (index_end + real_bytes) % capacity; size += real_bytes; return real_bytes; } size_t CircularBuffer::Read(uint8_t *data, size_t bytes) { size_t real_bytes = std::min(bytes, size); if(data) { // split task on index rollover if(real_bytes <= capacity - index_start) { memcpy(data, buffer + index_start, real_bytes); } else { size_t first_bytes = capacity - index_start; memcpy(data, buffer + index_start, first_bytes); memcpy(data + first_bytes, buffer, real_bytes - first_bytes); } } index_start = (index_start + real_bytes) % capacity; size -= real_bytes; return real_bytes; } // --- BitReader ----------------------------------------------------------------- bool BitReader::GetBits(int& result, size_t count) { int result_value = 0; while(count) { if(data_bytes == 0) return false; size_t copy_bits = std::min(count, 8 - data_bits); result_value <<= copy_bits; result_value |= (*data & (0xFF >> data_bits)) >> (8 - data_bits - copy_bits); data_bits += copy_bits; count -= copy_bits; // switch to next byte if(data_bits == 8) { data++; data_bytes--; data_bits = 0; } } result = result_value; return true; } // --- BitWriter ----------------------------------------------------------------- void BitWriter::Reset() { data.clear(); byte_bits = 0; } void BitWriter::AddBits(int data_new, size_t count) { while(count) { // add new byte, if needed if(byte_bits == 0) data.push_back(0x00); size_t copy_bits = std::min(count, 8 - byte_bits); uint8_t copy_data = (data_new >> (count - copy_bits)) & (0xFF >> (8 - copy_bits)); data.back() |= copy_data << (8 - byte_bits - copy_bits); // fprintf(stderr, "data_new: 0x%04X, count: %zu / byte_bits: %zu, copy_bits: %zu, copy_data: 0x%02X\n", data_new, count, byte_bits, copy_bits, copy_data); byte_bits = (byte_bits + copy_bits) % 8; count -= copy_bits; } } void BitWriter::AddBytes(const uint8_t *data, size_t len) { for(size_t i = 0; i < len; i++) AddBits(data[i], 8); } void BitWriter::WriteAudioMuxLengthBytes() { size_t len = data.size() - 3; data[1] |= (len >> 8) & 0x1F; data[2] = len & 0xFF; } const dab_channels_t dab_channels { { "5A", 174928}, { "5B", 176640}, { "5C", 178352}, { "5D", 180064}, { "6A", 181936}, { "6B", 183648}, { "6C", 185360}, { "6D", 187072}, { "7A", 188928}, { "7B", 190640}, { "7C", 192352}, { "7D", 194064}, { "8A", 195936}, { "8B", 197648}, { "8C", 199360}, { "8D", 201072}, { "9A", 202928}, { "9B", 204640}, { "9C", 206352}, { "9D", 208064}, {"10A", 209936}, {"10N", 210096}, {"10B", 211648}, {"10C", 213360}, {"10D", 215072}, {"11A", 216928}, {"11N", 217088}, {"11B", 218640}, {"11C", 220352}, {"11D", 222064}, {"12A", 223936}, {"12N", 224096}, {"12B", 225648}, {"12C", 227360}, {"12D", 229072}, {"13A", 230784}, {"13B", 232496}, {"13C", 234208}, {"13D", 235776}, {"13E", 237488}, {"13F", 239200}, { "LA", 1452960}, { "LB", 1454672}, { "LC", 1456384}, { "LD", 1458096}, { "LE", 1459808}, { "LF", 1461520}, { "LG", 1463232}, { "LH", 1464944}, { "LI", 1466656}, { "LJ", 1468368}, { "LK", 1470080}, { "LL", 1471792}, { "LM", 1473504}, { "LN", 1475216}, { "LO", 1476928}, { "LP", 1478640}, }; welle.io-2.1/src/backend/tools.h000066400000000000000000000102771357201522000165650ustar00rootroot00000000000000/* DABlin - capital DAB experience Copyright (C) 2015-2018 Stefan Pöschel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef TOOLS_H_ #define TOOLS_H_ #include #include #include #include #include #include #include typedef std::vector string_vector_t; // --- MiscTools ----------------------------------------------------------------- class MiscTools { public: static string_vector_t SplitString(const std::string &s, const char delimiter); }; // --- CalcCRC ----------------------------------------------------------------- class CalcCRC { private: bool initial_invert; bool final_invert; uint16_t gen_polynom; uint16_t crc_lut[256]; void FillLUT(); public: CalcCRC(bool initial_invert, bool final_invert, uint16_t gen_polynom); virtual ~CalcCRC() {} // simple API uint16_t Calc(const uint8_t *data, size_t len); // modular API void Initialize(uint16_t& crc); void ProcessByte(uint16_t& crc, const uint8_t data); void ProcessBit(uint16_t& crc, const bool data); void ProcessBits(uint16_t& crc, const uint8_t *data, size_t len); void Finalize(uint16_t& crc); static CalcCRC CalcCRC_CRC16_CCITT; static CalcCRC CalcCRC_CRC16_IBM; static CalcCRC CalcCRC_FIRE_CODE; static size_t CRCLen; }; inline void CalcCRC::Initialize(uint16_t& crc) { crc = initial_invert ? 0xFFFF : 0x0000; } inline void CalcCRC::ProcessByte(uint16_t& crc, const uint8_t data) { // use LUT crc = (crc << 8) ^ crc_lut[(crc >> 8) ^ data]; } inline void CalcCRC::ProcessBit(uint16_t& crc, const bool data) { if(data ^ (bool) (crc & 0x8000)) crc = (crc << 1) ^ gen_polynom; else crc = crc << 1; } inline void CalcCRC::Finalize(uint16_t& crc) { if(final_invert) crc = ~crc; } // --- CircularBuffer ----------------------------------------------------------------- class CircularBuffer { private: uint8_t *buffer; size_t capacity; size_t size; size_t index_start; size_t index_end; public: CircularBuffer(size_t capacity); ~CircularBuffer(); size_t Capacity() {return capacity;} size_t Size() {return size;} size_t Write(const uint8_t *data, size_t bytes); size_t Read(uint8_t *data, size_t bytes); void Clear() {size = index_start = index_end = 0;} }; // --- BitReader ----------------------------------------------------------------- class BitReader { private: const uint8_t *data; size_t data_bytes; size_t data_bits; public: BitReader(const uint8_t *data, size_t data_bytes) : data(data), data_bytes(data_bytes), data_bits(0) {} bool GetBits(int& result, size_t count); }; // --- BitWriter ----------------------------------------------------------------- class BitWriter { private: std::vector data; size_t byte_bits; public: BitWriter() {Reset();} void Reset(); void AddBits(int data_new, size_t count); void AddBytes(const uint8_t *data, size_t len); const std::vector GetData() {return data;} void WriteAudioMuxLengthBytes(); // needed for LATM }; typedef std::map dab_channels_t; extern const dab_channels_t dab_channels; struct AUDIO_SERVICE { int subchid; bool dab_plus; static const int subchid_none = -1; bool IsNone() const {return subchid == subchid_none;} AUDIO_SERVICE() : AUDIO_SERVICE(subchid_none, false) {} AUDIO_SERVICE(int subchid, bool dab_plus) : subchid(subchid), dab_plus(dab_plus) {} bool operator==(const AUDIO_SERVICE & audio_service) const { return subchid == audio_service.subchid && dab_plus == audio_service.dab_plus; } bool operator!=(const AUDIO_SERVICE & audio_service) const { return !(*this == audio_service); } }; #endif /* TOOLS_H_ */ welle.io-2.1/src/backend/uep-protection.cpp000066400000000000000000000167421357201522000207400ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * The deconvolution for both uep and eep */ #include "dab-constants.h" #include "uep-protection.h" #include "protTables.h" struct protectionProfile { int16_t bitRate; int16_t protLevel; int16_t L1; int16_t L2; int16_t L3; int16_t L4; int16_t PI1; int16_t PI2; int16_t PI3; int16_t PI4; } profileTable[] = { {32, 5, 3, 4, 17, 0, 5, 3, 2, -1}, {32, 4, 3, 3, 18, 0, 11, 6, 5, -1}, {32, 3, 3, 4, 14, 3, 15, 9, 6, 8}, {32, 2, 3, 4, 14, 3, 22, 13, 8, 13}, {32, 1, 3, 5, 13, 3, 24, 17, 12, 17}, {48, 5, 4, 3, 26, 3, 5, 4, 2, 3}, {48, 4, 3, 4, 26, 3, 9, 6, 4, 6}, {48, 3, 3, 4, 26, 3, 15, 10, 6, 9}, {48, 2, 3, 4, 26, 3, 24, 14, 8, 15}, {48, 1, 3, 5, 25, 3, 24, 18, 13, 18}, {56, 5, 6, 10, 23, 3, 5, 4, 2, 3}, {56, 4, 6, 10, 23, 3, 9, 6, 4, 5}, {56, 3, 6, 12, 21, 3, 16, 7, 6, 9}, {56, 2, 6, 10, 23, 3, 23, 13, 8, 13}, {64, 5, 6, 9, 31, 2, 5, 3, 2, 3}, {64, 4, 6, 9, 33, 0, 11, 6, 5, -1}, {64, 3, 6, 12, 27, 3, 16, 8, 6, 9}, {64, 2, 6, 10, 29, 3, 23, 13, 8, 13}, {64, 1, 6, 11, 28, 3, 24, 18, 12, 18}, {80, 5, 6, 10, 41, 3, 6, 3, 2, 3}, {80, 4, 6, 10, 41, 3, 11, 6, 5, 6}, {80, 3, 6, 11, 40, 3, 16, 8, 6, 7}, {80, 2, 6, 10, 41, 3, 23, 13, 8, 13}, {80, 1, 6, 10, 41, 3, 24, 7, 12, 18}, {96, 5, 7, 9, 53, 3, 5, 4, 2, 4}, {96, 4, 7, 10, 52, 3, 9, 6, 4, 6}, {96, 3, 6, 12, 51, 3, 16, 9, 6, 10}, {96, 2, 6, 10, 53, 3, 22, 12, 9, 12}, {96, 1, 6, 13, 50, 3, 24, 18, 13, 19}, // // Thanks to Kalle Riis, who found that the "112" was missing {112, 5, 14, 17, 50, 3, 5, 4, 2, 5}, {112, 4, 11, 21, 49, 3, 9, 6, 4, 8}, {112, 3, 11, 23, 47, 3, 16, 8, 6, 9}, {112, 2, 11, 21, 49, 3, 23, 12, 9, 14}, {128, 5, 12, 19, 62, 3, 5, 3, 2, 4}, {128, 4, 11, 21, 61, 3, 11, 6, 5, 7}, {128, 3, 11, 22, 60, 3, 16, 9, 6, 10}, {128, 2, 11, 21, 61, 3, 22, 12, 9, 14}, {128, 1, 11, 20, 62, 3, 24, 17, 13, 19}, {160, 5, 11, 19, 87, 3, 5, 4, 2, 4}, {160, 4, 11, 23, 83, 3, 11, 6, 5, 9}, {160, 3, 11, 24, 82, 3, 16, 8, 6, 11}, {160, 2, 11, 21, 85, 3, 22, 11, 9, 13}, {160, 1, 11, 22, 84, 3, 24, 18, 12, 19}, {192, 5, 11, 20, 110, 3, 6, 4, 2, 5}, {192, 4, 11, 22, 108, 3, 10, 6, 4, 9}, {192, 3, 11, 24, 106, 3, 16, 10, 6, 11}, {192, 2, 11, 20, 110, 3, 22, 13, 9, 13}, {192, 1, 11, 21, 109, 3, 24, 20, 13, 24}, {224, 5, 12, 22, 131, 3, 8, 6, 2, 6}, {224, 4, 12, 26, 127, 3, 12, 8, 4, 11}, {224, 3, 11, 20, 134, 3, 16, 10, 7, 9}, {224, 2, 11, 22, 132, 3, 24, 16, 10, 15}, {224, 1, 11, 24, 130, 3, 24, 20, 12, 20}, {256, 5, 11, 24, 154, 3, 6, 5, 2, 5}, {256, 4, 11, 24, 154, 3, 12, 9, 5, 10}, {256, 3, 11, 27, 151, 3, 16, 10, 7, 10}, {256, 2, 11, 22, 156, 3, 24, 14, 10, 13}, {256, 1, 11, 26, 152, 3, 24, 19, 14, 18}, {320, 5, 11, 26, 200, 3, 8, 5, 2, 6}, {320, 4, 11, 25, 201, 3, 13, 9, 5, 10}, {320, 2, 11, 26, 200, 3, 24, 17, 9, 17}, {384, 5, 11, 27, 247, 3, 8, 6, 2, 7}, {384, 3, 11, 24, 250, 3, 16, 9, 7, 10}, {384, 1, 12, 28, 245, 3, 24, 20, 14, 23}, {0, -1, -1, -1, -1, -1, -1, -1, -1, -1} }; static int16_t findIndex(int16_t bitRate, int16_t protLevel) { int16_t i; for (i = 0; profileTable[i].bitRate != 0; i ++) { if ( (profileTable[i].bitRate == bitRate) && (profileTable[i].protLevel == protLevel)) { return i; } } return -1; } /** * the table is based on chapter 11 of the DAB standard. * * \brief uep_deconvolve * * The bitRate and the protectionLevel determine the * depuncturing scheme. */ UEPProtection::UEPProtection( int16_t bitRate, int16_t protLevel) : Viterbi(24 * bitRate), outSize(24 * bitRate), viterbiBlock(outSize * 4 + 24) { int16_t index = findIndex (bitRate, protLevel); if (index == -1) { fprintf(stderr, "UEP: %d (%d) has a problem\n", bitRate, protLevel); index = 1; } L1 = profileTable[index].L1; L2 = profileTable[index].L2; L3 = profileTable[index].L3; L4 = profileTable[index].L4; PI1 = getPCodes(profileTable[index].PI1 -1); PI2 = getPCodes(profileTable[index].PI2 -1); PI3 = getPCodes(profileTable[index].PI3 -1); if ((profileTable[index].PI4 - 1) != -1) PI4 = getPCodes(profileTable[index].PI4 -1); else PI4 = nullptr; } bool UEPProtection::deconvolve(const softbit_t *v, int32_t size, uint8_t *outBuffer) { int16_t i, j; int16_t inputCounter = 0; int32_t viterbiCounter = 0; (void)size; // currently unused // according to the standard we process the logical frame // with a pair of tuples // (L1, PI1), (L2, PI2), (L3, PI3), (L4, PI4) /// clear the bits in the viterbiBlock, /// only the non-punctured ones are set memset(viterbiBlock.data(), 0, (outSize * 4 + 24) * sizeof(softbit_t)); for (i = 0; i < L1; i ++) { for (j = 0; j < 128; j ++) { if (PI1[j % 32] != 0) { viterbiBlock[viterbiCounter] = v[inputCounter ++]; } viterbiCounter++; } } for (i = 0; i < L2; i ++) { for (j = 0; j < 128; j ++) { if (PI2[j % 32] != 0) { viterbiBlock[viterbiCounter] = v[inputCounter ++]; } viterbiCounter++; } } for (i = 0; i < L3; i ++) { for (j = 0; j < 128; j ++) { if (PI3[j % 32] != 0) { viterbiBlock[viterbiCounter] = v[inputCounter ++]; } viterbiCounter++; } } for (i = 0; i < L4; i ++) { if (PI4 == nullptr) { throw std::logic_error("Invalid usage of NULL PI4"); } for (j = 0; j < 128; j ++) { if (PI4[j % 32] != 0) { viterbiBlock[viterbiCounter] = v[inputCounter ++]; } viterbiCounter++; } } /** * we have a final block of 24 bits with puncturing according to PI_X * This block constitues the 6 * 4 bits of the register itself. */ for (i = 0; i < 24; i ++) { if (PI_X[i] != 0) { viterbiBlock[viterbiCounter] = v[inputCounter ++]; } viterbiCounter++; } /// The actual deconvolution is done by the viterbi decoder Viterbi::deconvolve(viterbiBlock.data(), outBuffer); return true; } welle.io-2.1/src/backend/uep-protection.h000066400000000000000000000030011357201522000203650ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Programming * * This file is part of the SDR-J (JSDR). * SDR-J is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * SDR-J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SDR-J; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef UEP_PROTECTION #define UEP_PROTECTION #include #include #include #include "protection.h" #include "viterbi.h" class UEPProtection: public Protection, public Viterbi { public: UEPProtection(int16_t bitRate, int16_t protLevel); bool deconvolve(const softbit_t *v, int32_t size, uint8_t *outBuffer); private: int16_t L1; int16_t L2; int16_t L3; int16_t L4; const int8_t *PI1; const int8_t *PI2; const int8_t *PI3; const int8_t *PI4; int32_t outSize; std::vector viterbiBlock; }; #endif welle.io-2.1/src/backend/viterbi.cpp000066400000000000000000000243501357201522000174210ustar00rootroot00000000000000/* * Copyright (C) 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * Lazy Chair Computing * * This file is part of the Qt-DAB * Qt-DAB is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Qt-DAB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Qt-DAB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "viterbi.h" #include #ifdef __MINGW32__ # include # include # include #endif // It took a while to discover that the polynomes we used // in our own "straightforward" implementation was bitreversed!! // The official one is on top. #define K 7 #define POLYS { 0155, 0117, 0123, 0155} //#define POLYS {109, 79, 83, 109} // In the reversed form the polys look: //#define POLYS { 0133, 0171, 0145, 0133 } //#define POLYS { 91, 121, 101, 91 } #define METRICSHIFT 0 #define PRECISIONSHIFT 0 #define RENORMALIZE_THRESHOLD 137 /* ADDSHIFT and SUBSHIFT make sure that the thing returned is a byte. */ #if (K-1<8) #define ADDSHIFT (8-(K-1)) #define SUBSHIFT 0 #elif (K-1>8) #define ADDSHIFT 0 #define SUBSHIFT ((K-1)-8) #else #define ADDSHIFT 0 #define SUBSHIFT 0 #endif static uint8_t Partab[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0}; // One could create the table above, i.e. a 256 entry // odd-parity lookup table by the following function // It is now precomputed void Viterbi::partab_init() { int16_t i,cnt,ti; for (i = 0; i < 256; i++){ cnt = 0; ti = i; while (ti != 0) { if (ti & 1) cnt++; ti >>= 1; } Partab[i] = cnt & 1; } } int Viterbi::parity(int x) { /* Fold down to one byte */ x ^= (x >> 16); x ^= (x >> 8); return Partab[x]; // return parityb(x); } static inline void renormalize(COMPUTETYPE* X, COMPUTETYPE threshold) { int32_t i; if (X[0] > threshold) { COMPUTETYPE min = X[0]; for (i = 0; i < NUMSTATES; i++) { if (min > X[i]) min = X[i]; } for (i = 0; i < NUMSTATES; i++) { X[i] -= min; } } } // The main use of the viterbi decoder is in handling the FIC blocks // There are (in mode 1) 3 ofdm blocks, giving 4 FIC blocks // There all have a predefined length. In that case we use the // "fast" (i.e. spiral) code, otherwise we use the generic code Viterbi::Viterbi(int16_t wordlength) { int polys[RATE] = POLYS; int16_t i, state; #ifdef __MINGW32__ uint32_t size; #endif frameBits = wordlength; // partab_init (); // B I G N O T E The spiral code uses (wordLength + (K - 1) * sizeof ... // However, the application then crashes, so something is not OK // By doubling the size, the problem disappears. It is not solved though // and not further investigation. #ifdef __MINGW32__ size = 2 * ((wordlength + (K - 1)) / 8 + 1 + 16) & ~0xF; data = (uint8_t *)_aligned_malloc (size, 16); size = 2 * (RATE * (wordlength + (K - 1)) * sizeof(COMPUTETYPE) + 16) & ~0xF; symbols = (COMPUTETYPE *)_aligned_malloc (size, 16); size = 2 * (wordlength + (K - 1)) * sizeof (decision_t); size = (size + 16) & ~0xF; vp. decisions = (decision_t *)_aligned_malloc (size, 16); #else if (posix_memalign ((void**)&data, 16, (wordlength + (K - 1))/ 8 + 1)){ printf("Allocation of data array failed\n"); } if (posix_memalign ((void**)&symbols, 16, RATE * (wordlength + (K - 1)) * sizeof(COMPUTETYPE))){ printf("Allocation of symbols array failed\n"); } if (posix_memalign ((void**)&(vp. decisions), 16, 2 * (wordlength + (K - 1)) * sizeof (decision_t))){ printf ("Allocation of vp decisions failed\n"); } #endif for (state = 0; state < NUMSTATES / 2; state++) { for (i = 0; i < RATE; i++) { Branchtab[i * NUMSTATES / 2 + state] = (polys[i] < 0) ^ parity((2 * state) & abs (polys[i])) ? 255 : 0; } } init_viterbi (&vp, 0); } Viterbi::~Viterbi() { #ifdef __MINGW32__ _aligned_free (vp. decisions); _aligned_free (data); _aligned_free (symbols); #else free (vp. decisions); free (data); free (symbols); #endif } static int maskTable[] = {128, 64, 32, 16, 8, 4, 2, 1}; static inline uint8_t getbit (uint8_t v, int32_t o) { return (v & maskTable[o]) ? 1 : 0; } //static //uint8_t getbit (uint8_t v, int32_t o) { //uint8_t mask = 1 << (7 - o); // return (v & mask) ? 1 : 0; //} // depends: POLYS, RATE, COMPUTETYPE // encode was only used for testing purposes //void encode (/*const*/ unsigned char *bytes, COMPUTETYPE *symbols, int nbits) { //int i, k; //int polys[RATE] = POLYS; //int sr = 0; // //// FIXME: this is slowish //// -- remember about the padding! // for (i = 0; i < nbits + (K - 1); i++) { // int b = bytes[i/8]; // int j = i % 8; // int bit = (b >> (7-j)) & 1; // // sr = (sr << 1) | bit; // for (k = 0; k < RATE; k++) // *(symbols++) = parity(sr & polys[k]); // } //} // Note that our DAB environment maps the softbits to -127 .. 127 // we have to map that onto 0 .. 255 void Viterbi::deconvolve(softbit_t *input, uint8_t *output) { uint32_t i; init_viterbi (&vp, 0); for (i = 0; i < (uint16_t)(frameBits + (K - 1)) * RATE; i ++) { COMPUTETYPE temp = (COMPUTETYPE)input[i] + 127; if (temp < 0) temp = 0; if (temp > 255) temp = 255; symbols[i] = temp; } update_viterbi_blk_GENERIC (&vp, symbols, frameBits + (K - 1)); chainback_viterbi (&vp, data, frameBits, 0); for (i = 0; i < (uint16_t)frameBits; i ++) output[i] = getbit (data[i >> 3], i & 07); } /* C-language butterfly */ void Viterbi::BFLY( int i, int s, COMPUTETYPE * syms, struct v * vp, decision_t * d) { int32_t j, decision0, decision1; COMPUTETYPE metric,m0,m1,m2,m3; metric =0; for (j = 0; j < RATE;j++) metric += (Branchtab[i + j * NUMSTATES/2] ^ syms[s*RATE+j]) >> METRICSHIFT ; metric = metric >> PRECISIONSHIFT; const COMPUTETYPE max = ((RATE * ((256 - 1) >> METRICSHIFT)) >> PRECISIONSHIFT); m0 = vp->old_metrics->t[i] + metric; m1 = vp->old_metrics->t[i + NUMSTATES / 2] + (max - metric); m2 = vp->old_metrics->t[i] + (max - metric); m3 = vp->old_metrics->t[i + NUMSTATES / 2] + metric; decision0 = ((int32_t)(m0 - m1)) > 0; decision1 = ((int32_t)(m2 - m3)) > 0; vp->new_metrics->t[2 * i] = decision0 ? m1 : m0; vp->new_metrics->t[2 * i + 1] = decision1 ? m3 : m2; d->w[i/(sizeof(uint32_t)*8/2)+s*(sizeof(decision_t)/sizeof(uint32_t))] |= (decision0|decision1<<1) << ((2*i)&(sizeof(uint32_t)*8-1)); } /* Update decoder with a block of demodulated symbols * Note that nbits is the number of decoded data bits, not the number * of symbols! */ void Viterbi::update_viterbi_blk_GENERIC( struct v *vp, COMPUTETYPE *syms, int16_t nbits) { decision_t *d = (decision_t *)vp->decisions; int32_t s, i; for (s = 0; s < nbits; s++) { memset (&d[s], 0, sizeof (decision_t)); } for (s = 0; s < nbits; s++) { void *tmp; for (i = 0; i < NUMSTATES / 2; i++) { BFLY (i, s, syms, vp, vp->decisions); } renormalize (vp->new_metrics -> t, RENORMALIZE_THRESHOLD); // Swap pointers to old and new metrics tmp = vp->old_metrics; vp->old_metrics = vp -> new_metrics; vp->new_metrics = (metric_t *)tmp; } } // /* Viterbi chainback */ void Viterbi::chainback_viterbi( struct v *vp, uint8_t *data, /* Decoded output data */ int16_t nbits, /* Number of data bits */ uint16_t endstate) /*Terminal encoder state */ { decision_t *d = vp->decisions; /* Make room beyond the end of the encoder register so we can * accumulate a full byte of decoded data */ endstate = (endstate % NUMSTATES) << ADDSHIFT; /* The store into data[] only needs to be done every 8 bits. * But this avoids a conditional branch, and the writes will * combine in the cache anyway */ d += (K - 1); /* Look past tail */ while (nbits-- != 0){ int k; // int l = (endstate >> ADDSHIFT) / 32; // int m = (endstate >> ADDSHIFT) % 32; k = (d[nbits].w[(endstate >> ADDSHIFT) / 32] >> ((endstate>>ADDSHIFT) % 32)) & 1; endstate = (endstate >> 1) | (k << (K - 2 + ADDSHIFT)); data[nbits >> 3] = endstate >> SUBSHIFT; } } /* Initialize Viterbi decoder for start of new frame */ void Viterbi::init_viterbi(struct v *p, int16_t starting_state) { struct v *vp = p; int32_t i; for (i = 0; i < NUMSTATES; i++) vp->metrics1.t[i] = 63; vp->old_metrics = &vp -> metrics1; vp->new_metrics = &vp -> metrics2; /* Bias known start state */ vp->old_metrics-> t[starting_state & (NUMSTATES-1)] = 0; } welle.io-2.1/src/backend/viterbi.h000066400000000000000000000043061357201522000170650ustar00rootroot00000000000000#ifndef __VITERBI__ #define __VITERBI__ /* * Viterbi.h according to the SPIRAL project */ #include "dab-constants.h" #include "MathHelper.h" // For our particular viterbi decoder, we have #define RATE 4 #define NUMSTATES 64 #define DECISIONTYPE uint32_t #define DECISIONTYPE_BITSIZE (sizeof(DECISIONTYPE) * 8) #define COMPUTETYPE uint16_t //decision_t is a BIT vector typedef union { DECISIONTYPE t[NUMSTATES/DECISIONTYPE_BITSIZE]; uint32_t w[NUMSTATES/32]; uint16_t s[NUMSTATES/16]; uint8_t c[NUMSTATES/8]; } decision_t __attribute__ ((aligned (16))); typedef union { COMPUTETYPE t[NUMSTATES]; } metric_t __attribute__ ((aligned (16))); /* State info for instance of Viterbi decoder */ struct v { /* path metric buffer 1 */ __attribute__ ((aligned (16))) metric_t metrics1; /* path metric buffer 2 */ __attribute__ ((aligned (16))) metric_t metrics2; /* Pointers to path metrics, swapped on every bit */ metric_t *old_metrics,*new_metrics; decision_t *decisions; /* decisions */ }; class Viterbi { public: Viterbi(int16_t); ~Viterbi(void); Viterbi(const Viterbi& other) = delete; Viterbi& operator=(const Viterbi& other) = delete; void deconvolve(softbit_t *input, uint8_t *output); private: struct v vp; COMPUTETYPE Branchtab [NUMSTATES / 2 * RATE] __attribute__ ((aligned (16))); // int parityb (uint8_t); int parity(int x); void partab_init (void); // uint8_t Partab [256]; void init_viterbi(struct v *, int16_t starting_state); void update_viterbi_blk_GENERIC( struct v *vp, COMPUTETYPE *syms, int16_t nbits); void chainback_viterbi( struct v *vp, uint8_t *data, /* Decoded output data */ int16_t nbits, /* Number of data bits */ uint16_t endstate); /*Terminal encoder state */ void BFLY( int i, int s, COMPUTETYPE * syms, struct v * vp, decision_t * d); uint8_t *data; COMPUTETYPE *symbols; int16_t frameBits; }; #endif welle.io-2.1/src/input/000077500000000000000000000000001357201522000150155ustar00rootroot00000000000000welle.io-2.1/src/input/airspy_sdr.cpp000066400000000000000000000225731357201522000177110ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright 2015 by Andrea Montefusco IW0HDV * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License 3.0+ * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #include #include "airspy_sdr.h" // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif static const int EXTIO_NS = 8192; static const int EXTIO_BASE_TYPE_SIZE = sizeof(float); CAirspy::CAirspy(RadioControllerInterface &radioController) : radioController(radioController), SampleBuffer(256 * 1024), SpectrumSampleBuffer(8192) { std::clog << "Airspy: " << "Open airspy" << std::endl; device = {}; int result = airspy_init(); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: " << "airspy_init () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; throw 0; } result = airspy_open(&device); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: " << "airpsy_open () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; throw 0; } airspy_set_sample_type(device, AIRSPY_SAMPLE_FLOAT32_IQ); result = airspy_set_samplerate(device, AIRSPY_SAMPLERATE); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: " <<"airspy_set_samplerate() failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; throw 0; } if (sw_agc) { setAgc(true); } else { setAgc(false); setGain(currentLinearityGain); } running = false; return; } CAirspy::~CAirspy(void) { if (device) { int result = airspy_stop_rx(device); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_stop_rx () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; } result = airspy_close(device); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_close () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; } } airspy_exit(); } void CAirspy::setFrequency(int nf) { freq = nf; int result = airspy_set_freq(device, nf); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_set_freq() failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; } } int CAirspy::getFrequency() const { return freq; } bool CAirspy::restart(void) { int result; if (running) return true; SampleBuffer.FlushRingBuffer(); SpectrumSampleBuffer.FlushRingBuffer(); result = airspy_set_sample_type(device, AIRSPY_SAMPLE_FLOAT32_IQ); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_set_sample_type () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; return false; } result = airspy_start_rx(device, (airspy_sample_block_cb_fn)callback, this); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_start_rx () failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; return false; } running = true; return true; } bool CAirspy::is_ok() { // Check if airspy is still connected airspy_error status = (airspy_error) airspy_is_streaming(device); if(status != AIRSPY_TRUE && running == true) { std::clog << "Airspy: airspy is not working. Maybe it is unplugged. Code: " << status << "running" << running << std::endl; radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "airspy is unplugged.")); stop(); } return running; } void CAirspy::stop(void) { if (!running) return; int result = airspy_stop_rx(device); if (result != AIRSPY_SUCCESS) { std::clog << "Airspy: airspy_stop_rx() failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; } running = false; } int CAirspy::callback(airspy_transfer* transfer) { if (!transfer) { throw std::logic_error("AIRSPY: no transfer"); } auto *p = static_cast(transfer->ctx); // AIRSPY_SAMPLE_FLOAT32_IQ: p->data_available(reinterpret_cast(transfer->samples), transfer->sample_count); return 0; } // Called from AirSpy data callback which gives us interleaved float32 // I and Q according to setting given to airspy_set_sample_type() above. // The AirSpy runs at 4096ksps, we need to decimate by two. int CAirspy::data_available(const DSPCOMPLEX* buf, size_t num_samples) { if (num_samples % 2 != 0) { throw std::runtime_error("CAirspy::data_available() needs an even number of IQ samples to be able to decimate"); } const DSPCOMPLEX* sbuf = reinterpret_cast(buf); std::vector temp(num_samples/2); float maxnorm = 0; for (size_t i = 0; i < num_samples/2; i++) { const auto z = 0.5f * (sbuf[2*i] + sbuf[2*i+1]); temp[i] = z; if (sw_agc and (num_frames % 10) == 0) { if (norm(z) > maxnorm) { maxnorm = norm(z); } } } if (sw_agc and (num_frames % 10) == 0) { const float maxampl = sqrt(maxnorm); // std::clog << "Airspy: maxampl: " << maxampl << std::endl; if (maxampl > 0.2f) { const int newgain = currentLinearityGain - 1; if (newgain >= AIRSPY_GAIN_MIN) { setGain(newgain); } } else if (maxampl < 0.02f) { const int newgain = currentLinearityGain + 1; if (newgain <= AIRSPY_GAIN_MAX) { setGain(newgain); } } } num_frames++; SampleBuffer.putDataIntoBuffer(temp.data(), num_samples/2); SpectrumSampleBuffer.putDataIntoBuffer(temp.data(), num_samples/2); return 0; } void CAirspy::reset(void) { SampleBuffer.FlushRingBuffer(); SpectrumSampleBuffer.FlushRingBuffer(); } int32_t CAirspy::getSamples(DSPCOMPLEX* Buffer, int32_t Size) { return SampleBuffer.getDataFromBuffer(Buffer, Size); } std::vector CAirspy::getSpectrumSamples(int size) { std::vector buf(size); int sizeRead = SpectrumSampleBuffer.getDataFromBuffer(buf.data(), size); if (sizeRead < size) { buf.resize(sizeRead); } return buf; } int32_t CAirspy::getSamplesToRead(void) { return SampleBuffer.GetRingBufferReadAvailable(); } int CAirspy::getGainCount() { return 21; } void CAirspy::setAgc(bool agc) { if (not agc) { int result = airspy_set_linearity_gain(device, currentLinearityGain); if (result != AIRSPY_SUCCESS) std::clog << "Airspy: airspy_set_mixer_agc() failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; } sw_agc = agc; } std::string CAirspy::getDescription() { // Get airspy device name and version char Version[255] = {0}; airspy_version_string_read(device, Version, 20); // Get airspy library version airspy_lib_version_t lib_version; airspy_lib_version(&lib_version); std::string ver = Version; ver += "AirSpy, lib. v" + std::to_string(lib_version.major_version) + "." + std::to_string(lib_version.minor_version) + "." + std::to_string(lib_version.revision); return ver; } bool CAirspy::setDeviceParam(DeviceParam param, int value) { switch (param) { case DeviceParam::BiasTee: std::clog << "Airspy: Set bias tee to " << value << std::endl; airspy_set_rf_bias(device, value); return true; default: return false; } } CDeviceID CAirspy::getID() { return CDeviceID::AIRSPY; } float CAirspy::getGain() const { return currentLinearityGain; } float CAirspy::setGain(int gain) { std::clog << "Airspy: setgain: " << gain << std::endl; currentLinearityGain = gain; int result = airspy_set_linearity_gain(device, currentLinearityGain); if (result != AIRSPY_SUCCESS) std::clog << "Airspy: airspy_set_mixer_agc() failed: " << airspy_error_name((airspy_error)result) << "(" << result << ")" << std::endl; return currentLinearityGain; } welle.io-2.1/src/input/airspy_sdr.h000066400000000000000000000055771357201522000173630ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright 2015 by Andrea Montefusco IW0HDV * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License 3.0+ * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #ifndef __AIRSPY_RADIO__ #define __AIRSPY_RADIO__ #include "virtual_input.h" #include "dab-constants.h" #include "MathHelper.h" #include "ringbuffer.h" #include #ifndef __MINGW32__ #include "libairspy/airspy.h" #else #include "airspy.h" #endif enum class CAirspy_IOCTL { SET_BIAS_TEE }; class CAirspy : public CVirtualInput { public: CAirspy(RadioControllerInterface& radioController); ~CAirspy(void); CAirspy(const CAirspy&) = delete; CAirspy& operator=(const CAirspy&) = delete; void setFrequency(int nf); int getFrequency(void) const; bool restart(void); bool is_ok(void); void stop(void); void reset(void); int32_t getSamples(DSPCOMPLEX* Buffer, int32_t Size); std::vector getSpectrumSamples(int size); int32_t getSamplesToRead(void); float getGain(void) const; float setGain(int gain); int getGainCount(void); void setAgc(bool agc); std::string getDescription(void); bool setDeviceParam(DeviceParam param, int value); CDeviceID getID(void); private: RadioControllerInterface& radioController; const int AIRSPY_SAMPLERATE = 4096000; const int AIRSPY_GAIN_MIN = 0; const int AIRSPY_GAIN_MAX = 21; bool running = false; int freq = 0; size_t num_frames = 0; bool sw_agc = false; int currentLinearityGain = 10; IQRingBuffer SampleBuffer; RingBuffer SpectrumSampleBuffer; struct airspy_device *device; static int callback(airspy_transfer_t*); int data_available(const DSPCOMPLEX* buf, size_t num_samples); }; #endif welle.io-2.1/src/input/input_factory.cpp000066400000000000000000000140551357201522000204140ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif #include "input_factory.h" #include "null_device.h" #include "rtl_tcp.h" #include "raw_file.h" #ifdef HAVE_RTLSDR #include "rtl_sdr.h" #endif #ifdef HAVE_AIRSPY #include "airspy_sdr.h" #endif #ifdef HAVE_SOAPYSDR #include "soapy_sdr.h" #endif #ifdef __ANDROID__ #include "android_rtl_sdr.h" #endif CVirtualInput *CInputFactory::GetDevice(RadioControllerInterface& radioController, const std::string& device) { CVirtualInput *InputDevice = nullptr; std::clog << "InputFactory:" << "Input device:" << device << std::endl; if (device == "auto") InputDevice = GetAutoDevice(radioController); else InputDevice = GetManualDevice(radioController, device); // Fallback if no device is found or an error occured if (InputDevice == nullptr) { std::string text; if (device == "auto") text = QT_TRANSLATE_NOOP("CRadioController", "No valid device found use Null device instead."); else text = QT_TRANSLATE_NOOP("CRadioController", "Error while opening device"); radioController.onMessage(message_level_t::Error, text); InputDevice = new CNullDevice(); } return InputDevice; } CVirtualInput *CInputFactory::GetDevice(RadioControllerInterface &radioController, const CDeviceID deviceId) { CVirtualInput *InputDevice = nullptr; try { switch(deviceId) { #ifdef HAVE_AIRSPY case CDeviceID::AIRSPY: InputDevice = new CAirspy(radioController); break; #endif case CDeviceID::RTL_TCP: InputDevice = new CRTL_TCP_Client(radioController); break; #ifdef HAVE_RTLSDR case CDeviceID::RTL_SDR: InputDevice = new CRTL_SDR(radioController); break; #endif case CDeviceID::RAWFILE: InputDevice = new CRAWFile(radioController); break; #ifdef HAVE_SOAPYSDR case CDeviceID::SOAPYSDR: InputDevice = new CSoapySdr(radioController); break; #endif #ifdef __ANDROID__ case CDeviceID::ANDROID_RTL_SDR: InputDevice = new CAndroid_RTL_SDR(radioController); break; #endif case CDeviceID::NULLDEVICE: InputDevice = new CNullDevice(); break; default: throw std::runtime_error("unknown device ID " + std::string(__FILE__) +":"+ std::to_string(__LINE__)); } } catch (...) { std::clog << "InputFactory:" "Error while opening device \"" << static_cast(deviceId) << "\"." << std::endl; } // Fallback if no device is found or an error occured if (InputDevice == nullptr) { std::string text = QT_TRANSLATE_NOOP("CRadioController", "Error while opening device"); radioController.onMessage(message_level_t::Error, text); InputDevice = new CNullDevice(); } return InputDevice; } CVirtualInput* CInputFactory::GetAutoDevice(RadioControllerInterface& radioController) { (void)radioController; CVirtualInput *inputDevice = nullptr; // Try to find a input device for (int i = 0; i <= 3; i++) { try { switch(i) { #ifdef HAVE_AIRSPY case 0: inputDevice = new CAirspy(radioController); break; #endif #ifdef HAVE_RTLSDR case 1: inputDevice = new CRTL_SDR(radioController); break; #endif #ifdef HAVE_SOAPYSDR case 2: inputDevice = new CSoapySdr(radioController); break; #endif #ifdef __ANDROID__ case 3: inputDevice = new CAndroid_RTL_SDR(radioController); break; #endif } } catch (...) { // An error occured. Maybe the device isn't present. // Just try the next input device } // Break loop if we found a device if (inputDevice != nullptr) break; } return inputDevice; } CVirtualInput* CInputFactory::GetManualDevice(RadioControllerInterface& radioController, const std::string& device) { CVirtualInput *InputDevice = nullptr; try { #ifdef HAVE_AIRSPY if (device == "airspy") InputDevice = new CAirspy(radioController); else #endif if (device == "rtl_tcp") InputDevice = new CRTL_TCP_Client(radioController); else #ifdef HAVE_RTLSDR if (device == "rtl_sdr") InputDevice = new CRTL_SDR(radioController); else #endif #ifdef HAVE_SOAPYSDR if (device == "soapysdr") InputDevice = new CSoapySdr(radioController); else #endif #ifdef __ANDROID__ if (device == "android_rtl_sdr") InputDevice = new CAndroid_RTL_SDR(radioController); else #endif if (device == "rawfile") InputDevice = new CRAWFile(radioController); else std::clog << "InputFactory:" "Unknown device \"" << device << "\"." << std::endl; } catch (...) { std::clog << "InputFactory:" "Error while opening device \"" << device << "\"." << std::endl; } return InputDevice; } welle.io-2.1/src/input/input_factory.h000066400000000000000000000033311357201522000200540ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef CINPUTFACTORY_H #define CINPUTFACTORY_H #include #include "virtual_input.h" #include "radio-controller.h" class CInputFactory { public: static CVirtualInput* GetDevice(RadioControllerInterface& radioController, const std::string& Device); static CVirtualInput* GetDevice(RadioControllerInterface& radioController, const CDeviceID deviceId); private: static CVirtualInput* GetAutoDevice(RadioControllerInterface& radioController); static CVirtualInput* GetManualDevice(RadioControllerInterface& radioController, const std::string& Device); }; #endif // CINPUTFACTORY_H welle.io-2.1/src/input/null_device.cpp000066400000000000000000000042361357201522000200170ustar00rootroot00000000000000/* * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "null_device.h" CNullDevice::CNullDevice() { } void CNullDevice::setFrequency(int Frequency) { (void) Frequency; } int CNullDevice::getFrequency(void) const { return 0; } bool CNullDevice::restart() { return false; } bool CNullDevice::is_ok() { return true; } void CNullDevice::stop() { } void CNullDevice::reset() { } int32_t CNullDevice::getSamples(DSPCOMPLEX *Buffer, int32_t Size) { memset((void*)Buffer, 0, Size * sizeof(DSPCOMPLEX)); return Size; } std::vector CNullDevice::getSpectrumSamples(int size) { std::vector sampleBuffer(size); std::fill(sampleBuffer.begin(), sampleBuffer.end(), 0); return sampleBuffer; } int32_t CNullDevice::getSamplesToRead() { return 0; } float CNullDevice::getGain() const { return 0; } float CNullDevice::setGain(int Gain) { (void) Gain; return 0; } int CNullDevice::getGainCount() { return 0; } void CNullDevice::setAgc(bool AGC) { (void) AGC; } std::string CNullDevice::getDescription() { return "Null device"; } CDeviceID CNullDevice::getID() { return CDeviceID::NULLDEVICE; } welle.io-2.1/src/input/null_device.h000066400000000000000000000033021357201522000174550ustar00rootroot00000000000000/* * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef CNULLDEVICE_H #define CNULLDEVICE_H #include "virtual_input.h" class CNullDevice : public CVirtualInput { public: CNullDevice(); void setFrequency(int Frequency); int getFrequency(void) const; bool restart(void); bool is_ok(void); void stop(void); void reset(void); int32_t getSamples(DSPCOMPLEX* Buffer, int32_t Size); std::vector getSpectrumSamples(int size); int32_t getSamplesToRead(void); float getGain(void) const; float setGain(int Gain); int getGainCount(void); void setAgc(bool AGC); std::string getDescription(void); CDeviceID getID(void); }; #endif // CNULLDEVICE_H welle.io-2.1/src/input/raw_file.cpp000066400000000000000000000253571357201522000173250ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #include #include "raw_file.h" // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif static inline int64_t getMyTime(void) { struct timeval tv; gettimeofday(&tv, NULL); return ((int64_t)tv.tv_sec * 1000000 + (int64_t)tv.tv_usec); } #define INPUT_FRAMEBUFFERSIZE 8 * 32768 CRAWFile::CRAWFile(RadioControllerInterface& radioController, bool throttle, bool rewind) : radioController(radioController), throttle(throttle), autoRewind(rewind), fileName(""), fileFormat(CRAWFileFormat::Unknown), IQByteSize(1), SampleBuffer(INPUT_FRAMEBUFFERSIZE), SpectrumSampleBuffer(8*2048) { } CRAWFile::~CRAWFile(void) { ExitCondition = true; if (readerOK) { if (thread.joinable()) { thread.join(); } if (filePointer) { fclose(filePointer); } } } void CRAWFile::setFrequency(int Frequency) { (void)Frequency; } int CRAWFile::getFrequency() const { return 0; } bool CRAWFile::restart(void) { if (readerOK) readerPausing = false; return readerOK; } bool CRAWFile::is_ok() { return readerOK; } void CRAWFile::stop(void) { if (readerOK) readerPausing = true; } void CRAWFile::reset() { } void CRAWFile::rewind() { if (filePointer) { fseek(filePointer, 0, SEEK_SET); endReached = false; } } float CRAWFile::getGain() const { return 0; } float CRAWFile::setGain(int Gain) { (void)Gain; return 0; } int CRAWFile::getGainCount() { return 0; } void CRAWFile::setAgc(bool AGC) { (void)AGC; } std::string CRAWFile::getDescription() { return "rawfile (" + fileName + ")"; } CDeviceID CRAWFile::getID() { return CDeviceID::RAWFILE; } bool ends_with(const std::string& value, const std::string& ending) { if (ending.size() > value.size()) return false; return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); } void CRAWFile::setFileName(const std::string& fileName, const std::string& fileFormat) { this->fileName = fileName; setFileFormat(fileFormat); filePointer = fopen(fileName.c_str(), "rb"); if (filePointer == nullptr) { std::clog << "RAWFile: Cannot open file: " << fileName << std::endl; radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "Cannot open file "), fileName); return; } readerOK = true; readerPausing = true; currPos = 0; thread = std::thread(&CRAWFile::run, this); } void CRAWFile::setFileHandle(int handle, const std::string& fileFormat) { this->fileName = "unknown"; setFileFormat(fileFormat); filePointer = fdopen(handle, "rb"); if (filePointer == nullptr) { std::clog << "RAWFile: Cannot open file: " << fileName << std::endl; radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "Cannot open file "), fileName); return; } readerOK = true; readerPausing = true; currPos = 0; thread = std::thread(&CRAWFile::run, this); } std::string CRAWFile::getFileName() const { return fileName; } // size is in I/Q pairs, file contains 8 bits values int32_t CRAWFile::getSamples(DSPCOMPLEX* V, int32_t size) { if (filePointer == nullptr) return 0; while ((int32_t)(SampleBuffer.GetRingBufferReadAvailable()) < IQByteSize * size) if (readerPausing) std::this_thread::sleep_for(std::chrono::milliseconds(100)); else std::this_thread::sleep_for(std::chrono::milliseconds(100)); return convertSamples(SampleBuffer, V, size); } std::vector CRAWFile::getSpectrumSamples(int size) { std::vector buffer(size); int sizeRead = convertSamples(SpectrumSampleBuffer, buffer.data(), size); if (sizeRead < size) { buffer.resize(sizeRead); } return buffer; } int32_t CRAWFile::getSamplesToRead(void) { return SampleBuffer.GetRingBufferReadAvailable() / 2; } void CRAWFile::run(void) { int32_t t; int32_t bufferSize = 32768; int32_t period; int64_t nextStop; if (!readerOK) return; ExitCondition = false; period = (32768 * 1000) / (IQByteSize * 2048); // full IQs read std::clog << "RAWFile" << "Period =" << period << std::endl; std::vector bi(bufferSize); nextStop = getMyTime(); while (!ExitCondition) { if (readerPausing) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); nextStop = getMyTime(); continue; } while (SampleBuffer.WriteSpace() < bufferSize + 10) { if (ExitCondition) break; std::this_thread::sleep_for(std::chrono::microseconds(100)); } nextStop += period; t = readBuffer(bi.data(), bufferSize); if (t <= 0) { for (int i = 0; i < bufferSize; i++) bi[i] = 0; t = bufferSize; } SampleBuffer.putDataIntoBuffer(bi.data(), t); SpectrumSampleBuffer.putDataIntoBuffer(bi.data(), t); putIntoRecordBuffer(*bi.data(), t); int64_t t_to_wait = nextStop - getMyTime(); if (throttle and t_to_wait > 0) std::this_thread::sleep_for(std::chrono::microseconds(t_to_wait)); } std::clog << "RAWFile:" << "Read threads ends" << std::endl; } /* * length is number of uints that we read. */ int32_t CRAWFile::readBuffer(uint8_t* data, int32_t length) { int32_t n; if (!filePointer) { return 0; } n = fread(data, sizeof(uint8_t), length, filePointer); currPos += n; if (n < length) { if (autoRewind) { fseek(filePointer, 0, SEEK_SET); std::clog << "RAWFile:" << "End of file, restarting" << std::endl; radioController.onMessage(message_level_t::Information, QT_TRANSLATE_NOOP("CRadioController", "End of file, restarting")); } else { radioController.onMessage(message_level_t::Information, QT_TRANSLATE_NOOP("CRadioController", "End of file")); endReached = true; return 0; } } return n & ~01; } int32_t CRAWFile::convertSamples(RingBufferBase& Buffer, DSPCOMPLEX *V, int32_t size) { // Native endianness complex requires no conversion if (fileFormat == CRAWFileFormat::COMPLEXF) { int32_t amount = Buffer.getDataFromBuffer(V, IQByteSize * size); return amount / IQByteSize; } uint8_t *temp = (uint8_t*)alloca((size_t)IQByteSize * (size_t)size * sizeof(uint8_t)); int32_t amount = Buffer.getDataFromBuffer(temp, IQByteSize * size); // Unsigned 8-bit if (fileFormat == CRAWFileFormat::U8) { for (int i = 0; i < amount / 2; i++) V[i] = DSPCOMPLEX(float(temp[2 * i] - 128) / 128.0, float(temp[2 * i + 1] - 128) / 128.0); } // Signed 8-bit else if (fileFormat == CRAWFileFormat::S8) { for (int i = 0; i < amount / 2; i++) V[i] = DSPCOMPLEX(float((int8_t)temp[2 * i]) / 128.0, float((int8_t)temp[2 * i + 1]) / 128.0); } // Signed 16-bit little endian else if (fileFormat == CRAWFileFormat::S16LE) { for (int i = 0, j = 0; i < amount / 4; i++, j+= IQByteSize) { int16_t IQ_I = (int16_t)(temp[j + 0] << 8) | temp[j + 1]; int16_t IQ_Q = (int16_t)(temp[j + 2] << 8) | temp[j + 3]; V[i] = DSPCOMPLEX((float)(IQ_I), (float)(IQ_Q)); } } // Signed 16-bit big endian else if (fileFormat == CRAWFileFormat::S16BE) { for (int i = 0, j = 0; i < amount / 4; i++, j += IQByteSize) { int16_t IQ_I = (int16_t)(temp[j + 1] << 8) | temp[j + 0]; int16_t IQ_Q = (int16_t)(temp[j + 3] << 8) | temp[j + 2]; V[i] = DSPCOMPLEX((float)(IQ_I), (float)(IQ_Q)); } } return amount / IQByteSize; } void CRAWFile::setFileFormat(const std::string &fileFormat) { if (fileFormat == "u8" or (fileFormat == "auto" and ends_with(fileName, ".u8.iq"))) { this->fileFormat = CRAWFileFormat::U8; IQByteSize = 2; } else if (fileFormat == "s8" or (fileFormat == "auto" and ends_with(fileName, ".s8.iq"))) { this->fileFormat = CRAWFileFormat::S8; IQByteSize = 2; } else if(fileFormat == "s16le" or (fileFormat == "auto" and ends_with(fileName, ".s16le.iq"))) { this->fileFormat = CRAWFileFormat::S16LE; IQByteSize = 4; } else if(fileFormat == "s16be" or (fileFormat == "auto" and ends_with(fileName, ".s16be.iq"))) { this->fileFormat = CRAWFileFormat::S16BE; IQByteSize = 4; } else if(fileFormat == "cf32" or (fileFormat == "auto" and ends_with(fileName, ".cf32.iq"))) { this->fileFormat = CRAWFileFormat::COMPLEXF; IQByteSize = 8; } else if (fileFormat == "auto") { // Default to u8 for backward compatibility this->fileFormat = CRAWFileFormat::U8; IQByteSize = 2; } else { this->fileFormat = CRAWFileFormat::Unknown; std::clog << "RAWFile: unknown file format" << std::endl; radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "Unknown RAW file format")); } } welle.io-2.1/src/input/raw_file.h000066400000000000000000000063051357201522000167620ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __RAW_FILES #define __RAW_FILES #include #include #include "virtual_input.h" #include "dab-constants.h" #include "ringbuffer.h" #include "radio-controller.h" // Enum of available input device enum class CRAWFileFormat {U8, S8, S16LE, S16BE, COMPLEXF, Unknown}; class CRAWFile : public CVirtualInput { public: CRAWFile(RadioControllerInterface& radioController, bool throttle = true, bool rewind = true); ~CRAWFile(void); // Interface methods void setFrequency(int Frequency); int getFrequency(void) const; int32_t getSamples(DSPCOMPLEX*, int32_t); std::vector getSpectrumSamples(int size); int32_t getSamplesToRead(void); bool restart(void); bool is_ok(void); void stop(void); void reset(void); void rewind(void); float getGain(void) const; float setGain(int Gain); int getGainCount(void); void setAgc(bool AGC); std::string getDescription(void); CDeviceID getID(void); // Specific methods void setFileName(const std::string& FileName, const std::string& FileFormat); void setFileHandle(int handle, const std::string& fileFormat); std::string getFileName(void) const; bool endWasReached() const { return endReached; } private: RadioControllerInterface& radioController; bool throttle; bool autoRewind; std::string fileName; CRAWFileFormat fileFormat; uint8_t IQByteSize; void run(void); int32_t readBuffer(uint8_t*, int32_t); int32_t convertSamples(RingBufferBase& Buffer, DSPCOMPLEX* V, int32_t size); void setFileFormat(const std::string& fileFormat); IQRingBuffer SampleBuffer; RingBuffer SpectrumSampleBuffer; FILE* filePointer = nullptr; bool readerOK = false; bool readerPausing = false; bool endReached = false; std::atomic ExitCondition = ATOMIC_VAR_INIT(false); int64_t currPos = 0; std::thread thread; }; #endif welle.io-2.1/src/input/rtl_sdr.cpp000066400000000000000000000252771357201522000172070ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "rtl_sdr.h" // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif #define READLEN_DEFAULT 8192 // Fallback if function is not defined in shared lib int __attribute__((weak)) rtlsdr_set_bias_tee(rtlsdr_dev_t *dev, int on); CRTL_SDR::CRTL_SDR(RadioControllerInterface& radioController) : radioController(radioController), sampleBuffer(1024 * 1024), spectrumSampleBuffer(8192) { int ret = 0; std::clog << "RTL_SDR:" << "Open rtl-sdr" << std::endl; // Get all devices uint32_t deviceCount = rtlsdr_get_device_count(); if (deviceCount == 0) { std::clog << "RTL_SDR:" << "No devices found" << std::endl; throw 0; } else { std::clog << "RTL_SDR:" << "Found " << deviceCount << " devices. Uses the first working one" << std::endl; } // Iterate over all found rtl-sdr devices and try to open it. Stops if one device is successfull opened. for(uint32_t i=0; i= 0) { std::clog << "RTL_SDR:" << " Opening rtl-sdr device" << i << std::endl; break; } } if (ret < 0) { std::clog << "RTL_SDR:" << " Opening rtl-sdr failed" << std::endl; throw 0; } open = true; // Set sample rate ret = rtlsdr_set_sample_rate(device, INPUT_RATE); if (ret < 0) { std::clog << "RTL_SDR:" << " Setting sample rate failed" << std::endl; throw 0; } // Get tuner gains uint32_t gainsCount = rtlsdr_get_tuner_gains(device, NULL); std::clog << "RTL_SDR:" << " Supported gain values" << gainsCount << std::endl; gains.resize(gainsCount); gainsCount = rtlsdr_get_tuner_gains(device, gains.data()); for (int i = gainsCount; i > 0; i--) { std::clog << "RTL_SDR:" << " gain " << (gains[i - 1] / 10.0) << std::endl; } // Always use manual gain, the AGC is implemented in software rtlsdr_set_tuner_gain_mode(device, 1); // Enable AGC by default setAgc(true); } CRTL_SDR::~CRTL_SDR(void) { stop(); if (open) rtlsdr_close(device); open = false; } void CRTL_SDR::setFrequency(int frequency) { stop(); rtlsdrUnplugged = false; lastFrequency = frequency; restart(); } int CRTL_SDR::getFrequency(void) const { return lastFrequency; } bool CRTL_SDR::restart(void) { int ret; if(rtlsdrUnplugged) { return false; } if (rtlsdrRunning) { return true; } sampleBuffer.FlushRingBuffer(); spectrumSampleBuffer.FlushRingBuffer(); ret = rtlsdr_reset_buffer(device); if (ret < 0) return false; rtlsdr_set_center_freq(device, lastFrequency + frequencyOffset); rtlsdrRunning = true; rtlsdrThread = std::thread(&CRTL_SDR::rtlsdr_read_async_wrapper, this); agcThread = std::thread(&CRTL_SDR::AGCTimer, this); return true; } bool CRTL_SDR::is_ok(void) { return rtlsdrRunning and not rtlsdrUnplugged; } void CRTL_SDR::stop(void) { if (not rtlsdrRunning) return; rtlsdrRunning = false; if (agcThread.joinable()) { agcThread.join(); } rtlsdr_cancel_async(device); if (rtlsdrThread.joinable()) { rtlsdrThread.join(); } } float CRTL_SDR::getGain() const { return currentGain / 10.0; } float CRTL_SDR::setGain(int gain_index) { if ((size_t)gain_index >= gains.size()) { std::clog << "RTL_SDR:" << "Unknown gain count" << gain_index << std::endl; return 0; } currentGainIndex = gain_index; currentGain = gains[gain_index]; //std::clog << "RTL_SDR:" << "Set gain to" << currentGain / 10.0 << "db" << std::endl; int ret = rtlsdr_set_tuner_gain(device, currentGain); if (ret != 0) { std::clog << "RTL_SDR:" << "Setting gain failed" << std::endl; } return currentGain / 10.0; } int CRTL_SDR::getGainCount() { return gains.size() - 1; } void CRTL_SDR::setAgc(bool AGC) { if (AGC == true) { isAGC = true; } else { isAGC = false; setGain(currentGainIndex); } } bool CRTL_SDR::setDeviceParam(DeviceParam param, int value) { switch(param) { case DeviceParam::BiasTee: if(rtlsdr_set_bias_tee) { std::clog << "RTL_SDR: Set bias tee to " << value << std::endl; rtlsdr_set_bias_tee(device, value); } else { std::clog << "RTL_SDR: " << "Error: rtlsdr_set_bias_tee() not defined!" << std::endl; } return true; default: std::runtime_error("Unsupported device parameter"); } return false; } std::string CRTL_SDR::getDescription() { char manufact[256] = {0}; char product[256] = {0}; char serial[256] = {0}; rtlsdr_get_usb_strings(device, manufact, product, serial); std::string name; name += manufact; name += ", "; name += product; name += ", "; name += serial; return name; } CDeviceID CRTL_SDR::getID() { return CDeviceID::RTL_SDR; } void CRTL_SDR::AGCTimer(void) { while (rtlsdrRunning && not rtlsdrUnplugged) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); if (isAGC) { // Check for overloading if (minAmplitude == 0 || maxAmplitude == 255) { // We have to decrease the gain if (currentGainIndex > 0) { setGain(currentGainIndex - 1); //std::clog << "RTL_SDR:" << "Decreased gain to " << (float)currentGain / 10.0f << std::endl; } } else { if (currentGainIndex < ((ssize_t)gains.size() - 1)) { // Calc if a gain increase overloads the device. Calc it from the gain values int NewGain = gains[currentGainIndex + 1]; float DeltaGain = ((float) NewGain / 10) - ((float) currentGain / 10); float LinGain = pow(10, DeltaGain / 20); int NewMaxValue = (float) maxAmplitude * LinGain; int NewMinValue = (float) minAmplitude / LinGain; // We have to increase the gain if(NewMinValue >= 0 && NewMaxValue <= 255) { setGain(currentGainIndex + 1); //std::clog << "RTL_SDR:" << "Increased gain to " << (float) currentGain / 10 << std::endl; } } } } else { // AGC is off if (minAmplitude == 0 || maxAmplitude == 255) { std::string Text = QT_TRANSLATE_NOOP("CRadioController", "ADC overload. Maybe you are using a too high gain."); std::clog << "RTL_SDR:" << Text << std::endl; radioController.onMessage(message_level_t::Information, Text); } } } } int32_t CRTL_SDR::getSamples(DSPCOMPLEX *buffer, int32_t size) { std::vector tempBuffer(2 * size); int32_t amount = sampleBuffer.getDataFromBuffer(tempBuffer.data(), 2 * size); // Normalise samples for (int i = 0; i < amount / 2; i++) { buffer[i] = DSPCOMPLEX( (float(tempBuffer[2 * i] - 128)) / 128.0, (float(tempBuffer[2 * i + 1] - 128)) / 128.0); } return amount / 2; } std::vector CRTL_SDR::getSpectrumSamples(int size) { std::vector tempBuffer(2 * size); // Get samples int32_t amount = spectrumSampleBuffer.getDataFromBuffer( tempBuffer.data(), 2 * size); std::vector buffer(amount / 2); // Convert samples into generic format for (int i = 0; i < amount / 2; i++) { buffer[i] = DSPCOMPLEX( (float(tempBuffer[2 * i] - 128)) / 128.0, (float(tempBuffer[2 * i + 1] - 128)) / 128.0); } return buffer; } int32_t CRTL_SDR::getSamplesToRead(void) { return sampleBuffer.GetRingBufferReadAvailable() / 2; } void CRTL_SDR::reset(void) { sampleBuffer.FlushRingBuffer(); } void CRTL_SDR::RTLSDRCallBack(uint8_t* buf, uint32_t len, void* ctx) { if (ctx) { CRTL_SDR *rtlsdr = (CRTL_SDR*)ctx; if (len != READLEN_DEFAULT) { std::clog << "Short read" << std::endl; return; } int32_t tmp = rtlsdr->sampleBuffer.putDataIntoBuffer(buf, len); if ((len - tmp) > 0) rtlsdr->sampleCounter += len - tmp; rtlsdr->spectrumSampleBuffer.putDataIntoBuffer(buf, len); rtlsdr->putIntoRecordBuffer(*buf, len); // Check if device is overloaded rtlsdr->minAmplitude = 255; rtlsdr->maxAmplitude = 0; for (uint32_t i=0;iminAmplitude > buf[i]) rtlsdr->minAmplitude = buf[i]; if (rtlsdr->maxAmplitude < buf[i]) rtlsdr->maxAmplitude = buf[i]; } } else { std::clog << "ERROR no ctx in RTLSDR callback" << std::endl; } } void CRTL_SDR::rtlsdr_read_async_wrapper() { std::clog << "Start RTLSDR thread" << std::endl; rtlsdr_read_async(device, (rtlsdr_read_async_cb_t)&CRTL_SDR::RTLSDRCallBack, (void*)this, 0, READLEN_DEFAULT); if(rtlsdrRunning) radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "RTL-SDR is unplugged.")); rtlsdrUnplugged = true; rtlsdrRunning = false; std::clog << "End RTLSDR thread" << std::endl; } welle.io-2.1/src/input/rtl_sdr.h000066400000000000000000000062031357201522000166400ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _CRTLSDR_H #define _CRTLSDR_H #include #include #include #include #include #include "virtual_input.h" #include "dab-constants.h" #include "MathHelper.h" #include "ringbuffer.h" #include "radio-controller.h" // This class is a simple wrapper around the // rtlsdr library that is read is as dll // It does not do any processing class CRTL_SDR : public CVirtualInput { public: CRTL_SDR(RadioControllerInterface& radioController); ~CRTL_SDR(void); // Interface methods bool restart(void); bool is_ok(void); void stop(void); void reset(void); int32_t getSamples(DSPCOMPLEX *buffer, int32_t size); std::vector getSpectrumSamples(int size); int32_t getSamplesToRead(void); void setFrequency(int Frequency); int getFrequency(void) const; float getGain(void) const; float setGain(int gain_index); int getGainCount(void); void setAgc(bool AGC); std::string getDescription(void); bool setDeviceParam(DeviceParam param, int value); CDeviceID getID(void); private: std::thread agcThread; RadioControllerInterface& radioController; int lastFrequency = kHz(94700); int frequencyOffset = 0; int currentGain = 0; bool isAGC = false; bool isHwAGC = false; std::thread rtlsdrThread; void rtlsdr_read_async_wrapper(void); std::atomic rtlsdrRunning = ATOMIC_VAR_INIT(false); std::atomic rtlsdrUnplugged = ATOMIC_VAR_INIT(false); bool open = false; std::vector gains; int currentGainIndex = 0; uint8_t minAmplitude = 255; uint8_t maxAmplitude = 0; void AGCTimer(void); IQRingBuffer sampleBuffer; RingBuffer spectrumSampleBuffer; struct rtlsdr_dev *device = nullptr; int32_t sampleCounter = 0; static void RTLSDRCallBack(uint8_t* buf, uint32_t len, void *ctx); }; #endif welle.io-2.1/src/input/rtl_tcp.cpp000066400000000000000000000343031357201522000171730ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include "rtl_tcp.h" // For Qt translation if Qt is exisiting #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif // commands are packed in 5 bytes, one "command byte" // and an integer parameter struct command { unsigned char cmd; unsigned int param; }__attribute__((packed)); enum rtlsdr_tuner { RTLSDR_TUNER_UNKNOWN = 0, RTLSDR_TUNER_E4000, RTLSDR_TUNER_FC0012, RTLSDR_TUNER_FC0013, RTLSDR_TUNER_FC2580, RTLSDR_TUNER_R820T, RTLSDR_TUNER_R828D }; #define ONE_BYTE 8 CRTL_TCP_Client::CRTL_TCP_Client(RadioControllerInterface& radioController) : radioController(radioController), sampleBuffer(32 * 32768), spectrumSampleBuffer(8192) { memset(&dongleInfo, 0, sizeof(dongle_info_t)); dongleInfo.tuner_type = RTLSDR_TUNER_UNKNOWN; } CRTL_TCP_Client::~CRTL_TCP_Client(void) { stop(); } void CRTL_TCP_Client::setFrequency(int newFrequency) { frequency = newFrequency; sendVFO(newFrequency); } int CRTL_TCP_Client::getFrequency() const { return frequency; } bool CRTL_TCP_Client::restart(void) { if (rtlsdrRunning) { return true; } rtlsdrRunning = true; receiveThread = std::thread(&CRTL_TCP_Client::receiveAndReconnect, this); receiveThread.detach(); // Wait so that the other thread has a chance to establish the connection std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::unique_lock lock(mutex); return connected; } bool CRTL_TCP_Client::is_ok() { return rtlsdrRunning; } void CRTL_TCP_Client::stop(void) { #ifdef __ANDROID__ // Send TCP_ANDROID_EXIT cmd to explicitly cause the driver to turn off itself sendCommand(0x7e, 0); #endif std::unique_lock lock(mutex); agcRunning = false; rtlsdrRunning = false; // Close connection sock.close(); lock.unlock(); if (agcThread.joinable()) { agcThread.join(); } if (receiveThread.joinable()) { receiveThread.join(); } } static int32_t read_convert_from_buffer( RingBufferBase& buffer, DSPCOMPLEX *v, int32_t size) { int32_t amount, i; std::vector tempBuffer(2 * size); // Get data from the ring buffer amount = buffer.getDataFromBuffer(tempBuffer.data(), 2 * size); for (i = 0; i < amount / 2; i ++) v[i] = DSPCOMPLEX(((float)tempBuffer[2 * i] - 128.0f) / 128.0f, ((float)tempBuffer[2 * i + 1] - 128.0f) / 128.0f); return amount / 2; } int32_t CRTL_TCP_Client::getSamples(DSPCOMPLEX *v, int32_t size) { return read_convert_from_buffer(sampleBuffer, v, size); } std::vector CRTL_TCP_Client::getSpectrumSamples(int size) { std::vector buffer(size); int sizeRead = read_convert_from_buffer(spectrumSampleBuffer, buffer.data(), size); if (sizeRead < size) { buffer.resize(sizeRead); } return buffer; } int32_t CRTL_TCP_Client::getSamplesToRead(void) { return sampleBuffer.GetRingBufferReadAvailable () / 2; } void CRTL_TCP_Client::reset(void) { sampleBuffer.FlushRingBuffer(); } void CRTL_TCP_Client::receiveData(void) { std::vector buffer(8192); size_t read = 0; while (sock.valid() && read < buffer.size()) { const size_t remain = buffer.size() - read; ssize_t ret = sock.recv(buffer.data() + read, remain, 0); if (ret == 0) { handleDisconnect(); } else if (ret == -1) { if (errno == EAGAIN) { continue; } else if (errno == EINTR) { continue; } else if (errno == ECONNRESET || errno == EBADF) { handleDisconnect(); } else { std::string errstr = strerror(errno); throw std::runtime_error("recv: " + errstr); } } else { read += ret; } if (not rtlsdrRunning) { break; } } if (firstData) { firstData = false; // Get dongle information ::memcpy(&dongleInfo, buffer.data(), sizeof(dongle_info_t)); // Convert the byte order dongleInfo.tuner_type = ntohl(dongleInfo.tuner_type); dongleInfo.tuner_gain_count = ntohl(dongleInfo.tuner_gain_count); if(dongleInfo.magic[0] == 'R' && dongleInfo.magic[1] == 'T' && dongleInfo.magic[2] == 'L' && dongleInfo.magic[3] == '0') { std::string TunerType; switch(dongleInfo.tuner_type) { case RTLSDR_TUNER_UNKNOWN: TunerType = "Unknown"; break; case RTLSDR_TUNER_E4000: TunerType = "E4000"; break; case RTLSDR_TUNER_FC0012: TunerType = "FC0012"; break; case RTLSDR_TUNER_FC0013: TunerType = "FC0013"; break; case RTLSDR_TUNER_FC2580: TunerType = "FC2580"; break; case RTLSDR_TUNER_R820T: TunerType = "R820T"; break; case RTLSDR_TUNER_R828D: TunerType = "R828D"; break; default: TunerType = "Unknown"; } std::clog << "RTL_TCP_CLIENT: Tuner type: " << dongleInfo.tuner_type << " " << TunerType << std::endl; std::clog << "RTL_TCP_CLIENT: Tuner gain count: " << dongleInfo.tuner_gain_count << std::endl; } else { std::clog << "RTL_TCP_CLIENT: Didn't find the \"RTL0\" magic key." << std::endl; } } sampleBuffer.putDataIntoBuffer(buffer.data(), buffer.size()); spectrumSampleBuffer.putDataIntoBuffer(buffer.data(), buffer.size()); // Check if device is overloaded minAmplitude = 255; maxAmplitude = 0; for (const auto b : buffer) { if (minAmplitude > b) minAmplitude = b; if (maxAmplitude < b) maxAmplitude = b; } } void CRTL_TCP_Client::handleDisconnect() { connected = false; firstData = true; radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "RTL-TCP connection closed.")); sock.close(); } void CRTL_TCP_Client::sendCommand(uint8_t cmd, int32_t param) { if (!connected || !sock.valid()) { return; } std::vector datagram; datagram.resize(5); datagram[0] = cmd; // command to set rate datagram[4] = param & 0xFF; //lsb last datagram[3] = (param >> ONE_BYTE) & 0xFF; datagram[2] = (param >> (2 * ONE_BYTE)) & 0xFF; datagram[1] = (param >> (3 * ONE_BYTE)) & 0xFF; sock.send(datagram.data(), datagram.size(), 0); } void CRTL_TCP_Client::sendVFO(int32_t frequency) { sendCommand(0x01, frequency); } void CRTL_TCP_Client::sendRate(int32_t theRate) { sendCommand(0x02, theRate); } void CRTL_TCP_Client::setGainMode(int32_t gainMode) { sendCommand (0x03, gainMode); } float CRTL_TCP_Client::getGain() const { return currentGain; } float CRTL_TCP_Client::setGain(int32_t gain) { currentGainCount = gain; float gainValue = getGainValue(gain); sendCommand(0x04, (int)10 * gainValue); currentGain = gainValue; return gainValue; } int32_t CRTL_TCP_Client::getGainCount() { int32_t MaxGainCount = 0; switch (dongleInfo.tuner_type) { case RTLSDR_TUNER_E4000: MaxGainCount = e4k_gains.size(); break; case RTLSDR_TUNER_FC0012: MaxGainCount = fc0012_gains.size(); break; case RTLSDR_TUNER_FC0013: MaxGainCount = fc0013_gains.size(); break; case RTLSDR_TUNER_FC2580: MaxGainCount = fc2580_gains.size(); break; case RTLSDR_TUNER_R820T: MaxGainCount = r82xx_gains.size(); break; case RTLSDR_TUNER_R828D: MaxGainCount = r82xx_gains.size(); break; default: MaxGainCount = 29; // Most likely it is the R820T tuner } return MaxGainCount; } void CRTL_TCP_Client::setAgc(bool AGC) { isAGC = AGC; } //void CRTL_TCP_Client::setHwAgc(bool hwAGC) //{ // isHwAGC = hwAGC; // sendCommand(0x08, hwAGC ? 1 : 0); //} std::string CRTL_TCP_Client::getDescription() { return "rtl_tcp_client (server: " + serverAddress + ":" + std::to_string(serverPort) + ")"; } CDeviceID CRTL_TCP_Client::getID() { return CDeviceID::RTL_TCP; } void CRTL_TCP_Client::setIP(const std::string& ipAddress) { serverAddress = ipAddress; } void CRTL_TCP_Client::setPort(uint16_t Port) { serverPort = Port; } void CRTL_TCP_Client::receiveAndReconnect() { while (rtlsdrRunning) { std::unique_lock lock(mutex); if (!connected) { std::clog << "RTL_TCP_CLIENT: Try to connect to server " << serverAddress << ":" << serverPort << std::endl; try { connected = sock.connect(serverAddress, serverPort, 2); } catch(const std::runtime_error& e) { std::clog << "RTL_TCP_CLIENT: " << e.what() << std::endl; } if (connected) { std::clog << "RTL_TCP_CLIENT: Successful connected to server " << std::endl; // Always use manual gain, the AGC is implemented in software setGainMode(1); setGain(currentGainCount); sendRate(INPUT_RATE); sendVFO(frequency); if (!agcRunning) { agcRunning = true; agcThread = std::thread(&CRTL_TCP_Client::agcTimer, this); } } else { std::clog << "RTL_TCP_CLIENT: Could not connect to server" << std::endl; agcRunning = false; rtlsdrRunning = false; lock.unlock(); radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "Connection failed to server "), serverAddress + ":" + std::to_string(serverPort)); } } if (connected) { if (lock.owns_lock()) { lock.unlock(); } receiveData(); } } } void CRTL_TCP_Client::agcTimer(void) { while (agcRunning) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); if (isAGC && (dongleInfo.tuner_type != RTLSDR_TUNER_UNKNOWN)) { // Check for overloading if (minAmplitude == 0 || maxAmplitude == 255) { // We have to decrease the gain if(currentGainCount > 0) { setGain(currentGainCount - 1); //std::clog << "RTL_TCP_CLIENT: Decrease gain to " << (float)currentGain << std::endl; } } else { if (currentGainCount < (getGainCount() - 1)) { // Calc if a gain increase overloads the device. Calc it // from the gain values const float newGain = getGainValue(currentGainCount + 1); const float deltaGain = newGain - currentGain; const float linGain = pow(10, deltaGain / 20); const int newMaxValue = (float)maxAmplitude * linGain; const int newMinValue = (float)minAmplitude / linGain; // We have to increase the gain if (newMinValue >=0 && newMaxValue <= 255) { setGain(currentGainCount + 1); //std::clog << "RTL_TCP_CLIENT: Increase gain to " << currentGain << std::endl; } } } } else { // AGC is off or unknown tuner if (minAmplitude == 0 || maxAmplitude == 255) { std::string text = QT_TRANSLATE_NOOP("CRadioController", "ADC overload." " Maybe you are using a too high gain."); std::clog << "RTL_TCP_CLIENT:" << text << std::endl; radioController.onMessage(message_level_t::Information, text); } } } } float CRTL_TCP_Client::getGainValue(uint16_t gainCount) { float gainValue = 0; if (dongleInfo.tuner_type == RTLSDR_TUNER_UNKNOWN) return 0; // Get max gain count uint32_t maxGainCount = getGainCount(); if (maxGainCount == 0) return 0; // Check if gainCount is valid if (gainCount < maxGainCount) { // Get gain switch(dongleInfo.tuner_type) { case RTLSDR_TUNER_E4000: gainValue = e4k_gains[gainCount]; break; case RTLSDR_TUNER_FC0012: gainValue = fc0012_gains[gainCount]; break; case RTLSDR_TUNER_FC0013: gainValue = fc0013_gains[gainCount]; break; case RTLSDR_TUNER_FC2580: gainValue = fc2580_gains[gainCount]; break; case RTLSDR_TUNER_R820T: gainValue = r82xx_gains[gainCount]; break; case RTLSDR_TUNER_R828D: gainValue = r82xx_gains[gainCount]; break; default: gainValue = 0; } } else { gainValue = 999.0; // Max gain } return gainValue; } welle.io-2.1/src/input/rtl_tcp.h000066400000000000000000000102271357201522000166370ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __RTL_TCP_CLIENT #define __RTL_TCP_CLIENT #include #include #include #include #include "Socket.h" #include "virtual_input.h" #include "dab-constants.h" #include "MathHelper.h" #include "ringbuffer.h" #include "radio-controller.h" struct dongle_info_t { /* structure size must be multiple of 2 bytes */ char magic[4]; uint32_t tuner_type; uint32_t tuner_gain_count; }; class CRTL_TCP_Client : public CVirtualInput { public: CRTL_TCP_Client(RadioControllerInterface& radioController); ~CRTL_TCP_Client(void); // Interface methods void setFrequency(int); int getFrequency(void) const; bool restart(void); bool is_ok(void); int32_t getSamples(DSPCOMPLEX* V, int32_t size); std::vector getSpectrumSamples(int size); int32_t getSamplesToRead(void); void reset(void); float getGain(void) const; float setGain(int gain); int getGainCount(void); void setAgc(bool AGC); std::string getDescription(void); CDeviceID getID(void); // Specific methods void setIP(const std::string& ipAddress); void setPort(uint16_t Port); RadioControllerInterface& radioController; private: void stop(void); void agcTimer(void); void receiveData(void); void receiveAndReconnect(void); void handleDisconnect(void); std::mutex mutex; Socket sock; std::thread receiveThread; bool agcRunning = false; std::thread agcThread; float currentGain = 0; uint16_t currentGainCount = 0; uint8_t minAmplitude = 255; uint8_t maxAmplitude = 0; bool isAGC = true; bool isHwAGC = false; int frequency = kHz(220000); IQRingBuffer sampleBuffer; RingBuffer spectrumSampleBuffer; bool connected = false; bool rtlsdrRunning = false; std::string serverAddress = "127.0.0.1"; uint16_t serverPort = 1234; bool firstData = true; dongle_info_t dongleInfo; // Gain values for the different tuners const std::array e4k_gains{{-1.0, 1.5, 4.0, 6.5, 9.0, 11.5, 14.0, 16.5, 19.0, 21.5, 24.0, 29.0, 34.0, 42.0}}; const std::array fc0012_gains{{ -9.9, -4.0, 7.1, 17.9, 19.2 }}; const std::array fc0013_gains{{ -9.9, -7.3, -6.5, -6.3, -6.0, -5.8, -5.4, 5.8, 6.1, 6.3, 6.5, 6.7, 6.8, 7.0, 7.1, 17.9, 18.1, 18.2, 18.4, 18.6, 18.8, 19.1, 19.7 }}; const std::array fc2580_gains{{ 0 /* no gain values */ }}; const std::array r82xx_gains{{ 0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6 }}; void sendVFO(int32_t frequency); void sendRate(int32_t theRate); void setGainMode(int32_t gainMode); void sendCommand(uint8_t cmd, int32_t param); float getGainValue(uint16_t gainCount); }; #endif welle.io-2.1/src/input/soapy_sdr.cpp000066400000000000000000000253241357201522000175320ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include "soapy_sdr.h" #include "dab-constants.h" #include "unistd.h" // For Qt translation if Qt is existing #ifdef QT_CORE_LIB #include #else #define QT_TRANSLATE_NOOP(x,y) (y) #endif using namespace std; CSoapySdr::CSoapySdr(RadioControllerInterface& radioController) : radioController(radioController), m_sampleBuffer(1024 * 1024), m_spectrumSampleBuffer(8192) { } CSoapySdr::~CSoapySdr() { stop(); } void CSoapySdr::setFrequency(int Frequency) { m_freq = Frequency; if (m_device != nullptr) { m_device->setFrequency(SOAPY_SDR_RX, 0, Frequency); m_freq = m_device->getFrequency(SOAPY_SDR_RX, 0); std::clog << "OutputSoapySDR:Actual frequency: " << m_freq / 1000.0 << " kHz." << std::endl; } } int CSoapySdr::getFrequency() const { return m_freq; } bool CSoapySdr::restart() { if (m_running) { return true; } m_sampleBuffer.FlushRingBuffer(); m_spectrumSampleBuffer.FlushRingBuffer(); try { m_device = SoapySDR::Device::make(m_driver_args); } catch (std::exception& e) { std::clog << "Exception caught in SoapySDR::Device::make with \"" << m_driver_args << "\" :\n" << " " << e.what() << std::endl; stop(); radioController.onMessage(message_level_t::Error, QT_TRANSLATE_NOOP("CRadioController", "Could not load SoapySDR with provided device arguments.")); return false; } stringstream ss; ss << "SoapySDR driver=" << m_device->getDriverKey(); ss << " hardware=" << m_device->getHardwareKey(); for (const auto &it : m_device->getHardwareInfo()) { ss << " " << it.first << "=" << it.second; } std::clog << ss.str().c_str() << std::endl; m_device->setMasterClockRate(INPUT_RATE*16); std::clog << "SoapySDR master clock rate set to " << m_device->getMasterClockRate()/1000.0 << " kHz" << std::endl; m_device->setSampleRate(SOAPY_SDR_RX, 0, INPUT_RATE); std::clog << "OutputSoapySDR:Actual RX rate: " << m_device->getSampleRate(SOAPY_SDR_RX, 0) / 1000.0 << " ksps." << std::endl; clog << "Supported antenna: "; for (const auto& ant : m_device->listAntennas(SOAPY_SDR_RX, 0)) { clog << " " << ant; } clog << endl; if (!m_antenna.empty()) { clog << "Select antenna " << m_antenna << endl; m_device->setAntenna(SOAPY_SDR_RX, 0, m_antenna); } else { clog << "Not selecting antenna" << endl; } if (!m_clock_source.empty()) { m_device->setClockSource(m_clock_source); } if (m_freq > 0) { setFrequency(m_freq); } auto range = m_device->getGainRange(SOAPY_SDR_RX, 0); // Ignore step size, as it could be 0. 1dB steps are ok for (double g = range.minimum(); g < range.maximum(); g++) { m_gains.push_back(g); } const bool automatic = false; m_device->setGainMode(SOAPY_SDR_RX, 0, automatic); if (m_device->hasDCOffsetMode(SOAPY_SDR_RX, 0)) { m_device->setDCOffsetMode(SOAPY_SDR_RX, 0, true); } else { clog << "DC offset compensation not supported" << endl; } m_running = true; m_thread = std::thread(&CSoapySdr::workerthread, this); return true; } bool CSoapySdr::is_ok() { return m_running; } void CSoapySdr::stop() { m_running = false; if (m_thread.joinable()) { m_thread.join(); } if (m_device != nullptr) { SoapySDR::Device::unmake(m_device); m_device = nullptr; } } void CSoapySdr::reset() { m_sampleBuffer.FlushRingBuffer(); } int32_t CSoapySdr::getSamples(DSPCOMPLEX *Buffer, int32_t Size) { int32_t amount = m_sampleBuffer.getDataFromBuffer(Buffer, Size); return amount; } std::vector CSoapySdr::getSpectrumSamples(int size) { std::vector sampleBuffer(size); int32_t amount = m_spectrumSampleBuffer.getDataFromBuffer(sampleBuffer.data(), size); if (amount < size) { sampleBuffer.resize(amount); } return sampleBuffer; } int32_t CSoapySdr::getSamplesToRead() { return m_sampleBuffer.GetRingBufferReadAvailable(); } float CSoapySdr::getGain() const { if (m_device != nullptr) { float g = m_device->getGain(SOAPY_SDR_RX, 0); return g; } else { return 0; } } float CSoapySdr::setGain(int32_t gainIndex) { if (m_device != nullptr) { try { m_device->setGain(SOAPY_SDR_RX, 0, m_gains.at(gainIndex)); } catch (const out_of_range&) { std::clog << "Soapy gain " << gainIndex << " is out of range" << std::endl; } float g = m_device->getGain(SOAPY_SDR_RX, 0); std::clog << "Soapy gain is " << g << std::endl; return g; } return 0; } void CSoapySdr::setDriverArgs(const std::string& args) { if (m_driver_args != args) { m_driver_args = args; m_running = false; stop(); restart(); } } void CSoapySdr::setAntenna(const std::string& antenna) { if (!antenna.empty() && m_device != nullptr) { clog << "Select antenna " << antenna << ", supported: "; for (const auto& ant : m_device->listAntennas(SOAPY_SDR_RX, 0)) { clog << " " << ant; } clog << endl; try { m_device->setAntenna(SOAPY_SDR_RX, 0, antenna); m_antenna = antenna; } catch (...) { clog << "Could not set antenna to " << antenna << endl; } } else if (m_device == nullptr) { m_antenna = antenna; } } void CSoapySdr::setClockSource(const std::string& clock_source) { m_clock_source = clock_source; } void CSoapySdr::increaseGain() { if (m_device != nullptr) { float current_gain = m_device->getGain(SOAPY_SDR_RX, 0); for (const float g : m_gains) { if (g > current_gain) { m_device->setGain(SOAPY_SDR_RX, 0, g); break; } } } } void CSoapySdr::decreaseGain() { if (m_device != nullptr) { float current_gain = m_device->getGain(SOAPY_SDR_RX, 0); for (auto it = m_gains.rbegin(); it != m_gains.rend(); ++it) { if (*it > current_gain) { m_device->setGain(SOAPY_SDR_RX, 0, *it); break; } } } } int32_t CSoapySdr::getGainCount() { return m_gains.size(); } void CSoapySdr::setAgc(bool AGC) { m_sw_agc = AGC; } //void CSoapySdr::setHwAgc(bool hwAGC) //{ // if (m_device != nullptr) { // m_device->setGainMode(SOAPY_SDR_RX, 0, hwAGC); // } //} std::string CSoapySdr::getDescription() { if (m_device != nullptr) { return "SoapySDR (" + m_device->getDriverKey() + ")"; } else { return "SoapySDR (uninitialised)"; } } CDeviceID CSoapySdr::getID() { return CDeviceID::SOAPYSDR; } bool CSoapySdr::setDeviceParam(DeviceParam param, const std::string& value) { switch(param) { case DeviceParam::SoapySDRAntenna: setAntenna(value); return true; case DeviceParam::SoapySDRClockSource: setClockSource(value); return true; case DeviceParam::SoapySDRDriverArgs: setDriverArgs(value); return true; default: std::runtime_error("Unsupported device parameter"); } return false; } void CSoapySdr::workerthread() { std::vector channels; channels.push_back(0); std::clog << " *************** Setup soapy stream" << std::endl; auto stream = m_device->setupStream(SOAPY_SDR_RX, "CF32", channels); m_device->activateStream(stream); try { process(stream); } catch (std::exception& e) { std::clog << " *************** Exception caught in soapy: " << e.what() << std::endl; } std::clog << " *************** Close soapy stream" << std::endl; m_device->closeStream(stream); m_running = false; } void CSoapySdr::process(SoapySDR::Stream *stream) { size_t frames = 0; while (m_running) { frames++; // Stream MTU is in samples, not bytes. const size_t mtu = m_device->getStreamMTU(stream); const size_t samps_to_read = mtu; // Always read MTU samples std::vector buf(samps_to_read); void *buffs[1]; buffs[0] = buf.data(); int flags = 0; long long timeNs = 0; assert(m_device != nullptr); int ret = m_device->readStream( stream, buffs, samps_to_read, flags, timeNs); if (ret == SOAPY_SDR_TIMEOUT) { continue; } else if (ret == SOAPY_SDR_OVERFLOW) { continue; } else if (ret == SOAPY_SDR_UNDERFLOW) { continue; } if (ret < 0) { std::clog << " *************** Unexpected stream error " << SoapySDR::errToStr(ret) << std::endl; m_running = false; } else { buf.resize(ret); if (m_sw_agc and (frames % 200) == 0) { float maxnorm = 0; for (const DSPCOMPLEX& z : buf) { if (norm(z) > maxnorm) { maxnorm = norm(z); } } const float maxampl = sqrt(maxnorm); if (maxampl > 0.5f) { decreaseGain(); } else if (maxampl < 0.1f) { increaseGain(); } } m_sampleBuffer.putDataIntoBuffer(buf.data(), ret); m_spectrumSampleBuffer.putDataIntoBuffer(buf.data(), ret); } } } welle.io-2.1/src/input/soapy_sdr.h000066400000000000000000000057221357201522000171770ustar00rootroot00000000000000/* * Copyright (C) 2018 * Matthias P. Braendli (matthias.braendli@mpb.li) * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #pragma once #include #include #include "virtual_input.h" #include "ringbuffer.h" #include #include #include #include class CSoapySdr_Thread; class CSoapySdr : public CVirtualInput { public: CSoapySdr(RadioControllerInterface& radioController); ~CSoapySdr(); CSoapySdr(const CSoapySdr&) = delete; CSoapySdr operator=(const CSoapySdr&) = delete; virtual void setFrequency(int Frequency); virtual int getFrequency(void) const; virtual bool restart(void); virtual bool is_ok(void); virtual void stop(void); virtual void reset(void); virtual int32_t getSamples(DSPCOMPLEX* Buffer, int32_t Size); virtual std::vector getSpectrumSamples(int size); virtual int32_t getSamplesToRead(void); virtual float setGain(int gainIndex); virtual float getGain(void) const; virtual int getGainCount(void); virtual void setAgc(bool AGC); virtual std::string getDescription(void); virtual CDeviceID getID(void); virtual bool setDeviceParam(DeviceParam param, const std::string& value); private: void setDriverArgs(const std::string& args); void setAntenna(const std::string& antenna); void setClockSource(const std::string& clock_source); void decreaseGain(); void increaseGain(); RadioControllerInterface& radioController; int m_freq = 0; std::string m_driver_args; std::string m_antenna; std::string m_clock_source; SoapySDR::Device *m_device = nullptr; std::atomic m_running = ATOMIC_VAR_INIT(false); bool m_sw_agc = false; IQRingBuffer m_sampleBuffer; RingBuffer m_spectrumSampleBuffer; std::vector m_gains; std::thread m_thread; void workerthread(void); void process(SoapySDR::Stream *stream); }; welle.io-2.1/src/input/virtual_input.h000066400000000000000000000062431357201522000201000ustar00rootroot00000000000000/* * Copyright (C) 2017 * Albrecht Lohofener (albrechtloh@gmx.de) * * This file is based on SDR-J * Copyright (C) 2010, 2011, 2012, 2013 * Jan van Katwijk (J.vanKatwijk@gmail.com) * * This file is part of the welle.io. * Many of the ideas as implemented in welle.io are derived from * other work, made available through the GNU general Public License. * All copyrights of the original authors are recognized. * * welle.io is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * welle.io is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with welle.io; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __VIRTUAL_INPUT #define __VIRTUAL_INPUT #include #include #include #include "dab-constants.h" #include "radio-controller.h" #include "ringbuffer.h" enum class CDeviceID { UNKNOWN, NULLDEVICE, AIRSPY, RAWFILE, RTL_SDR, RTL_TCP, SOAPYSDR, ANDROID_RTL_SDR}; class CVirtualInput : public InputInterface { public: virtual ~CVirtualInput() {} virtual CDeviceID getID(void) = 0; void writeRecordBufferToFile(std::string &fileanme) { if(!recordBuffer) return; std::ofstream rawStream(fileanme, std::ios::binary); while(recordBuffer->GetRingBufferReadAvailable() > 0) { size_t data_tmpSize = 0; if(recordBuffer->GetRingBufferReadAvailable() > 1024) data_tmpSize = 1024; else data_tmpSize = static_cast(recordBuffer->GetRingBufferReadAvailable()); uint8_t data_tmp[data_tmpSize]; recordBuffer->getDataFromBuffer(data_tmp, data_tmpSize); rawStream.write((char *) data_tmp, data_tmpSize); } rawStream.close(); } void initRecordBuffer(uint32_t size) { // The ring buffer size has to be power of 2 uint32_t bitCount = ceil(log2(size)); uint32_t bufferSize = pow(2, bitCount); try { recordBuffer.reset(new RingBuffer(bufferSize)); } catch (const std::bad_alloc& e) { std::clog << "CVirtualInput: recordBuffer allocation failed (size " << bufferSize * sizeof(uint8_t) << " bytes) : " << e.what() << std::endl; } } protected: void putIntoRecordBuffer(uint8_t &data, uint32_t size) { if(!recordBuffer) return; recordBuffer->putDataIntoBuffer(&data, static_cast(size)); //std::clog << "CVirtualInput: GetRingBufferReadAvailable() " << recordBuffer->GetRingBufferReadAvailable() << std::endl; } private: std::unique_ptr> recordBuffer; }; #endif welle.io-2.1/src/libs/000077500000000000000000000000001357201522000146075ustar00rootroot00000000000000welle.io-2.1/src/libs/COPYING.LGPL-2.1000066400000000000000000000636421357201522000167100ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! welle.io-2.1/src/libs/faad2/000077500000000000000000000000001357201522000155645ustar00rootroot00000000000000welle.io-2.1/src/libs/faad2/COPYING000066400000000000000000000442761357201522000166340ustar00rootroot00000000000000 Any non-GPL usage of this software or parts of this software is strictly forbidden. Commercial non-GPL licensing of this software is possible. For more info contact Ahead Software through Mpeg4AAClicense@nero.com. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. welle.io-2.1/src/libs/faad2/config.h000066400000000000000000000066131357201522000172100ustar00rootroot00000000000000/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define if you want to use libfaad together with Digital Radio Mondiale (DRM) */ /* #undef DRM */ /* Define if you want support for Digital Radio Mondiale (DRM) parametric stereo */ /* #undef DRM_PS */ /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 /* Define if needed */ /* #undef HAVE_FLOAT32_T */ /* Define to 1 if you have the header file. */ #define HAVE_FLOAT_H 1 /* Define to 1 if you have the `getpwuid' function. */ #define HAVE_GETPWUID 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define if you have the IOKit API */ /* #undef HAVE_IOKIT_IOKITLIB_H */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define if you have C99's lrintf function. */ #define HAVE_LRINTF 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MATHF_H */ /* Define to 1 if you have the `memcpy' function. */ #define HAVE_MEMCPY 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strchr' function. */ #define HAVE_STRCHR 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strsep' function. */ #define HAVE_STRSEP 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SYSFS_LIBSYSFS_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Name of package */ #define PACKAGE "faad2" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Version number of package */ #define VERSION "2.7.0" /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `long int' if does not define. */ /* #undef off_t */ welle.io-2.1/src/libs/faad2/include/000077500000000000000000000000001357201522000172075ustar00rootroot00000000000000welle.io-2.1/src/libs/faad2/include/faad.h000066400000000000000000000026651357201522000202640ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: faad.h,v 1.51 2007/11/01 12:33:29 menno Exp $ **/ /* warn people for update */ #pragma message("please update faad2 include filename and function names!") /* Backwards compatible link */ #include "neaacdec.h" welle.io-2.1/src/libs/faad2/include/neaacdec.h000066400000000000000000000204171357201522000211070ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: neaacdec.h,v 1.13 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __NEAACDEC_H__ #define __NEAACDEC_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if 1 /* MACROS FOR BACKWARDS COMPATIBILITY */ /* structs */ #define faacDecHandle NeAACDecHandle #define faacDecConfiguration NeAACDecConfiguration #define faacDecConfigurationPtr NeAACDecConfigurationPtr #define faacDecFrameInfo NeAACDecFrameInfo /* functions */ #define faacDecGetErrorMessage NeAACDecGetErrorMessage #define faacDecSetConfiguration NeAACDecSetConfiguration #define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration #define faacDecInit NeAACDecInit #define faacDecInit2 NeAACDecInit2 #define faacDecInitDRM NeAACDecInitDRM #define faacDecPostSeekReset NeAACDecPostSeekReset #define faacDecOpen NeAACDecOpen #define faacDecClose NeAACDecClose #define faacDecDecode NeAACDecDecode #define AudioSpecificConfig NeAACDecAudioSpecificConfig #endif #ifdef _WIN32 #pragma pack(push, 8) #ifndef NEAACDECAPI #define NEAACDECAPI __cdecl #endif #else #ifndef NEAACDECAPI #define NEAACDECAPI #endif #endif #define FAAD2_VERSION "2.7" /* object types for AAC */ #define MAIN 1 #define LC 2 #define SSR 3 #define LTP 4 #define HE_AAC 5 #define ER_LC 17 #define ER_LTP 19 #define LD 23 #define DRM_ER_LC 27 /* special object type for DRM */ /* header types */ #define RAW 0 #define ADIF 1 #define ADTS 2 #define LATM 3 /* SBR signalling */ #define NO_SBR 0 #define SBR_UPSAMPLED 1 #define SBR_DOWNSAMPLED 2 #define NO_SBR_UPSAMPLED 3 /* library output formats */ #define FAAD_FMT_16BIT 1 #define FAAD_FMT_24BIT 2 #define FAAD_FMT_32BIT 3 #define FAAD_FMT_FLOAT 4 #define FAAD_FMT_FIXED FAAD_FMT_FLOAT #define FAAD_FMT_DOUBLE 5 /* Capabilities */ #define LC_DEC_CAP (1<<0) /* Can decode LC */ #define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */ #define LTP_DEC_CAP (1<<2) /* Can decode LTP */ #define LD_DEC_CAP (1<<3) /* Can decode LD */ #define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */ #define FIXED_POINT_CAP (1<<5) /* Fixed point */ /* Channel definitions */ #define FRONT_CHANNEL_CENTER (1) #define FRONT_CHANNEL_LEFT (2) #define FRONT_CHANNEL_RIGHT (3) #define SIDE_CHANNEL_LEFT (4) #define SIDE_CHANNEL_RIGHT (5) #define BACK_CHANNEL_LEFT (6) #define BACK_CHANNEL_RIGHT (7) #define BACK_CHANNEL_CENTER (8) #define LFE_CHANNEL (9) #define UNKNOWN_CHANNEL (0) /* DRM channel definitions */ #define DRMCH_MONO 1 #define DRMCH_STEREO 2 #define DRMCH_SBR_MONO 3 #define DRMCH_SBR_STEREO 4 #define DRMCH_SBR_PS_STEREO 5 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel, so at least so much bytes per channel should be available in this stream */ #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */ typedef void *NeAACDecHandle; typedef struct mp4AudioSpecificConfig { /* Audio Specific Info */ unsigned char objectTypeIndex; unsigned char samplingFrequencyIndex; unsigned long samplingFrequency; unsigned char channelsConfiguration; /* GA Specific Info */ unsigned char frameLengthFlag; unsigned char dependsOnCoreCoder; unsigned short coreCoderDelay; unsigned char extensionFlag; unsigned char aacSectionDataResilienceFlag; unsigned char aacScalefactorDataResilienceFlag; unsigned char aacSpectralDataResilienceFlag; unsigned char epConfig; char sbr_present_flag; char forceUpSampling; char downSampledSBR; } mp4AudioSpecificConfig; typedef struct NeAACDecConfiguration { unsigned char defObjectType; unsigned long defSampleRate; unsigned char outputFormat; unsigned char downMatrix; unsigned char useOldADTSFormat; unsigned char dontUpSampleImplicitSBR; } NeAACDecConfiguration, *NeAACDecConfigurationPtr; typedef struct NeAACDecFrameInfo { unsigned long bytesconsumed; unsigned long samples; unsigned char channels; unsigned char error; unsigned long samplerate; /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ unsigned char sbr; /* MPEG-4 ObjectType */ unsigned char object_type; /* AAC header type; MP4 will be signalled as RAW also */ unsigned char header_type; /* multichannel configuration */ unsigned char num_front_channels; unsigned char num_side_channels; unsigned char num_back_channels; unsigned char num_lfe_channels; unsigned char channel_position[64]; /* PS: 0: off, 1: on */ unsigned char ps; } NeAACDecFrameInfo; char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode); unsigned long NEAACDECAPI NeAACDecGetCapabilities(void); NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, NeAACDecConfigurationPtr config); /* Init the library based on info from the AAC file (ADTS/ADIF) */ long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, unsigned char *buffer, unsigned long buffer_size, unsigned long *samplerate, unsigned char *channels); /* Init the library using a DecoderSpecificInfo */ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, unsigned long SizeOfDecoderSpecificInfo, unsigned long *samplerate, unsigned char *channels); /* Init the library for DRM */ char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, unsigned char channels); void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame); void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size); void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size, void **sample_buffer, unsigned long sample_buffer_size); char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, unsigned long buffer_size, mp4AudioSpecificConfig *mp4ASC); #ifdef _WIN32 #pragma pack(pop) #endif #ifdef __cplusplus } #endif /* __cplusplus */ #endif welle.io-2.1/src/libs/faad2/libfaad/000077500000000000000000000000001357201522000171465ustar00rootroot00000000000000welle.io-2.1/src/libs/faad2/libfaad/Makefile.am000066400000000000000000000026571357201522000212140ustar00rootroot00000000000000lib_LTLIBRARIES = libfaad.la AM_CFLAGS = -iquote $(top_srcdir)/include include_HEADERS = $(top_srcdir)/include/faad.h \ $(top_srcdir)/include/neaacdec.h libfaad_la_LDFLAGS = -version-info 2:0:0 libfaad_la_LIBADD = -lm libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \ drm_dec.c error.c filtbank.c \ ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \ ps_dec.c ps_syntax.c \ pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \ rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \ sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \ sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \ analysis.h bits.h cfft.h cfft_tab.h common.h \ decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \ huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h \ mdct.h mdct_tab.h mp4.h ms.h output.h pns.h ps_dec.h ps_tables.h \ pulse.h rvlc.h \ sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \ sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \ sine_win.h specrec.h ssr.h ssr_fb.h ssr_ipqf.h \ ssr_win.h syntax.h structs.h tns.h \ sbr_qmf_c.h codebook/hcb.h \ codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \ codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \ codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h welle.io-2.1/src/libs/faad2/libfaad/Makefile.in000066400000000000000000000466471357201522000212340ustar00rootroot00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = libfaad DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libfaad_la_DEPENDENCIES = am_libfaad_la_OBJECTS = bits.lo cfft.lo decoder.lo drc.lo drm_dec.lo \ error.lo filtbank.lo ic_predict.lo is.lo lt_predict.lo mdct.lo \ mp4.lo ms.lo output.lo pns.lo ps_dec.lo ps_syntax.lo pulse.lo \ specrec.lo syntax.lo tns.lo hcr.lo huffman.lo rvlc.lo ssr.lo \ ssr_fb.lo ssr_ipqf.lo common.lo sbr_dct.lo sbr_e_nf.lo \ sbr_fbt.lo sbr_hfadj.lo sbr_hfgen.lo sbr_huff.lo sbr_qmf.lo \ sbr_syntax.lo sbr_tf_grid.lo sbr_dec.lo libfaad_la_OBJECTS = $(am_libfaad_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libfaad_la_SOURCES) DIST_SOURCES = $(libfaad_la_SOURCES) includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ GTK_CONFIG = @GTK_CONFIG@ HAVE_MPEG4IP_PLUG_FALSE = @HAVE_MPEG4IP_PLUG_FALSE@ HAVE_MPEG4IP_PLUG_TRUE = @HAVE_MPEG4IP_PLUG_TRUE@ HAVE_XMMS_FALSE = @HAVE_XMMS_FALSE@ HAVE_XMMS_TRUE = @HAVE_XMMS_TRUE@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MP4FF_LIBS = @MP4FF_LIBS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RPMBUILD = @RPMBUILD@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMMS_CONFIG = @XMMS_CONFIG@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ external_mp4v2 = @external_mp4v2@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ lib_LTLIBRARIES = libfaad.la AM_CFLAGS = -iquote $(top_srcdir)/include include_HEADERS = $(top_srcdir)/include/faad.h \ $(top_srcdir)/include/neaacdec.h libfaad_la_LDFLAGS = -version-info 2:0:0 libfaad_la_LIBADD = -lm libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \ drm_dec.c error.c filtbank.c \ ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \ ps_dec.c ps_syntax.c \ pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \ rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \ sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \ sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \ analysis.h bits.h cfft.h cfft_tab.h common.h \ decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \ huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h \ mdct.h mdct_tab.h mp4.h ms.h output.h pns.h ps_dec.h ps_tables.h \ pulse.h rvlc.h \ sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \ sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \ sine_win.h specrec.h ssr.h ssr_fb.h ssr_ipqf.h \ ssr_win.h syntax.h structs.h tns.h \ sbr_qmf_c.h codebook/hcb.h \ codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \ codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \ codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libfaad/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libfaad/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libfaad.la: $(libfaad_la_OBJECTS) $(libfaad_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libfaad_la_LDFLAGS) $(libfaad_la_OBJECTS) $(libfaad_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drm_dec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtbank.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffman.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic_predict.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lt_predict.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdct.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ms.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps_dec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps_syntax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pulse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rvlc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_dct.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_dec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_e_nf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_fbt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_hfadj.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_hfgen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_huff.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_qmf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_syntax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbr_tf_grid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/specrec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssr_fb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssr_ipqf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syntax.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tns.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(mkdir_p) $(distdir)/../include @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-includeHEADERS install-exec-am: install-libLTLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-includeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: welle.io-2.1/src/libs/faad2/libfaad/analysis.h000066400000000000000000000031271357201522000211450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: analysis.h,v 1.18 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __ANALYSIS_H__ #define __ANALYSIS_H__ #ifdef __cplusplus extern "C" { #endif #ifdef ANALYSIS #define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg #define DEBUGVAR(A,B,C) ,A,B,C extern uint16_t dbg_count; #else #define DEBUGDEC #define DEBUGVAR(A,B,C) #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/bits.c000066400000000000000000000145241357201522000202610ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: bits.c,v 1.44 2007/11/01 12:33:29 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include "bits.h" /* initialize buffer, call once before first getbits or showbits */ void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) { uint32_t tmp; if (ld == NULL) return; // useless //memset(ld, 0, sizeof(bitfile)); if (buffer_size == 0 || _buffer == NULL) { ld->error = 1; return; } ld->buffer = _buffer; ld->buffer_size = buffer_size; ld->bytes_left = buffer_size; if (ld->bytes_left >= 4) { tmp = getdword((uint32_t*)ld->buffer); ld->bytes_left -= 4; } else { tmp = getdword_n((uint32_t*)ld->buffer, ld->bytes_left); ld->bytes_left = 0; } ld->bufa = tmp; if (ld->bytes_left >= 4) { tmp = getdword((uint32_t*)ld->buffer + 1); ld->bytes_left -= 4; } else { tmp = getdword_n((uint32_t*)ld->buffer + 1, ld->bytes_left); ld->bytes_left = 0; } ld->bufb = tmp; ld->start = (uint32_t*)ld->buffer; ld->tail = ((uint32_t*)ld->buffer + 2); ld->bits_left = 32; ld->error = 0; } void faad_endbits(bitfile *ld) { // void } uint32_t faad_get_processed_bits(bitfile *ld) { return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left)); } uint8_t faad_byte_align(bitfile *ld) { int remainder = (32 - ld->bits_left) & 0x7; if (remainder) { faad_flushbits(ld, 8 - remainder); return (uint8_t)(8 - remainder); } return 0; } void faad_flushbits_ex(bitfile *ld, uint32_t bits) { uint32_t tmp; ld->bufa = ld->bufb; if (ld->bytes_left >= 4) { tmp = getdword(ld->tail); ld->bytes_left -= 4; } else { tmp = getdword_n(ld->tail, ld->bytes_left); ld->bytes_left = 0; } ld->bufb = tmp; ld->tail++; ld->bits_left += (32 - bits); //ld->bytes_left -= 4; // if (ld->bytes_left == 0) // ld->no_more_reading = 1; // if (ld->bytes_left < 0) // ld->error = 1; } /* rewind to beginning */ void faad_rewindbits(bitfile *ld) { uint32_t tmp; ld->bytes_left = ld->buffer_size; if (ld->bytes_left >= 4) { tmp = getdword((uint32_t*)&ld->start[0]); ld->bytes_left -= 4; } else { tmp = getdword_n((uint32_t*)&ld->start[0], ld->bytes_left); ld->bytes_left = 0; } ld->bufa = tmp; if (ld->bytes_left >= 4) { tmp = getdword((uint32_t*)&ld->start[1]); ld->bytes_left -= 4; } else { tmp = getdword_n((uint32_t*)&ld->start[1], ld->bytes_left); ld->bytes_left = 0; } ld->bufb = tmp; ld->bits_left = 32; ld->tail = &ld->start[2]; } /* reset to a certain point */ void faad_resetbits(bitfile *ld, int bits) { uint32_t tmp; int words = bits >> 5; int remainder = bits & 0x1F; ld->bytes_left = ld->buffer_size - words*4; if (ld->bytes_left >= 4) { tmp = getdword(&ld->start[words]); ld->bytes_left -= 4; } else { tmp = getdword_n(&ld->start[words], ld->bytes_left); ld->bytes_left = 0; } ld->bufa = tmp; if (ld->bytes_left >= 4) { tmp = getdword(&ld->start[words+1]); ld->bytes_left -= 4; } else { tmp = getdword_n(&ld->start[words+1], ld->bytes_left); ld->bytes_left = 0; } ld->bufb = tmp; ld->bits_left = 32 - remainder; ld->tail = &ld->start[words+2]; /* recheck for reading too many bytes */ ld->error = 0; // if (ld->bytes_left == 0) // ld->no_more_reading = 1; // if (ld->bytes_left < 0) // ld->error = 1; } uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC) { int i; unsigned int temp; int bytes = bits >> 3; int remainder = bits & 0x7; uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); for (i = 0; i < bytes; i++) { buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); } if (remainder) { temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); buffer[bytes] = (uint8_t)temp; } return buffer; } #ifdef DRM /* return the original data buffer */ void *faad_origbitbuffer(bitfile *ld) { return (void*)ld->start; } /* return the original data buffer size */ uint32_t faad_origbitbuffer_size(bitfile *ld) { return ld->buffer_size; } #endif /* reversed bit reading routines, used for RVLC and HCR */ void faad_initbits_rev(bitfile *ld, void *buffer, uint32_t bits_in_buffer) { uint32_t tmp; int32_t index; ld->buffer_size = bit2byte(bits_in_buffer); index = (bits_in_buffer+31)/32 - 1; ld->start = (uint32_t*)buffer + index - 2; tmp = getdword((uint32_t*)buffer + index); ld->bufa = tmp; tmp = getdword((uint32_t*)buffer + index - 1); ld->bufb = tmp; ld->tail = (uint32_t*)buffer + index; ld->bits_left = bits_in_buffer % 32; if (ld->bits_left == 0) ld->bits_left = 32; ld->bytes_left = ld->buffer_size; ld->error = 0; } /* EOF */ welle.io-2.1/src/libs/faad2/libfaad/bits.h000066400000000000000000000304721357201522000202660ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: bits.h,v 1.45 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __BITS_H__ #define __BITS_H__ #ifdef __cplusplus extern "C" { #endif #include "analysis.h" #ifdef ANALYSIS #include #endif #define BYTE_NUMBIT 8 #define BYTE_NUMBIT_LD 3 //#define bit2byte(a) ((a+7)/BYTE_NUMBIT) #define bit2byte(a) ((a+7)>>BYTE_NUMBIT_LD) typedef struct _bitfile { /* bit input */ uint32_t bufa; uint32_t bufb; uint32_t bits_left; uint32_t buffer_size; /* size of the buffer in bytes */ uint32_t bytes_left; uint8_t error; uint32_t *tail; uint32_t *start; const void *buffer; } bitfile; #if 0 static uint32_t const bitmask[] = { 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF /* added bitmask 32, correct?!?!?! */ , 0xFFFFFFFF }; #endif void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size); void faad_endbits(bitfile *ld); void faad_initbits_rev(bitfile *ld, void *buffer, uint32_t bits_in_buffer); uint8_t faad_byte_align(bitfile *ld); uint32_t faad_get_processed_bits(bitfile *ld); void faad_flushbits_ex(bitfile *ld, uint32_t bits); void faad_rewindbits(bitfile *ld); void faad_resetbits(bitfile *ld, int bits); uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC); #ifdef DRM void *faad_origbitbuffer(bitfile *ld); uint32_t faad_origbitbuffer_size(bitfile *ld); #endif /* circumvent memory alignment errors on ARM */ static INLINE uint32_t getdword(void *mem) { uint32_t tmp; #ifndef ARCH_IS_BIG_ENDIAN ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3]; ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; #else ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; #endif return tmp; } /* reads only n bytes from the stream instead of the standard 4 */ static /*INLINE*/ uint32_t getdword_n(void *mem, int n) { uint32_t tmp = 0; #ifndef ARCH_IS_BIG_ENDIAN switch (n) { case 3: ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; case 2: ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; case 1: ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; default: break; } #else switch (n) { case 3: ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; case 2: ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; case 1: ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; default: break; } #endif return tmp; } static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) { if (bits <= ld->bits_left) { //return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits]; return (ld->bufa << (32 - ld->bits_left)) >> (32 - bits); } bits -= ld->bits_left; //return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); return ((ld->bufa & ((1<bits_left)-1)) << bits) | (ld->bufb >> (32 - bits)); } static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) { /* do nothing if error */ if (ld->error != 0) return; if (bits < ld->bits_left) { ld->bits_left -= bits; } else { faad_flushbits_ex(ld, bits); } } /* return next n bits (right adjusted) */ static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; if (n == 0) return 0; ret = faad_showbits(ld, n); faad_flushbits(ld, n); #ifdef ANALYSIS if (print) fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); #endif return ret; } static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) { uint8_t r; if (ld->bits_left > 0) { ld->bits_left--; r = (uint8_t)((ld->bufa >> ld->bits_left) & 1); return r; } /* bits_left == 0 */ #if 0 r = (uint8_t)(ld->bufb >> 31); faad_flushbits_ex(ld, 1); #else r = (uint8_t)faad_getbits(ld, 1); #endif return r; } /* reversed bitreading routines */ static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits) { uint8_t i; uint32_t B = 0; if (bits <= ld->bits_left) { for (i = 0; i < bits; i++) { if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) B |= (1 << (bits - i - 1)); } return B; } else { for (i = 0; i < ld->bits_left; i++) { if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) B |= (1 << (bits - i - 1)); } for (i = 0; i < bits - ld->bits_left; i++) { if (ld->bufb & (1 << (i + (32-ld->bits_left)))) B |= (1 << (bits - ld->bits_left - i - 1)); } return B; } } static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits) { /* do nothing if error */ if (ld->error != 0) return; if (bits < ld->bits_left) { ld->bits_left -= bits; } else { uint32_t tmp; ld->bufa = ld->bufb; tmp = getdword(ld->start); ld->bufb = tmp; ld->start--; ld->bits_left += (32 - bits); if (ld->bytes_left < 4) { ld->error = 1; ld->bytes_left = 0; } else { ld->bytes_left -= 4; } // if (ld->bytes_left == 0) // ld->no_more_reading = 1; } } static /*INLINE*/ uint32_t faad_getbits_rev(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; if (n == 0) return 0; ret = faad_showbits_rev(ld, n); faad_flushbits_rev(ld, n); #ifdef ANALYSIS if (print) fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); #endif return ret; } #ifdef DRM /* CRC lookup table for G8 polynome in DRM standard */ static const uint8_t crc_table_G8[256] = { 0x0, 0x1d, 0x3a, 0x27, 0x74, 0x69, 0x4e, 0x53, 0xe8, 0xf5, 0xd2, 0xcf, 0x9c, 0x81, 0xa6, 0xbb, 0xcd, 0xd0, 0xf7, 0xea, 0xb9, 0xa4, 0x83, 0x9e, 0x25, 0x38, 0x1f, 0x2, 0x51, 0x4c, 0x6b, 0x76, 0x87, 0x9a, 0xbd, 0xa0, 0xf3, 0xee, 0xc9, 0xd4, 0x6f, 0x72, 0x55, 0x48, 0x1b, 0x6, 0x21, 0x3c, 0x4a, 0x57, 0x70, 0x6d, 0x3e, 0x23, 0x4, 0x19, 0xa2, 0xbf, 0x98, 0x85, 0xd6, 0xcb, 0xec, 0xf1, 0x13, 0xe, 0x29, 0x34, 0x67, 0x7a, 0x5d, 0x40, 0xfb, 0xe6, 0xc1, 0xdc, 0x8f, 0x92, 0xb5, 0xa8, 0xde, 0xc3, 0xe4, 0xf9, 0xaa, 0xb7, 0x90, 0x8d, 0x36, 0x2b, 0xc, 0x11, 0x42, 0x5f, 0x78, 0x65, 0x94, 0x89, 0xae, 0xb3, 0xe0, 0xfd, 0xda, 0xc7, 0x7c, 0x61, 0x46, 0x5b, 0x8, 0x15, 0x32, 0x2f, 0x59, 0x44, 0x63, 0x7e, 0x2d, 0x30, 0x17, 0xa, 0xb1, 0xac, 0x8b, 0x96, 0xc5, 0xd8, 0xff, 0xe2, 0x26, 0x3b, 0x1c, 0x1, 0x52, 0x4f, 0x68, 0x75, 0xce, 0xd3, 0xf4, 0xe9, 0xba, 0xa7, 0x80, 0x9d, 0xeb, 0xf6, 0xd1, 0xcc, 0x9f, 0x82, 0xa5, 0xb8, 0x3, 0x1e, 0x39, 0x24, 0x77, 0x6a, 0x4d, 0x50, 0xa1, 0xbc, 0x9b, 0x86, 0xd5, 0xc8, 0xef, 0xf2, 0x49, 0x54, 0x73, 0x6e, 0x3d, 0x20, 0x7, 0x1a, 0x6c, 0x71, 0x56, 0x4b, 0x18, 0x5, 0x22, 0x3f, 0x84, 0x99, 0xbe, 0xa3, 0xf0, 0xed, 0xca, 0xd7, 0x35, 0x28, 0xf, 0x12, 0x41, 0x5c, 0x7b, 0x66, 0xdd, 0xc0, 0xe7, 0xfa, 0xa9, 0xb4, 0x93, 0x8e, 0xf8, 0xe5, 0xc2, 0xdf, 0x8c, 0x91, 0xb6, 0xab, 0x10, 0xd, 0x2a, 0x37, 0x64, 0x79, 0x5e, 0x43, 0xb2, 0xaf, 0x88, 0x95, 0xc6, 0xdb, 0xfc, 0xe1, 0x5a, 0x47, 0x60, 0x7d, 0x2e, 0x33, 0x14, 0x9, 0x7f, 0x62, 0x45, 0x58, 0xb, 0x16, 0x31, 0x2c, 0x97, 0x8a, 0xad, 0xb0, 0xe3, 0xfe, 0xd9, 0xc4, }; static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) { int bytes, rem; unsigned int CRC; unsigned int r=255; /* Initialize to all ones */ /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ #define GPOLY 0435 faad_rewindbits(ld); CRC = (unsigned int) ~faad_getbits(ld, 8 DEBUGVAR(1,999,"faad_check_CRC(): CRC")) & 0xFF; /* CRC is stored inverted */ bytes = len >> 3; rem = len & 0x7; for (; bytes > 0; bytes--) { r = crc_table_G8[( r ^ faad_getbits(ld, 8 DEBUGVAR(1,998,"")) ) & 0xFF]; } for (; rem > 0; rem--) { r = ( (r << 1) ^ (( ( faad_get1bit(ld DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; } if (r != CRC) // if (0) { return 28; } else { return 0; } } static uint8_t tabFlipbits[256] = { 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240, 8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248, 4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244, 12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252, 2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242, 10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250, 6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246, 14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254, 1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241, 9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249, 5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245, 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253, 3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243, 11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251, 7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247, 15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255 }; #endif #ifdef ERROR_RESILIENCE /* Modified bit reading functions for HCR */ typedef struct { /* bit input */ uint32_t bufa; uint32_t bufb; int8_t len; } bits_t; static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits) { if (bits == 0) return 0; if (ld->len <= 32) { /* huffman_spectral_data_2 needs to read more than may be available, bits maybe > ld->len, deliver 0 than */ if (ld->len >= bits) return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits))); else return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits))); } else { if ((ld->len - bits) < 32) { return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) | (ld->bufa >> (ld->len - bits)); } else { return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits))); } } } /* return 1 if position is outside of buffer, 0 otherwise */ static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits) { ld->len -= bits; if (ld->len <0) { ld->len = 0; return 1; } else { return 0; } } static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result) { *result = showbits_hcr(ld, n); return flushbits_hcr(ld, n); } static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result) { uint32_t res; int8_t ret; ret = getbits_hcr(ld, 1, &res); *result = (int8_t)(res & 1); return ret; } #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/cfft.c000066400000000000000000001034641357201522000202440ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: cfft.c,v 1.35 2007/11/01 12:33:29 menno Exp $ **/ /* * Algorithmically based on Fortran-77 FFTPACK * by Paul N. Swarztrauber(Version 4, 1985). * * Does even sized fft only */ /* isign is +1 for backward and -1 for forward transforms */ #include "common.h" #include "structs.h" #include #include "cfft.h" #include "cfft_tab.h" /* static function declarations */ static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa); static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa); static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign); static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, const complex_t *wa4, const int8_t isign); INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, const uint16_t *ifac, const complex_t *wa, const int8_t isign); static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac); /*---------------------------------------------------------------------- passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd. ----------------------------------------------------------------------*/ static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa) { uint16_t i, k, ah, ac; if (ido == 1) { for (k = 0; k < l1; k++) { ah = 2*k; ac = 4*k; RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); } } else { for (k = 0; k < l1; k++) { ah = k*ido; ac = 2*k*ido; for (i = 0; i < ido; i++) { complex_t t2; RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); #if 1 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); #else ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); #endif } } } } static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa) { uint16_t i, k, ah, ac; if (ido == 1) { for (k = 0; k < l1; k++) { ah = 2*k; ac = 4*k; RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); } } else { for (k = 0; k < l1; k++) { ah = k*ido; ac = 2*k*ido; for (i = 0; i < ido; i++) { complex_t t2; RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); #if 1 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); #else ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); #endif } } } } static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign) { static real_t taur = FRAC_CONST(-0.5); static real_t taui = FRAC_CONST(0.866025403784439); uint16_t i, k, ac, ah; complex_t c2, c3, d2, d3, t2; if (ido == 1) { if (isign == 1) { for (k = 0; k < l1; k++) { ac = 3*k+1; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); RE(ch[ah+l1]) = RE(c2) - IM(c3); IM(ch[ah+l1]) = IM(c2) + RE(c3); RE(ch[ah+2*l1]) = RE(c2) + IM(c3); IM(ch[ah+2*l1]) = IM(c2) - RE(c3); } } else { for (k = 0; k < l1; k++) { ac = 3*k+1; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); RE(ch[ah+l1]) = RE(c2) + IM(c3); IM(ch[ah+l1]) = IM(c2) - RE(c3); RE(ch[ah+2*l1]) = RE(c2) - IM(c3); IM(ch[ah+2*l1]) = IM(c2) + RE(c3); } } } else { if (isign == 1) { for (k = 0; k < l1; k++) { for (i = 0; i < ido; i++) { ac = i + (3*k+1)*ido; ah = i + k * ido; RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); RE(d2) = RE(c2) - IM(c3); IM(d3) = IM(c2) - RE(c3); RE(d3) = RE(c2) + IM(c3); IM(d2) = IM(c2) + RE(c3); #if 1 ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); #else ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); #endif } } } else { for (k = 0; k < l1; k++) { for (i = 0; i < ido; i++) { ac = i + (3*k+1)*ido; ah = i + k * ido; RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); RE(d2) = RE(c2) + IM(c3); IM(d3) = IM(c2) + RE(c3); RE(d3) = RE(c2) - IM(c3); IM(d2) = IM(c2) - RE(c3); #if 1 ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); #else ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); #endif } } } } } static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3) { uint16_t i, k, ac, ah; if (ido == 1) { for (k = 0; k < l1; k++) { complex_t t1, t2, t3, t4; ac = 4*k; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); RE(ch[ah]) = RE(t2) + RE(t3); RE(ch[ah+2*l1]) = RE(t2) - RE(t3); IM(ch[ah]) = IM(t2) + IM(t3); IM(ch[ah+2*l1]) = IM(t2) - IM(t3); RE(ch[ah+l1]) = RE(t1) + RE(t4); RE(ch[ah+3*l1]) = RE(t1) - RE(t4); IM(ch[ah+l1]) = IM(t1) + IM(t4); IM(ch[ah+3*l1]) = IM(t1) - IM(t4); } } else { for (k = 0; k < l1; k++) { ac = 4*k*ido; ah = k*ido; for (i = 0; i < ido; i++) { complex_t c2, c3, c4, t1, t2, t3, t4; RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); RE(c2) = RE(t1) + RE(t4); RE(c4) = RE(t1) - RE(t4); IM(c2) = IM(t1) + IM(t4); IM(c4) = IM(t1) - IM(t4); RE(ch[ah+i]) = RE(t2) + RE(t3); RE(c3) = RE(t2) - RE(t3); IM(ch[ah+i]) = IM(t2) + IM(t3); IM(c3) = IM(t2) - IM(t3); #if 1 ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); #else ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); #endif } } } } static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3) { uint16_t i, k, ac, ah; if (ido == 1) { for (k = 0; k < l1; k++) { complex_t t1, t2, t3, t4; ac = 4*k; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); RE(ch[ah]) = RE(t2) + RE(t3); RE(ch[ah+2*l1]) = RE(t2) - RE(t3); IM(ch[ah]) = IM(t2) + IM(t3); IM(ch[ah+2*l1]) = IM(t2) - IM(t3); RE(ch[ah+l1]) = RE(t1) - RE(t4); RE(ch[ah+3*l1]) = RE(t1) + RE(t4); IM(ch[ah+l1]) = IM(t1) - IM(t4); IM(ch[ah+3*l1]) = IM(t1) + IM(t4); } } else { for (k = 0; k < l1; k++) { ac = 4*k*ido; ah = k*ido; for (i = 0; i < ido; i++) { complex_t c2, c3, c4, t1, t2, t3, t4; RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); RE(c2) = RE(t1) - RE(t4); RE(c4) = RE(t1) + RE(t4); IM(c2) = IM(t1) - IM(t4); IM(c4) = IM(t1) + IM(t4); RE(ch[ah+i]) = RE(t2) + RE(t3); RE(c3) = RE(t2) - RE(t3); IM(ch[ah+i]) = IM(t2) + IM(t3); IM(c3) = IM(t2) - IM(t3); #if 1 ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); #else ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); #endif } } } } static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, const complex_t *wa4, const int8_t isign) { static real_t tr11 = FRAC_CONST(0.309016994374947); static real_t ti11 = FRAC_CONST(0.951056516295154); static real_t tr12 = FRAC_CONST(-0.809016994374947); static real_t ti12 = FRAC_CONST(0.587785252292473); uint16_t i, k, ac, ah; complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5; if (ido == 1) { if (isign == 1) { for (k = 0; k < l1; k++) { ac = 5*k + 1; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); ComplexMult(&RE(c5), &RE(c4), ti11, ti12, RE(t5), RE(t4)); ComplexMult(&IM(c5), &IM(c4), ti11, ti12, IM(t5), IM(t4)); RE(ch[ah+l1]) = RE(c2) - IM(c5); IM(ch[ah+l1]) = IM(c2) + RE(c5); RE(ch[ah+2*l1]) = RE(c3) - IM(c4); IM(ch[ah+2*l1]) = IM(c3) + RE(c4); RE(ch[ah+3*l1]) = RE(c3) + IM(c4); IM(ch[ah+3*l1]) = IM(c3) - RE(c4); RE(ch[ah+4*l1]) = RE(c2) + IM(c5); IM(ch[ah+4*l1]) = IM(c2) - RE(c5); } } else { for (k = 0; k < l1; k++) { ac = 5*k + 1; ah = k; RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); ComplexMult(&RE(c4), &RE(c5), ti12, ti11, RE(t5), RE(t4)); ComplexMult(&IM(c4), &IM(c5), ti12, ti11, IM(t5), IM(t4)); RE(ch[ah+l1]) = RE(c2) + IM(c5); IM(ch[ah+l1]) = IM(c2) - RE(c5); RE(ch[ah+2*l1]) = RE(c3) + IM(c4); IM(ch[ah+2*l1]) = IM(c3) - RE(c4); RE(ch[ah+3*l1]) = RE(c3) - IM(c4); IM(ch[ah+3*l1]) = IM(c3) + RE(c4); RE(ch[ah+4*l1]) = RE(c2) - IM(c5); IM(ch[ah+4*l1]) = IM(c2) + RE(c5); } } } else { if (isign == 1) { for (k = 0; k < l1; k++) { for (i = 0; i < ido; i++) { ac = i + (k*5 + 1) * ido; ah = i + k * ido; RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); ComplexMult(&RE(c5), &RE(c4), ti11, ti12, RE(t5), RE(t4)); ComplexMult(&IM(c5), &IM(c4), ti11, ti12, IM(t5), IM(t4)); IM(d2) = IM(c2) + RE(c5); IM(d3) = IM(c3) + RE(c4); RE(d4) = RE(c3) + IM(c4); RE(d5) = RE(c2) + IM(c5); RE(d2) = RE(c2) - IM(c5); IM(d5) = IM(c2) - RE(c5); RE(d3) = RE(c3) - IM(c4); IM(d4) = IM(c3) - RE(c4); #if 1 ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); #else ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); #endif } } } else { for (k = 0; k < l1; k++) { for (i = 0; i < ido; i++) { ac = i + (k*5 + 1) * ido; ah = i + k * ido; RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); ComplexMult(&RE(c4), &RE(c5), ti12, ti11, RE(t5), RE(t4)); ComplexMult(&IM(c4), &IM(c5), ti12, ti11, IM(t5), IM(t4)); IM(d2) = IM(c2) - RE(c5); IM(d3) = IM(c3) - RE(c4); RE(d4) = RE(c3) - IM(c4); RE(d5) = RE(c2) - IM(c5); RE(d2) = RE(c2) + IM(c5); IM(d5) = IM(c2) + RE(c5); RE(d3) = RE(c3) + IM(c4); IM(d4) = IM(c3) + RE(c4); #if 1 ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); #else ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); #endif } } } } } /*---------------------------------------------------------------------- cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs. ----------------------------------------------------------------------*/ static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch, const uint16_t *ifac, const complex_t *wa, const int8_t isign) { uint16_t i; uint16_t k1, l1, l2; uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; nf = ifac[1]; na = 0; l1 = 1; iw = 0; for (k1 = 2; k1 <= nf+1; k1++) { ip = ifac[k1]; l2 = ip*l1; ido = n / l2; idl1 = ido*l1; switch (ip) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; if (na == 0) passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); else passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); na = 1 - na; break; case 2: if (na == 0) passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); else passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); na = 1 - na; break; case 3: ix2 = iw + ido; if (na == 0) passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); else passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); na = 1 - na; break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; if (na == 0) passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); else passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); na = 1 - na; break; } l1 = l2; iw += (ip-1) * ido; } if (na == 0) return; for (i = 0; i < n; i++) { RE(c[i]) = RE(ch[i]); IM(c[i]) = IM(ch[i]); } } static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch, const uint16_t *ifac, const complex_t *wa, const int8_t isign) { uint16_t i; uint16_t k1, l1, l2; uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; nf = ifac[1]; na = 0; l1 = 1; iw = 0; for (k1 = 2; k1 <= nf+1; k1++) { ip = ifac[k1]; l2 = ip*l1; ido = n / l2; idl1 = ido*l1; switch (ip) { case 4: ix2 = iw + ido; ix3 = ix2 + ido; if (na == 0) passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); else passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); na = 1 - na; break; case 2: if (na == 0) passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); else passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); na = 1 - na; break; case 3: ix2 = iw + ido; if (na == 0) passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); else passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); na = 1 - na; break; case 5: ix2 = iw + ido; ix3 = ix2 + ido; ix4 = ix3 + ido; if (na == 0) passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); else passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); na = 1 - na; break; } l1 = l2; iw += (ip-1) * ido; } if (na == 0) return; for (i = 0; i < n; i++) { RE(c[i]) = RE(ch[i]); IM(c[i]) = IM(ch[i]); } } void cfftf(cfft_info *cfft, complex_t *c) { cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1); } void cfftb(cfft_info *cfft, complex_t *c) { cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1); } static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac) { static uint16_t ntryh[4] = {3, 4, 2, 5}; #ifndef FIXED_POINT real_t arg, argh, argld, fi; uint16_t ido, ipm; uint16_t i1, k1, l1, l2; uint16_t ld, ii, ip; #endif uint16_t ntry = 0, i, j; uint16_t ib; uint16_t nf, nl, nq, nr; nl = n; nf = 0; j = 0; startloop: j++; if (j <= 4) ntry = ntryh[j-1]; else ntry += 2; do { nq = nl / ntry; nr = nl - ntry*nq; if (nr != 0) goto startloop; nf++; ifac[nf+1] = ntry; nl = nq; if (ntry == 2 && nf != 1) { for (i = 2; i <= nf; i++) { ib = nf - i + 2; ifac[ib+1] = ifac[ib]; } ifac[2] = 2; } } while (nl != 1); ifac[0] = n; ifac[1] = nf; #ifndef FIXED_POINT argh = (real_t)2.0*(real_t)M_PI / (real_t)n; i = 0; l1 = 1; for (k1 = 1; k1 <= nf; k1++) { ip = ifac[k1+1]; ld = 0; l2 = l1*ip; ido = n / l2; ipm = ip - 1; for (j = 0; j < ipm; j++) { i1 = i; RE(wa[i]) = 1.0; IM(wa[i]) = 0.0; ld += l1; fi = 0; argld = ld*argh; for (ii = 0; ii < ido; ii++) { i++; fi++; arg = fi * argld; RE(wa[i]) = (real_t)cos(arg); #if 1 IM(wa[i]) = (real_t)sin(arg); #else IM(wa[i]) = (real_t)-sin(arg); #endif } if (ip > 5) { RE(wa[i1]) = RE(wa[i]); IM(wa[i1]) = IM(wa[i]); } } l1 = l2; } #endif } cfft_info *cffti(uint16_t n) { cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info)); cfft->n = n; cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t)); #ifndef FIXED_POINT cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t)); cffti1(n, cfft->tab, cfft->ifac); #else cffti1(n, NULL, cfft->ifac); switch (n) { case 64: cfft->tab = (complex_t*)cfft_tab_64; break; case 512: cfft->tab = (complex_t*)cfft_tab_512; break; #ifdef LD_DEC case 256: cfft->tab = (complex_t*)cfft_tab_256; break; #endif #ifdef ALLOW_SMALL_FRAMELENGTH case 60: cfft->tab = (complex_t*)cfft_tab_60; break; case 480: cfft->tab = (complex_t*)cfft_tab_480; break; #ifdef LD_DEC case 240: cfft->tab = (complex_t*)cfft_tab_240; break; #endif #endif case 128: cfft->tab = (complex_t*)cfft_tab_128; break; } #endif return cfft; } void cfftu(cfft_info *cfft) { if (cfft->work) faad_free(cfft->work); #ifndef FIXED_POINT if (cfft->tab) faad_free(cfft->tab); #endif if (cfft) faad_free(cfft); } welle.io-2.1/src/libs/faad2/libfaad/cfft.h000066400000000000000000000032121357201522000202370ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: cfft.h,v 1.24 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __CFFT_H__ #define __CFFT_H__ #ifdef __cplusplus extern "C" { #endif typedef struct { uint16_t n; uint16_t ifac[15]; complex_t *work; complex_t *tab; } cfft_info; void cfftf(cfft_info *cfft, complex_t *c); void cfftb(cfft_info *cfft, complex_t *c); cfft_info *cffti(uint16_t n); void cfftu(cfft_info *cfft); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/cfft_tab.h000066400000000000000000003633061357201522000211020ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: cfft_tab.h,v 1.21 2007/11/01 12:33:29 menno Exp $ **/ #ifndef __CFFT_TAB_H__ #define __CFFT_TAB_H__ #ifdef __cplusplus extern "C" { #endif #ifdef FIXED_POINT ALIGN static const complex_t cfft_tab_512[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) }, { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) }, { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) }, { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) }, { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) }, { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) }, { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) }, { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) }, { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) }, { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) }, { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) }, { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) }, { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) }, { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) }, { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) }, { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) }, { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) }, { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) }, { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) }, { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) }, { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) }, { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) }, { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) }, { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) }, { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) }, { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) }, { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) }, { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) }, { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) }, { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) }, { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) }, { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) }, { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) }, { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) }, { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) }, { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) }, { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) }, { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) }, { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) }, { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) }, { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) }, { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) }, { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) }, { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) }, { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) }, { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) }, { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) }, { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) }, { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) }, { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) }, { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) }, { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) }, { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) }, { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) }, { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) }, { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) }, { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) }, { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) }, { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) }, { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) }, { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) }, { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) }, { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) }, { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) }, { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) }, { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) }, { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) }, { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) }, { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) }, { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) }, { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) }, { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) }, { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) }, { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) }, { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) }, { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) }, { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) }, { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) }, { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) }, { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) }, { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) }, { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) }, { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) }, { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) }, { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) }, { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) }, { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) }, { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) }, { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) }, { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) }, { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) }, { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) }, { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) }, { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) }, { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) }, { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) }, { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) }, { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) }, { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) }, { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const complex_t cfft_tab_480[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) }, { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) }, { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) }, { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) }, { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) }, { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) }, { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) }, { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) }, { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) }, { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) }, { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) }, { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) }, { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) }, { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) }, { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) }, { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) }, { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) }, { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) }, { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) }, { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) }, { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) }, { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) }, { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) }, { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) }, { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) }, { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) }, { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) }, { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) }, { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) }, { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) }, { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) }, { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) }, { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) }, { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) }, { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) }, { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) }, { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) }, { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) }, { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) }, { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) }, { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) }, { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) }, { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) }, { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) }, { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) }, { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) }, { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) }, { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) }, { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) }, { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) }, { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) }, { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) }, { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) }, { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) }, { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) }, { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) }, { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) }, { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) }, { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) }, { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) }, { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) }, { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) }, { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) }, { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) }, { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) }, { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) }, { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) }, { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) }, { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) }, { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) }, { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) }, { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) }, { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) }, { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) }, { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) }, { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) }, { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) }, { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) }, { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) }, { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) }, { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) }, { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) }, { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) }, { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) }, { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) }, { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) }, { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) }, { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) }, { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) }, { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) }, { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) }, { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } }; #endif ALIGN static const complex_t cfft_tab_64[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const complex_t cfft_tab_60[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } }; #endif #ifdef LD_DEC ALIGN static const complex_t cfft_tab_256[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const complex_t cfft_tab_240[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } }; #endif #endif ALIGN static const complex_t cfft_tab_128[] = { { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } }; #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/codebook/000077500000000000000000000000001357201522000207335ustar00rootroot00000000000000welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb.h000066400000000000000000000072121357201522000216420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb.h,v 1.8 2007/11/01 12:34:10 menno Exp $ **/ #ifndef __HCB_H__ #define __HCB_H__ #ifdef __cplusplus extern "C" { #endif /* * Optimal huffman decoding for AAC taken from: * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO * AES paper 5436 * * 2 methods are used for huffman decoding: * - binary search * - 2-step table lookup * * The choice of the "optimal" method is based on the fact that if the * memory size for the Two-step is exorbitantly high then the decision * is Binary search for that codebook. However, for marginally more memory * size, if Twostep outperforms even the best case of Binary then the * decision is Two-step for that codebook. * * The following methods are used for the different tables. * codebook "optimal" method * HCB_1 2-Step * HCB_2 2-Step * HCB_3 Binary * HCB_4 2-Step * HCB_5 Binary * HCB_6 2-Step * HCB_7 Binary * HCB_8 2-Step * HCB_9 Binary * HCB_10 2-Step * HCB_11 2-Step * HCB_SF Binary * */ #define ZERO_HCB 0 #define FIRST_PAIR_HCB 5 #define ESC_HCB 11 #define QUAD_LEN 4 #define PAIR_LEN 2 #define NOISE_HCB 13 #define INTENSITY_HCB2 14 #define INTENSITY_HCB 15 /* 1st step table */ typedef struct { uint8_t offset; uint8_t extra_bits; } hcb; /* 2nd step table with quadruple data */ typedef struct { uint8_t bits; int8_t x; int8_t y; } hcb_2_pair; typedef struct { uint8_t bits; int8_t x; int8_t y; int8_t v; int8_t w; } hcb_2_quad; /* binary search table */ typedef struct { uint8_t is_leaf; int8_t data[4]; } hcb_bin_quad; typedef struct { uint8_t is_leaf; int8_t data[2]; } hcb_bin_pair; hcb *hcb_table[]; hcb_2_quad *hcb_2_quad_table[]; hcb_2_pair *hcb_2_pair_table[]; hcb_bin_pair *hcb_bin_table[]; uint8_t hcbN[]; uint8_t unsigned_cb[]; int hcb_2_quad_table_size[]; int hcb_2_pair_table_size[]; int hcb_bin_table_size[]; #include "codebook/hcb_1.h" #include "codebook/hcb_2.h" #include "codebook/hcb_3.h" #include "codebook/hcb_4.h" #include "codebook/hcb_5.h" #include "codebook/hcb_6.h" #include "codebook/hcb_7.h" #include "codebook/hcb_8.h" #include "codebook/hcb_9.h" #include "codebook/hcb_10.h" #include "codebook/hcb_11.h" #include "codebook/hcb_sf.h" #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_1.h000066400000000000000000000136271357201522000220710ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_1.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_1 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb1_1[] = { { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* 10000 */ 1, 0 }, { /* 10001 */ 2, 0 }, { /* 10010 */ 3, 0 }, { /* 10011 */ 4, 0 }, { /* 10100 */ 5, 0 }, { /* 10101 */ 6, 0 }, { /* 10110 */ 7, 0 }, { /* 10111 */ 8, 0 }, /* 7 bit codewords */ { /* 11000 */ 9, 2 }, { /* 11001 */ 13, 2 }, { /* 11010 */ 17, 2 }, { /* 11011 */ 21, 2 }, { /* 11100 */ 25, 2 }, { /* 11101 */ 29, 2 }, /* 9 bit codewords */ { /* 11110 */ 33, 4 }, /* 9/10/11 bit codewords */ { /* 11111 */ 49, 6 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_quad hcb1_2[] = { /* 1 bit codeword */ { 1, 0, 0, 0, 0 }, /* 5 bit codewords */ { 5, 1, 0, 0, 0 }, { 5, -1, 0, 0, 0 }, { 5, 0, 0, 0, -1 }, { 5, 0, 1, 0, 0 }, { 5, 0, 0, 0, 1 }, { 5, 0, 0, -1, 0 }, { 5, 0, 0, 1, 0 }, { 5, 0, -1, 0, 0 }, /* 7 bit codewords */ /* first 5 bits: 11000 */ { 7, 1, -1, 0, 0 }, { 7, -1, 1, 0, 0 }, { 7, 0, 0, -1, 1 }, { 7, 0, 1, -1, 0 }, /* first 5 bits: 11001 */ { 7, 0, -1, 1, 0 }, { 7, 0, 0, 1, -1 }, { 7, 1, 1, 0, 0 }, { 7, 0, 0, -1, -1 }, /* first 5 bits: 11010 */ { 7, -1, -1, 0, 0 }, { 7, 0, -1, -1, 0 }, { 7, 1, 0, -1, 0 }, { 7, 0, 1, 0, -1 }, /* first 5 bits: 11011 */ { 7, -1, 0, 1, 0 }, { 7, 0, 0, 1, 1 }, { 7, 1, 0, 1, 0 }, { 7, 0, -1, 0, 1 }, /* first 5 bits: 11100 */ { 7, 0, 1, 1, 0 }, { 7, 0, 1, 0, 1 }, { 7, -1, 0, -1, 0 }, { 7, 1, 0, 0, 1 }, /* first 5 bits: 11101 */ { 7, -1, 0, 0, -1 }, { 7, 1, 0, 0, -1 }, { 7, -1, 0, 0, 1 }, { 7, 0, -1, 0, -1 }, /* 9 bit codeword */ /* first 5 bits: 11110 */ { 9, 1, 1, -1, 0 }, { 9, -1, 1, -1, 0 }, { 9, 1, -1, 1, 0 }, { 9, 0, 1, 1, -1 }, { 9, 0, 1, -1, 1 }, { 9, 0, -1, 1, 1 }, { 9, 0, -1, 1, -1 }, { 9, 1, -1, -1, 0 }, { 9, 1, 0, -1, 1 }, { 9, 0, 1, -1, -1 }, { 9, -1, 1, 1, 0 }, { 9, -1, 0, 1, -1 }, { 9, -1, -1, 1, 0 }, { 9, 0, -1, -1, 1 }, { 9, 1, -1, 0, 1 }, { 9, 1, -1, 0, -1 }, /* 9/10/11 bit codewords */ /* first 5 bits: 11111 */ /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */ { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */ { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 }, { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 }, { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 }, { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 }, { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 }, { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 }, { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 }, { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 }, /* 11 bit */ { 11, 1, -1, 1, -1 }, { 11, -1, 1, -1, 1 }, { 11, -1, 1, 1, -1 }, { 11, 1, -1, -1, 1 }, { 11, 1, 1, 1, 1 }, { 11, -1, -1, 1, 1 }, { 11, 1, 1, -1, -1 }, { 11, -1, -1, 1, -1 }, { 11, -1, -1, -1, -1 }, { 11, 1, 1, -1, 1 }, { 11, 1, -1, 1, 1 }, { 11, -1, 1, 1, 1 }, { 11, -1, 1, -1, -1 }, { 11, -1, -1, -1, 1 }, { 11, 1, -1, -1, -1 }, { 11, 1, 1, 1, -1 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_10.h000066400000000000000000000173371357201522000221530ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_10.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_10 */ /* 1st step: 6 bits * 2^6 = 64 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb10_1[] = { /* 4 bit codewords */ { /* 000000 */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* 000100 */ 1, 0 }, { /* */ 1, 0 }, { /* */ 1, 0 }, { /* */ 1, 0 }, { /* 001000 */ 2, 0 }, { /* */ 2, 0 }, { /* */ 2, 0 }, { /* */ 2, 0 }, /* 5 bit codewords */ { /* 001100 */ 3, 0 }, { /* */ 3, 0 }, { /* 001110 */ 4, 0 }, { /* */ 4, 0 }, { /* 010000 */ 5, 0 }, { /* */ 5, 0 }, { /* 010010 */ 6, 0 }, { /* */ 6, 0 }, { /* 010100 */ 7, 0 }, { /* */ 7, 0 }, { /* 010110 */ 8, 0 }, { /* */ 8, 0 }, { /* 011000 */ 9, 0 }, { /* */ 9, 0 }, { /* 011010 */ 10, 0 }, { /* */ 10, 0 }, /* 6 bit codewords */ { /* 011100 */ 11, 0 }, { /* 011101 */ 12, 0 }, { /* 011110 */ 13, 0 }, { /* 011111 */ 14, 0 }, { /* 100000 */ 15, 0 }, { /* 100001 */ 16, 0 }, { /* 100010 */ 17, 0 }, { /* 100011 */ 18, 0 }, { /* 100100 */ 19, 0 }, { /* 100101 */ 20, 0 }, { /* 100110 */ 21, 0 }, { /* 100111 */ 22, 0 }, { /* 101000 */ 23, 0 }, { /* 101001 */ 24, 0 }, /* 7 bit codewords */ { /* 101010 */ 25, 1 }, { /* 101011 */ 27, 1 }, { /* 101100 */ 29, 1 }, { /* 101101 */ 31, 1 }, { /* 101110 */ 33, 1 }, { /* 101111 */ 35, 1 }, { /* 110000 */ 37, 1 }, { /* 110001 */ 39, 1 }, /* 7/8 bit codewords */ { /* 110010 */ 41, 2 }, /* 8 bit codewords */ { /* 110011 */ 45, 2 }, { /* 110100 */ 49, 2 }, { /* 110101 */ 53, 2 }, { /* 110110 */ 57, 2 }, { /* 110111 */ 61, 2 }, /* 8/9 bit codewords */ { /* 111000 */ 65, 3 }, /* 9 bit codewords */ { /* 111001 */ 73, 3 }, { /* 111010 */ 81, 3 }, { /* 111011 */ 89, 3 }, /* 9/10 bit codewords */ { /* 111100 */ 97, 4 }, /* 10 bit codewords */ { /* 111101 */ 113, 4 }, { /* 111110 */ 129, 4 }, /* 10/11/12 bit codewords */ { /* 111111 */ 145, 6 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_pair hcb10_2[] = { /* 4 bit codewords */ { 4, 1, 1 }, { 4, 1, 2 }, { 4, 2, 1 }, /* 5 bit codewords */ { 5, 2, 2 }, { 5, 1, 0 }, { 5, 0, 1 }, { 5, 1, 3 }, { 5, 3, 2 }, { 5, 3, 1 }, { 5, 2, 3 }, { 5, 3, 3 }, /* 6 bit codewords */ { 6, 2, 0 }, { 6, 0, 2 }, { 6, 2, 4 }, { 6, 4, 2 }, { 6, 1, 4 }, { 6, 4, 1 }, { 6, 0, 0 }, { 6, 4, 3 }, { 6, 3, 4 }, { 6, 3, 0 }, { 6, 0, 3 }, { 6, 4, 4 }, { 6, 2, 5 }, { 6, 5, 2 }, /* 7 bit codewords */ { 7, 1, 5 }, { 7, 5, 1 }, { 7, 5, 3 }, { 7, 3, 5 }, { 7, 5, 4 }, { 7, 4, 5 }, { 7, 6, 2 }, { 7, 2, 6 }, { 7, 6, 3 }, { 7, 4, 0 }, { 7, 6, 1 }, { 7, 0, 4 }, { 7, 1, 6 }, { 7, 3, 6 }, { 7, 5, 5 }, { 7, 6, 4 }, /* 7/8 bit codewords */ { 7, 4, 6 }, { 7, 4, 6 }, { 8, 6, 5 }, { 8, 7, 2 }, /* 8 bit codewords */ { 8, 3, 7 }, { 8, 2, 7 }, { 8, 5, 6 }, { 8, 8, 2 }, { 8, 7, 3 }, { 8, 5, 0 }, { 8, 7, 1 }, { 8, 0, 5 }, { 8, 8, 1 }, { 8, 1, 7 }, { 8, 8, 3 }, { 8, 7, 4 }, { 8, 4, 7 }, { 8, 2, 8 }, { 8, 6, 6 }, { 8, 7, 5 }, { 8, 1, 8 }, { 8, 3, 8 }, { 8, 8, 4 }, { 8, 4, 8 }, /* 8/9 bit codewords */ { 8, 5, 7 }, { 8, 5, 7 }, { 8, 8, 5 }, { 8, 8, 5 }, { 8, 5, 8 }, { 8, 5, 8 }, { 9, 7, 6 }, { 9, 6, 7 }, /* 9 bit codewords */ { 9, 9, 2 }, { 9, 6, 0 }, { 9, 6, 8 }, { 9, 9, 3 }, { 9, 3, 9 }, { 9, 9, 1 }, { 9, 2, 9 }, { 9, 0, 6 }, { 9, 8, 6 }, { 9, 9, 4 }, { 9, 4, 9 }, { 9, 10, 2 }, { 9, 1, 9 }, { 9, 7, 7 }, { 9, 8, 7 }, { 9, 9, 5 }, { 9, 7, 8 }, { 9, 10, 3 }, { 9, 5, 9 }, { 9, 10, 4 }, { 9, 2, 10 }, { 9, 10, 1 }, { 9, 3, 10 }, { 9, 9, 6 }, /* 9/10 bit codewords */ { 9, 6, 9 }, { 9, 6, 9 }, { 9, 8, 0 }, { 9, 8, 0 }, { 9, 4, 10 }, { 9, 4, 10 }, { 9, 7, 0 }, { 9, 7, 0 }, { 9, 11, 2 }, { 9, 11, 2 }, { 10, 7, 9 }, { 10, 11, 3 }, { 10, 10, 6 }, { 10, 1, 10 }, { 10, 11, 1 }, { 10, 9, 7 }, /* 10 bit codewords */ { 10, 0, 7 }, { 10, 8, 8 }, { 10, 10, 5 }, { 10, 3, 11 }, { 10, 5, 10 }, { 10, 8, 9 }, { 10, 11, 5 }, { 10, 0, 8 }, { 10, 11, 4 }, { 10, 2, 11 }, { 10, 7, 10 }, { 10, 6, 10 }, { 10, 10, 7 }, { 10, 4, 11 }, { 10, 1, 11 }, { 10, 12, 2 }, { 10, 9, 8 }, { 10, 12, 3 }, { 10, 11, 6 }, { 10, 5, 11 }, { 10, 12, 4 }, { 10, 11, 7 }, { 10, 12, 5 }, { 10, 3, 12 }, { 10, 6, 11 }, { 10, 9, 0 }, { 10, 10, 8 }, { 10, 10, 0 }, { 10, 12, 1 }, { 10, 0, 9 }, { 10, 4, 12 }, { 10, 9, 9 }, /* 10/11/12 bit codewords */ { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 11, 9, 10 }, { 11, 9, 10 }, { 11, 1, 12 }, { 11, 1, 12 }, { 11, 11, 8 }, { 11, 11, 8 }, { 11, 12, 7 }, { 11, 12, 7 }, { 11, 7, 11 }, { 11, 7, 11 }, { 11, 5, 12 }, { 11, 5, 12 }, { 11, 6, 12 }, { 11, 6, 12 }, { 11, 10, 9 }, { 11, 10, 9 }, { 11, 8, 11 }, { 11, 8, 11 }, { 11, 12, 8 }, { 11, 12, 8 }, { 11, 0, 10 }, { 11, 0, 10 }, { 11, 7, 12 }, { 11, 7, 12 }, { 11, 11, 0 }, { 11, 11, 0 }, { 11, 10, 10 }, { 11, 10, 10 }, { 11, 11, 9 }, { 11, 11, 9 }, { 11, 11, 10 }, { 11, 11, 10 }, { 11, 0, 11 }, { 11, 0, 11 }, { 11, 11, 11 }, { 11, 11, 11 }, { 11, 9, 11 }, { 11, 9, 11 }, { 11, 10, 11 }, { 11, 10, 11 }, { 11, 12, 0 }, { 11, 12, 0 }, { 11, 8, 12 }, { 11, 8, 12 }, { 12, 12, 9 }, { 12, 10, 12 }, { 12, 9, 12 }, { 12, 11, 12 }, { 12, 12, 11 }, { 12, 0, 12 }, { 12, 12, 10 }, { 12, 12, 12 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_11.h000066400000000000000000000231771357201522000221530ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_11.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_11 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb11_1[] = { /* 4 bits */ { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* 00010 */ 1, 0 }, { /* */ 1, 0 }, /* 5 bits */ { /* 00100 */ 2, 0 }, { /* 00101 */ 3, 0 }, { /* 00110 */ 4, 0 }, { /* 00111 */ 5, 0 }, { /* 01000 */ 6, 0 }, { /* 01001 */ 7, 0 }, /* 6 bits */ { /* 01010 */ 8, 1 }, { /* 01011 */ 10, 1 }, { /* 01100 */ 12, 1 }, /* 6/7 bits */ { /* 01101 */ 14, 2 }, /* 7 bits */ { /* 01110 */ 18, 2 }, { /* 01111 */ 22, 2 }, { /* 10000 */ 26, 2 }, /* 7/8 bits */ { /* 10001 */ 30, 3 }, /* 8 bits */ { /* 10010 */ 38, 3 }, { /* 10011 */ 46, 3 }, { /* 10100 */ 54, 3 }, { /* 10101 */ 62, 3 }, { /* 10110 */ 70, 3 }, { /* 10111 */ 78, 3 }, /* 8/9 bits */ { /* 11000 */ 86, 4 }, /* 9 bits */ { /* 11001 */ 102, 4 }, { /* 11010 */ 118, 4 }, { /* 11011 */ 134, 4 }, /* 9/10 bits */ { /* 11100 */ 150, 5 }, /* 10 bits */ { /* 11101 */ 182, 5 }, { /* 11110 */ 214, 5 }, /* 10/11/12 bits */ { /* 11111 */ 246, 7 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_pair hcb11_2[] = { /* 4 */ { 4, 0, 0 }, { 4, 1, 1 }, /* 5 */ { 5, 16, 16 }, { 5, 1, 0 }, { 5, 0, 1 }, { 5, 2, 1 }, { 5, 1, 2 }, { 5, 2, 2 }, /* 6 */ { 6, 1, 3 }, { 6, 3, 1 }, { 6, 3, 2 }, { 6, 2, 0 }, { 6, 2, 3 }, { 6, 0, 2 }, /* 6/7 */ { 6, 3, 3 }, { 6, 3, 3 }, { 7, 4, 1 }, { 7, 1, 4 }, /* 7 */ { 7, 4, 2 }, { 7, 2, 4 }, { 7, 4, 3 }, { 7, 3, 4 }, { 7, 3, 0 }, { 7, 0, 3 }, { 7, 5, 1 }, { 7, 5, 2 }, { 7, 2, 5 }, { 7, 4, 4 }, { 7, 1, 5 }, { 7, 5, 3 }, /* 7/8 */ { 7, 3, 5 }, { 7, 3, 5 }, { 7, 5, 4 }, { 7, 5, 4 }, { 8, 4, 5 }, { 8, 6, 2 }, { 8, 2, 6 }, { 8, 6, 1 }, /* 8 */ { 8, 6, 3 }, { 8, 3, 6 }, { 8, 1, 6 }, { 8, 4, 16 }, { 8, 3, 16 }, { 8, 16, 5 }, { 8, 16, 3 }, { 8, 16, 4 }, { 8, 6, 4 }, { 8, 16, 6 }, { 8, 4, 0 }, { 8, 4, 6 }, { 8, 0, 4 }, { 8, 2, 16 }, { 8, 5, 5 }, { 8, 5, 16 }, { 8, 16, 7 }, { 8, 16, 2 }, { 8, 16, 8 }, { 8, 2, 7 }, { 8, 7, 2 }, { 8, 3, 7 }, { 8, 6, 5 }, { 8, 5, 6 }, { 8, 6, 16 }, { 8, 16, 10 }, { 8, 7, 3 }, { 8, 7, 1 }, { 8, 16, 9 }, { 8, 7, 16 }, { 8, 1, 16 }, { 8, 1, 7 }, { 8, 4, 7 }, { 8, 16, 11 }, { 8, 7, 4 }, { 8, 16, 12 }, { 8, 8, 16 }, { 8, 16, 1 }, { 8, 6, 6 }, { 8, 9, 16 }, { 8, 2, 8 }, { 8, 5, 7 }, { 8, 10, 16 }, { 8, 16, 13 }, { 8, 8, 3 }, { 8, 8, 2 }, { 8, 3, 8 }, { 8, 5, 0 }, /* 8/9 */ { 8, 16, 14 }, { 8, 16, 14 }, { 8, 11, 16 }, { 8, 11, 16 }, { 8, 7, 5 }, { 8, 7, 5 }, { 8, 4, 8 }, { 8, 4, 8 }, { 8, 6, 7 }, { 8, 6, 7 }, { 8, 7, 6 }, { 8, 7, 6 }, { 8, 0, 5 }, { 8, 0, 5 }, { 9, 8, 4 }, { 9, 16, 15 }, /* 9 */ { 9, 12, 16 }, { 9, 1, 8 }, { 9, 8, 1 }, { 9, 14, 16 }, { 9, 5, 8 }, { 9, 13, 16 }, { 9, 3, 9 }, { 9, 8, 5 }, { 9, 7, 7 }, { 9, 2, 9 }, { 9, 8, 6 }, { 9, 9, 2 }, { 9, 9, 3 }, { 9, 15, 16 }, { 9, 4, 9 }, { 9, 6, 8 }, { 9, 6, 0 }, { 9, 9, 4 }, { 9, 5, 9 }, { 9, 8, 7 }, { 9, 7, 8 }, { 9, 1, 9 }, { 9, 10, 3 }, { 9, 0, 6 }, { 9, 10, 2 }, { 9, 9, 1 }, { 9, 9, 5 }, { 9, 4, 10 }, { 9, 2, 10 }, { 9, 9, 6 }, { 9, 3, 10 }, { 9, 6, 9 }, { 9, 10, 4 }, { 9, 8, 8 }, { 9, 10, 5 }, { 9, 9, 7 }, { 9, 11, 3 }, { 9, 1, 10 }, { 9, 7, 0 }, { 9, 10, 6 }, { 9, 7, 9 }, { 9, 3, 11 }, { 9, 5, 10 }, { 9, 10, 1 }, { 9, 4, 11 }, { 9, 11, 2 }, { 9, 13, 2 }, { 9, 6, 10 }, /* 9/10 */ { 9, 13, 3 }, { 9, 13, 3 }, { 9, 2, 11 }, { 9, 2, 11 }, { 9, 16, 0 }, { 9, 16, 0 }, { 9, 5, 11 }, { 9, 5, 11 }, { 9, 11, 5 }, { 9, 11, 5 }, { 10, 11, 4 }, { 10, 9, 8 }, { 10, 7, 10 }, { 10, 8, 9 }, { 10, 0, 16 }, { 10, 4, 13 }, { 10, 0, 7 }, { 10, 3, 13 }, { 10, 11, 6 }, { 10, 13, 1 }, { 10, 13, 4 }, { 10, 12, 3 }, { 10, 2, 13 }, { 10, 13, 5 }, { 10, 8, 10 }, { 10, 6, 11 }, { 10, 10, 8 }, { 10, 10, 7 }, { 10, 14, 2 }, { 10, 12, 4 }, { 10, 1, 11 }, { 10, 4, 12 }, /* 10 */ { 10, 11, 1 }, { 10, 3, 12 }, { 10, 1, 13 }, { 10, 12, 2 }, { 10, 7, 11 }, { 10, 3, 14 }, { 10, 5, 12 }, { 10, 5, 13 }, { 10, 14, 4 }, { 10, 4, 14 }, { 10, 11, 7 }, { 10, 14, 3 }, { 10, 12, 5 }, { 10, 13, 6 }, { 10, 12, 6 }, { 10, 8, 0 }, { 10, 11, 8 }, { 10, 2, 12 }, { 10, 9, 9 }, { 10, 14, 5 }, { 10, 6, 13 }, { 10, 10, 10 }, { 10, 15, 2 }, { 10, 8, 11 }, { 10, 9, 10 }, { 10, 14, 6 }, { 10, 10, 9 }, { 10, 5, 14 }, { 10, 11, 9 }, { 10, 14, 1 }, { 10, 2, 14 }, { 10, 6, 12 }, { 10, 1, 12 }, { 10, 13, 8 }, { 10, 0, 8 }, { 10, 13, 7 }, { 10, 7, 12 }, { 10, 12, 7 }, { 10, 7, 13 }, { 10, 15, 3 }, { 10, 12, 1 }, { 10, 6, 14 }, { 10, 2, 15 }, { 10, 15, 5 }, { 10, 15, 4 }, { 10, 1, 14 }, { 10, 9, 11 }, { 10, 4, 15 }, { 10, 14, 7 }, { 10, 8, 13 }, { 10, 13, 9 }, { 10, 8, 12 }, { 10, 5, 15 }, { 10, 3, 15 }, { 10, 10, 11 }, { 10, 11, 10 }, { 10, 12, 8 }, { 10, 15, 6 }, { 10, 15, 7 }, { 10, 8, 14 }, { 10, 15, 1 }, { 10, 7, 14 }, { 10, 9, 0 }, { 10, 0, 9 }, /* 10/11/12 */ { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 11, 9, 14 }, { 11, 9, 14 }, { 11, 15, 8 }, { 11, 15, 8 }, { 11, 11, 11 }, { 11, 11, 11 }, { 11, 11, 14 }, { 11, 11, 14 }, { 11, 1, 15 }, { 11, 1, 15 }, { 11, 10, 12 }, { 11, 10, 12 }, { 11, 10, 14 }, { 11, 10, 14 }, { 11, 13, 11 }, { 11, 13, 11 }, { 11, 13, 10 }, { 11, 13, 10 }, { 11, 11, 13 }, { 11, 11, 13 }, { 11, 11, 12 }, { 11, 11, 12 }, { 11, 8, 15 }, { 11, 8, 15 }, { 11, 14, 11 }, { 11, 14, 11 }, { 11, 13, 12 }, { 11, 13, 12 }, { 11, 12, 13 }, { 11, 12, 13 }, { 11, 15, 9 }, { 11, 15, 9 }, { 11, 14, 10 }, { 11, 14, 10 }, { 11, 10, 0 }, { 11, 10, 0 }, { 11, 12, 11 }, { 11, 12, 11 }, { 11, 9, 15 }, { 11, 9, 15 }, { 11, 0, 10 }, { 11, 0, 10 }, { 11, 12, 12 }, { 11, 12, 12 }, { 11, 11, 0 }, { 11, 11, 0 }, { 11, 12, 14 }, { 11, 12, 14 }, { 11, 10, 15 }, { 11, 10, 15 }, { 11, 13, 13 }, { 11, 13, 13 }, { 11, 0, 13 }, { 11, 0, 13 }, { 11, 14, 12 }, { 11, 14, 12 }, { 11, 15, 10 }, { 11, 15, 10 }, { 11, 15, 11 }, { 11, 15, 11 }, { 11, 11, 15 }, { 11, 11, 15 }, { 11, 14, 13 }, { 11, 14, 13 }, { 11, 13, 0 }, { 11, 13, 0 }, { 11, 0, 11 }, { 11, 0, 11 }, { 11, 13, 14 }, { 11, 13, 14 }, { 11, 15, 12 }, { 11, 15, 12 }, { 11, 15, 13 }, { 11, 15, 13 }, { 11, 12, 15 }, { 11, 12, 15 }, { 11, 14, 0 }, { 11, 14, 0 }, { 11, 14, 14 }, { 11, 14, 14 }, { 11, 13, 15 }, { 11, 13, 15 }, { 11, 12, 0 }, { 11, 12, 0 }, { 11, 14, 15 }, { 11, 14, 15 }, { 12, 0, 14 }, { 12, 0, 12 }, { 12, 15, 14 }, { 12, 15, 0 }, { 12, 0, 15 }, { 12, 15, 15 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_2.h000066400000000000000000000117431357201522000220670ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_2.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_2 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb2_1[] = { { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* 00100 */ 1, 0 }, { /* */ 1, 0 }, { /* 00110 */ 2, 0 }, { /* 00111 */ 3, 0 }, { /* 01000 */ 4, 0 }, { /* 01001 */ 5, 0 }, { /* 01010 */ 6, 0 }, { /* 01011 */ 7, 0 }, { /* 01100 */ 8, 0 }, /* 6 bit codewords */ { /* 01101 */ 9, 1 }, { /* 01110 */ 11, 1 }, { /* 01111 */ 13, 1 }, { /* 10000 */ 15, 1 }, { /* 10001 */ 17, 1 }, { /* 10010 */ 19, 1 }, { /* 10011 */ 21, 1 }, { /* 10100 */ 23, 1 }, { /* 10101 */ 25, 1 }, { /* 10110 */ 27, 1 }, { /* 10111 */ 29, 1 }, { /* 11000 */ 31, 1 }, /* 7 bit codewords */ { /* 11001 */ 33, 2 }, { /* 11010 */ 37, 2 }, { /* 11011 */ 41, 2 }, /* 7/8 bit codewords */ { /* 11100 */ 45, 3 }, /* 8 bit codewords */ { /* 11101 */ 53, 3 }, { /* 11110 */ 61, 3 }, /* 8/9 bit codewords */ { /* 11111 */ 69, 4 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_quad hcb2_2[] = { /* 3 bit codeword */ { 3, 0, 0, 0, 0 }, /* 4 bit codeword */ { 4, 1, 0, 0, 0 }, /* 5 bit codewords */ { 5, -1, 0, 0, 0 }, { 5, 0, 0, 0, 1 }, { 5, 0, 0, -1, 0 }, { 5, 0, 0, 0, -1 }, { 5, 0, -1, 0, 0 }, { 5, 0, 0, 1, 0 }, { 5, 0, 1, 0, 0 }, /* 6 bit codewords */ { 6, 0, -1, 1, 0 }, { 6, -1, 1, 0, 0 }, { 6, 0, 1, -1, 0 }, { 6, 0, 0, 1, -1 }, { 6, 0, 1, 0, -1 }, { 6, 0, 0, -1, 1 }, { 6, -1, 0, 0, -1 }, { 6, 1, -1, 0, 0 }, { 6, 1, 0, -1, 0 }, { 6, -1, -1, 0, 0 }, { 6, 0, 0, -1, -1 }, { 6, 1, 0, 1, 0 }, { 6, 1, 0, 0, 1 }, { 6, 0, -1, 0, 1 }, { 6, -1, 0, 1, 0 }, { 6, 0, 1, 0, 1 }, { 6, 0, -1, -1, 0 }, { 6, -1, 0, 0, 1 }, { 6, 0, -1, 0, -1 }, { 6, -1, 0, -1, 0 }, { 6, 1, 1, 0, 0 }, { 6, 0, 1, 1, 0 }, { 6, 0, 0, 1, 1 }, { 6, 1, 0, 0, -1 }, /* 7 bit codewords */ { 7, 0, 1, -1, 1 }, { 7, 1, 0, -1, 1 }, { 7, -1, 1, -1, 0 }, { 7, 0, -1, 1, -1 }, { 7, 1, -1, 1, 0 }, { 7, 1, 1, 0, -1 }, { 7, 1, 0, 1, 1 }, { 7, -1, 1, 1, 0 }, { 7, 0, -1, -1, 1 }, { 7, 1, 1, 1, 0 }, { 7, -1, 0, 1, -1 }, { 7, -1, -1, -1, 0 }, /* 7/8 bit codewords */ { 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 }, { 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 }, { 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 }, { 8, 1, -1, 0, 1 }, { 8, -1, 1, 0, -1 }, /* 8 bit codewords */ { 8, -1, -1, 1, 0 }, { 8, -1, 0, 1, 1 }, { 8, -1, -1, 0, 1 }, { 8, -1, -1, 0, -1 }, { 8, 0, -1, -1, -1 }, { 8, 1, 0, 1, -1 }, { 8, 1, 0, -1, -1 }, { 8, 0, 1, -1, -1 }, { 8, 0, 1, 1, 1 }, { 8, -1, 1, 0, 1 }, { 8, -1, 0, -1, -1 }, { 8, 0, 1, 1, -1 }, { 8, 1, -1, 0, -1 }, { 8, 0, -1, 1, 1 }, { 8, 1, 1, 0, 1 }, { 8, 1, -1, 1, -1 }, /* 8/9 bit codewords */ { 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 }, { 9, 1, -1, -1, 1 }, { 9, -1, -1, -1, -1 }, { 9, -1, 1, 1, -1 }, { 9, -1, 1, 1, 1 }, { 9, 1, 1, 1, 1 }, { 9, -1, -1, 1, -1 }, { 9, 1, -1, 1, 1 }, { 9, -1, 1, -1, -1 }, { 9, -1, -1, 1, 1 }, { 9, 1, 1, -1, -1 }, { 9, 1, -1, -1, -1 }, { 9, -1, -1, -1, 1 }, { 9, 1, 1, -1, 1 }, { 9, 1, 1, 1, -1 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_3.h000066400000000000000000000207361357201522000220720ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_3.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_3 */ static hcb_bin_quad hcb3[] = { { /* 0 */ 0, { 1, 2, 0, 0 } }, { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */ { /* 2 */ 0, { 1, 2, 0, 0 } }, { /* 3 */ 0, { 2, 3, 0, 0 } }, { /* 4 */ 0, { 3, 4, 0, 0 } }, { /* 5 */ 0, { 4, 5, 0, 0 } }, { /* 6 */ 0, { 5, 6, 0, 0 } }, { /* 7 */ 0, { 6, 7, 0, 0 } }, { /* 8 */ 0, { 7, 8, 0, 0 } }, { /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */ { /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */ { /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */ { /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */ { /* 13 */ 0, { 4, 5, 0, 0 } }, { /* 14 */ 0, { 5, 6, 0, 0 } }, { /* 15 */ 0, { 6, 7, 0, 0 } }, { /* 16 */ 0, { 7, 8, 0, 0 } }, { /* 17 */ 1, { 1, 1, 0, 0 } }, { /* 18 */ 1, { 0, 0, 1, 1 } }, { /* 19 */ 0, { 6, 7, 0, 0 } }, { /* 20 */ 0, { 7, 8, 0, 0 } }, { /* 21 */ 0, { 8, 9, 0, 0 } }, { /* 22 */ 0, { 9, 10, 0, 0 } }, { /* 23 */ 0, { 10, 11, 0, 0 } }, { /* 24 */ 0, { 11, 12, 0, 0 } }, { /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */ { /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */ { /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */ { /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */ { /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */ { /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */ { /* 31 */ 0, { 6, 7, 0, 0 } }, { /* 32 */ 0, { 7, 8, 0, 0 } }, { /* 33 */ 0, { 8, 9, 0, 0 } }, { /* 34 */ 0, { 9, 10, 0, 0 } }, { /* 35 */ 0, { 10, 11, 0, 0 } }, { /* 36 */ 0, { 11, 12, 0, 0 } }, { /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */ { /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */ { /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */ { /* 40 */ 0, { 9, 10, 0, 0 } }, { /* 41 */ 0, { 10, 11, 0, 0 } }, { /* 42 */ 0, { 11, 12, 0, 0 } }, { /* 43 */ 0, { 12, 13, 0, 0 } }, { /* 44 */ 0, { 13, 14, 0, 0 } }, { /* 45 */ 0, { 14, 15, 0, 0 } }, { /* 46 */ 0, { 15, 16, 0, 0 } }, { /* 47 */ 0, { 16, 17, 0, 0 } }, { /* 48 */ 0, { 17, 18, 0, 0 } }, { /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */ { /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */ { /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */ { /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */ { /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */ { /* 54 */ 0, { 13, 14, 0, 0 } }, { /* 55 */ 0, { 14, 15, 0, 0 } }, { /* 56 */ 0, { 15, 16, 0, 0 } }, { /* 57 */ 0, { 16, 17, 0, 0 } }, { /* 58 */ 0, { 17, 18, 0, 0 } }, { /* 59 */ 0, { 18, 19, 0, 0 } }, { /* 60 */ 0, { 19, 20, 0, 0 } }, { /* 61 */ 0, { 20, 21, 0, 0 } }, { /* 62 */ 0, { 21, 22, 0, 0 } }, { /* 63 */ 0, { 22, 23, 0, 0 } }, { /* 64 */ 0, { 23, 24, 0, 0 } }, { /* 65 */ 0, { 24, 25, 0, 0 } }, { /* 66 */ 0, { 25, 26, 0, 0 } }, { /* 67 */ 1, { 0, 0, 2, 1 } }, { /* 68 */ 1, { 0, 1, 2, 1 } }, { /* 69 */ 1, { 1, 2, 0, 0 } }, { /* 70 */ 1, { 0, 1, 1, 2 } }, { /* 71 */ 1, { 2, 1, 1, 0 } }, { /* 72 */ 1, { 0, 0, 2, 0 } }, { /* 73 */ 1, { 0, 2, 1, 0 } }, { /* 74 */ 1, { 0, 1, 2, 0 } }, { /* 75 */ 1, { 0, 2, 0, 0 } }, { /* 76 */ 1, { 0, 1, 0, 2 } }, { /* 77 */ 1, { 2, 0, 1, 0 } }, { /* 78 */ 1, { 1, 2, 1, 1 } }, { /* 79 */ 1, { 0, 2, 1, 1 } }, { /* 80 */ 1, { 1, 1, 2, 0 } }, { /* 81 */ 1, { 1, 1, 2, 1 } }, { /* 82 */ 0, { 11, 12, 0, 0 } }, { /* 83 */ 0, { 12, 13, 0, 0 } }, { /* 84 */ 0, { 13, 14, 0, 0 } }, { /* 85 */ 0, { 14, 15, 0, 0 } }, { /* 86 */ 0, { 15, 16, 0, 0 } }, { /* 87 */ 0, { 16, 17, 0, 0 } }, { /* 88 */ 0, { 17, 18, 0, 0 } }, { /* 89 */ 0, { 18, 19, 0, 0 } }, { /* 90 */ 0, { 19, 20, 0, 0 } }, { /* 91 */ 0, { 20, 21, 0, 0 } }, { /* 92 */ 0, { 21, 22, 0, 0 } }, { /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */ { /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */ { /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */ { /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */ { /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */ { /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */ { /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */ { /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */ { /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */ { /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */ { /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */ { /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */ { /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */ { /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */ { /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */ { /* 08 */ 0, { 7, 8, 0, 0 } }, { /* 09 */ 0, { 8, 9, 0, 0 } }, { /* 10 */ 0, { 9, 10, 0, 0 } }, { /* 11 */ 0, { 10, 11, 0, 0 } }, { /* 12 */ 0, { 11, 12, 0, 0 } }, { /* 13 */ 0, { 12, 13, 0, 0 } }, { /* 14 */ 0, { 13, 14, 0, 0 } }, { /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */ { /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */ { /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */ { /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */ { /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */ { /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */ { /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */ { /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */ { /* 23 */ 0, { 6, 7, 0, 0 } }, { /* 24 */ 0, { 7, 8, 0, 0 } }, { /* 25 */ 0, { 8, 9, 0, 0 } }, { /* 26 */ 0, { 9, 10, 0, 0 } }, { /* 27 */ 0, { 10, 11, 0, 0 } }, { /* 28 */ 0, { 11, 12, 0, 0 } }, { /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */ { /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */ { /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */ { /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */ { /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */ { /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */ { /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */ { /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */ { /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */ { /* 38 */ 0, { 3, 4, 0, 0 } }, { /* 39 */ 0, { 4, 5, 0, 0 } }, { /* 40 */ 0, { 5, 6, 0, 0 } }, { /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */ { /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */ { /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */ { /* 44 */ 0, { 3, 4, 0, 0 } }, { /* 45 */ 0, { 4, 5, 0, 0 } }, { /* 46 */ 0, { 5, 6, 0, 0 } }, { /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */ { /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */ { /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */ { /* 50 */ 0, { 3, 4, 0, 0 } }, { /* 51 */ 0, { 4, 5, 0, 0 } }, { /* 52 */ 0, { 5, 6, 0, 0 } }, { /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */ { /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */ { /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */ { /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */ { /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */ { /* 58 */ 0, { 1, 2, 0, 0 } }, { /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */ { /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */ }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_4.h000066400000000000000000000171371357201522000220740ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_4.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_4 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb4_1[] = { /* 4 bit codewords */ { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* 00010 */ 1, 0 }, { /* */ 1, 0 }, { /* 00100 */ 2, 0 }, { /* */ 2, 0 }, { /* 00110 */ 3, 0 }, { /* */ 3, 0 }, { /* 01000 */ 4, 0 }, { /* */ 4, 0 }, { /* 01010 */ 5, 0 }, { /* */ 5, 0 }, { /* 01100 */ 6, 0 }, { /* */ 6, 0 }, { /* 01110 */ 7, 0 }, { /* */ 7, 0 }, { /* 10000 */ 8, 0 }, { /* */ 8, 0 }, { /* 10010 */ 9, 0 }, { /* */ 9, 0 }, /* 5 bit codewords */ { /* 10100 */ 10, 0 }, { /* 10101 */ 11, 0 }, { /* 10110 */ 12, 0 }, { /* 10111 */ 13, 0 }, { /* 11000 */ 14, 0 }, { /* 11001 */ 15, 0 }, /* 7 bit codewords */ { /* 11010 */ 16, 2 }, { /* 11011 */ 20, 2 }, /* 7/8 bit codewords */ { /* 11100 */ 24, 3 }, /* 8 bit codewords */ { /* 11101 */ 32, 3 }, /* 8/9 bit codewords */ { /* 11110 */ 40, 4 }, /* 9/10/11/12 bit codewords */ { /* 11111 */ 56, 7 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_quad hcb4_2[] = { /* 4 bit codewords */ { 4, 1, 1, 1, 1 }, { 4, 0, 1, 1, 1 }, { 4, 1, 1, 0, 1 }, { 4, 1, 1, 1, 0 }, { 4, 1, 0, 1, 1 }, { 4, 1, 0, 0, 0 }, { 4, 1, 1, 0, 0 }, { 4, 0, 0, 0, 0 }, { 4, 0, 0, 1, 1 }, { 4, 1, 0, 1, 0 }, /* 5 bit codewords */ { 5, 1, 0, 0, 1 }, { 5, 0, 1, 1, 0 }, { 5, 0, 0, 0, 1 }, { 5, 0, 1, 0, 1 }, { 5, 0, 0, 1, 0 }, { 5, 0, 1, 0, 0 }, /* 7 bit codewords */ /* first 5 bits: 11010 */ { 7, 2, 1, 1, 1 }, { 7, 1, 1, 2, 1 }, { 7, 1, 2, 1, 1 }, { 7, 1, 1, 1, 2 }, /* first 5 bits: 11011 */ { 7, 2, 1, 1, 0 }, { 7, 2, 1, 0, 1 }, { 7, 1, 2, 1, 0 }, { 7, 2, 0, 1, 1 }, /* 7/8 bit codewords */ /* first 5 bits: 11100 */ { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 }, { 8, 0, 1, 1, 2 }, { 8, 1, 1, 2, 0 }, { 8, 0, 2, 1, 1 }, { 8, 1, 0, 1, 2 }, { 8, 1, 2, 0, 1 }, { 8, 1, 1, 0, 2 }, /* 8 bit codewords */ { 8, 1, 0, 2, 1 }, { 8, 2, 1, 0, 0 }, { 8, 2, 0, 1, 0 }, { 8, 1, 2, 0, 0 }, { 8, 2, 0, 0, 1 }, { 8, 0, 1, 0, 2 }, { 8, 0, 2, 1, 0 }, { 8, 0, 0, 1, 2 }, /* 8/9 bit codewords */ { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 }, { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 }, { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 }, { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 }, { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 }, { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 }, { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 }, { 9, 0, 2, 0, 0 }, { 9, 0, 0, 2, 0 }, /* 9/10/11 bit codewords */ /* 9 bit codewords repeated 2^3 = 8 times */ { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, /* 10 bit codewords repeated 2^2 = 4 times */ { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, /* 11 bit codewords repeated 2^1 = 2 times */ { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 }, { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 }, { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 }, { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 }, { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 }, { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 }, { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 }, { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 }, { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 }, { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 }, { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 }, /* 12 bit codewords */ { 12, 2, 2, 0, 2 }, { 12, 2, 0, 2, 2 }, }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_5.h000066400000000000000000000146511357201522000220730ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_5.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_5 */ static hcb_bin_pair hcb5[] = { { /* 0 */ 0, { 1, 2 } }, { /* 1 */ 1, { 0, 0 } }, /* 0 */ { /* 2 */ 0, { 1, 2 } }, { /* 3 */ 0, { 2, 3 } }, { /* 4 */ 0, { 3, 4 } }, { /* 5 */ 0, { 4, 5 } }, { /* 6 */ 0, { 5, 6 } }, { /* 7 */ 0, { 6, 7 } }, { /* 8 */ 0, { 7, 8 } }, { /* 9 */ 1, { -1, 0 } }, /* 1000 */ { /* 10 */ 1, { 1, 0 } }, /* 1001 */ { /* 11 */ 1, { 0, 1 } }, /* 1010 */ { /* 12 */ 1, { 0, -1 } }, /* 1011 */ { /* 13 */ 0, { 4, 5 } }, { /* 14 */ 0, { 5, 6 } }, { /* 15 */ 0, { 6, 7 } }, { /* 16 */ 0, { 7, 8 } }, { /* 17 */ 1, { 1, -1 } }, { /* 18 */ 1, { -1, 1 } }, { /* 19 */ 1, { -1, -1 } }, { /* 20 */ 1, { 1, 1 } }, { /* 21 */ 0, { 4, 5 } }, { /* 22 */ 0, { 5, 6 } }, { /* 23 */ 0, { 6, 7 } }, { /* 24 */ 0, { 7, 8 } }, { /* 25 */ 0, { 8, 9 } }, { /* 26 */ 0, { 9, 10 } }, { /* 27 */ 0, { 10, 11 } }, { /* 28 */ 0, { 11, 12 } }, { /* 29 */ 0, { 12, 13 } }, { /* 30 */ 0, { 13, 14 } }, { /* 31 */ 0, { 14, 15 } }, { /* 32 */ 0, { 15, 16 } }, { /* 33 */ 1, { -2, 0 } }, { /* 34 */ 1, { 0, 2 } }, { /* 35 */ 1, { 2, 0 } }, { /* 36 */ 1, { 0, -2 } }, { /* 37 */ 0, { 12, 13 } }, { /* 38 */ 0, { 13, 14 } }, { /* 39 */ 0, { 14, 15 } }, { /* 40 */ 0, { 15, 16 } }, { /* 41 */ 0, { 16, 17 } }, { /* 42 */ 0, { 17, 18 } }, { /* 43 */ 0, { 18, 19 } }, { /* 44 */ 0, { 19, 20 } }, { /* 45 */ 0, { 20, 21 } }, { /* 46 */ 0, { 21, 22 } }, { /* 47 */ 0, { 22, 23 } }, { /* 48 */ 0, { 23, 24 } }, { /* 49 */ 1, { -2, -1 } }, { /* 50 */ 1, { 2, 1 } }, { /* 51 */ 1, { -1, -2 } }, { /* 52 */ 1, { 1, 2 } }, { /* 53 */ 1, { -2, 1 } }, { /* 54 */ 1, { 2, -1 } }, { /* 55 */ 1, { -1, 2 } }, { /* 56 */ 1, { 1, -2 } }, { /* 57 */ 1, { -3, 0 } }, { /* 58 */ 1, { 3, 0 } }, { /* 59 */ 1, { 0, -3 } }, { /* 60 */ 1, { 0, 3 } }, { /* 61 */ 0, { 12, 13 } }, { /* 62 */ 0, { 13, 14 } }, { /* 63 */ 0, { 14, 15 } }, { /* 64 */ 0, { 15, 16 } }, { /* 65 */ 0, { 16, 17 } }, { /* 66 */ 0, { 17, 18 } }, { /* 67 */ 0, { 18, 19 } }, { /* 68 */ 0, { 19, 20 } }, { /* 69 */ 0, { 20, 21 } }, { /* 70 */ 0, { 21, 22 } }, { /* 71 */ 0, { 22, 23 } }, { /* 72 */ 0, { 23, 24 } }, { /* 73 */ 1, { -3, -1 } }, { /* 74 */ 1, { 1, 3 } }, { /* 75 */ 1, { 3, 1 } }, { /* 76 */ 1, { -1, -3 } }, { /* 77 */ 1, { -3, 1 } }, { /* 78 */ 1, { 3, -1 } }, { /* 79 */ 1, { 1, -3 } }, { /* 80 */ 1, { -1, 3 } }, { /* 81 */ 1, { -2, 2 } }, { /* 82 */ 1, { 2, 2 } }, { /* 83 */ 1, { -2, -2 } }, { /* 84 */ 1, { 2, -2 } }, { /* 85 */ 0, { 12, 13 } }, { /* 86 */ 0, { 13, 14 } }, { /* 87 */ 0, { 14, 15 } }, { /* 88 */ 0, { 15, 16 } }, { /* 89 */ 0, { 16, 17 } }, { /* 90 */ 0, { 17, 18 } }, { /* 91 */ 0, { 18, 19 } }, { /* 92 */ 0, { 19, 20 } }, { /* 93 */ 0, { 20, 21 } }, { /* 94 */ 0, { 21, 22 } }, { /* 95 */ 0, { 22, 23 } }, { /* 96 */ 0, { 23, 24 } }, { /* 97 */ 1, { -3, -2 } }, { /* 98 */ 1, { 3, -2 } }, { /* 99 */ 1, { -2, 3 } }, { /* 00 */ 1, { 2, -3 } }, { /* 01 */ 1, { 3, 2 } }, { /* 02 */ 1, { 2, 3 } }, { /* 03 */ 1, { -3, 2 } }, { /* 04 */ 1, { -2, -3 } }, { /* 05 */ 1, { 0, -4 } }, { /* 06 */ 1, { -4, 0 } }, { /* 07 */ 1, { 4, 1 } }, { /* 08 */ 1, { 4, 0 } }, { /* 09 */ 0, { 12, 13 } }, { /* 10 */ 0, { 13, 14 } }, { /* 11 */ 0, { 14, 15 } }, { /* 12 */ 0, { 15, 16 } }, { /* 13 */ 0, { 16, 17 } }, { /* 14 */ 0, { 17, 18 } }, { /* 15 */ 0, { 18, 19 } }, { /* 16 */ 0, { 19, 20 } }, { /* 17 */ 0, { 20, 21 } }, { /* 18 */ 0, { 21, 22 } }, { /* 19 */ 0, { 22, 23 } }, { /* 20 */ 0, { 23, 24 } }, { /* 21 */ 1, { -4, -1 } }, { /* 22 */ 1, { 0, 4 } }, { /* 23 */ 1, { 4, -1 } }, { /* 24 */ 1, { -1, -4 } }, { /* 25 */ 1, { 1, 4 } }, { /* 26 */ 1, { -1, 4 } }, { /* 27 */ 1, { -4, 1 } }, { /* 28 */ 1, { 1, -4 } }, { /* 29 */ 1, { 3, -3 } }, { /* 30 */ 1, { -3, -3 } }, { /* 31 */ 1, { -3, 3 } }, { /* 32 */ 1, { -2, 4 } }, { /* 33 */ 1, { -4, -2 } }, { /* 34 */ 1, { 4, 2 } }, { /* 35 */ 1, { 2, -4 } }, { /* 36 */ 1, { 2, 4 } }, { /* 37 */ 1, { 3, 3 } }, { /* 38 */ 1, { -4, 2 } }, { /* 39 */ 0, { 6, 7 } }, { /* 40 */ 0, { 7, 8 } }, { /* 41 */ 0, { 8, 9 } }, { /* 42 */ 0, { 9, 10 } }, { /* 43 */ 0, { 10, 11 } }, { /* 44 */ 0, { 11, 12 } }, { /* 45 */ 1, { -2, -4 } }, { /* 46 */ 1, { 4, -2 } }, { /* 47 */ 1, { 3, -4 } }, { /* 48 */ 1, { -4, -3 } }, { /* 49 */ 1, { -4, 3 } }, { /* 50 */ 1, { 3, 4 } }, { /* 51 */ 1, { -3, 4 } }, { /* 52 */ 1, { 4, 3 } }, { /* 53 */ 1, { 4, -3 } }, { /* 54 */ 1, { -3, -4 } }, { /* 55 */ 0, { 2, 3 } }, { /* 56 */ 0, { 3, 4 } }, { /* 57 */ 1, { 4, -4 } }, { /* 58 */ 1, { -4, 4 } }, { /* 59 */ 1, { 4, 4 } }, { /* 60 */ 1, { -4, -4 } } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_6.h000066400000000000000000000116211357201522000220660ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_6.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_6 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb6_1[] = { /* 4 bit codewords */ { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* 00010 */ 1, 0 }, { /* */ 1, 0 }, { /* 00100 */ 2, 0 }, { /* */ 2, 0 }, { /* 00110 */ 3, 0 }, { /* */ 3, 0 }, { /* 01000 */ 4, 0 }, { /* */ 4, 0 }, { /* 01010 */ 5, 0 }, { /* */ 5, 0 }, { /* 01100 */ 6, 0 }, { /* */ 6, 0 }, { /* 01110 */ 7, 0 }, { /* */ 7, 0 }, { /* 10000 */ 8, 0 }, { /* */ 8, 0 }, /* 6 bit codewords */ { /* 10010 */ 9, 1 }, { /* 10011 */ 11, 1 }, { /* 10100 */ 13, 1 }, { /* 10101 */ 15, 1 }, { /* 10110 */ 17, 1 }, { /* 10111 */ 19, 1 }, { /* 11000 */ 21, 1 }, { /* 11001 */ 23, 1 }, /* 7 bit codewords */ { /* 11010 */ 25, 2 }, { /* 11011 */ 29, 2 }, { /* 11100 */ 33, 2 }, /* 7/8 bit codewords */ { /* 11101 */ 37, 3 }, /* 8/9 bit codewords */ { /* 11110 */ 45, 4 }, /* 9/10/11 bit codewords */ { /* 11111 */ 61, 6 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_pair hcb6_2[] = { /* 4 bit codewords */ { 4, 0, 0 }, { 4, 1, 0 }, { 4, 0, -1 }, { 4, 0, 1 }, { 4, -1, 0 }, { 4, 1, 1 }, { 4, -1, 1 }, { 4, 1, -1 }, { 4, -1, -1 }, /* 6 bit codewords */ { 6, 2, -1 }, { 6, 2, 1 }, { 6, -2, 1 }, { 6, -2, -1 }, { 6, -2, 0 }, { 6, -1, 2 }, { 6, 2, 0 }, { 6, 1, -2 }, { 6, 1, 2 }, { 6, 0, -2 }, { 6, -1, -2 }, { 6, 0, 2 }, { 6, 2, -2 }, { 6, -2, 2 }, { 6, -2, -2 }, { 6, 2, 2 }, /* 7 bit codewords */ { 7, -3, 1 }, { 7, 3, 1 }, { 7, 3, -1 }, { 7, -1, 3 }, { 7, -3, -1 }, { 7, 1, 3 }, { 7, 1, -3 }, { 7, -1, -3 }, { 7, 3, 0 }, { 7, -3, 0 }, { 7, 0, -3 }, { 7, 0, 3 }, /* 7/8 bit codewords */ { 7, 3, 2 }, { 7, 3, 2 }, { 8, -3, -2 }, { 8, -2, 3 }, { 8, 2, 3 }, { 8, 3, -2 }, { 8, 2, -3 }, { 8, -2, -3 }, /* 8 bit codewords */ { 8, -3, 2 }, { 8, -3, 2 }, { 8, 3, 3 }, { 8, 3, 3 }, { 9, 3, -3 }, { 9, -3, -3 }, { 9, -3, 3 }, { 9, 1, -4 }, { 9, -1, -4 }, { 9, 4, 1 }, { 9, -4, 1 }, { 9, -4, -1 }, { 9, 1, 4 }, { 9, 4, -1 }, { 9, -1, 4 }, { 9, 0, -4 }, /* 9/10/11 bit codewords */ { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 10, -3, -4 }, { 10, -3, -4 }, { 10, -3, 4 }, { 10, -3, 4 }, { 10, 3, -4 }, { 10, 3, -4 }, { 10, 4, -3 }, { 10, 4, -3 }, { 10, 3, 4 }, { 10, 3, 4 }, { 10, 4, 3 }, { 10, 4, 3 }, { 10, -4, 3 }, { 10, -4, 3 }, { 10, -4, -3 }, { 10, -4, -3 }, { 11, 4, 4 }, { 11, -4, 4 }, { 11, -4, -4 }, { 11, 4, -4 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_7.h000066400000000000000000000123241357201522000220700ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_7.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_7 */ static hcb_bin_pair hcb7[] = { { /* 0 */ 0, { 1, 2 } }, { /* 1 */ 1, { 0, 0 } }, { /* 2 */ 0, { 1, 2 } }, { /* 3 */ 0, { 2, 3 } }, { /* 4 */ 0, { 3, 4 } }, { /* 5 */ 1, { 1, 0 } }, { /* 6 */ 1, { 0, 1 } }, { /* 7 */ 0, { 2, 3 } }, { /* 8 */ 0, { 3, 4 } }, { /* 9 */ 1, { 1, 1 } }, { /* 10 */ 0, { 3, 4 } }, { /* 11 */ 0, { 4, 5 } }, { /* 12 */ 0, { 5, 6 } }, { /* 13 */ 0, { 6, 7 } }, { /* 14 */ 0, { 7, 8 } }, { /* 15 */ 0, { 8, 9 } }, { /* 16 */ 0, { 9, 10 } }, { /* 17 */ 0, { 10, 11 } }, { /* 18 */ 0, { 11, 12 } }, { /* 19 */ 1, { 2, 1 } }, { /* 20 */ 1, { 1, 2 } }, { /* 21 */ 1, { 2, 0 } }, { /* 22 */ 1, { 0, 2 } }, { /* 23 */ 0, { 8, 9 } }, { /* 24 */ 0, { 9, 10 } }, { /* 25 */ 0, { 10, 11 } }, { /* 26 */ 0, { 11, 12 } }, { /* 27 */ 0, { 12, 13 } }, { /* 28 */ 0, { 13, 14 } }, { /* 29 */ 0, { 14, 15 } }, { /* 30 */ 0, { 15, 16 } }, { /* 31 */ 1, { 3, 1 } }, { /* 32 */ 1, { 1, 3 } }, { /* 33 */ 1, { 2, 2 } }, { /* 34 */ 1, { 3, 0 } }, { /* 35 */ 1, { 0, 3 } }, { /* 36 */ 0, { 11, 12 } }, { /* 37 */ 0, { 12, 13 } }, { /* 38 */ 0, { 13, 14 } }, { /* 39 */ 0, { 14, 15 } }, { /* 40 */ 0, { 15, 16 } }, { /* 41 */ 0, { 16, 17 } }, { /* 42 */ 0, { 17, 18 } }, { /* 43 */ 0, { 18, 19 } }, { /* 44 */ 0, { 19, 20 } }, { /* 45 */ 0, { 20, 21 } }, { /* 46 */ 0, { 21, 22 } }, { /* 47 */ 1, { 2, 3 } }, { /* 48 */ 1, { 3, 2 } }, { /* 49 */ 1, { 1, 4 } }, { /* 50 */ 1, { 4, 1 } }, { /* 51 */ 1, { 1, 5 } }, { /* 52 */ 1, { 5, 1 } }, { /* 53 */ 1, { 3, 3 } }, { /* 54 */ 1, { 2, 4 } }, { /* 55 */ 1, { 0, 4 } }, { /* 56 */ 1, { 4, 0 } }, { /* 57 */ 0, { 12, 13 } }, { /* 58 */ 0, { 13, 14 } }, { /* 59 */ 0, { 14, 15 } }, { /* 60 */ 0, { 15, 16 } }, { /* 61 */ 0, { 16, 17 } }, { /* 62 */ 0, { 17, 18 } }, { /* 63 */ 0, { 18, 19 } }, { /* 64 */ 0, { 19, 20 } }, { /* 65 */ 0, { 20, 21 } }, { /* 66 */ 0, { 21, 22 } }, { /* 67 */ 0, { 22, 23 } }, { /* 68 */ 0, { 23, 24 } }, { /* 69 */ 1, { 4, 2 } }, { /* 70 */ 1, { 2, 5 } }, { /* 71 */ 1, { 5, 2 } }, { /* 72 */ 1, { 0, 5 } }, { /* 73 */ 1, { 6, 1 } }, { /* 74 */ 1, { 5, 0 } }, { /* 75 */ 1, { 1, 6 } }, { /* 76 */ 1, { 4, 3 } }, { /* 77 */ 1, { 3, 5 } }, { /* 78 */ 1, { 3, 4 } }, { /* 79 */ 1, { 5, 3 } }, { /* 80 */ 1, { 2, 6 } }, { /* 81 */ 1, { 6, 2 } }, { /* 82 */ 1, { 1, 7 } }, { /* 83 */ 0, { 10, 11 } }, { /* 84 */ 0, { 11, 12 } }, { /* 85 */ 0, { 12, 13 } }, { /* 86 */ 0, { 13, 14 } }, { /* 87 */ 0, { 14, 15 } }, { /* 88 */ 0, { 15, 16 } }, { /* 89 */ 0, { 16, 17 } }, { /* 90 */ 0, { 17, 18 } }, { /* 91 */ 0, { 18, 19 } }, { /* 92 */ 0, { 19, 20 } }, { /* 93 */ 1, { 3, 6 } }, { /* 94 */ 1, { 0, 6 } }, { /* 95 */ 1, { 6, 0 } }, { /* 96 */ 1, { 4, 4 } }, { /* 97 */ 1, { 7, 1 } }, { /* 98 */ 1, { 4, 5 } }, { /* 99 */ 1, { 7, 2 } }, { /* 00 */ 1, { 5, 4 } }, { /* 01 */ 1, { 6, 3 } }, { /* 02 */ 1, { 2, 7 } }, { /* 03 */ 1, { 7, 3 } }, { /* 04 */ 1, { 6, 4 } }, { /* 05 */ 1, { 5, 5 } }, { /* 06 */ 1, { 4, 6 } }, { /* 07 */ 1, { 3, 7 } }, { /* 08 */ 0, { 5, 6 } }, { /* 09 */ 0, { 6, 7 } }, { /* 10 */ 0, { 7, 8 } }, { /* 11 */ 0, { 8, 9 } }, { /* 12 */ 0, { 9, 10 } }, { /* 13 */ 1, { 7, 0 } }, { /* 14 */ 1, { 0, 7 } }, { /* 15 */ 1, { 6, 5 } }, { /* 16 */ 1, { 5, 6 } }, { /* 17 */ 1, { 7, 4 } }, { /* 18 */ 1, { 4, 7 } }, { /* 19 */ 1, { 5, 7 } }, { /* 20 */ 1, { 7, 5 } }, { /* 21 */ 0, { 2, 3 } }, { /* 22 */ 0, { 3, 4 } }, { /* 23 */ 1, { 7, 6 } }, { /* 24 */ 1, { 6, 6 } }, { /* 25 */ 1, { 6, 7 } }, { /* 26 */ 1, { 7, 7 } } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_8.h000066400000000000000000000104561357201522000220750ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_8.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* 2-step huffman table HCB_8 */ /* 1st step: 5 bits * 2^5 = 32 entries * * Used to find offset into 2nd step table and number of extra bits to get */ static hcb hcb8_1[] = { /* 3 bit codeword */ { /* 00000 */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, { /* */ 0, 0 }, /* 4 bit codewords */ { /* 00100 */ 1, 0 }, { /* */ 1, 0 }, { /* 00110 */ 2, 0 }, { /* */ 2, 0 }, { /* 01000 */ 3, 0 }, { /* */ 3, 0 }, { /* 01010 */ 4, 0 }, { /* */ 4, 0 }, { /* 01100 */ 5, 0 }, { /* */ 5, 0 }, /* 5 bit codewords */ { /* 01110 */ 6, 0 }, { /* 01111 */ 7, 0 }, { /* 10000 */ 8, 0 }, { /* 10001 */ 9, 0 }, { /* 10010 */ 10, 0 }, { /* 10011 */ 11, 0 }, { /* 10100 */ 12, 0 }, /* 6 bit codewords */ { /* 10101 */ 13, 1 }, { /* 10110 */ 15, 1 }, { /* 10111 */ 17, 1 }, { /* 11000 */ 19, 1 }, { /* 11001 */ 21, 1 }, /* 7 bit codewords */ { /* 11010 */ 23, 2 }, { /* 11011 */ 27, 2 }, { /* 11100 */ 31, 2 }, /* 7/8 bit codewords */ { /* 11101 */ 35, 3 }, /* 8 bit codewords */ { /* 11110 */ 43, 3 }, /* 8/9/10 bit codewords */ { /* 11111 */ 51, 5 } }; /* 2nd step table * * Gives size of codeword and actual data (x,y,v,w) */ static hcb_2_pair hcb8_2[] = { /* 3 bit codeword */ { 3, 1, 1 }, /* 4 bit codewords */ { 4, 2, 1 }, { 4, 1, 0 }, { 4, 1, 2 }, { 4, 0, 1 }, { 4, 2, 2 }, /* 5 bit codewords */ { 5, 0, 0 }, { 5, 2, 0 }, { 5, 0, 2 }, { 5, 3, 1 }, { 5, 1, 3 }, { 5, 3, 2 }, { 5, 2, 3 }, /* 6 bit codewords */ { 6, 3, 3 }, { 6, 4, 1 }, { 6, 1, 4 }, { 6, 4, 2 }, { 6, 2, 4 }, { 6, 3, 0 }, { 6, 0, 3 }, { 6, 4, 3 }, { 6, 3, 4 }, { 6, 5, 2 }, /* 7 bit codewords */ { 7, 5, 1 }, { 7, 2, 5 }, { 7, 1, 5 }, { 7, 5, 3 }, { 7, 3, 5 }, { 7, 4, 4 }, { 7, 5, 4 }, { 7, 0, 4 }, { 7, 4, 5 }, { 7, 4, 0 }, { 7, 2, 6 }, { 7, 6, 2 }, /* 7/8 bit codewords */ { 7, 6, 1 }, { 7, 6, 1 }, { 7, 1, 6 }, { 7, 1, 6 }, { 8, 3, 6 }, { 8, 6, 3 }, { 8, 5, 5 }, { 8, 5, 0 }, /* 8 bit codewords */ { 8, 6, 4 }, { 8, 0, 5 }, { 8, 4, 6 }, { 8, 7, 1 }, { 8, 7, 2 }, { 8, 2, 7 }, { 8, 6, 5 }, { 8, 7, 3 }, /* 8/9/10 bit codewords */ { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 9, 6, 6 }, { 9, 6, 6 }, { 9, 7, 4 }, { 9, 7, 4 }, { 9, 6, 0 }, { 9, 6, 0 }, { 9, 4, 7 }, { 9, 4, 7 }, { 9, 0, 6 }, { 9, 0, 6 }, { 9, 7, 5 }, { 9, 7, 5 }, { 9, 7, 6 }, { 9, 7, 6 }, { 9, 6, 7 }, { 9, 6, 7 }, { 10, 5, 7 }, { 10, 7, 0 }, { 10, 0, 7 }, { 10, 7, 7 } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_9.h000066400000000000000000000274521357201522000221020ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_9.h,v 1.5 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_9 */ static hcb_bin_pair hcb9[] = { { /* 0 */ 0, { 1, 2 } }, { /* 1 */ 1, { 0, 0 } }, { /* 2 */ 0, { 1, 2 } }, { /* 3 */ 0, { 2, 3 } }, { /* 4 */ 0, { 3, 4 } }, { /* 5 */ 1, { 1, 0 } }, { /* 6 */ 1, { 0, 1 } }, { /* 7 */ 0, { 2, 3 } }, { /* 8 */ 0, { 3, 4 } }, { /* 9 */ 1, { 1, 1 } }, { /* 10 */ 0, { 3, 4 } }, { /* 11 */ 0, { 4, 5 } }, { /* 12 */ 0, { 5, 6 } }, { /* 13 */ 0, { 6, 7 } }, { /* 14 */ 0, { 7, 8 } }, { /* 15 */ 0, { 8, 9 } }, { /* 16 */ 0, { 9, 10 } }, { /* 17 */ 0, { 10, 11 } }, { /* 18 */ 0, { 11, 12 } }, { /* 19 */ 1, { 2, 1 } }, { /* 20 */ 1, { 1, 2 } }, { /* 21 */ 1, { 2, 0 } }, { /* 22 */ 1, { 0, 2 } }, { /* 23 */ 0, { 8, 9 } }, { /* 24 */ 0, { 9, 10 } }, { /* 25 */ 0, { 10, 11 } }, { /* 26 */ 0, { 11, 12 } }, { /* 27 */ 0, { 12, 13 } }, { /* 28 */ 0, { 13, 14 } }, { /* 29 */ 0, { 14, 15 } }, { /* 30 */ 0, { 15, 16 } }, { /* 31 */ 1, { 3, 1 } }, { /* 32 */ 1, { 2, 2 } }, { /* 33 */ 1, { 1, 3 } }, { /* 34 */ 0, { 13, 14 } }, { /* 35 */ 0, { 14, 15 } }, { /* 36 */ 0, { 15, 16 } }, { /* 37 */ 0, { 16, 17 } }, { /* 38 */ 0, { 17, 18 } }, { /* 39 */ 0, { 18, 19 } }, { /* 40 */ 0, { 19, 20 } }, { /* 41 */ 0, { 20, 21 } }, { /* 42 */ 0, { 21, 22 } }, { /* 43 */ 0, { 22, 23 } }, { /* 44 */ 0, { 23, 24 } }, { /* 45 */ 0, { 24, 25 } }, { /* 46 */ 0, { 25, 26 } }, { /* 47 */ 1, { 3, 0 } }, { /* 48 */ 1, { 0, 3 } }, { /* 49 */ 1, { 2, 3 } }, { /* 50 */ 1, { 3, 2 } }, { /* 51 */ 1, { 1, 4 } }, { /* 52 */ 1, { 4, 1 } }, { /* 53 */ 1, { 2, 4 } }, { /* 54 */ 1, { 1, 5 } }, { /* 55 */ 0, { 18, 19 } }, { /* 56 */ 0, { 19, 20 } }, { /* 57 */ 0, { 20, 21 } }, { /* 58 */ 0, { 21, 22 } }, { /* 59 */ 0, { 22, 23 } }, { /* 60 */ 0, { 23, 24 } }, { /* 61 */ 0, { 24, 25 } }, { /* 62 */ 0, { 25, 26 } }, { /* 63 */ 0, { 26, 27 } }, { /* 64 */ 0, { 27, 28 } }, { /* 65 */ 0, { 28, 29 } }, { /* 66 */ 0, { 29, 30 } }, { /* 67 */ 0, { 30, 31 } }, { /* 68 */ 0, { 31, 32 } }, { /* 69 */ 0, { 32, 33 } }, { /* 70 */ 0, { 33, 34 } }, { /* 71 */ 0, { 34, 35 } }, { /* 72 */ 0, { 35, 36 } }, { /* 73 */ 1, { 4, 2 } }, { /* 74 */ 1, { 3, 3 } }, { /* 75 */ 1, { 0, 4 } }, { /* 76 */ 1, { 4, 0 } }, { /* 77 */ 1, { 5, 1 } }, { /* 78 */ 1, { 2, 5 } }, { /* 79 */ 1, { 1, 6 } }, { /* 80 */ 1, { 3, 4 } }, { /* 81 */ 1, { 5, 2 } }, { /* 82 */ 1, { 6, 1 } }, { /* 83 */ 1, { 4, 3 } }, { /* 84 */ 0, { 25, 26 } }, { /* 85 */ 0, { 26, 27 } }, { /* 86 */ 0, { 27, 28 } }, { /* 87 */ 0, { 28, 29 } }, { /* 88 */ 0, { 29, 30 } }, { /* 89 */ 0, { 30, 31 } }, { /* 90 */ 0, { 31, 32 } }, { /* 91 */ 0, { 32, 33 } }, { /* 92 */ 0, { 33, 34 } }, { /* 93 */ 0, { 34, 35 } }, { /* 94 */ 0, { 35, 36 } }, { /* 95 */ 0, { 36, 37 } }, { /* 96 */ 0, { 37, 38 } }, { /* 97 */ 0, { 38, 39 } }, { /* 98 */ 0, { 39, 40 } }, { /* 99 */ 0, { 40, 41 } }, { /* 00 */ 0, { 41, 42 } }, { /* 01 */ 0, { 42, 43 } }, { /* 02 */ 0, { 43, 44 } }, { /* 03 */ 0, { 44, 45 } }, { /* 04 */ 0, { 45, 46 } }, { /* 05 */ 0, { 46, 47 } }, { /* 06 */ 0, { 47, 48 } }, { /* 07 */ 0, { 48, 49 } }, { /* 08 */ 0, { 49, 50 } }, { /* 09 */ 1, { 0, 5 } }, { /* 10 */ 1, { 2, 6 } }, { /* 11 */ 1, { 5, 0 } }, { /* 12 */ 1, { 1, 7 } }, { /* 13 */ 1, { 3, 5 } }, { /* 14 */ 1, { 1, 8 } }, { /* 15 */ 1, { 8, 1 } }, { /* 16 */ 1, { 4, 4 } }, { /* 17 */ 1, { 5, 3 } }, { /* 18 */ 1, { 6, 2 } }, { /* 19 */ 1, { 7, 1 } }, { /* 20 */ 1, { 0, 6 } }, { /* 21 */ 1, { 8, 2 } }, { /* 22 */ 1, { 2, 8 } }, { /* 23 */ 1, { 3, 6 } }, { /* 24 */ 1, { 2, 7 } }, { /* 25 */ 1, { 4, 5 } }, { /* 26 */ 1, { 9, 1 } }, { /* 27 */ 1, { 1, 9 } }, { /* 28 */ 1, { 7, 2 } }, { /* 29 */ 0, { 30, 31 } }, { /* 30 */ 0, { 31, 32 } }, { /* 31 */ 0, { 32, 33 } }, { /* 32 */ 0, { 33, 34 } }, { /* 33 */ 0, { 34, 35 } }, { /* 34 */ 0, { 35, 36 } }, { /* 35 */ 0, { 36, 37 } }, { /* 36 */ 0, { 37, 38 } }, { /* 37 */ 0, { 38, 39 } }, { /* 38 */ 0, { 39, 40 } }, { /* 39 */ 0, { 40, 41 } }, { /* 40 */ 0, { 41, 42 } }, { /* 41 */ 0, { 42, 43 } }, { /* 42 */ 0, { 43, 44 } }, { /* 43 */ 0, { 44, 45 } }, { /* 44 */ 0, { 45, 46 } }, { /* 45 */ 0, { 46, 47 } }, { /* 46 */ 0, { 47, 48 } }, { /* 47 */ 0, { 48, 49 } }, { /* 48 */ 0, { 49, 50 } }, { /* 49 */ 0, { 50, 51 } }, { /* 50 */ 0, { 51, 52 } }, { /* 51 */ 0, { 52, 53 } }, { /* 52 */ 0, { 53, 54 } }, { /* 53 */ 0, { 54, 55 } }, { /* 54 */ 0, { 55, 56 } }, { /* 55 */ 0, { 56, 57 } }, { /* 56 */ 0, { 57, 58 } }, { /* 57 */ 0, { 58, 59 } }, { /* 58 */ 0, { 59, 60 } }, { /* 59 */ 1, { 6, 0 } }, { /* 60 */ 1, { 5, 4 } }, { /* 61 */ 1, { 6, 3 } }, { /* 62 */ 1, { 8, 3 } }, { /* 63 */ 1, { 0, 7 } }, { /* 64 */ 1, { 9, 2 } }, { /* 65 */ 1, { 3, 8 } }, { /* 66 */ 1, { 4, 6 } }, { /* 67 */ 1, { 3, 7 } }, { /* 68 */ 1, { 0, 8 } }, { /* 69 */ 1, { 10, 1 } }, { /* 70 */ 1, { 6, 4 } }, { /* 71 */ 1, { 2, 9 } }, { /* 72 */ 1, { 5, 5 } }, { /* 73 */ 1, { 8, 0 } }, { /* 74 */ 1, { 7, 0 } }, { /* 75 */ 1, { 7, 3 } }, { /* 76 */ 1, { 10, 2 } }, { /* 77 */ 1, { 9, 3 } }, { /* 78 */ 1, { 8, 4 } }, { /* 79 */ 1, { 1, 10 } }, { /* 80 */ 1, { 7, 4 } }, { /* 81 */ 1, { 6, 5 } }, { /* 82 */ 1, { 5, 6 } }, { /* 83 */ 1, { 4, 8 } }, { /* 84 */ 1, { 4, 7 } }, { /* 85 */ 1, { 3, 9 } }, { /* 86 */ 1, { 11, 1 } }, { /* 87 */ 1, { 5, 8 } }, { /* 88 */ 1, { 9, 0 } }, { /* 89 */ 1, { 8, 5 } }, { /* 90 */ 0, { 29, 30 } }, { /* 91 */ 0, { 30, 31 } }, { /* 92 */ 0, { 31, 32 } }, { /* 93 */ 0, { 32, 33 } }, { /* 94 */ 0, { 33, 34 } }, { /* 95 */ 0, { 34, 35 } }, { /* 96 */ 0, { 35, 36 } }, { /* 97 */ 0, { 36, 37 } }, { /* 98 */ 0, { 37, 38 } }, { /* 99 */ 0, { 38, 39 } }, { /* 00 */ 0, { 39, 40 } }, { /* 01 */ 0, { 40, 41 } }, { /* 02 */ 0, { 41, 42 } }, { /* 03 */ 0, { 42, 43 } }, { /* 04 */ 0, { 43, 44 } }, { /* 05 */ 0, { 44, 45 } }, { /* 06 */ 0, { 45, 46 } }, { /* 07 */ 0, { 46, 47 } }, { /* 08 */ 0, { 47, 48 } }, { /* 09 */ 0, { 48, 49 } }, { /* 10 */ 0, { 49, 50 } }, { /* 11 */ 0, { 50, 51 } }, { /* 12 */ 0, { 51, 52 } }, { /* 13 */ 0, { 52, 53 } }, { /* 14 */ 0, { 53, 54 } }, { /* 15 */ 0, { 54, 55 } }, { /* 16 */ 0, { 55, 56 } }, { /* 17 */ 0, { 56, 57 } }, { /* 18 */ 0, { 57, 58 } }, { /* 19 */ 1, { 10, 3 } }, { /* 20 */ 1, { 2, 10 } }, { /* 21 */ 1, { 0, 9 } }, { /* 22 */ 1, { 11, 2 } }, { /* 23 */ 1, { 9, 4 } }, { /* 24 */ 1, { 6, 6 } }, { /* 25 */ 1, { 12, 1 } }, { /* 26 */ 1, { 4, 9 } }, { /* 27 */ 1, { 8, 6 } }, { /* 28 */ 1, { 1, 11 } }, { /* 29 */ 1, { 9, 5 } }, { /* 30 */ 1, { 10, 4 } }, { /* 31 */ 1, { 5, 7 } }, { /* 32 */ 1, { 7, 5 } }, { /* 33 */ 1, { 2, 11 } }, { /* 34 */ 1, { 1, 12 } }, { /* 35 */ 1, { 12, 2 } }, { /* 36 */ 1, { 11, 3 } }, { /* 37 */ 1, { 3, 10 } }, { /* 38 */ 1, { 5, 9 } }, { /* 39 */ 1, { 6, 7 } }, { /* 40 */ 1, { 8, 7 } }, { /* 41 */ 1, { 11, 4 } }, { /* 42 */ 1, { 0, 10 } }, { /* 43 */ 1, { 7, 6 } }, { /* 44 */ 1, { 12, 3 } }, { /* 45 */ 1, { 10, 0 } }, { /* 46 */ 1, { 10, 5 } }, { /* 47 */ 1, { 4, 10 } }, { /* 48 */ 1, { 6, 8 } }, { /* 49 */ 1, { 2, 12 } }, { /* 50 */ 1, { 9, 6 } }, { /* 51 */ 1, { 9, 7 } }, { /* 52 */ 1, { 4, 11 } }, { /* 53 */ 1, { 11, 0 } }, { /* 54 */ 1, { 6, 9 } }, { /* 55 */ 1, { 3, 11 } }, { /* 56 */ 1, { 5, 10 } }, { /* 57 */ 0, { 20, 21 } }, { /* 58 */ 0, { 21, 22 } }, { /* 59 */ 0, { 22, 23 } }, { /* 60 */ 0, { 23, 24 } }, { /* 61 */ 0, { 24, 25 } }, { /* 62 */ 0, { 25, 26 } }, { /* 63 */ 0, { 26, 27 } }, { /* 64 */ 0, { 27, 28 } }, { /* 65 */ 0, { 28, 29 } }, { /* 66 */ 0, { 29, 30 } }, { /* 67 */ 0, { 30, 31 } }, { /* 68 */ 0, { 31, 32 } }, { /* 69 */ 0, { 32, 33 } }, { /* 70 */ 0, { 33, 34 } }, { /* 71 */ 0, { 34, 35 } }, { /* 72 */ 0, { 35, 36 } }, { /* 73 */ 0, { 36, 37 } }, { /* 74 */ 0, { 37, 38 } }, { /* 75 */ 0, { 38, 39 } }, { /* 76 */ 0, { 39, 40 } }, { /* 77 */ 1, { 8, 8 } }, { /* 78 */ 1, { 7, 8 } }, { /* 79 */ 1, { 12, 5 } }, { /* 80 */ 1, { 3, 12 } }, { /* 81 */ 1, { 11, 5 } }, { /* 82 */ 1, { 7, 7 } }, { /* 83 */ 1, { 12, 4 } }, { /* 84 */ 1, { 11, 6 } }, { /* 85 */ 1, { 10, 6 } }, { /* 86 */ 1, { 4, 12 } }, { /* 87 */ 1, { 7, 9 } }, { /* 88 */ 1, { 5, 11 } }, { /* 89 */ 1, { 0, 11 } }, { /* 90 */ 1, { 12, 6 } }, { /* 91 */ 1, { 6, 10 } }, { /* 92 */ 1, { 12, 0 } }, { /* 93 */ 1, { 10, 7 } }, { /* 94 */ 1, { 5, 12 } }, { /* 95 */ 1, { 7, 10 } }, { /* 96 */ 1, { 9, 8 } }, { /* 97 */ 1, { 0, 12 } }, { /* 98 */ 1, { 11, 7 } }, { /* 99 */ 1, { 8, 9 } }, { /* 00 */ 1, { 9, 9 } }, { /* 01 */ 1, { 10, 8 } }, { /* 02 */ 1, { 7, 11 } }, { /* 03 */ 1, { 12, 7 } }, { /* 04 */ 1, { 6, 11 } }, { /* 05 */ 1, { 8, 11 } }, { /* 06 */ 1, { 11, 8 } }, { /* 07 */ 1, { 7, 12 } }, { /* 08 */ 1, { 6, 12 } }, { /* 09 */ 0, { 8, 9 } }, { /* 10 */ 0, { 9, 10 } }, { /* 11 */ 0, { 10, 11 } }, { /* 12 */ 0, { 11, 12 } }, { /* 13 */ 0, { 12, 13 } }, { /* 14 */ 0, { 13, 14 } }, { /* 15 */ 0, { 14, 15 } }, { /* 16 */ 0, { 15, 16 } }, { /* 17 */ 1, { 8, 10 } }, { /* 18 */ 1, { 10, 9 } }, { /* 19 */ 1, { 8, 12 } }, { /* 20 */ 1, { 9, 10 } }, { /* 21 */ 1, { 9, 11 } }, { /* 22 */ 1, { 9, 12 } }, { /* 23 */ 1, { 10, 11 } }, { /* 24 */ 1, { 12, 9 } }, { /* 25 */ 1, { 10, 10 } }, { /* 26 */ 1, { 11, 9 } }, { /* 27 */ 1, { 12, 8 } }, { /* 28 */ 1, { 11, 10 } }, { /* 29 */ 1, { 12, 10 } }, { /* 30 */ 1, { 12, 11 } }, { /* 31 */ 0, { 2, 3 } }, { /* 32 */ 0, { 3, 4 } }, { /* 33 */ 1, { 10, 12 } }, { /* 34 */ 1, { 11, 11 } }, { /* 35 */ 1, { 11, 12 } }, { /* 36 */ 1, { 12, 12 } } }; welle.io-2.1/src/libs/faad2/libfaad/codebook/hcb_sf.h000066400000000000000000000164571357201522000223450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcb_sf.h,v 1.7 2007/11/01 12:34:11 menno Exp $ **/ /* Binary search huffman table HCB_SF */ static uint8_t hcb_sf[][2] = { { /* 0 */ 1, 2 }, { /* 1 */ 60, 0 }, { /* 2 */ 1, 2 }, { /* 3 */ 2, 3 }, { /* 4 */ 3, 4 }, { /* 5 */ 59, 0 }, { /* 6 */ 3, 4 }, { /* 7 */ 4, 5 }, { /* 8 */ 5, 6 }, { /* 9 */ 61, 0 }, { /* 10 */ 58, 0 }, { /* 11 */ 62, 0 }, { /* 12 */ 3, 4 }, { /* 13 */ 4, 5 }, { /* 14 */ 5, 6 }, { /* 15 */ 57, 0 }, { /* 16 */ 63, 0 }, { /* 17 */ 4, 5 }, { /* 18 */ 5, 6 }, { /* 19 */ 6, 7 }, { /* 20 */ 7, 8 }, { /* 21 */ 56, 0 }, { /* 22 */ 64, 0 }, { /* 23 */ 55, 0 }, { /* 24 */ 65, 0 }, { /* 25 */ 4, 5 }, { /* 26 */ 5, 6 }, { /* 27 */ 6, 7 }, { /* 28 */ 7, 8 }, { /* 29 */ 66, 0 }, { /* 30 */ 54, 0 }, { /* 31 */ 67, 0 }, { /* 32 */ 5, 6 }, { /* 33 */ 6, 7 }, { /* 34 */ 7, 8 }, { /* 35 */ 8, 9 }, { /* 36 */ 9, 10 }, { /* 37 */ 53, 0 }, { /* 38 */ 68, 0 }, { /* 39 */ 52, 0 }, { /* 40 */ 69, 0 }, { /* 41 */ 51, 0 }, { /* 42 */ 5, 6 }, { /* 43 */ 6, 7 }, { /* 44 */ 7, 8 }, { /* 45 */ 8, 9 }, { /* 46 */ 9, 10 }, { /* 47 */ 70, 0 }, { /* 48 */ 50, 0 }, { /* 49 */ 49, 0 }, { /* 50 */ 71, 0 }, { /* 51 */ 6, 7 }, { /* 52 */ 7, 8 }, { /* 53 */ 8, 9 }, { /* 54 */ 9, 10 }, { /* 55 */ 10, 11 }, { /* 56 */ 11, 12 }, { /* 57 */ 72, 0 }, { /* 58 */ 48, 0 }, { /* 59 */ 73, 0 }, { /* 60 */ 47, 0 }, { /* 61 */ 74, 0 }, { /* 62 */ 46, 0 }, { /* 63 */ 6, 7 }, { /* 64 */ 7, 8 }, { /* 65 */ 8, 9 }, { /* 66 */ 9, 10 }, { /* 67 */ 10, 11 }, { /* 68 */ 11, 12 }, { /* 69 */ 76, 0 }, { /* 70 */ 75, 0 }, { /* 71 */ 77, 0 }, { /* 72 */ 78, 0 }, { /* 73 */ 45, 0 }, { /* 74 */ 43, 0 }, { /* 75 */ 6, 7 }, { /* 76 */ 7, 8 }, { /* 77 */ 8, 9 }, { /* 78 */ 9, 10 }, { /* 79 */ 10, 11 }, { /* 80 */ 11, 12 }, { /* 81 */ 44, 0 }, { /* 82 */ 79, 0 }, { /* 83 */ 42, 0 }, { /* 84 */ 41, 0 }, { /* 85 */ 80, 0 }, { /* 86 */ 40, 0 }, { /* 87 */ 6, 7 }, { /* 88 */ 7, 8 }, { /* 89 */ 8, 9 }, { /* 90 */ 9, 10 }, { /* 91 */ 10, 11 }, { /* 92 */ 11, 12 }, { /* 93 */ 81, 0 }, { /* 94 */ 39, 0 }, { /* 95 */ 82, 0 }, { /* 96 */ 38, 0 }, { /* 97 */ 83, 0 }, { /* 98 */ 7, 8 }, { /* 99 */ 8, 9 }, { /* 00 */ 9, 10 }, { /* 01 */ 10, 11 }, { /* 02 */ 11, 12 }, { /* 03 */ 12, 13 }, { /* 04 */ 13, 14 }, { /* 05 */ 37, 0 }, { /* 06 */ 35, 0 }, { /* 07 */ 85, 0 }, { /* 08 */ 33, 0 }, { /* 09 */ 36, 0 }, { /* 10 */ 34, 0 }, { /* 11 */ 84, 0 }, { /* 12 */ 32, 0 }, { /* 13 */ 6, 7 }, { /* 14 */ 7, 8 }, { /* 15 */ 8, 9 }, { /* 16 */ 9, 10 }, { /* 17 */ 10, 11 }, { /* 18 */ 11, 12 }, { /* 19 */ 87, 0 }, { /* 20 */ 89, 0 }, { /* 21 */ 30, 0 }, { /* 22 */ 31, 0 }, { /* 23 */ 8, 9 }, { /* 24 */ 9, 10 }, { /* 25 */ 10, 11 }, { /* 26 */ 11, 12 }, { /* 27 */ 12, 13 }, { /* 28 */ 13, 14 }, { /* 29 */ 14, 15 }, { /* 30 */ 15, 16 }, { /* 31 */ 86, 0 }, { /* 32 */ 29, 0 }, { /* 33 */ 26, 0 }, { /* 34 */ 27, 0 }, { /* 35 */ 28, 0 }, { /* 36 */ 24, 0 }, { /* 37 */ 88, 0 }, { /* 38 */ 9, 10 }, { /* 39 */ 10, 11 }, { /* 40 */ 11, 12 }, { /* 41 */ 12, 13 }, { /* 42 */ 13, 14 }, { /* 43 */ 14, 15 }, { /* 44 */ 15, 16 }, { /* 45 */ 16, 17 }, { /* 46 */ 17, 18 }, { /* 47 */ 25, 0 }, { /* 48 */ 22, 0 }, { /* 49 */ 23, 0 }, { /* 50 */ 15, 16 }, { /* 51 */ 16, 17 }, { /* 52 */ 17, 18 }, { /* 53 */ 18, 19 }, { /* 54 */ 19, 20 }, { /* 55 */ 20, 21 }, { /* 56 */ 21, 22 }, { /* 57 */ 22, 23 }, { /* 58 */ 23, 24 }, { /* 59 */ 24, 25 }, { /* 60 */ 25, 26 }, { /* 61 */ 26, 27 }, { /* 62 */ 27, 28 }, { /* 63 */ 28, 29 }, { /* 64 */ 29, 30 }, { /* 65 */ 90, 0 }, { /* 66 */ 21, 0 }, { /* 67 */ 19, 0 }, { /* 68 */ 3, 0 }, { /* 69 */ 1, 0 }, { /* 70 */ 2, 0 }, { /* 71 */ 0, 0 }, { /* 72 */ 23, 24 }, { /* 73 */ 24, 25 }, { /* 74 */ 25, 26 }, { /* 75 */ 26, 27 }, { /* 76 */ 27, 28 }, { /* 77 */ 28, 29 }, { /* 78 */ 29, 30 }, { /* 79 */ 30, 31 }, { /* 80 */ 31, 32 }, { /* 81 */ 32, 33 }, { /* 82 */ 33, 34 }, { /* 83 */ 34, 35 }, { /* 84 */ 35, 36 }, { /* 85 */ 36, 37 }, { /* 86 */ 37, 38 }, { /* 87 */ 38, 39 }, { /* 88 */ 39, 40 }, { /* 89 */ 40, 41 }, { /* 90 */ 41, 42 }, { /* 91 */ 42, 43 }, { /* 92 */ 43, 44 }, { /* 93 */ 44, 45 }, { /* 94 */ 45, 46 }, { /* 95 */ 98, 0 }, { /* 96 */ 99, 0 }, { /* 97 */ 100, 0 }, { /* 98 */ 101, 0 }, { /* 99 */ 102, 0 }, { /* 00 */ 117, 0 }, { /* 01 */ 97, 0 }, { /* 02 */ 91, 0 }, { /* 03 */ 92, 0 }, { /* 04 */ 93, 0 }, { /* 05 */ 94, 0 }, { /* 06 */ 95, 0 }, { /* 07 */ 96, 0 }, { /* 08 */ 104, 0 }, { /* 09 */ 111, 0 }, { /* 10 */ 112, 0 }, { /* 11 */ 113, 0 }, { /* 12 */ 114, 0 }, { /* 13 */ 115, 0 }, { /* 14 */ 116, 0 }, { /* 15 */ 110, 0 }, { /* 16 */ 105, 0 }, { /* 17 */ 106, 0 }, { /* 18 */ 107, 0 }, { /* 19 */ 108, 0 }, { /* 20 */ 109, 0 }, { /* 21 */ 118, 0 }, { /* 22 */ 6, 0 }, { /* 23 */ 8, 0 }, { /* 24 */ 9, 0 }, { /* 25 */ 10, 0 }, { /* 26 */ 5, 0 }, { /* 27 */ 103, 0 }, { /* 28 */ 120, 0 }, { /* 29 */ 119, 0 }, { /* 30 */ 4, 0 }, { /* 31 */ 7, 0 }, { /* 32 */ 15, 0 }, { /* 33 */ 16, 0 }, { /* 34 */ 18, 0 }, { /* 35 */ 20, 0 }, { /* 36 */ 17, 0 }, { /* 37 */ 11, 0 }, { /* 38 */ 12, 0 }, { /* 39 */ 14, 0 }, { /* 40 */ 13, 0 } }; welle.io-2.1/src/libs/faad2/libfaad/common.c000066400000000000000000000412061357201522000206050ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: common.c,v 1.27 2008/03/23 23:03:28 menno Exp $ **/ /* just some common functions that could be used anywhere */ #include "common.h" #include "structs.h" #include #include "syntax.h" /* Returns the sample rate index based on the samplerate */ uint8_t get_sr_index(const uint32_t samplerate) { if (92017 <= samplerate) return 0; if (75132 <= samplerate) return 1; if (55426 <= samplerate) return 2; if (46009 <= samplerate) return 3; if (37566 <= samplerate) return 4; if (27713 <= samplerate) return 5; if (23004 <= samplerate) return 6; if (18783 <= samplerate) return 7; if (13856 <= samplerate) return 8; if (11502 <= samplerate) return 9; if (9391 <= samplerate) return 10; if (16428320 <= samplerate) return 11; return 11; } /* Returns the sample rate based on the sample rate index */ uint32_t get_sample_rate(const uint8_t sr_index) { static const uint32_t sample_rates[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 }; if (sr_index < 12) return sample_rates[sr_index]; return 0; } uint8_t max_pred_sfb(const uint8_t sr_index) { static const uint8_t pred_sfb_max[] = { 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34 }; if (sr_index < 12) return pred_sfb_max[sr_index]; return 0; } uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, const uint8_t is_short) { /* entry for each sampling rate * 1 Main/LC long window * 2 Main/LC short window * 3 SSR long window * 4 SSR short window */ static const uint8_t tns_sbf_max[][4] = { {31, 9, 28, 7}, /* 96000 */ {31, 9, 28, 7}, /* 88200 */ {34, 10, 27, 7}, /* 64000 */ {40, 14, 26, 6}, /* 48000 */ {42, 14, 26, 6}, /* 44100 */ {51, 14, 26, 6}, /* 32000 */ {46, 14, 29, 7}, /* 24000 */ {46, 14, 29, 7}, /* 22050 */ {42, 14, 23, 8}, /* 16000 */ {42, 14, 23, 8}, /* 12000 */ {42, 14, 23, 8}, /* 11025 */ {39, 14, 19, 7}, /* 8000 */ {39, 14, 19, 7}, /* 7350 */ {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; uint8_t i = 0; if (is_short) i++; if (object_type == SSR) i += 2; return tns_sbf_max[sr_index][i]; } /* Returns 0 if an object type is decodable, otherwise returns -1 */ int8_t can_decode_ot(const uint8_t object_type) { switch (object_type) { case LC: return 0; case MAIN: #ifdef MAIN_DEC return 0; #else return -1; #endif case SSR: #ifdef SSR_DEC return 0; #else return -1; #endif case LTP: #ifdef LTP_DEC return 0; #else return -1; #endif /* ER object types */ #ifdef ERROR_RESILIENCE case ER_LC: #ifdef DRM case DRM_ER_LC: #endif return 0; case ER_LTP: #ifdef LTP_DEC return 0; #else return -1; #endif case LD: #ifdef LD_DEC return 0; #else return -1; #endif #endif } return -1; } void *faad_malloc(size_t size) { #if 0 // defined(_WIN32) && !defined(_WIN32_WCE) return _aligned_malloc(size, 16); #else // #ifdef 0 return malloc(size); #endif // #ifdef 0 } /* common free function */ void faad_free(void *b) { #if 0 // defined(_WIN32) && !defined(_WIN32_WCE) _aligned_free(b); #else free(b); } #endif static const uint8_t Parity [256] = { // parity 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 }; static uint32_t __r1 = 1; static uint32_t __r2 = 1; /* * This is a simple random number generator with good quality for audio purposes. * It consists of two polycounters with opposite rotation direction and different * periods. The periods are coprime, so the total period is the product of both. * * ------------------------------------------------------------------------------------------------- * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| * | ------------------------------------------------------------------------------------------------- * | | | | | | | * | +--+--+--+-XOR-+--------+ * | | * +--------------------------------------------------------------------------------------+ * * ------------------------------------------------------------------------------------------------- * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ * ------------------------------------------------------------------------------------------------- | * | | | | | * +--+----XOR----+--+ | * | | * +----------------------------------------------------------------------------------------+ * * * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, * which gives a period of 18.410.713.077.675.721.215. The result is the * XORed values of both generators. */ uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2) { uint32_t t1, t2, t3, t4; t3 = t1 = *__r1; t4 = t2 = *__r2; // Parity calculation is done via table lookup, this is also available t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. t1 <<= 31; t2 = Parity [t2]; return (*__r1 = (t3 >> 1) | t1 ) ^ (*__r2 = (t4 + t4) | t2 ); } static uint32_t ones32(uint32_t x) { x -= ((x >> 1) & 0x55555555); x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); x = (((x >> 4) + x) & 0x0f0f0f0f); x += (x >> 8); x += (x >> 16); return (x & 0x0000003f); } static uint32_t floor_log2(uint32_t x) { #if 1 x |= (x >> 1); x |= (x >> 2); x |= (x >> 4); x |= (x >> 8); x |= (x >> 16); return (ones32(x) - 1); #else uint32_t count = 0; while (x >>= 1) count++; return count; #endif } /* returns position of first bit that is not 0 from msb, * starting count at lsb */ uint32_t wl_min_lzc(uint32_t x) { #if 1 x |= (x >> 1); x |= (x >> 2); x |= (x >> 4); x |= (x >> 8); x |= (x >> 16); return (ones32(x)); #else uint32_t count = 0; while (x >>= 1) count++; return (count + 1); #endif } #ifdef FIXED_POINT #define TABLE_BITS 6 /* just take the maximum number of bits for interpolation */ #define INTERP_BITS (REAL_BITS-TABLE_BITS) static const real_t pow2_tab[] = { REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117), REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557), REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258), REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242), REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578), REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703), REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484), REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778), REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741), REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591), REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095), REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647), REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423), REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837), REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254), REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736), REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478), REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521), REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342), REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966), REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400), REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000) }; static const real_t log2_tab[] = { REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453), REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169), REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312), REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881), REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248), REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625), REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760), REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728), REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675), REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031), REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156), REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610), REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496), REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123), REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469), REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106), REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742), REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405), REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519), REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240), REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917), REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000) }; real_t pow2_fix(real_t val) { uint32_t x1, x2; uint32_t errcorr; uint32_t index_frac; real_t retval; int32_t whole = (val >> REAL_BITS); /* rest = [0..1] */ int32_t rest = val - (whole << REAL_BITS); /* index into pow2_tab */ int32_t index = rest >> (REAL_BITS-TABLE_BITS); if (val == 0) return (1<> (REAL_BITS-TABLE_BITS-INTERP_BITS); index_frac = index_frac & ((1< 0) { retval = 1 << whole; } else { retval = REAL_CONST(1) >> -whole; } x1 = pow2_tab[index & ((1<> INTERP_BITS; if (whole > 0) { retval = retval * (errcorr + x1); } else { retval = MUL_R(retval, (errcorr + x1)); } return retval; } int32_t pow2_int(real_t val) { uint32_t x1, x2; uint32_t errcorr; uint32_t index_frac; real_t retval; int32_t whole = (val >> REAL_BITS); /* rest = [0..1] */ int32_t rest = val - (whole << REAL_BITS); /* index into pow2_tab */ int32_t index = rest >> (REAL_BITS-TABLE_BITS); if (val == 0) return 1; /* leave INTERP_BITS bits */ index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS); index_frac = index_frac & ((1< 0) retval = 1 << whole; else retval = 0; x1 = pow2_tab[index & ((1<> INTERP_BITS; retval = MUL_R(retval, (errcorr + x1)); return retval; } /* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ int32_t log2_int(uint32_t val) { uint32_t frac; uint32_t whole = (val); int32_t exp = 0; uint32_t index; uint32_t index_frac; uint32_t x1, x2; uint32_t errcorr; /* error */ if (val == 0) return -10000; exp = floor_log2(val); exp -= REAL_BITS; /* frac = [1..2] */ if (exp >= 0) frac = val >> exp; else frac = val << -exp; /* index in the log2 table */ index = frac >> (REAL_BITS-TABLE_BITS); /* leftover part for linear interpolation */ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); /* leave INTERP_BITS bits */ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); x1 = log2_tab[index & ((1<> INTERP_BITS; return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1; } /* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ real_t log2_fix(uint32_t val) { uint32_t frac; uint32_t whole = (val >> REAL_BITS); int8_t exp = 0; uint32_t index; uint32_t index_frac; uint32_t x1, x2; uint32_t errcorr; /* error */ if (val == 0) return -100000; exp = floor_log2(val); exp -= REAL_BITS; /* frac = [1..2] */ if (exp >= 0) frac = val >> exp; else frac = val << -exp; /* index in the log2 table */ index = frac >> (REAL_BITS-TABLE_BITS); /* leftover part for linear interpolation */ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); /* leave INTERP_BITS bits */ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); x1 = log2_tab[index & ((1<> INTERP_BITS; return (exp << REAL_BITS) + errcorr + x1; } #endif welle.io-2.1/src/libs/faad2/libfaad/common.h000066400000000000000000000221051357201522000206070ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: common.h,v 1.77 2009/02/05 00:51:03 menno Exp $ **/ #ifndef __COMMON_H__ #define __COMMON_H__ #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_CONFIG_H # include "../config.h" #endif #include "neaacdec.h" #if 1 #define INLINE __inline #else #define INLINE inline #endif #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) #define ALIGN __declspec(align(16)) #else #define ALIGN #endif #ifndef max #define max(a, b) (((a) > (b)) ? (a) : (b)) #endif #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif /* COMPILE TIME DEFINITIONS */ /* use double precision */ /* #define USE_DOUBLE_PRECISION */ /* use fixed point reals */ //#define FIXED_POINT //#define BIG_IQ_TABLE /* Use if target platform has address generators with autoincrement */ //#define PREFER_POINTERS #ifdef _WIN32_WCE #define FIXED_POINT #endif #ifdef __BFIN__ #define FIXED_POINT #endif #define ERROR_RESILIENCE /* Allow decoding of MAIN profile AAC */ #define MAIN_DEC /* Allow decoding of SSR profile AAC */ //#define SSR_DEC /* Allow decoding of LTP profile AAC */ #define LTP_DEC /* Allow decoding of LD profile AAC */ #define LD_DEC /* Allow decoding of Digital Radio Mondiale (DRM) */ //#define DRM //#define DRM_PS /* LD can't do without LTP */ #ifdef LD_DEC #ifndef ERROR_RESILIENCE #define ERROR_RESILIENCE #endif #ifndef LTP_DEC #define LTP_DEC #endif #endif #define ALLOW_SMALL_FRAMELENGTH // Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC) //#define LC_ONLY_DECODER #ifdef LC_ONLY_DECODER #undef LD_DEC #undef LTP_DEC #undef MAIN_DEC #undef SSR_DEC #undef DRM #undef ALLOW_SMALL_FRAMELENGTH #undef ERROR_RESILIENCE #endif #define SBR_DEC //#define SBR_LOW_POWER #define PS_DEC #ifdef SBR_LOW_POWER #undef PS_DEC #endif /* FIXED POINT: No MAIN decoding */ #ifdef FIXED_POINT # ifdef MAIN_DEC # undef MAIN_DEC # endif #endif // FIXED_POINT #ifdef DRM # ifndef ALLOW_SMALL_FRAMELENGTH # define ALLOW_SMALL_FRAMELENGTH # endif # undef LD_DEC # undef LTP_DEC # undef MAIN_DEC # undef SSR_DEC #endif #ifdef FIXED_POINT #define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B) #define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B) #else #define DIV_R(A, B) ((A)/(B)) #define DIV_C(A, B) ((A)/(B)) #endif #ifndef SBR_LOW_POWER #define qmf_t complex_t #define QMF_RE(A) RE(A) #define QMF_IM(A) IM(A) #else #define qmf_t real_t #define QMF_RE(A) (A) #define QMF_IM(A) #endif /* END COMPILE TIME DEFINITIONS */ #if defined(_WIN32) && !defined(__MINGW32__) #include typedef unsigned __int64 uint64_t; typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; typedef unsigned __int8 uint8_t; typedef signed __int64 int64_t; typedef signed __int32 int32_t; typedef signed __int16 int16_t; typedef signed __int8 int8_t; typedef float float32_t; #else #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # else /* we need these... */ #ifndef __TCS__ typedef unsigned long long uint64_t; typedef signed long long int64_t; #else typedef unsigned long uint64_t; typedef signed long int64_t; #endif typedef unsigned long uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; typedef signed long int32_t; typedef signed short int16_t; typedef signed char int8_t; # endif #endif #if HAVE_UNISTD_H //# include #endif #ifndef HAVE_FLOAT32_T typedef float float32_t; #endif #if STDC_HEADERS # include #else # if !HAVE_STRCHR # define strchr index # define strrchr rindex # endif char *strchr(), *strrchr(); # if !HAVE_MEMCPY # define memcpy(d, s, n) bcopy((s), (d), (n)) # define memmove(d, s, n) bcopy((s), (d), (n)) # endif #endif #endif #ifdef WORDS_BIGENDIAN #define ARCH_IS_BIG_ENDIAN #endif /* FIXED_POINT doesn't work with MAIN and SSR yet */ #ifdef FIXED_POINT #undef MAIN_DEC #undef SSR_DEC #endif #if defined(FIXED_POINT) #include "fixed.h" #elif defined(USE_DOUBLE_PRECISION) typedef double real_t; #include #define MUL_R(A,B) ((A)*(B)) #define MUL_C(A,B) ((A)*(B)) #define MUL_F(A,B) ((A)*(B)) /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); } #define REAL_CONST(A) ((real_t)(A)) #define COEF_CONST(A) ((real_t)(A)) #define Q2_CONST(A) ((real_t)(A)) #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ #else /* Normal floating point operation */ typedef float real_t; #define MUL_R(A,B) ((A)*(B)) #define MUL_C(A,B) ((A)*(B)) #define MUL_F(A,B) ((A)*(B)) #define REAL_CONST(A) ((real_t)(A)) #define COEF_CONST(A) ((real_t)(A)) #define Q2_CONST(A) ((real_t)(A)) #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); } #if defined(_WIN32) && !defined(__MINGW32__) #define HAS_LRINTF static INLINE int lrintf(float f) { int i; __asm { fld f fistp i } return i; } #elif (defined(__i386__) && defined(__GNUC__) && \ !defined(__CYGWIN__) && !defined(__MINGW32__)) #ifndef HAVE_LRINTF #define HAS_LRINTF // from http://www.stereopsis.com/FPU.html static INLINE int lrintf(float f) { int i; __asm__ __volatile__ ( "flds %1 \n\t" "fistpl %0 \n\t" : "=m" (i) : "m" (f)); return i; } #endif /* HAVE_LRINTF */ #endif #ifdef __ICL /* only Intel C compiler has fmath ??? */ #include #define sin sinf #define cos cosf #define log logf #define floor floorf #define ceil ceilf #define sqrt sqrtf #else #ifdef HAVE_LRINTF # define HAS_LRINTF # define _ISOC9X_SOURCE 1 # define _ISOC99_SOURCE 1 # define __USE_ISOC9X 1 # define __USE_ISOC99 1 #endif #include #ifdef HAVE_SINF # define sin sinf #error #endif #ifdef HAVE_COSF # define cos cosf #endif #ifdef HAVE_LOGF # define log logf #endif #ifdef HAVE_EXPF # define exp expf #endif #ifdef HAVE_FLOORF # define floor floorf #endif #ifdef HAVE_CEILF # define ceil ceilf #endif #ifdef HAVE_SQRTF # define sqrt sqrtf #endif #endif #endif #ifndef HAS_LRINTF /* standard cast */ #define lrintf(f) ((int32_t)(f)) #endif typedef real_t complex_t[2]; #define RE(A) A[0] #define IM(A) A[1] /* common functions */ uint8_t cpu_has_sse(void); uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2); uint32_t wl_min_lzc(uint32_t x); #ifdef FIXED_POINT #define LOG2_MIN_INF REAL_CONST(-10000) int32_t log2_int(uint32_t val); int32_t log2_fix(uint32_t val); int32_t pow2_int(real_t val); real_t pow2_fix(real_t val); #endif uint8_t get_sr_index(const uint32_t samplerate); uint8_t max_pred_sfb(const uint8_t sr_index); uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, const uint8_t is_short); uint32_t get_sample_rate(const uint8_t sr_index); int8_t can_decode_ot(const uint8_t object_type); void *faad_malloc(size_t size); void faad_free(void *b); //#define PROFILE #ifdef PROFILE static int64_t faad_get_ts() { __asm { rdtsc } } #endif #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #ifndef M_PI_2 /* PI/2 */ #define M_PI_2 1.57079632679489661923 #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/decoder.c000066400000000000000000001077261357201522000207340ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: decoder.c,v 1.117 2009/02/05 00:51:03 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include #include #include "mp4.h" #include "syntax.h" #include "error.h" #include "output.h" #include "filtbank.h" #include "drc.h" #ifdef SBR_DEC #include "sbr_dec.h" #include "sbr_syntax.h" #endif #ifdef SSR_DEC #include "ssr.h" #endif #ifdef ANALYSIS uint16_t dbg_count; #endif /* static function declarations */ static void* aac_frame_decode(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size, void **sample_buffer2, unsigned long sample_buffer_size); static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo); char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode) { if (errcode >= NUM_ERROR_MESSAGES) return NULL; return err_msg[errcode]; } unsigned long NEAACDECAPI NeAACDecGetCapabilities(void) { uint32_t cap = 0; /* can't do without it */ cap += LC_DEC_CAP; #ifdef MAIN_DEC cap += MAIN_DEC_CAP; #endif #ifdef LTP_DEC cap += LTP_DEC_CAP; #endif #ifdef LD_DEC cap += LD_DEC_CAP; #endif #ifdef ERROR_RESILIENCE cap += ERROR_RESILIENCE_CAP; #endif #ifdef FIXED_POINT cap += FIXED_POINT_CAP; #endif return cap; } const unsigned char mes[] = { 0x67,0x20,0x61,0x20,0x20,0x20,0x6f,0x20,0x72,0x20,0x65,0x20,0x6e,0x20,0x20,0x20,0x74,0x20,0x68,0x20,0x67,0x20,0x69,0x20,0x72,0x20,0x79,0x20,0x70,0x20,0x6f,0x20,0x63 }; NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) { uint8_t i; NeAACDecStruct *hDecoder = NULL; if ((hDecoder = (NeAACDecStruct*)faad_malloc(sizeof(NeAACDecStruct))) == NULL) return NULL; memset(hDecoder, 0, sizeof(NeAACDecStruct)); hDecoder->cmes = mes; hDecoder->config.outputFormat = FAAD_FMT_16BIT; hDecoder->config.defObjectType = MAIN; hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ hDecoder->config.downMatrix = 0; hDecoder->adts_header_present = 0; hDecoder->adif_header_present = 0; hDecoder->latm_header_present = 0; #ifdef ERROR_RESILIENCE hDecoder->aacSectionDataResilienceFlag = 0; hDecoder->aacScalefactorDataResilienceFlag = 0; hDecoder->aacSpectralDataResilienceFlag = 0; #endif hDecoder->frameLength = 1024; hDecoder->frame = 0; hDecoder->sample_buffer = NULL; hDecoder->__r1 = 1; hDecoder->__r2 = 1; for (i = 0; i < MAX_CHANNELS; i++) { hDecoder->window_shape_prev[i] = 0; hDecoder->time_out[i] = NULL; hDecoder->fb_intermed[i] = NULL; #ifdef SSR_DEC hDecoder->ssr_overlap[i] = NULL; hDecoder->prev_fmd[i] = NULL; #endif #ifdef MAIN_DEC hDecoder->pred_stat[i] = NULL; #endif #ifdef LTP_DEC hDecoder->ltp_lag[i] = 0; hDecoder->lt_pred_stat[i] = NULL; #endif } #ifdef SBR_DEC for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) { hDecoder->sbr[i] = NULL; } #endif hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0)); return hDecoder; } NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hpDecoder) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder) { NeAACDecConfigurationPtr config = &(hDecoder->config); return config; } return NULL; } unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hpDecoder, NeAACDecConfigurationPtr config) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder && config) { /* check if we can decode this object type */ if (can_decode_ot(config->defObjectType) < 0) return 0; hDecoder->config.defObjectType = config->defObjectType; /* samplerate: anything but 0 should be possible */ if (config->defSampleRate == 0) return 0; hDecoder->config.defSampleRate = config->defSampleRate; /* check output format */ #ifdef FIXED_POINT if ((config->outputFormat < 1) || (config->outputFormat > 4)) return 0; #else if ((config->outputFormat < 1) || (config->outputFormat > 5)) return 0; #endif hDecoder->config.outputFormat = config->outputFormat; if (config->downMatrix > 1) return 0; hDecoder->config.downMatrix = config->downMatrix; /* OK */ return 1; } return 0; } static int latmCheck(latm_header *latm, bitfile *ld) { uint32_t good=0, bad=0, bits, m; while (ld->bytes_left) { bits = faad_latm_frame(latm, ld); if(bits==-1U) bad++; else { good++; while(bits>0) { m = min(bits, 8); faad_getbits(ld, m); bits -= m; } } } return (good>0); } long NEAACDECAPI NeAACDecInit(NeAACDecHandle hpDecoder, unsigned char *buffer, unsigned long buffer_size, unsigned long *samplerate, unsigned char *channels) { uint32_t bits = 0; bitfile ld; adif_header adif; adts_header adts; NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) return -1; hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); hDecoder->object_type = hDecoder->config.defObjectType; *samplerate = get_sample_rate(hDecoder->sf_index); *channels = 1; if (buffer != NULL) { #if 0 int is_latm; latm_header *l = &hDecoder->latm_config; #endif faad_initbits(&ld, buffer, buffer_size); #if 0 memset(l, 0, sizeof(latm_header)); is_latm = latmCheck(l, &ld); l->inited = 0; l->frameLength = 0; faad_rewindbits(&ld); if(is_latm && l->ASCbits>0) { int32_t x; hDecoder->latm_header_present = 1; x = NeAACDecInit2(hDecoder, l->ASC, (l->ASCbits+7)/8, samplerate, channels); if(x!=0) hDecoder->latm_header_present = 0; return x; } else #endif /* Check if an ADIF header is present */ if ((buffer[0] == 'A') && (buffer[1] == 'D') && (buffer[2] == 'I') && (buffer[3] == 'F')) { hDecoder->adif_header_present = 1; get_adif_header(&adif, &ld); faad_byte_align(&ld); hDecoder->sf_index = adif.pce[0].sf_index; hDecoder->object_type = adif.pce[0].object_type + 1; *samplerate = get_sample_rate(hDecoder->sf_index); *channels = adif.pce[0].channels; memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config)); hDecoder->pce_set = 1; bits = bit2byte(faad_get_processed_bits(&ld)); /* Check if an ADTS header is present */ } else if (faad_showbits(&ld, 12) == 0xfff) { hDecoder->adts_header_present = 1; adts.old_format = hDecoder->config.useOldADTSFormat; adts_frame(&adts, &ld); hDecoder->sf_index = adts.sf_index; hDecoder->object_type = adts.profile + 1; *samplerate = get_sample_rate(hDecoder->sf_index); *channels = (adts.channel_configuration > 6) ? 2 : adts.channel_configuration; } if (ld.error) { faad_endbits(&ld); return -1; } faad_endbits(&ld); } #if (defined(PS_DEC) || defined(DRM_PS)) /* check if we have a mono file */ if (*channels == 1) { /* upMatrix to 2 channels for implicit signalling of PS */ *channels = 2; } #endif hDecoder->channelConfiguration = *channels; #ifdef SBR_DEC /* implicit signalling */ if (*samplerate <= 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) { *samplerate *= 2; hDecoder->forceUpSampling = 1; } else if (*samplerate > 24000 && (hDecoder->config.dontUpSampleImplicitSBR == 0)) { hDecoder->downSampledSBR = 1; } #endif /* must be done before frameLength is divided by 2 for LD */ #ifdef SSR_DEC if (hDecoder->object_type == SSR) hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); else #endif hDecoder->fb = filter_bank_init(hDecoder->frameLength); #ifdef LD_DEC if (hDecoder->object_type == LD) hDecoder->frameLength >>= 1; #endif if (can_decode_ot(hDecoder->object_type) < 0) return -1; return bits; } /* Init the library using a DecoderSpecificInfo */ char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hpDecoder, unsigned char *pBuffer, unsigned long SizeOfDecoderSpecificInfo, unsigned long *samplerate, unsigned char *channels) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; int8_t rc; mp4AudioSpecificConfig mp4ASC; if((hDecoder == NULL) || (pBuffer == NULL) || (SizeOfDecoderSpecificInfo < 2) || (samplerate == NULL) || (channels == NULL)) { return -1; } hDecoder->adif_header_present = 0; hDecoder->adts_header_present = 0; /* decode the audio specific config */ rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC, &(hDecoder->pce), hDecoder->latm_header_present); /* copy the relevant info to the decoder handle */ *samplerate = mp4ASC.samplingFrequency; if (mp4ASC.channelsConfiguration) { *channels = mp4ASC.channelsConfiguration; } else { *channels = hDecoder->pce.channels; hDecoder->pce_set = 1; } #if (defined(PS_DEC) || defined(DRM_PS)) /* check if we have a mono file */ if (*channels == 1) { /* upMatrix to 2 channels for implicit signalling of PS */ *channels = 2; } #endif hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; hDecoder->object_type = mp4ASC.objectTypeIndex; #ifdef ERROR_RESILIENCE hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag; hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag; hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag; #endif #ifdef SBR_DEC hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag; hDecoder->downSampledSBR = mp4ASC.downSampledSBR; if (hDecoder->config.dontUpSampleImplicitSBR == 0) hDecoder->forceUpSampling = mp4ASC.forceUpSampling; else hDecoder->forceUpSampling = 0; /* AAC core decoder samplerate is 2 times as low */ if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1) { hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2); } #endif if (rc != 0) { return rc; } hDecoder->channelConfiguration = mp4ASC.channelsConfiguration; if (mp4ASC.frameLengthFlag) #ifdef ALLOW_SMALL_FRAMELENGTH hDecoder->frameLength = 960; #else return -1; #endif /* must be done before frameLength is divided by 2 for LD */ #ifdef SSR_DEC if (hDecoder->object_type == SSR) hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); else #endif hDecoder->fb = filter_bank_init(hDecoder->frameLength); #ifdef LD_DEC if (hDecoder->object_type == LD) hDecoder->frameLength >>= 1; #endif return 0; } #ifdef DRM char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hpDecoder, unsigned long samplerate, unsigned char channels) { NeAACDecStruct** hDecoder = (NeAACDecStruct**)hpDecoder; if (hDecoder == NULL) return 1; /* error */ NeAACDecClose(*hDecoder); *hDecoder = NeAACDecOpen(); /* Special object type defined for DRM */ (*hDecoder)->config.defObjectType = DRM_ER_LC; (*hDecoder)->config.defSampleRate = samplerate; #ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */ (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */ #endif (*hDecoder)->frameLength = 960; (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate); (*hDecoder)->object_type = (*hDecoder)->config.defObjectType; if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO)) (*hDecoder)->channelConfiguration = 2; else (*hDecoder)->channelConfiguration = 1; #ifdef SBR_DEC if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO)) (*hDecoder)->sbr_present_flag = 0; else (*hDecoder)->sbr_present_flag = 1; #endif (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength); return 0; } #endif void NEAACDECAPI NeAACDecClose(NeAACDecHandle hpDecoder) { uint8_t i; NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder == NULL) return; #ifdef PROFILE printf("AAC decoder total: %I64d cycles\n", hDecoder->cycles); printf("requant: %I64d cycles\n", hDecoder->requant_cycles); printf("spectral_data: %I64d cycles\n", hDecoder->spectral_cycles); printf("scalefactors: %I64d cycles\n", hDecoder->scalefac_cycles); printf("output: %I64d cycles\n", hDecoder->output_cycles); #endif for (i = 0; i < MAX_CHANNELS; i++) { if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]); if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]); #ifdef SSR_DEC if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]); if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]); #endif #ifdef MAIN_DEC if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]); #endif #ifdef LTP_DEC if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]); #endif } #ifdef SSR_DEC if (hDecoder->object_type == SSR) ssr_filter_bank_end(hDecoder->fb); else #endif filter_bank_end(hDecoder->fb); drc_end(hDecoder->drc); if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); #ifdef SBR_DEC for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) { if (hDecoder->sbr[i]) sbrDecodeEnd(hDecoder->sbr[i]); } #endif if (hDecoder) faad_free(hDecoder); } void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hpDecoder, long frame) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if (hDecoder) { hDecoder->postSeekResetFlag = 1; if (frame != -1) hDecoder->frame = frame; } } static void create_channel_config(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo) { hInfo->num_front_channels = 0; hInfo->num_side_channels = 0; hInfo->num_back_channels = 0; hInfo->num_lfe_channels = 0; memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t)); if (hDecoder->downMatrix) { hInfo->num_front_channels = 2; hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; return; } /* check if there is a PCE */ if (hDecoder->pce_set) { uint8_t i, chpos = 0; uint8_t chdir, back_center = 0; hInfo->num_front_channels = hDecoder->pce.num_front_channels; hInfo->num_side_channels = hDecoder->pce.num_side_channels; hInfo->num_back_channels = hDecoder->pce.num_back_channels; hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels; chdir = hInfo->num_front_channels; if (chdir & 1) { #if (defined(PS_DEC) || defined(DRM_PS)) /* When PS is enabled output is always stereo */ hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; #else hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER; chdir--; #endif } for (i = 0; i < chdir; i += 2) { hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; } for (i = 0; i < hInfo->num_side_channels; i += 2) { hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT; hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT; } chdir = hInfo->num_back_channels; if (chdir & 1) { back_center = 1; chdir--; } for (i = 0; i < chdir; i += 2) { hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT; hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT; } if (back_center) { hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER; } for (i = 0; i < hInfo->num_lfe_channels; i++) { hInfo->channel_position[chpos++] = LFE_CHANNEL; } } else { switch (hDecoder->channelConfiguration) { case 1: #if (defined(PS_DEC) || defined(DRM_PS)) /* When PS is enabled output is always stereo */ hInfo->num_front_channels = 2; hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; #else hInfo->num_front_channels = 1; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; #endif break; case 2: hInfo->num_front_channels = 2; hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; break; case 3: hInfo->num_front_channels = 3; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; break; case 4: hInfo->num_front_channels = 3; hInfo->num_back_channels = 1; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; hInfo->channel_position[3] = BACK_CHANNEL_CENTER; break; case 5: hInfo->num_front_channels = 3; hInfo->num_back_channels = 2; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; hInfo->channel_position[3] = BACK_CHANNEL_LEFT; hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; break; case 6: hInfo->num_front_channels = 3; hInfo->num_back_channels = 2; hInfo->num_lfe_channels = 1; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; hInfo->channel_position[3] = BACK_CHANNEL_LEFT; hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; hInfo->channel_position[5] = LFE_CHANNEL; break; case 7: hInfo->num_front_channels = 3; hInfo->num_side_channels = 2; hInfo->num_back_channels = 2; hInfo->num_lfe_channels = 1; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; hInfo->channel_position[3] = SIDE_CHANNEL_LEFT; hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT; hInfo->channel_position[5] = BACK_CHANNEL_LEFT; hInfo->channel_position[6] = BACK_CHANNEL_RIGHT; hInfo->channel_position[7] = LFE_CHANNEL; break; default: /* channelConfiguration == 0 || channelConfiguration > 7 */ { uint8_t i; uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe; if (ch & 1) /* there's either a center front or a center back channel */ { uint8_t ch1 = (ch-1)/2; if (hDecoder->first_syn_ele == ID_SCE) { hInfo->num_front_channels = ch1 + 1; hInfo->num_back_channels = ch1; hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; for (i = 1; i <= ch1; i+=2) { hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; } for (i = ch1+1; i < ch; i+=2) { hInfo->channel_position[i] = BACK_CHANNEL_LEFT; hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; } } else { hInfo->num_front_channels = ch1; hInfo->num_back_channels = ch1 + 1; for (i = 0; i < ch1; i+=2) { hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; } for (i = ch1; i < ch-1; i+=2) { hInfo->channel_position[i] = BACK_CHANNEL_LEFT; hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; } hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; } } else { uint8_t ch1 = (ch)/2; hInfo->num_front_channels = ch1; hInfo->num_back_channels = ch1; if (ch1 & 1) { hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; for (i = 1; i <= ch1; i+=2) { hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; } for (i = ch1+1; i < ch-1; i+=2) { hInfo->channel_position[i] = BACK_CHANNEL_LEFT; hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; } hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; } else { for (i = 0; i < ch1; i+=2) { hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; } for (i = ch1; i < ch; i+=2) { hInfo->channel_position[i] = BACK_CHANNEL_LEFT; hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; } } } hInfo->num_lfe_channels = hDecoder->has_lfe; for (i = ch; i < hDecoder->fr_channels; i++) { hInfo->channel_position[i] = LFE_CHANNEL; } } break; } } } void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hpDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0); } void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hpDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size, void **sample_buffer, unsigned long sample_buffer_size) { NeAACDecStruct* hDecoder = (NeAACDecStruct*)hpDecoder; if ((sample_buffer == NULL) || (sample_buffer_size == 0)) { hInfo->error = 27; return NULL; } return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, sample_buffer, sample_buffer_size); } #ifdef DRM #define ERROR_STATE_INIT 6 static void conceal_output(NeAACDecStruct *hDecoder, uint16_t frame_len, uint8_t out_ch, void *sample_buffer) { return; } #endif static void* aac_frame_decode(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size, void **sample_buffer2, unsigned long sample_buffer_size) { uint16_t i; uint8_t channels = 0; uint8_t output_channels = 0; bitfile ld = {0}; uint32_t bitsconsumed; uint16_t frame_len; void *sample_buffer; uint32_t startbit=0, endbit=0, payload_bits=0; #ifdef PROFILE int64_t count = faad_get_ts(); #endif /* safety checks */ if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL)) { return NULL; } #if 0 printf("%d\n", buffer_size*8); #endif frame_len = hDecoder->frameLength; memset(hInfo, 0, sizeof(NeAACDecFrameInfo)); memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0])); #ifdef USE_TIME_LIMIT if ((TIME_LIMIT * get_sample_rate(hDecoder->sf_index)) > hDecoder->TL_count) { hDecoder->TL_count += 1024; } else { hInfo->error = (NUM_ERROR_MESSAGES-1); goto error; } #endif /* check for some common metadata tag types in the bitstream * No need to return an error */ /* ID3 */ if (buffer_size >= 128) { if (memcmp(buffer, "TAG", 3) == 0) { /* found it */ hInfo->bytesconsumed = 128; /* 128 bytes fixed size */ /* no error, but no output either */ return NULL; } } /* initialize the bitstream */ faad_initbits(&ld, buffer, buffer_size); #if 0 { int i; for (i = 0; i < ((buffer_size+3)>>2); i++) { uint8_t *buf; uint32_t temp = 0; buf = faad_getbitbuffer(&ld, 32); //temp = getdword((void*)buf); temp = *((uint32_t*)buf); printf("0x%.8X\n", temp); free(buf); } faad_endbits(&ld); faad_initbits(&ld, buffer, buffer_size); } #endif #if 0 if(hDecoder->latm_header_present) { payload_bits = faad_latm_frame(&hDecoder->latm_config, &ld); startbit = faad_get_processed_bits(&ld); if(payload_bits == -1U) { hInfo->error = 1; goto error; } } #endif #ifdef DRM if (hDecoder->object_type == DRM_ER_LC) { /* We do not support stereo right now */ if (0) //(hDecoder->channelConfiguration == 2) { hInfo->error = 28; // Throw CRC error goto error; } faad_getbits(&ld, 8 DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC")); } #endif if (hDecoder->adts_header_present) { adts_header adts; adts.old_format = hDecoder->config.useOldADTSFormat; if ((hInfo->error = adts_frame(&adts, &ld)) > 0) goto error; /* MPEG2 does byte_alignment() here, * but ADTS header is always multiple of 8 bits in MPEG2 * so not needed to actually do it. */ } #ifdef ANALYSIS dbg_count = 0; #endif /* decode the complete bitstream */ #ifdef DRM if (/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC)) { DRM_aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); } else { #endif raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); #ifdef DRM } #endif #if 0 if(hDecoder->latm_header_present) { endbit = faad_get_processed_bits(&ld); if(endbit-startbit > payload_bits) fprintf(stderr, "\r\nERROR, too many payload bits read: %u > %d. Please. report with a link to a sample\n", endbit-startbit, payload_bits); if(hDecoder->latm_config.otherDataLenBits > 0) faad_getbits(&ld, hDecoder->latm_config.otherDataLenBits); faad_byte_align(&ld); } #endif channels = hDecoder->fr_channels; if (hInfo->error > 0) goto error; /* safety check */ if (channels == 0 || channels > MAX_CHANNELS) { /* invalid number of channels */ hInfo->error = 12; goto error; } /* no more bit reading after this */ bitsconsumed = faad_get_processed_bits(&ld); hInfo->bytesconsumed = bit2byte(bitsconsumed); if (ld.error) { hInfo->error = 14; goto error; } faad_endbits(&ld); if (!hDecoder->adts_header_present && !hDecoder->adif_header_present #if 0 && !hDecoder->latm_header_present #endif ) { if (hDecoder->channelConfiguration == 0) hDecoder->channelConfiguration = channels; if (channels == 8) /* 7.1 */ hDecoder->channelConfiguration = 7; if (channels == 7) /* not a standard channelConfiguration */ hDecoder->channelConfiguration = 0; } if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix) { hDecoder->downMatrix = 1; output_channels = 2; } else { output_channels = channels; } #if (defined(PS_DEC) || defined(DRM_PS)) hDecoder->upMatrix = 0; /* check if we have a mono file */ if (output_channels == 1) { /* upMatrix to 2 channels for implicit signalling of PS */ hDecoder->upMatrix = 1; output_channels = 2; } #endif /* Make a channel configuration based on either a PCE or a channelConfiguration */ create_channel_config(hDecoder, hInfo); /* number of samples in this frame */ hInfo->samples = frame_len*output_channels; /* number of channels in this frame */ hInfo->channels = output_channels; /* samplerate */ hInfo->samplerate = get_sample_rate(hDecoder->sf_index); /* object type */ hInfo->object_type = hDecoder->object_type; /* sbr */ hInfo->sbr = NO_SBR; /* header type */ hInfo->header_type = RAW; if (hDecoder->adif_header_present) hInfo->header_type = ADIF; if (hDecoder->adts_header_present) hInfo->header_type = ADTS; #if 0 if (hDecoder->latm_header_present) hInfo->header_type = LATM; #endif #if (defined(PS_DEC) || defined(DRM_PS)) hInfo->ps = hDecoder->ps_used_global; #endif /* check if frame has channel elements */ if (channels == 0) { hDecoder->frame++; return NULL; } /* allocate the buffer for the final samples */ if ((hDecoder->sample_buffer == NULL) || (hDecoder->alloced_channels != output_channels)) { static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t), sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t), sizeof(int16_t), sizeof(int16_t), 0, 0, 0 }; uint8_t stride = str[hDecoder->config.outputFormat-1]; #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1)) { stride = 2 * stride; } #endif /* check if we want to use internal sample_buffer */ if (sample_buffer_size == 0) { if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); hDecoder->sample_buffer = NULL; hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride); } else if (sample_buffer_size < frame_len*output_channels*stride) { /* provided sample buffer is not big enough */ hInfo->error = 27; return NULL; } hDecoder->alloced_channels = output_channels; } if (sample_buffer_size == 0) { sample_buffer = hDecoder->sample_buffer; } else { sample_buffer = *sample_buffer2; } #ifdef SBR_DEC if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) { uint8_t ele; /* this data is different when SBR is used or when the data is upsampled */ if (!hDecoder->downSampledSBR) { frame_len *= 2; hInfo->samples *= 2; hInfo->samplerate *= 2; } /* check if every element was provided with SBR data */ for (ele = 0; ele < hDecoder->fr_ch_ele; ele++) { if (hDecoder->sbr[ele] == NULL) { hInfo->error = 25; goto error; } } /* sbr */ if (hDecoder->sbr_present_flag == 1) { hInfo->object_type = HE_AAC; hInfo->sbr = SBR_UPSAMPLED; } else { hInfo->sbr = NO_SBR_UPSAMPLED; } if (hDecoder->downSampledSBR) { hInfo->sbr = SBR_DOWNSAMPLED; } } #endif sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, output_channels, frame_len, hDecoder->config.outputFormat); #ifdef DRM //conceal_output(hDecoder, frame_len, output_channels, sample_buffer); #endif hDecoder->postSeekResetFlag = 0; hDecoder->frame++; #ifdef LD_DEC if (hDecoder->object_type != LD) { #endif if (hDecoder->frame <= 1) hInfo->samples = 0; #ifdef LD_DEC } else { /* LD encoders will give lower delay */ if (hDecoder->frame <= 0) hInfo->samples = 0; } #endif /* cleanup */ #ifdef ANALYSIS fflush(stdout); #endif #ifdef PROFILE count = faad_get_ts() - count; hDecoder->cycles += count; #endif return sample_buffer; error: #ifdef DRM hDecoder->error_state = ERROR_STATE_INIT; #endif /* reset filterbank state */ for (i = 0; i < MAX_CHANNELS; i++) { if (hDecoder->fb_intermed[i] != NULL) { memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength*sizeof(real_t)); } } #ifdef SBR_DEC for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) { if (hDecoder->sbr[i] != NULL) { sbrReset(hDecoder->sbr[i]); } } #endif faad_endbits(&ld); /* cleanup */ #ifdef ANALYSIS fflush(stdout); #endif return NULL; } welle.io-2.1/src/libs/faad2/libfaad/drc.c000066400000000000000000000120461357201522000200650ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: drc.c,v 1.28 2007/11/01 12:33:30 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include #include "syntax.h" #include "drc.h" drc_info *drc_init(real_t cut, real_t boost) { drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info)); memset(drc, 0, sizeof(drc_info)); drc->ctrl1 = cut; drc->ctrl2 = boost; drc->num_bands = 1; drc->band_top[0] = 1024/4 - 1; drc->dyn_rng_sgn[0] = 1; drc->dyn_rng_ctl[0] = 0; return drc; } void drc_end(drc_info *drc) { if (drc) faad_free(drc); } #ifdef FIXED_POINT static real_t drc_pow2_table[] = { COEF_CONST(0.5146511183), COEF_CONST(0.5297315472), COEF_CONST(0.5452538663), COEF_CONST(0.5612310242), COEF_CONST(0.5776763484), COEF_CONST(0.5946035575), COEF_CONST(0.6120267717), COEF_CONST(0.6299605249), COEF_CONST(0.6484197773), COEF_CONST(0.6674199271), COEF_CONST(0.6869768237), COEF_CONST(0.7071067812), COEF_CONST(0.7278265914), COEF_CONST(0.7491535384), COEF_CONST(0.7711054127), COEF_CONST(0.7937005260), COEF_CONST(0.8169577266), COEF_CONST(0.8408964153), COEF_CONST(0.8655365610), COEF_CONST(0.8908987181), COEF_CONST(0.9170040432), COEF_CONST(0.9438743127), COEF_CONST(0.9715319412), COEF_CONST(1.0000000000), COEF_CONST(1.0293022366), COEF_CONST(1.0594630944), COEF_CONST(1.0905077327), COEF_CONST(1.1224620483), COEF_CONST(1.1553526969), COEF_CONST(1.1892071150), COEF_CONST(1.2240535433), COEF_CONST(1.2599210499), COEF_CONST(1.2968395547), COEF_CONST(1.3348398542), COEF_CONST(1.3739536475), COEF_CONST(1.4142135624), COEF_CONST(1.4556531828), COEF_CONST(1.4983070769), COEF_CONST(1.5422108254), COEF_CONST(1.5874010520), COEF_CONST(1.6339154532), COEF_CONST(1.6817928305), COEF_CONST(1.7310731220), COEF_CONST(1.7817974363), COEF_CONST(1.8340080864), COEF_CONST(1.8877486254), COEF_CONST(1.9430638823) }; #endif void drc_decode(drc_info *drc, real_t *spec) { uint16_t i, bd, top; #ifdef FIXED_POINT int32_t exp, frac; #else real_t factor, exp; #endif uint16_t bottom = 0; if (drc->num_bands == 1) drc->band_top[0] = 1024/4 - 1; for (bd = 0; bd < drc->num_bands; bd++) { top = 4 * (drc->band_top[bd] + 1); #ifndef FIXED_POINT /* Decode DRC gain factor */ if (drc->dyn_rng_sgn[bd]) /* compress */ exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); else /* boost */ exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); factor = (real_t)pow(2.0, exp); /* Apply gain factor */ for (i = bottom; i < top; i++) spec[i] *= factor; #else /* Decode DRC gain factor */ if (drc->dyn_rng_sgn[bd]) /* compress */ { exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; } else { /* boost */ exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; } /* Apply gain factor */ if (exp < 0) { for (i = bottom; i < top; i++) { spec[i] >>= -exp; if (frac) spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); } } else { for (i = bottom; i < top; i++) { spec[i] <<= exp; if (frac) spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); } } #endif bottom = top; } } welle.io-2.1/src/libs/faad2/libfaad/drc.h000066400000000000000000000030511357201522000200660ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: drc.h,v 1.22 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __DRC_H__ #define __DRC_H__ #ifdef __cplusplus extern "C" { #endif #define DRC_REF_LEVEL 20*4 /* -20 dB */ drc_info *drc_init(real_t cut, real_t boost); void drc_end(drc_info *drc); void drc_decode(drc_info *drc, real_t *spec); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/drm_dec.c000066400000000000000000001367361357201522000207270ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: drm_dec.c,v 1.9 2007/11/01 12:33:30 menno Exp $ **/ #include #include #include #include #include "common.h" #ifdef DRM #include "sbr_dec.h" #include "drm_dec.h" #include "bits.h" /* constants */ #define DECAY_CUTOFF 3 #define DECAY_SLOPE 0.05f /* type definitaions */ typedef const int8_t (*drm_ps_huff_tab)[2]; /* binary search huffman tables */ static const int8_t f_huffman_sa[][2] = { { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 1x */ { /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */ { 5, 6 }, /* index 3: 3 bits: 11x */ { /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */ { /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */ { 8, 9 }, /* index 6: 4 bits: 111x */ { /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */ { /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */ { 11, 12 }, /* index 9: 5 bits: 1111x */ { /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */ { /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */ { /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */ { /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */ }; static const int8_t t_huffman_sa[][2] = { { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 1x */ { /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */ { 4, 5 }, /* index 3: 3 bits: 11x */ { /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */ { 6, 7 }, /* index 5: 4 bits: 111x */ { /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */ { 8, 9 }, /* index 7: 5 bits: 1111x */ { /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */ { 10, 11 }, /* index 9: 6 bits: 11111x */ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */ { /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */ { /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */ { /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */ }; static const int8_t f_huffman_pan[][2] = { { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ { 4, 5 }, /* index 3: 4 bits: 111x */ { /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */ { 6, 7 }, /* index 5: 5 bits: 1111x */ { /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */ { 8, 9 }, /* index 7: 6 bits: 11111x */ { /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */ { 10, 11 }, /* index 9: 7 bits: 111111x */ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */ { 12, 13 }, /* index 11: 8 bits: 1111111x */ { /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */ { /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */ { /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */ { 16, 17 }, /* index 15: 11 bits: 1111111111x */ { /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */ { 18, 19 }, /* index 17: 12 bits: 11111111111x */ { /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */ { 21, 22 }, /* index 19: 13 bits: 111111111111x */ { /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */ { /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */ { 24, 25 }, /* index 22: 14 bits: 1111111111111x */ { /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */ { /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */ { 26, 27 }, /* index 25: 15 bits: 11111111111111x */ { /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */ { /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */ }; static const int8_t t_huffman_pan[][2] = { { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ { /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */ { /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */ { /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */ { /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */ { /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */ { /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */ { 10, 11 }, /* index 9: 10 bits: 111111111x */ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */ { 12, 13 }, /* index 11: 11 bits: 1111111111x */ { /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */ { 14, 15 }, /* index 13: 12 bits: 11111111111x */ { /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */ { 16, 17 }, /* index 15: 13 bits: 111111111111x */ { /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */ { 18, 19 }, /* index 17: 14 bits: 1111111111111x */ { /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */ { 20, 21 }, /* index 19: 15 bits: 11111111111111x */ { /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */ { 22, 23 }, /* index 21: 16 bits: 111111111111111x */ { 24, 25 }, /* index 22: 17 bits: 1111111111111110x */ { 26, 27 }, /* index 23: 17 bits: 1111111111111111x */ { /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */ { /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */ { /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */ { /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */ }; /* There are 3 classes in the standard but the last 2 are identical */ static const real_t sa_quant[8][2] = { { FRAC_CONST(0.0000), FRAC_CONST(0.0000) }, { FRAC_CONST(0.0501), FRAC_CONST(0.1778) }, { FRAC_CONST(0.0706), FRAC_CONST(0.2818) }, { FRAC_CONST(0.0995), FRAC_CONST(0.4467) }, { FRAC_CONST(0.1399), FRAC_CONST(0.5623) }, { FRAC_CONST(0.1957), FRAC_CONST(0.7079) }, { FRAC_CONST(0.2713), FRAC_CONST(0.8913) }, { FRAC_CONST(0.3699), FRAC_CONST(1.0000) }, }; /* We don't need the actual quantizer values */ #if 0 static const real_t pan_quant[8][5] = { { COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) }, { COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) }, { COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) }, { COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) }, { COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) }, { COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) }, { COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) }, { COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) }, }; #endif /* 2^(pan_quant[x][y] */ static const real_t pan_pow_2_pos[8][5] = { { REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) }, { REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) }, { REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) }, { REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) }, { REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) }, { REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) }, { REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) }, { REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) } }; /* 2^(-pan_quant[x][y] */ static const real_t pan_pow_2_neg[8][5] = { { REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) }, { REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) }, { REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) }, { REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) }, { REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) }, { REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) }, { REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) }, { REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) } }; /* 2^(pan_quant[x][y]/30) */ static const real_t pan_pow_2_30_pos[8][5] = { { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) }, { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) }, { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) }, { COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) }, { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) }, { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) }, { COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) } }; /* 2^(-pan_quant[x][y]/30) */ static const real_t pan_pow_2_30_neg[8][5] = { { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) }, { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) }, { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) }, { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) }, { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) }, { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) }, { COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) } }; static const real_t g_decayslope[MAX_SA_BAND] = { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8), FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45), FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1), FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0) }; static const real_t sa_sqrt_1_minus[8][2] = { { FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) }, { FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) }, { FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) }, { FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) }, { FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) }, { FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) }, { FRAC_CONST(0.929071574), FRAC_CONST(0) } }; static const uint8_t sa_freq_scale[9] = { 0, 1, 2, 3, 5, 7, 10, 13, 23 }; static const uint8_t pan_freq_scale[21] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 22, 26, 32, 64 }; static const uint8_t pan_quant_class[20] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4 }; /* Inverse mapping lookup */ static const uint8_t pan_inv_freq[64] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 }; static const uint8_t sa_inv_freq[MAX_SA_BAND] = { 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; static const real_t filter_coeff[] = { FRAC_CONST(0.65143905754106), FRAC_CONST(0.56471812200776), FRAC_CONST(0.48954165955695) }; static const uint8_t delay_length[3] = { 3, 4, 5 }; static const real_t delay_fraction[] = { FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347) }; static const real_t peak_decay = FRAC_CONST(0.76592833836465); static const real_t smooth_coeff = FRAC_CONST(0.25); /* Please note that these are the same tables as in plain PS */ static const complex_t Q_Fract_allpass_Qmf[][3] = { { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } }; static const complex_t Phi_Fract_Qmf[] = { { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } }; /* static function declarations */ static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld); static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld); static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff); uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld) { uint16_t bits = (uint16_t)faad_get_processed_bits(ld); ps->drm_ps_data_available = 1; ps->bs_enable_sa = faad_get1bit(ld); ps->bs_enable_pan = faad_get1bit(ld); if (ps->bs_enable_sa) { drm_ps_sa_element(ps, ld); } if (ps->bs_enable_pan) { drm_ps_pan_element(ps, ld); } bits = (uint16_t)faad_get_processed_bits(ld) - bits; return bits; } static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld) { drm_ps_huff_tab huff; uint8_t band; ps->bs_sa_dt_flag = faad_get1bit(ld); if (ps->bs_sa_dt_flag) { huff = t_huffman_sa; } else { huff = f_huffman_sa; } for (band = 0; band < DRM_NUM_SA_BANDS; band++) { ps->bs_sa_data[band] = huff_dec(ld, huff); } } static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld) { drm_ps_huff_tab huff; uint8_t band; ps->bs_pan_dt_flag = faad_get1bit(ld); if (ps->bs_pan_dt_flag) { huff = t_huffman_pan; } else { huff = f_huffman_pan; } for (band = 0; band < DRM_NUM_PAN_BANDS; band++) { ps->bs_pan_data[band] = huff_dec(ld, huff); } } /* binary search huffman decoding */ static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff) { uint8_t bit; int16_t index = 0; while (index >= 0) { bit = (uint8_t)faad_get1bit(ld); index = huff[index][bit]; } return index + 15; } static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i) { if (i < 0) { /* printf(" SAminclip %d", i); */ ps->sa_decode_error = 1; return 0; } else if (i > 7) { /* printf(" SAmaxclip %d", i); */ ps->sa_decode_error = 1; return 7; } else return i; } static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i) { if (i < -7) { /* printf(" PANminclip %d", i); */ ps->pan_decode_error = 1; return -7; } else if (i > 7) { /* printf(" PANmaxclip %d", i); */ ps->pan_decode_error = 1; return 7; } else return i; } static void drm_ps_delta_decode(drm_ps_info *ps) { uint8_t band; if (ps->bs_enable_sa) { if (ps->bs_sa_dt_flag && !ps->g_last_had_sa) { /* wait until we get a DT frame */ ps->bs_enable_sa = 0; } else if (ps->bs_sa_dt_flag) { /* DT frame, we have a last frame, so we can decode */ ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]); } else { /* DF always decodable */ ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]); } for (band = 1; band < DRM_NUM_SA_BANDS; band++) { if (ps->bs_sa_dt_flag && ps->g_last_had_sa) { ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]); } else if (!ps->bs_sa_dt_flag) { ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]); } } } /* An error during SA decoding implies PAN data will be undecodable, too */ /* Also, we don't like on/off switching in PS, so we force to last settings */ if (ps->sa_decode_error) { ps->pan_decode_error = 1; ps->bs_enable_pan = ps->g_last_had_pan; ps->bs_enable_sa = ps->g_last_had_sa; } if (ps->bs_enable_sa) { if (ps->sa_decode_error) { for (band = 0; band < DRM_NUM_SA_BANDS; band++) { ps->g_sa_index[band] = ps->g_last_good_sa_index[band]; } } else { for (band = 0; band < DRM_NUM_SA_BANDS; band++) { ps->g_last_good_sa_index[band] = ps->g_sa_index[band]; } } } if (ps->bs_enable_pan) { if (ps->bs_pan_dt_flag && !ps->g_last_had_pan) { ps->bs_enable_pan = 0; } else if (ps->bs_pan_dt_flag) { ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]); } else { ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]); } for (band = 1; band < DRM_NUM_PAN_BANDS; band++) { if (ps->bs_pan_dt_flag && ps->g_last_had_pan) { ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]); } else if (!ps->bs_pan_dt_flag) { ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]); } } if (ps->pan_decode_error) { for (band = 0; band < DRM_NUM_PAN_BANDS; band++) { ps->g_pan_index[band] = ps->g_last_good_pan_index[band]; } } else { for (band = 0; band < DRM_NUM_PAN_BANDS; band++) { ps->g_last_good_pan_index[band] = ps->g_pan_index[band]; } } } } static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64]) { uint8_t s, b, k; complex_t qfrac, tmp0, tmp, in, R0; real_t peakdiff; real_t nrg; real_t power; real_t transratio; real_t new_delay_slopes[NUM_OF_LINKS]; uint8_t temp_delay_ser[NUM_OF_LINKS]; complex_t Phi_Fract; #ifdef FIXED_POINT uint32_t in_re, in_im; #endif for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++) { /* set delay indices */ for (k = 0; k < NUM_OF_LINKS; k++) temp_delay_ser[k] = ps->delay_buf_index_ser[k]; RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]); IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]); for (s = 0; s < NUM_OF_SUBSAMPLES; s++) { const real_t gamma = REAL_CONST(1.5); const real_t sigma = REAL_CONST(1.5625); RE(in) = QMF_RE(X[s][b]); IM(in) = QMF_IM(X[s][b]); #ifdef FIXED_POINT /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF * meaning that P will be scaled by 2^(-10) compared to floating point version */ in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); power = in_re*in_re + in_im*in_im; #else power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in)); #endif ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay); if (ps->peakdecay_fast[b] < power) ps->peakdecay_fast[b] = power; peakdiff = ps->prev_peakdiff[b]; peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff); ps->prev_peakdiff[b] = peakdiff; nrg = ps->prev_nrg[b]; nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff); ps->prev_nrg[b] = nrg; if (MUL_R(peakdiff, gamma) <= nrg) { transratio = sigma; } else { transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma); } for (k = 0; k < NUM_OF_LINKS; k++) { new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]); } RE(tmp0) = RE(ps->d_buff[0][b]); IM(tmp0) = IM(ps->d_buff[0][b]); RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]); IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]); RE(ps->d_buff[1][b]) = RE(in); IM(ps->d_buff[1][b]) = IM(in); ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); RE(R0) = RE(tmp); IM(R0) = IM(tmp); for (k = 0; k < NUM_OF_LINKS; k++) { RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]); IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]); RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]); IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]); ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac)); RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0)); IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0)); RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp)); IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp)); RE(R0) = RE(tmp); IM(R0) = IM(tmp); } QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio); QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio); for (k = 0; k < NUM_OF_LINKS; k++) { if (++temp_delay_ser[k] >= delay_length[k]) temp_delay_ser[k] = 0; } } } for (k = 0; k < NUM_OF_LINKS; k++) ps->delay_buf_index_ser[k] = temp_delay_ser[k]; } static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) { uint8_t s, b, ifreq, qclass; real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND]; real_t new_dir_map, new_sa_map; if (ps->bs_enable_sa) { /* Instead of dequantization and mapping, we use an inverse mapping to look up all the values we need */ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++) { const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333); ifreq = sa_inv_freq[b]; qclass = (b != 0); sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass]; new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass]; k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b])); sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass]; new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass]; k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b])); } for (s = 0; s < NUM_OF_SUBSAMPLES; s++) { for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++) { QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); sa_map[b] += k_sa_map[b]; sa_dir_map[b] += k_sa_dir_map[b]; } for (b = sa_freq_scale[DRM_NUM_SA_BANDS]; b < NUM_OF_QMF_CHANNELS; b++) { QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); } } } else { for (s = 0; s < NUM_OF_SUBSAMPLES; s++) { for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) { QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); } } } } static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) { uint8_t s, b, qclass, ifreq; real_t tmp, coeff1, coeff2; real_t pan_base[MAX_PAN_BAND]; real_t pan_delta[MAX_PAN_BAND]; qmf_t temp_l, temp_r; if (ps->bs_enable_pan) { for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) { /* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an inverse mapping 64->20 and look up the 2^G(x,y) values directly */ ifreq = pan_inv_freq[b]; qclass = pan_quant_class[ifreq]; if (ps->g_prev_pan_index[ifreq] >= 0) { pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass]; } else { pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass]; } /* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */ /* a en b can be negative so we may need to inverse parts */ if (ps->g_pan_index[ifreq] >= 0) { if (ps->g_prev_pan_index[ifreq] >= 0) { pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); } else { pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); } } else { if (ps->g_prev_pan_index[ifreq] >= 0) { pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); } else { pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); } } } for (s = 0; s < NUM_OF_SUBSAMPLES; s++) { /* PAN always uses all 64 channels */ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) { tmp = pan_base[b]; coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp)); coeff1 = MUL_R(coeff2, tmp); QMF_RE(temp_l) = QMF_RE(X_left[s][b]); QMF_IM(temp_l) = QMF_IM(X_left[s][b]); QMF_RE(temp_r) = QMF_RE(X_right[s][b]); QMF_IM(temp_r) = QMF_IM(X_right[s][b]); QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1); QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1); QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2); QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2); /* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */ /* ^^^^^^^^^^^^^^^ k times */ pan_base[b] = MUL_C(pan_base[b], pan_delta[b]); } } } } drm_ps_info *drm_ps_init(void) { drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info)); memset(ps, 0, sizeof(drm_ps_info)); return ps; } void drm_ps_free(drm_ps_info *ps) { faad_free(ps); } /* main DRM PS decoding function */ uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]) { if (ps == NULL) { memcpy(X_right, X_left, sizeof(qmf_t)*30*64); return 0; } if (!ps->drm_ps_data_available && !guess) { memcpy(X_right, X_left, sizeof(qmf_t)*30*64); memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index)); memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index)); return 0; } /* if SBR CRC doesn't match out, we can assume decode errors to start with, and we'll guess what the parameters should be */ if (!guess) { ps->sa_decode_error = 0; ps->pan_decode_error = 0; drm_ps_delta_decode(ps); } else { ps->sa_decode_error = 1; ps->pan_decode_error = 1; /* don't even bother decoding */ } ps->drm_ps_data_available = 0; drm_calc_sa_side_signal(ps, X_left); drm_add_ambiance(ps, X_left, X_right); if (ps->bs_enable_sa) { ps->g_last_had_sa = 1; memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS); } else { ps->g_last_had_sa = 0; } if (ps->bs_enable_pan) { drm_add_pan(ps, X_left, X_right); ps->g_last_had_pan = 1; memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS); } else { ps->g_last_had_pan = 0; } return 0; } #endif welle.io-2.1/src/libs/faad2/libfaad/drm_dec.h000066400000000000000000000057221357201522000207220ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: drm_dec.h,v 1.8 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __DRM_DEC_H__ #define __DRM_DEC_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define DRM_PARAMETRIC_STEREO 0 #define DRM_NUM_SA_BANDS 8 #define DRM_NUM_PAN_BANDS 20 #define NUM_OF_LINKS 3 #define NUM_OF_QMF_CHANNELS 64 #define NUM_OF_SUBSAMPLES 30 #define MAX_SA_BAND 46 #define MAX_PAN_BAND 64 #define MAX_DELAY 5 typedef struct { uint8_t drm_ps_data_available; uint8_t bs_enable_sa; uint8_t bs_enable_pan; uint8_t bs_sa_dt_flag; uint8_t bs_pan_dt_flag; uint8_t g_last_had_sa; uint8_t g_last_had_pan; int8_t bs_sa_data[DRM_NUM_SA_BANDS]; int8_t bs_pan_data[DRM_NUM_PAN_BANDS]; int8_t g_sa_index[DRM_NUM_SA_BANDS]; int8_t g_pan_index[DRM_NUM_PAN_BANDS]; int8_t g_prev_sa_index[DRM_NUM_SA_BANDS]; int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS]; int8_t sa_decode_error; int8_t pan_decode_error; int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS]; int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS]; qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND]; complex_t d_buff[2][MAX_SA_BAND]; complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND]; uint8_t delay_buf_index_ser[NUM_OF_LINKS]; real_t prev_nrg[MAX_SA_BAND]; real_t prev_peakdiff[MAX_SA_BAND]; real_t peakdecay_fast[MAX_SA_BAND]; } drm_ps_info; uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld); drm_ps_info *drm_ps_init(void); void drm_ps_free(drm_ps_info *ps); uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/error.c000066400000000000000000000054111357201522000204440ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: error.c,v 1.33 2008/09/19 23:31:39 menno Exp $ **/ #include "common.h" #include "error.h" char *err_msg[] = { "No error", "Gain control not yet implemented", "Pulse coding not allowed in short blocks", "Invalid huffman codebook", "Scalefactor out of range", "Unable to find ADTS syncword", "Channel coupling not yet implemented", "Channel configuration not allowed in error resilient frame", "Bit error in error resilient scalefactor decoding", "Error decoding huffman scalefactor (bitstream error)", "Error decoding huffman codeword (bitstream error)", "Non existent huffman codebook number found", "Invalid number of channels", "Maximum number of bitstream elements exceeded", "Input data buffer too small", "Array index out of range", "Maximum number of scalefactor bands exceeded", "Quantised value out of range", "LTP lag out of range", "Invalid SBR parameter decoded", "SBR called without being initialised", "Unexpected channel configuration change", "Error in program_config_element", "First SBR frame is not the same as first AAC frame", "Unexpected fill element with SBR data", "Not all elements were provided with SBR data", "LTP decoding not available", "Output data buffer too small", "CRC error in DRM data", "PNS not allowed in DRM data stream", "No standard extension payload allowed in DRM", "PCE shall be the first element in a frame", "Bitstream value not allowed by specification", "MAIN prediction not initialised" }; welle.io-2.1/src/libs/faad2/libfaad/error.h000066400000000000000000000027011357201522000204500ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: error.h,v 1.27 2008/09/19 23:31:40 menno Exp $ **/ #ifndef __ERROR_H__ #define __ERROR_H__ #ifdef __cplusplus extern "C" { #endif #define NUM_ERROR_MESSAGES 34 extern char *err_msg[]; #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/filtbank.c000066400000000000000000000330651357201522000211130ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: filtbank.c,v 1.46 2009/01/26 23:51:15 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include #ifdef _WIN32_WCE #define assert(x) #else #include #endif #include "filtbank.h" #include "syntax.h" #include "kbd_win.h" #include "sine_win.h" #include "mdct.h" fb_info *filter_bank_init(uint16_t frame_len) { uint16_t nshort = frame_len/8; #ifdef LD_DEC uint16_t frame_len_ld = frame_len/2; #endif fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); memset(fb, 0, sizeof(fb_info)); /* normal */ fb->mdct256 = faad_mdct_init(2*nshort); fb->mdct2048 = faad_mdct_init(2*frame_len); #ifdef LD_DEC /* LD */ fb->mdct1024 = faad_mdct_init(2*frame_len_ld); #endif #ifdef ALLOW_SMALL_FRAMELENGTH if (frame_len == 1024) { #endif fb->long_window[0] = sine_long_1024; fb->short_window[0] = sine_short_128; fb->long_window[1] = kbd_long_1024; fb->short_window[1] = kbd_short_128; #ifdef LD_DEC fb->ld_window[0] = sine_mid_512; fb->ld_window[1] = ld_mid_512; #endif #ifdef ALLOW_SMALL_FRAMELENGTH } else /* (frame_len == 960) */ { fb->long_window[0] = sine_long_960; fb->short_window[0] = sine_short_120; fb->long_window[1] = kbd_long_960; fb->short_window[1] = kbd_short_120; #ifdef LD_DEC fb->ld_window[0] = sine_mid_480; fb->ld_window[1] = ld_mid_480; #endif } #endif return fb; } void filter_bank_end(fb_info *fb) { if (fb != NULL) { #ifdef PROFILE printf("FB: %I64d cycles\n", fb->cycles); #endif faad_mdct_end(fb->mdct256); faad_mdct_end(fb->mdct2048); #ifdef LD_DEC faad_mdct_end(fb->mdct1024); #endif faad_free(fb); } } static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) { #ifdef LD_DEC mdct_info *mdct = NULL; switch (len) { case 2048: case 1920: mdct = fb->mdct2048; break; case 1024: case 960: mdct = fb->mdct1024; break; } faad_imdct(mdct, in_data, out_data); #else faad_imdct(fb->mdct2048, in_data, out_data); #endif } #ifdef LTP_DEC static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) { mdct_info *mdct = NULL; switch (len) { case 2048: case 1920: mdct = fb->mdct2048; break; case 256: case 240: mdct = fb->mdct256; break; #ifdef LD_DEC case 1024: case 960: mdct = fb->mdct1024; break; #endif } faad_mdct(mdct, in_data, out_data); } #endif void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, uint8_t object_type, uint16_t frame_len) { int16_t i; ALIGN real_t transf_buf[2*1024] = {0}; const real_t *window_long = NULL; const real_t *window_long_prev = NULL; const real_t *window_short = NULL; const real_t *window_short_prev = NULL; uint16_t nlong = frame_len; uint16_t nshort = frame_len/8; uint16_t trans = nshort/2; uint16_t nflat_ls = (nlong-nshort)/2; #ifdef PROFILE int64_t count = faad_get_ts(); #endif /* select windows of current frame and previous frame (Sine or KBD) */ #ifdef LD_DEC if (object_type == LD) { window_long = fb->ld_window[window_shape]; window_long_prev = fb->ld_window[window_shape_prev]; } else { #endif window_long = fb->long_window[window_shape]; window_long_prev = fb->long_window[window_shape_prev]; window_short = fb->short_window[window_shape]; window_short_prev = fb->short_window[window_shape_prev]; #ifdef LD_DEC } #endif #if 0 for (i = 0; i < 1024; i++) { printf("%d\n", freq_in[i]); } #endif #if 0 printf("%d %d\n", window_sequence, window_shape); #endif switch (window_sequence) { case ONLY_LONG_SEQUENCE: /* perform iMDCT */ imdct_long(fb, freq_in, transf_buf, 2*nlong); /* add second half output of previous frame to windowed output of current frame */ for (i = 0; i < nlong; i+=4) { time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); } /* window the second half and save as overlap for next frame */ for (i = 0; i < nlong; i+=4) { overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]); overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]); overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]); } break; case LONG_START_SEQUENCE: /* perform iMDCT */ imdct_long(fb, freq_in, transf_buf, 2*nlong); /* add second half output of previous frame to windowed output of current frame */ for (i = 0; i < nlong; i+=4) { time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); } /* window the second half and save as overlap for next frame */ /* construct second half window using padding with 1's and 0's */ for (i = 0; i < nflat_ls; i++) overlap[i] = transf_buf[nlong+i]; for (i = 0; i < nshort; i++) overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); for (i = 0; i < nflat_ls; i++) overlap[nflat_ls+nshort+i] = 0; break; case EIGHT_SHORT_SEQUENCE: /* perform iMDCT for each short block */ faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0); faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1); faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2); faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3); faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4); faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5); faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6); faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7); /* add second half output of previous frame to windowed output of current frame */ for (i = 0; i < nflat_ls; i++) time_out[i] = overlap[i]; for(i = 0; i < nshort; i++) { time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]); time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]); time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]); time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]); if (i < trans) time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); } /* window the second half and save as overlap for next frame */ for(i = 0; i < nshort; i++) { if (i >= trans) overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]); overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]); overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]); overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]); } for (i = 0; i < nflat_ls; i++) overlap[nflat_ls+nshort+i] = 0; break; case LONG_STOP_SEQUENCE: /* perform iMDCT */ imdct_long(fb, freq_in, transf_buf, 2*nlong); /* add second half output of previous frame to windowed output of current frame */ /* construct first half window using padding with 1's and 0's */ for (i = 0; i < nflat_ls; i++) time_out[i] = overlap[i]; for (i = 0; i < nshort; i++) time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]); for (i = 0; i < nflat_ls; i++) time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i]; /* window the second half and save as overlap for next frame */ for (i = 0; i < nlong; i++) overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); break; } #if 0 for (i = 0; i < 1024; i++) { printf("%d\n", time_out[i]); //printf("0x%.8X\n", time_out[i]); } #endif #ifdef PROFILE count = faad_get_ts() - count; fb->cycles += count; #endif } #ifdef LTP_DEC /* only works for LTP -> no overlapping, no short blocks */ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, uint8_t object_type, uint16_t frame_len) { int16_t i; ALIGN real_t windowed_buf[2*1024] = {0}; const real_t *window_long = NULL; const real_t *window_long_prev = NULL; const real_t *window_short = NULL; const real_t *window_short_prev = NULL; uint16_t nlong = frame_len; uint16_t nshort = frame_len/8; uint16_t nflat_ls = (nlong-nshort)/2; assert(window_sequence != EIGHT_SHORT_SEQUENCE); #ifdef LD_DEC if (object_type == LD) { window_long = fb->ld_window[window_shape]; window_long_prev = fb->ld_window[window_shape_prev]; } else { #endif window_long = fb->long_window[window_shape]; window_long_prev = fb->long_window[window_shape_prev]; window_short = fb->short_window[window_shape]; window_short_prev = fb->short_window[window_shape_prev]; #ifdef LD_DEC } #endif switch(window_sequence) { case ONLY_LONG_SEQUENCE: for (i = nlong-1; i >= 0; i--) { windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); } mdct(fb, windowed_buf, out_mdct, 2*nlong); break; case LONG_START_SEQUENCE: for (i = 0; i < nlong; i++) windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); for (i = 0; i < nflat_ls; i++) windowed_buf[i+nlong] = in_data[i+nlong]; for (i = 0; i < nshort; i++) windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]); for (i = 0; i < nflat_ls; i++) windowed_buf[i+nlong+nflat_ls+nshort] = 0; mdct(fb, windowed_buf, out_mdct, 2*nlong); break; case LONG_STOP_SEQUENCE: for (i = 0; i < nflat_ls; i++) windowed_buf[i] = 0; for (i = 0; i < nshort; i++) windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]); for (i = 0; i < nflat_ls; i++) windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort]; for (i = 0; i < nlong; i++) windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); mdct(fb, windowed_buf, out_mdct, 2*nlong); break; } } #endif welle.io-2.1/src/libs/faad2/libfaad/filtbank.h000066400000000000000000000041101357201522000211050ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: filtbank.h,v 1.27 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __FILTBANK_H__ #define __FILTBANK_H__ #ifdef __cplusplus extern "C" { #endif fb_info *filter_bank_init(uint16_t frame_len); void filter_bank_end(fb_info *fb); #ifdef LTP_DEC void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, uint8_t object_type, uint16_t frame_len); #endif void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, uint8_t object_type, uint16_t frame_len); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/fixed.h000066400000000000000000000177771357201522000204410ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: fixed.h,v 1.32 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __FIXED_H__ #define __FIXED_H__ #ifdef __cplusplus extern "C" { #endif #if defined(_WIN32_WCE) && defined(_ARM_) #include #endif #define COEF_BITS 28 #define COEF_PRECISION (1 << COEF_BITS) #define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR #define REAL_PRECISION (1 << REAL_BITS) /* FRAC is the fractional only part of the fixed point number [0.0..1.0) */ #define FRAC_SIZE 32 /* frac is a 32 bit integer */ #define FRAC_BITS 31 #define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS)) #define FRAC_MAX 0x7FFFFFFF typedef int32_t real_t; #define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5))) #define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5))) #define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))) //#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))) #define Q2_BITS 22 #define Q2_PRECISION (1 << Q2_BITS) #define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5))) #if defined(_WIN32) && !defined(_WIN32_WCE) /* multiply with real shift */ static INLINE real_t MUL_R(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,REAL_BITS } } /* multiply with coef shift */ static INLINE real_t MUL_C(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,COEF_BITS } } static INLINE real_t MUL_Q2(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,Q2_BITS } } static INLINE real_t MUL_SHIFT6(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,6 } } static INLINE real_t MUL_SHIFT23(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,23 } } #if 1 static INLINE real_t _MulHigh(real_t A, real_t B) { _asm { mov eax,A imul B mov eax,edx } } /* multiply with fractional shift */ static INLINE real_t MUL_F(real_t A, real_t B) { return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS); } /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); } #else static INLINE real_t MUL_F(real_t A, real_t B) { _asm { mov eax,A imul B shrd eax,edx,FRAC_BITS } } /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); } #endif #elif defined(__GNUC__) && defined (__arm__) /* taken from MAD */ #define arm_mul(x, y, SCALEBITS) \ ({ \ uint32_t __hi; \ uint32_t __lo; \ uint32_t __result; \ asm("smull %0, %1, %3, %4\n\t" \ "movs %0, %0, lsr %5\n\t" \ "adc %2, %0, %1, lsl %6" \ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ : "%r" (x), "r" (y), \ "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \ : "cc"); \ __result; \ }) static INLINE real_t MUL_R(real_t A, real_t B) { return arm_mul(A, B, REAL_BITS); } static INLINE real_t MUL_C(real_t A, real_t B) { return arm_mul(A, B, COEF_BITS); } static INLINE real_t MUL_Q2(real_t A, real_t B) { return arm_mul(A, B, Q2_BITS); } static INLINE real_t MUL_SHIFT6(real_t A, real_t B) { return arm_mul(A, B, 6); } static INLINE real_t MUL_SHIFT23(real_t A, real_t B) { return arm_mul(A, B, 23); } static INLINE real_t _MulHigh(real_t x, real_t y) { uint32_t __lo; uint32_t __hi; asm("smull\t%0, %1, %2, %3" : "=&r"(__lo),"=&r"(__hi) : "%r"(x),"r"(y) : "cc"); return __hi; } static INLINE real_t MUL_F(real_t A, real_t B) { return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS); } /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { int32_t tmp, yt1, yt2; asm("smull %0, %1, %4, %6\n\t" "smlal %0, %1, %5, %7\n\t" "rsb %3, %4, #0\n\t" "smull %0, %2, %5, %6\n\t" "smlal %0, %2, %3, %7" : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1) : "3" (x1), "r" (x2), "r" (c1), "r" (c2) : "cc" ); *y1 = yt1 << (FRAC_SIZE-FRAC_BITS); *y2 = yt2 << (FRAC_SIZE-FRAC_BITS); } #else /* multiply with real shift */ #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS) /* multiply with coef shift */ #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS) /* multiply with fractional shift */ #if defined(_WIN32_WCE) && defined(_ARM_) /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */ static INLINE real_t MUL_F(real_t A, real_t B) { return _MulHigh(A,B) << (32-FRAC_BITS); } #else #ifdef __BFIN__ #define _MulHigh(X,Y) ({ int __xxo; \ asm ( \ "a1 = %2.H * %1.L (IS,M);\n\t" \ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ "a1 = a1 >>> 16;\n\t" \ "%0 = (a0 += a1);\n\t" \ : "=d" (__xxo) : "d" (X), "d" (Y) : "A0","A1"); __xxo; }) #define MUL_F(X,Y) ({ int __xxo; \ asm ( \ "a1 = %2.H * %1.L (M);\n\t" \ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (M);\n\t" \ "a1 = a1 >>> 16;\n\t" \ "%0 = (a0 += a1);\n\t" \ : "=d" (__xxo) : "d" (X), "d" (Y) : "A0","A1"); __xxo; }) #else #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE) #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS) #endif #endif #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS) #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6) #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23) /* Complex multiplication */ static INLINE void ComplexMult(real_t *y1, real_t *y2, real_t x1, real_t x2, real_t c1, real_t c2) { *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); } #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/hcr.c000066400000000000000000000405021357201522000200670ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: hcr.c,v 1.26 2009/01/26 23:51:15 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include #include "specrec.h" #include "huffman.h" /* ISO/IEC 14496-3/Amd.1 * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR) * * HCR devides the spectral data in known fixed size segments, and * sorts it by the importance of the data. The importance is firstly * the (lower) position in the spectrum, and secondly the largest * value in the used codebook. * The most important data is written at the start of each segment * (at known positions), the remaining data is interleaved inbetween, * with the writing direction alternating. * Data length is not increased. */ #ifdef ERROR_RESILIENCE /* 8.5.3.3.1 Pre-sorting */ #define NUM_CB 6 #define NUM_CB_ER 22 #define MAX_CB 32 #define VCB11_FIRST 16 #define VCB11_LAST 31 static const uint8_t PreSortCB_STD[NUM_CB] = { 11, 9, 7, 5, 3, 1}; static const uint8_t PreSortCB_ER[NUM_CB_ER] = { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1}; /* 8.5.3.3.2 Derivation of segment width */ static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49, 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41}; #define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword) /* bit-twiddling helpers */ static const uint8_t S[] = {1, 2, 4, 8, 16}; static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF}; typedef struct { uint8_t cb; uint8_t decoded; uint16_t sp_offset; bits_t bits; } codeword_t; /* rewind and reverse */ /* 32 bit version */ static uint32_t rewrev_word(uint32_t v, const uint8_t len) { /* 32 bit reverse */ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); /* shift off low bits */ v >>= (32 - len); return v; } /* 64 bit version */ static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len) { if (len <= 32) { *hi = 0; *lo = rewrev_word(*lo, len); } else { uint32_t t = *hi, v = *lo; /* double 32 bit reverse */ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]); v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]); v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]); v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]); v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]); /* last 32<>32 bit swap is implicit below */ /* shift off low bits (this is really only one 64 bit shift) */ *lo = (t >> (64 - len)) | (v << (len - 32)); *hi = v >> (64 - len); } } /* bits_t version */ static void rewrev_bits(bits_t *bits) { if (bits->len == 0) return; rewrev_lword(&bits->bufb, &bits->bufa, bits->len); } /* merge bits of a to b */ static void concat_bits(bits_t *b, bits_t *a) { uint32_t bl, bh, al, ah; if (a->len == 0) return; al = a->bufa; ah = a->bufb; if (b->len > 32) { /* maskoff superfluous high b bits */ bl = b->bufa; bh = b->bufb & ((1 << (b->len-32)) - 1); /* left shift a b->len bits */ ah = al << (b->len - 32); al = 0; } else { bl = b->bufa & ((1 << (b->len)) - 1); bh = 0; ah = (ah << (b->len)) | (al >> (32 - b->len)); al = al << b->len; } /* merge */ b->bufa = bl | al; b->bufb = bh | ah; b->len += a->len; } static uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB) { /* only want spectral data CB's */ if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST)) { if (this_CB < ESC_HCB) { /* normal codebook pairs */ return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1)); } else { /* escape codebook */ return (this_sec_CB == this_CB); } } return 0; } static void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld) { segment->len = segwidth; if (segwidth > 32) { segment->bufb = faad_getbits(ld, segwidth - 32); segment->bufa = faad_getbits(ld, 32); } else { segment->bufa = faad_getbits(ld, segwidth); segment->bufb = 0; } } static void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb) { codeword[index].sp_offset = sp; codeword[index].cb = cb; codeword[index].decoded = 0; codeword[index].bits.len = 0; } uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data) { uint16_t PCWs_done; uint16_t numberOfSegments, numberOfSets, numberOfCodewords; codeword_t codeword[512]; bits_t segment[512]; uint16_t sp_offset[8]; uint16_t g, i, sortloop, set, bitsread; uint16_t bitsleft, codewordsleft; uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB; const uint16_t nshort = hDecoder->frameLength/8; const uint16_t sp_data_len = ics->length_of_reordered_spectral_data; const uint8_t *PreSortCb; /* no data (e.g. silence) */ if (sp_data_len == 0) return 0; /* since there is spectral data, at least one codeword has nonzero length */ if (ics->length_of_longest_codeword == 0) return 10; if (sp_data_len < ics->length_of_longest_codeword) return 10; sp_offset[0] = 0; for (g = 1; g < ics->num_window_groups; g++) { sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1]; } PCWs_done = 0; numberOfSegments = 0; numberOfCodewords = 0; bitsread = 0; /* VCB11 code books in use */ if (hDecoder->aacSectionDataResilienceFlag) { PreSortCb = PreSortCB_ER; last_CB = NUM_CB_ER; } else { PreSortCb = PreSortCB_STD; last_CB = NUM_CB; } /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */ for (sortloop = 0; sortloop < last_CB; sortloop++) { /* select codebook to process this pass */ this_CB = PreSortCb[sortloop]; /* loop over sfbs */ for (sfb = 0; sfb < ics->max_sfb; sfb++) { /* loop over all in this sfb, 4 lines per loop */ for (w_idx = 0; 4*w_idx < (min(ics->swb_offset[sfb+1], ics->swb_offset_max) - ics->swb_offset[sfb]); w_idx++) { for(g = 0; g < ics->num_window_groups; g++) { for (i = 0; i < ics->num_sec[g]; i++) { /* check whether sfb used here is the one we want to process */ if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb)) { /* check whether codebook used here is the one we want to process */ this_sec_CB = ics->sect_cb[g][i]; if (is_good_cb(this_CB, this_sec_CB)) { /* precalculate some stuff */ uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb]; uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; uint16_t group_cws_count = (4*ics->window_group_length[g])/inc; uint8_t segwidth = segmentWidth(this_sec_CB); uint16_t cws; /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */ for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++) { uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count); /* read and decode PCW */ if (!PCWs_done) { /* read in normal segments */ if (bitsread + segwidth <= sp_data_len) { read_segment(&segment[numberOfSegments], segwidth, ld); bitsread += segwidth; huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]); /* keep leftover bits */ rewrev_bits(&segment[numberOfSegments]); numberOfSegments++; } else { /* remaining stuff after last segment, we unfortunately couldn't read this in earlier because it might not fit in 64 bits. since we already decoded (and removed) the PCW it is now guaranteed to fit */ if (bitsread < sp_data_len) { const uint8_t additional_bits = sp_data_len - bitsread; read_segment(&segment[numberOfSegments], additional_bits, ld); segment[numberOfSegments].len += segment[numberOfSegments-1].len; rewrev_bits(&segment[numberOfSegments]); if (segment[numberOfSegments-1].len > 32) { segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb + showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32); segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + showbits_hcr(&segment[numberOfSegments-1], 32); } else { segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len); segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb; } segment[numberOfSegments-1].len += additional_bits; } bitsread = sp_data_len; PCWs_done = 1; fill_in_codeword(codeword, 0, sp, this_sec_CB); } } else { fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB); } numberOfCodewords++; } } } } } } } } if (numberOfSegments == 0) return 10; numberOfSets = numberOfCodewords / numberOfSegments; /* step 2: decode nonPCWs */ for (set = 1; set <= numberOfSets; set++) { uint16_t trial; for (trial = 0; trial < numberOfSegments; trial++) { uint16_t codewordBase; for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++) { const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments; const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments; /* data up */ if (codeword_idx >= numberOfCodewords - numberOfSegments) break; if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0) { uint8_t tmplen; if (codeword[codeword_idx].bits.len != 0) concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits); tmplen = segment[segment_idx].len; if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx], &spectral_data[codeword[codeword_idx].sp_offset]) >= 0) { codeword[codeword_idx].decoded = 1; } else { codeword[codeword_idx].bits = segment[segment_idx]; codeword[codeword_idx].bits.len = tmplen; } } } } for (i = 0; i < numberOfSegments; i++) rewrev_bits(&segment[i]); } #if 0 // Seems to give false errors bitsleft = 0; for (i = 0; i < numberOfSegments && !bitsleft; i++) bitsleft += segment[i].len; if (bitsleft) return 10; codewordsleft = 0; for (i = 0; (i < numberOfCodewords - numberOfSegments) && (!codewordsleft); i++) if (!codeword[i].decoded) codewordsleft++; if (codewordsleft) return 10; #endif return 0; } #endif welle.io-2.1/src/libs/faad2/libfaad/huffman.c000066400000000000000000000363161357201522000207470ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: huffman.c,v 1.26 2007/11/01 12:33:30 menno Exp $ **/ #include "common.h" #include "structs.h" #include #ifdef ANALYSIS #include #endif #include "bits.h" #include "huffman.h" #include "codebook/hcb.h" /* static function declarations */ static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len); static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp); static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp); static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); static int16_t huffman_codebook(uint8_t i); static void vcb11_check_LAV(uint8_t cb, int16_t *sp); int8_t huffman_scale_factor(bitfile *ld) { uint16_t offset = 0; while (hcb_sf[offset][1]) { uint8_t b = faad_get1bit(ld DEBUGVAR(1,255,"huffman_scale_factor()")); offset += hcb_sf[offset][b]; if (offset > 240) { /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */ return -1; } } return hcb_sf[offset][0]; } hcb *hcb_table[] = { 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 }; hcb_2_quad *hcb_2_quad_table[] = { 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 }; hcb_2_pair *hcb_2_pair_table[] = { 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 }; hcb_bin_pair *hcb_bin_table[] = { 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 }; uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; /* defines whether a huffman codebook is unsigned or not */ /* Table 4.6.2 */ uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) { uint8_t i; for (i = 0; i < len; i++) { if(sp[i]) { if(faad_get1bit(ld DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) { sp[i] = -sp[i]; } } } } static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) { uint8_t neg, i; int16_t j; int16_t off; if (sp < 0) { if (sp != -16) return sp; neg = 1; } else { if (sp != 16) return sp; neg = 0; } for (i = 4; ; i++) { if (faad_get1bit(ld DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0) { break; } } off = (int16_t)faad_getbits(ld, i DEBUGVAR(1,9,"huffman_getescape(): escape")); j = off | (1< hcb_2_quad_table_size[cb]) { /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset, hcb_2_quad_table_size[cb]); */ return 10; } sp[0] = hcb_2_quad_table[cb][offset].x; sp[1] = hcb_2_quad_table[cb][offset].y; sp[2] = hcb_2_quad_table[cb][offset].v; sp[3] = hcb_2_quad_table[cb][offset].w; return 0; } static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) { uint8_t err = huffman_2step_quad(cb, ld, sp); huffman_sign_bits(ld, sp, QUAD_LEN); return err; } static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) { uint32_t cw; uint16_t offset = 0; uint8_t extra_bits; cw = faad_showbits(ld, hcbN[cb]); offset = hcb_table[cb][cw].offset; extra_bits = hcb_table[cb][cw].extra_bits; if (extra_bits) { /* we know for sure it's more than hcbN[cb] bits long */ faad_flushbits(ld, hcbN[cb]); offset += (uint16_t)faad_showbits(ld, extra_bits); faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]); } else { faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits); } if (offset > hcb_2_pair_table_size[cb]) { /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset, hcb_2_pair_table_size[cb]); */ return 10; } sp[0] = hcb_2_pair_table[cb][offset].x; sp[1] = hcb_2_pair_table[cb][offset].y; return 0; } static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) { uint8_t err = huffman_2step_pair(cb, ld, sp); huffman_sign_bits(ld, sp, PAIR_LEN); return err; } static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp) { uint16_t offset = 0; while (!hcb3[offset].is_leaf) { uint8_t b = faad_get1bit(ld DEBUGVAR(1,255,"huffman_spectral_data():3")); offset += hcb3[offset].data[b]; } if (offset > hcb_bin_table_size[cb]) { /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, hcb_bin_table_size[cb]); */ return 10; } sp[0] = hcb3[offset].data[0]; sp[1] = hcb3[offset].data[1]; sp[2] = hcb3[offset].data[2]; sp[3] = hcb3[offset].data[3]; return 0; } static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) { uint8_t err = huffman_binary_quad(cb, ld, sp); huffman_sign_bits(ld, sp, QUAD_LEN); return err; } static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp) { uint16_t offset = 0; while (!hcb_bin_table[cb][offset].is_leaf) { uint8_t b = faad_get1bit(ld DEBUGVAR(1,255,"huffman_spectral_data():9")); offset += hcb_bin_table[cb][offset].data[b]; } if (offset > hcb_bin_table_size[cb]) { /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, hcb_bin_table_size[cb]); */ return 10; } sp[0] = hcb_bin_table[cb][offset].data[0]; sp[1] = hcb_bin_table[cb][offset].data[1]; return 0; } static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) { uint8_t err = huffman_binary_pair(cb, ld, sp); huffman_sign_bits(ld, sp, PAIR_LEN); return err; } static int16_t huffman_codebook(uint8_t i) { static const uint32_t data = 16428320; if (i == 0) return (int16_t)(data >> 16) & 0xFFFF; else return (int16_t)data & 0xFFFF; } static void vcb11_check_LAV(uint8_t cb, int16_t *sp) { static const uint16_t vcb11_LAV_tab[] = { 16, 31, 47, 63, 95, 127, 159, 191, 223, 255, 319, 383, 511, 767, 1023, 2047 }; uint16_t max = 0; if (cb < 16 || cb > 31) return; max = vcb11_LAV_tab[cb - 16]; if ((abs(sp[0]) > max) || (abs(sp[1]) > max)) { sp[0] = 0; sp[1] = 0; } } uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) { switch (cb) { case 1: /* 2-step method for data quadruples */ case 2: return huffman_2step_quad(cb, ld, sp); case 3: /* binary search for data quadruples */ return huffman_binary_quad_sign(cb, ld, sp); case 4: /* 2-step method for data quadruples */ return huffman_2step_quad_sign(cb, ld, sp); case 5: /* binary search for data pairs */ return huffman_binary_pair(cb, ld, sp); case 6: /* 2-step method for data pairs */ return huffman_2step_pair(cb, ld, sp); case 7: /* binary search for data pairs */ case 9: return huffman_binary_pair_sign(cb, ld, sp); case 8: /* 2-step method for data pairs */ case 10: return huffman_2step_pair_sign(cb, ld, sp); case 12: { uint8_t err = huffman_2step_pair(11, ld, sp); sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1); return err; } case 11: { uint8_t err = huffman_2step_pair_sign(11, ld, sp); sp[0] = huffman_getescape(ld, sp[0]); sp[1] = huffman_getescape(ld, sp[1]); return err; } #ifdef ERROR_RESILIENCE /* VCB11 uses codebook 11 */ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: { uint8_t err = huffman_2step_pair_sign(11, ld, sp); sp[0] = huffman_getescape(ld, sp[0]); sp[1] = huffman_getescape(ld, sp[1]); /* check LAV (Largest Absolute Value) */ /* this finds errors in the ESCAPE signal */ vcb11_check_LAV(cb, sp); return err; } #endif default: /* Non existent codebook number, something went wrong */ return 11; } return 0; } #ifdef ERROR_RESILIENCE /* Special version of huffman_spectral_data Will not read from a bitfile but a bits_t structure. Will keep track of the bits decoded and return the number of bits remaining. Do not read more than ld->len, return -1 if codeword would be longer */ int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp) { uint32_t cw; uint16_t offset = 0; uint8_t extra_bits; uint8_t i, vcb11 = 0; switch (cb) { case 1: /* 2-step method for data quadruples */ case 2: case 4: cw = showbits_hcr(ld, hcbN[cb]); offset = hcb_table[cb][cw].offset; extra_bits = hcb_table[cb][cw].extra_bits; if (extra_bits) { /* we know for sure it's more than hcbN[cb] bits long */ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; offset += (uint16_t)showbits_hcr(ld, extra_bits); if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1; } else { if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1; } sp[0] = hcb_2_quad_table[cb][offset].x; sp[1] = hcb_2_quad_table[cb][offset].y; sp[2] = hcb_2_quad_table[cb][offset].v; sp[3] = hcb_2_quad_table[cb][offset].w; break; case 6: /* 2-step method for data pairs */ case 8: case 10: case 11: /* VCB11 uses codebook 11 */ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: if (cb >= 16) { /* store the virtual codebook */ vcb11 = cb; cb = 11; } cw = showbits_hcr(ld, hcbN[cb]); offset = hcb_table[cb][cw].offset; extra_bits = hcb_table[cb][cw].extra_bits; if (extra_bits) { /* we know for sure it's more than hcbN[cb] bits long */ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; offset += (uint16_t)showbits_hcr(ld, extra_bits); if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1; } else { if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1; } sp[0] = hcb_2_pair_table[cb][offset].x; sp[1] = hcb_2_pair_table[cb][offset].y; break; case 3: /* binary search for data quadruples */ while (!hcb3[offset].is_leaf) { uint8_t b; if ( get1bit_hcr(ld, &b) ) return -1; offset += hcb3[offset].data[b]; } sp[0] = hcb3[offset].data[0]; sp[1] = hcb3[offset].data[1]; sp[2] = hcb3[offset].data[2]; sp[3] = hcb3[offset].data[3]; break; case 5: /* binary search for data pairs */ case 7: case 9: while (!hcb_bin_table[cb][offset].is_leaf) { uint8_t b; if (get1bit_hcr(ld, &b) ) return -1; offset += hcb_bin_table[cb][offset].data[b]; } sp[0] = hcb_bin_table[cb][offset].data[0]; sp[1] = hcb_bin_table[cb][offset].data[1]; break; } /* decode sign bits */ if (unsigned_cb[cb]) { for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++) { if(sp[i]) { uint8_t b; if ( get1bit_hcr(ld, &b) ) return -1; if (b != 0) { sp[i] = -sp[i]; } } } } /* decode huffman escape bits */ if ((cb == ESC_HCB) || (cb >= 16)) { uint8_t k; for (k = 0; k < 2; k++) { if ((sp[k] == 16) || (sp[k] == -16)) { uint8_t neg, i; int32_t j; uint32_t off; neg = (sp[k] < 0) ? 1 : 0; for (i = 4; ; i++) { uint8_t b; if (get1bit_hcr(ld, &b)) return -1; if (b == 0) break; } if (getbits_hcr(ld, i, &off)) return -1; j = off + (1<len; } #endif welle.io-2.1/src/libs/faad2/libfaad/huffman.h000066400000000000000000000031441357201522000207450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: huffman.h,v 1.28 2007/11/01 12:33:30 menno Exp $ **/ #ifndef __HUFFMAN_H__ #define __HUFFMAN_H__ #ifdef __cplusplus extern "C" { #endif int8_t huffman_scale_factor(bitfile *ld); uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp); #ifdef ERROR_RESILIENCE int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp); #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ic_predict.c000066400000000000000000000153531357201522000214260ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ic_predict.c,v 1.28 2007/11/01 12:33:31 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef MAIN_DEC #include "syntax.h" #include "ic_predict.h" #include "pns.h" static void flt_round(float32_t *pf) { int32_t flg; uint32_t tmp, tmp1, tmp2; tmp = *(uint32_t*)pf; flg = tmp & (uint32_t)0x00008000; tmp &= (uint32_t)0xffff0000; tmp1 = tmp; /* round 1/2 lsb toward infinity */ if (flg) { tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ tmp |= (uint32_t)0x00010000; /* insert 1 lsb */ tmp2 = tmp; /* add 1 lsb and elided one */ tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ *pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp; } else { *pf = *(float32_t*)&tmp; } } static int16_t quant_pred(float32_t x) { int16_t q; uint32_t *tmp = (uint32_t*)&x; q = (int16_t)(*tmp>>16); return q; } static float32_t inv_quant_pred(int16_t q) { float32_t x; uint32_t *tmp = (uint32_t*)&x; *tmp = ((uint32_t)q)<<16; return x; } static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred) { uint16_t tmp; int16_t i, j; real_t dr1; float32_t predictedvalue; real_t e0, e1; real_t k1, k2; real_t r[2]; real_t COR[2]; real_t VAR[2]; r[0] = inv_quant_pred(state->r[0]); r[1] = inv_quant_pred(state->r[1]); COR[0] = inv_quant_pred(state->COR[0]); COR[1] = inv_quant_pred(state->COR[1]); VAR[0] = inv_quant_pred(state->VAR[0]); VAR[1] = inv_quant_pred(state->VAR[1]); #if 1 tmp = state->VAR[0]; j = (tmp >> 7); i = tmp & 0x7f; if (j >= 128) { j -= 128; k1 = COR[0] * exp_table[j] * mnt_table[i]; } else { k1 = REAL_CONST(0); } #else { #define B 0.953125 real_t c = COR[0]; real_t v = VAR[0]; float32_t tmp; if (c == 0 || v <= 1) { k1 = 0; } else { tmp = B / v; flt_round(&tmp); k1 = c * tmp; } } #endif if (pred) { #if 1 tmp = state->VAR[1]; j = (tmp >> 7); i = tmp & 0x7f; if (j >= 128) { j -= 128; k2 = COR[1] * exp_table[j] * mnt_table[i]; } else { k2 = REAL_CONST(0); } #else #define B 0.953125 real_t c = COR[1]; real_t v = VAR[1]; float32_t tmp; if (c == 0 || v <= 1) { k2 = 0; } else { tmp = B / v; flt_round(&tmp); k2 = c * tmp; } #endif predictedvalue = k1*r[0] + k2*r[1]; flt_round(&predictedvalue); *output = input + predictedvalue; } /* calculate new state data */ e0 = *output; e1 = e0 - k1*r[0]; dr1 = k1*e0; VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0); COR[0] = ALPHA*COR[0] + r[0]*e0; VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1); COR[1] = ALPHA*COR[1] + r[1]*e1; r[1] = A * (r[0]-dr1); r[0] = A * e0; state->r[0] = quant_pred(r[0]); state->r[1] = quant_pred(r[1]); state->COR[0] = quant_pred(COR[0]); state->COR[1] = quant_pred(COR[1]); state->VAR[0] = quant_pred(VAR[0]); state->VAR[1] = quant_pred(VAR[1]); } static void reset_pred_state(pred_state *state) { state->r[0] = 0; state->r[1] = 0; state->COR[0] = 0; state->COR[1] = 0; state->VAR[0] = 0x3F80; state->VAR[1] = 0x3F80; } void pns_reset_pred_state(ic_stream *ics, pred_state *state) { uint8_t sfb, g, b; uint16_t i, offs, offs2; /* prediction only for long blocks */ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) return; for (g = 0; g < ics->num_window_groups; g++) { for (b = 0; b < ics->window_group_length[g]; b++) { for (sfb = 0; sfb < ics->max_sfb; sfb++) { if (is_noise(ics, g, sfb)) { offs = ics->swb_offset[sfb]; offs2 = min(ics->swb_offset[sfb+1], ics->swb_offset_max); for (i = offs; i < offs2; i++) reset_pred_state(&state[i]); } } } } } void reset_all_predictors(pred_state *state, uint16_t frame_len) { uint16_t i; for (i = 0; i < frame_len; i++) reset_pred_state(&state[i]); } /* intra channel prediction */ void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, uint16_t frame_len, uint8_t sf_index) { uint8_t sfb; uint16_t bin; if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { reset_all_predictors(state, frame_len); } else { for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++) { uint16_t low = ics->swb_offset[sfb]; uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max); for (bin = low; bin < high; bin++) { ic_predict(&state[bin], spec[bin], &spec[bin], (ics->predictor_data_present && ics->pred.prediction_used[sfb])); } } if (ics->predictor_data_present) { if (ics->pred.predictor_reset) { for (bin = ics->pred.predictor_reset_group_number - 1; bin < frame_len; bin += 30) { reset_pred_state(&state[bin]); } } } } } #endif welle.io-2.1/src/libs/faad2/libfaad/ic_predict.h000066400000000000000000000341231357201522000214270ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ic_predict.h,v 1.23 2007/11/01 12:33:31 menno Exp $ **/ #ifdef MAIN_DEC #ifndef __IC_PREDICT_H__ #define __IC_PREDICT_H__ #ifdef __cplusplus extern "C" { #endif #define ALPHA REAL_CONST(0.90625) #define A REAL_CONST(0.953125) void pns_reset_pred_state(ic_stream *ics, pred_state *state); void reset_all_predictors(pred_state *state, uint16_t frame_len); void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, uint16_t frame_len, uint8_t sf_index); ALIGN static const real_t mnt_table[128] = { COEF_CONST(0.9531250000), COEF_CONST(0.9453125000), COEF_CONST(0.9375000000), COEF_CONST(0.9296875000), COEF_CONST(0.9257812500), COEF_CONST(0.9179687500), COEF_CONST(0.9101562500), COEF_CONST(0.9023437500), COEF_CONST(0.8984375000), COEF_CONST(0.8906250000), COEF_CONST(0.8828125000), COEF_CONST(0.8789062500), COEF_CONST(0.8710937500), COEF_CONST(0.8671875000), COEF_CONST(0.8593750000), COEF_CONST(0.8515625000), COEF_CONST(0.8476562500), COEF_CONST(0.8398437500), COEF_CONST(0.8359375000), COEF_CONST(0.8281250000), COEF_CONST(0.8242187500), COEF_CONST(0.8203125000), COEF_CONST(0.8125000000), COEF_CONST(0.8085937500), COEF_CONST(0.8007812500), COEF_CONST(0.7968750000), COEF_CONST(0.7929687500), COEF_CONST(0.7851562500), COEF_CONST(0.7812500000), COEF_CONST(0.7773437500), COEF_CONST(0.7734375000), COEF_CONST(0.7656250000), COEF_CONST(0.7617187500), COEF_CONST(0.7578125000), COEF_CONST(0.7539062500), COEF_CONST(0.7500000000), COEF_CONST(0.7421875000), COEF_CONST(0.7382812500), COEF_CONST(0.7343750000), COEF_CONST(0.7304687500), COEF_CONST(0.7265625000), COEF_CONST(0.7226562500), COEF_CONST(0.7187500000), COEF_CONST(0.7148437500), COEF_CONST(0.7109375000), COEF_CONST(0.7070312500), COEF_CONST(0.6992187500), COEF_CONST(0.6953125000), COEF_CONST(0.6914062500), COEF_CONST(0.6875000000), COEF_CONST(0.6835937500), COEF_CONST(0.6796875000), COEF_CONST(0.6796875000), COEF_CONST(0.6757812500), COEF_CONST(0.6718750000), COEF_CONST(0.6679687500), COEF_CONST(0.6640625000), COEF_CONST(0.6601562500), COEF_CONST(0.6562500000), COEF_CONST(0.6523437500), COEF_CONST(0.6484375000), COEF_CONST(0.6445312500), COEF_CONST(0.6406250000), COEF_CONST(0.6406250000), COEF_CONST(0.6367187500), COEF_CONST(0.6328125000), COEF_CONST(0.6289062500), COEF_CONST(0.6250000000), COEF_CONST(0.6210937500), COEF_CONST(0.6210937500), COEF_CONST(0.6171875000), COEF_CONST(0.6132812500), COEF_CONST(0.6093750000), COEF_CONST(0.6054687500), COEF_CONST(0.6054687500), COEF_CONST(0.6015625000), COEF_CONST(0.5976562500), COEF_CONST(0.5937500000), COEF_CONST(0.5937500000), COEF_CONST(0.5898437500), COEF_CONST(0.5859375000), COEF_CONST(0.5820312500), COEF_CONST(0.5820312500), COEF_CONST(0.5781250000), COEF_CONST(0.5742187500), COEF_CONST(0.5742187500), COEF_CONST(0.5703125000), COEF_CONST(0.5664062500), COEF_CONST(0.5664062500), COEF_CONST(0.5625000000), COEF_CONST(0.5585937500), COEF_CONST(0.5585937500), COEF_CONST(0.5546875000), COEF_CONST(0.5507812500), COEF_CONST(0.5507812500), COEF_CONST(0.5468750000), COEF_CONST(0.5429687500), COEF_CONST(0.5429687500), COEF_CONST(0.5390625000), COEF_CONST(0.5390625000), COEF_CONST(0.5351562500), COEF_CONST(0.5312500000), COEF_CONST(0.5312500000), COEF_CONST(0.5273437500), COEF_CONST(0.5273437500), COEF_CONST(0.5234375000), COEF_CONST(0.5195312500), COEF_CONST(0.5195312500), COEF_CONST(0.5156250000), COEF_CONST(0.5156250000), COEF_CONST(0.5117187500), COEF_CONST(0.5117187500), COEF_CONST(0.5078125000), COEF_CONST(0.5078125000), COEF_CONST(0.5039062500), COEF_CONST(0.5039062500), COEF_CONST(0.5000000000), COEF_CONST(0.4980468750), COEF_CONST(0.4960937500), COEF_CONST(0.4941406250), COEF_CONST(0.4921875000), COEF_CONST(0.4902343750), COEF_CONST(0.4882812500), COEF_CONST(0.4863281250), COEF_CONST(0.4843750000), COEF_CONST(0.4824218750), COEF_CONST(0.4804687500), COEF_CONST(0.4785156250) }; ALIGN static const real_t exp_table[128] = { COEF_CONST(0.50000000000000000000000000000000000000000000000000), COEF_CONST(0.25000000000000000000000000000000000000000000000000), COEF_CONST(0.12500000000000000000000000000000000000000000000000), COEF_CONST(0.06250000000000000000000000000000000000000000000000), COEF_CONST(0.03125000000000000000000000000000000000000000000000), COEF_CONST(0.01562500000000000000000000000000000000000000000000), COEF_CONST(0.00781250000000000000000000000000000000000000000000), COEF_CONST(0.00390625000000000000000000000000000000000000000000), COEF_CONST(0.00195312500000000000000000000000000000000000000000), COEF_CONST(0.00097656250000000000000000000000000000000000000000), COEF_CONST(0.00048828125000000000000000000000000000000000000000), COEF_CONST(0.00024414062500000000000000000000000000000000000000), COEF_CONST(0.00012207031250000000000000000000000000000000000000), COEF_CONST(0.00006103515625000000000000000000000000000000000000), COEF_CONST(0.00003051757812500000000000000000000000000000000000), COEF_CONST(0.00001525878906250000000000000000000000000000000000), COEF_CONST(0.00000762939453125000000000000000000000000000000000), COEF_CONST(0.00000381469726562500000000000000000000000000000000), COEF_CONST(0.00000190734863281250000000000000000000000000000000), COEF_CONST(0.00000095367431640625000000000000000000000000000000), COEF_CONST(0.00000047683715820312500000000000000000000000000000), COEF_CONST(0.00000023841857910156250000000000000000000000000000), COEF_CONST(0.00000011920928955078125000000000000000000000000000), COEF_CONST(0.00000005960464477539062500000000000000000000000000), COEF_CONST(0.00000002980232238769531300000000000000000000000000), COEF_CONST(0.00000001490116119384765600000000000000000000000000), COEF_CONST(0.00000000745058059692382810000000000000000000000000), COEF_CONST(0.00000000372529029846191410000000000000000000000000), COEF_CONST(0.00000000186264514923095700000000000000000000000000), COEF_CONST(0.00000000093132257461547852000000000000000000000000), COEF_CONST(0.00000000046566128730773926000000000000000000000000), COEF_CONST(0.00000000023283064365386963000000000000000000000000), COEF_CONST(0.00000000011641532182693481000000000000000000000000), COEF_CONST(0.00000000005820766091346740700000000000000000000000), COEF_CONST(0.00000000002910383045673370400000000000000000000000), COEF_CONST(0.00000000001455191522836685200000000000000000000000), COEF_CONST(0.00000000000727595761418342590000000000000000000000), COEF_CONST(0.00000000000363797880709171300000000000000000000000), COEF_CONST(0.00000000000181898940354585650000000000000000000000), COEF_CONST(0.00000000000090949470177292824000000000000000000000), COEF_CONST(0.00000000000045474735088646412000000000000000000000), COEF_CONST(0.00000000000022737367544323206000000000000000000000), COEF_CONST(0.00000000000011368683772161603000000000000000000000), COEF_CONST(0.00000000000005684341886080801500000000000000000000), COEF_CONST(0.00000000000002842170943040400700000000000000000000), COEF_CONST(0.00000000000001421085471520200400000000000000000000), COEF_CONST(0.00000000000000710542735760100190000000000000000000), COEF_CONST(0.00000000000000355271367880050090000000000000000000), COEF_CONST(0.00000000000000177635683940025050000000000000000000), COEF_CONST(0.00000000000000088817841970012523000000000000000000), COEF_CONST(0.00000000000000044408920985006262000000000000000000), COEF_CONST(0.00000000000000022204460492503131000000000000000000), COEF_CONST(0.00000000000000011102230246251565000000000000000000), COEF_CONST(0.00000000000000005551115123125782700000000000000000), COEF_CONST(0.00000000000000002775557561562891400000000000000000), COEF_CONST(0.00000000000000001387778780781445700000000000000000), COEF_CONST(0.00000000000000000693889390390722840000000000000000), COEF_CONST(0.00000000000000000346944695195361420000000000000000), COEF_CONST(0.00000000000000000173472347597680710000000000000000), COEF_CONST(0.00000000000000000086736173798840355000000000000000), COEF_CONST(0.00000000000000000043368086899420177000000000000000), COEF_CONST(0.00000000000000000021684043449710089000000000000000), COEF_CONST(0.00000000000000000010842021724855044000000000000000), COEF_CONST(0.00000000000000000005421010862427522200000000000000), COEF_CONST(0.00000000000000000002710505431213761100000000000000), COEF_CONST(0.00000000000000000001355252715606880500000000000000), COEF_CONST(0.00000000000000000000677626357803440270000000000000), COEF_CONST(0.00000000000000000000338813178901720140000000000000), COEF_CONST(0.00000000000000000000169406589450860070000000000000), COEF_CONST(0.00000000000000000000084703294725430034000000000000), COEF_CONST(0.00000000000000000000042351647362715017000000000000), COEF_CONST(0.00000000000000000000021175823681357508000000000000), COEF_CONST(0.00000000000000000000010587911840678754000000000000), COEF_CONST(0.00000000000000000000005293955920339377100000000000), COEF_CONST(0.00000000000000000000002646977960169688600000000000), COEF_CONST(0.00000000000000000000001323488980084844300000000000), COEF_CONST(0.00000000000000000000000661744490042422140000000000), COEF_CONST(0.00000000000000000000000330872245021211070000000000), COEF_CONST(0.00000000000000000000000165436122510605530000000000), COEF_CONST(0.00000000000000000000000082718061255302767000000000), COEF_CONST(0.00000000000000000000000041359030627651384000000000), COEF_CONST(0.00000000000000000000000020679515313825692000000000), COEF_CONST(0.00000000000000000000000010339757656912846000000000), COEF_CONST(0.00000000000000000000000005169878828456423000000000), COEF_CONST(0.00000000000000000000000002584939414228211500000000), COEF_CONST(0.00000000000000000000000001292469707114105700000000), COEF_CONST(0.00000000000000000000000000646234853557052870000000), COEF_CONST(0.00000000000000000000000000323117426778526440000000), COEF_CONST(0.00000000000000000000000000161558713389263220000000), COEF_CONST(0.00000000000000000000000000080779356694631609000000), COEF_CONST(0.00000000000000000000000000040389678347315804000000), COEF_CONST(0.00000000000000000000000000020194839173657902000000), COEF_CONST(0.00000000000000000000000000010097419586828951000000), COEF_CONST(0.00000000000000000000000000005048709793414475600000), COEF_CONST(0.00000000000000000000000000002524354896707237800000), COEF_CONST(0.00000000000000000000000000001262177448353618900000), COEF_CONST(0.00000000000000000000000000000631088724176809440000), COEF_CONST(0.00000000000000000000000000000315544362088404720000), COEF_CONST(0.00000000000000000000000000000157772181044202360000), COEF_CONST(0.00000000000000000000000000000078886090522101181000), COEF_CONST(0.00000000000000000000000000000039443045261050590000), COEF_CONST(0.00000000000000000000000000000019721522630525295000), COEF_CONST(0.00000000000000000000000000000009860761315262647600), COEF_CONST(0.00000000000000000000000000000004930380657631323800), COEF_CONST(0.00000000000000000000000000000002465190328815661900), COEF_CONST(0.00000000000000000000000000000001232595164407830900), COEF_CONST(0.00000000000000000000000000000000616297582203915470), COEF_CONST(0.00000000000000000000000000000000308148791101957740), COEF_CONST(0.00000000000000000000000000000000154074395550978870), COEF_CONST(0.00000000000000000000000000000000077037197775489434), COEF_CONST(0.00000000000000000000000000000000038518598887744717), COEF_CONST(0.00000000000000000000000000000000019259299443872359), COEF_CONST(0.00000000000000000000000000000000009629649721936179), COEF_CONST(0.00000000000000000000000000000000004814824860968090), COEF_CONST(0.00000000000000000000000000000000002407412430484045), COEF_CONST(0.00000000000000000000000000000000001203706215242022), COEF_CONST(0.00000000000000000000000000000000000601853107621011), COEF_CONST(0.00000000000000000000000000000000000300926553810506), COEF_CONST(0.00000000000000000000000000000000000150463276905253), COEF_CONST(0.00000000000000000000000000000000000075231638452626), COEF_CONST(0.00000000000000000000000000000000000037615819226313), COEF_CONST(0.00000000000000000000000000000000000018807909613157), COEF_CONST(0.00000000000000000000000000000000000009403954806578), COEF_CONST(0.00000000000000000000000000000000000004701977403289), COEF_CONST(0.00000000000000000000000000000000000002350988701645), COEF_CONST(0.00000000000000000000000000000000000001175494350822), COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */), COEF_CONST(0.0) }; #ifdef __cplusplus } #endif #endif #endif welle.io-2.1/src/libs/faad2/libfaad/iq_table.h000066400000000000000000020001171357201522000211000ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: iq_table.h,v 1.20 2007/11/01 12:33:31 menno Exp $ **/ #ifndef IQ_TABLE_H__ #define IQ_TABLE_H__ #ifdef __cplusplus extern "C" { #endif /* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */ #ifndef FIXED_POINT #define IQ_TABLE_SIZE 8192 #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = { 0, 1, 2.5198420997897464, 4.3267487109222245, 6.3496042078727974, 8.5498797333834844, 10.902723556992836, 13.390518279406722, 15.999999999999998, 18.720754407467133, 21.544346900318832, 24.463780996262464, 27.47314182127996, 30.567350940369842, 33.741991698453212, 36.993181114957046, 40.317473596635935, 43.711787041189993, 47.173345095760126, 50.699631325716943, 54.288352331898118, 57.937407704003519, 61.6448652744185, 65.408940536585988, 69.227979374755591, 73.100443455321638, 77.024897778591622, 80.999999999999986, 85.024491212518527, 89.097187944889555, 93.216975178615741, 97.382800224133163, 101.59366732596474, 105.84863288986224, 110.14680124343441, 114.4873208566006, 118.86938096020653, 123.29220851090024, 127.75506545836058, 132.25724627755247, 136.79807573413572, 141.37690685569191, 145.99311908523086, 150.6461165966291, 155.33532675434674, 160.06019870205279, 164.82020206673349, 169.61482576651861, 174.44357691188537, 179.30597979112557, 184.20157493201927, 189.12991823257562, 194.09058015449685, 199.08314497371677, 204.1072100829694, 209.16238534187647, 214.24829247050752, 219.36456448277784, 224.51084515641216, 229.6867885365223, 234.89205847013176, 240.12632816923249, 245.38927980018505, 250.68060409747261, 255.99999999999991, 261.34717430828869, 266.72184136106449, 272.12372272986045, 277.55254693037961, 283.0080491494619, 288.48997098659891, 293.99806020902247, 299.53207051947408, 305.0917613358298, 310.67689758182206, 316.28724948815585, 321.92259240337177, 327.58270661385535, 333.26737717243742, 338.97639373507025, 344.70955040510125, 350.46664558470013, 356.24748183302603, 362.05186573075139, 367.87960775058258, 373.73052213344511, 379.60442677002078, 385.50114308734607, 391.42049594019937, 397.36231350702371, 403.32642719014467, 409.31267152006262, 415.32088406360799, 421.35090533576471, 427.40257871497619, 433.4757503617617, 439.5702691404793, 445.68598654408271, 451.82275662172759, 457.98043590909128, 464.15888336127773, 470.35796028818726, 476.5775302922363, 482.81745920832043, 489.07761504591741, 495.35786793323581, 501.65809006331688, 507.97815564200368, 514.31794083769648, 520.67732373281672, 527.05618427690604, 533.45440424129174, 539.87186717525128, 546.30845836361505, 552.76406478574609, 559.23857507584194, 565.73187948450413, 572.24386984152341, 578.77443951983378, 585.32348340058843, 591.89089783931263, 598.47658063309257, 605.08043098876044, 611.70234949203643, 618.3422380775919, 624.99999999999977, 631.67553980553748, 638.36876330481164, 645.07957754617485, 651.80789078990415, 658.55361248311499, 665.31665323538357, 672.09692479505225, 678.8943400261943, 685.70881288621433, 692.540258404062, 699.38859265903977, 706.25373276018058, 713.13559682617972, 720.03410396586037, 726.94917425915435, 733.88072873858209, 740.82868937121543, 747.79297904110535, 754.77352153216191, 761.77024151147043, 768.78306451302956, 775.81191692189896, 782.85672595874246, 789.91741966475445, 796.99392688695798, 804.08617726386274, 811.19410121147098, 818.31762990962227, 825.45669528866563, 832.61123001644864, 839.78116748561604, 846.96644180120552, 854.16698776853514, 861.38274088137143, 868.61363731036977, 875.85961389178203, 883.12060811641959, 890.39655811886757, 897.68740266694181, 904.99308115138172, 912.31353357577188, 919.64870054668756, 926.99852326405619, 934.36294351172899, 941.74190364825859, 949.13534659787422, 956.54321584165211, 963.96545540887348, 971.40200986856541, 978.85282432122176, 986.31784439069588, 993.7970162162635, 1001.29028644485, 1008.797602223418, 1016.3189111915103, 1023.8541614739464, 1031.4033016736653, 1038.9662808647138, 1046.5430485853758, 1054.1335548314366, 1061.7377500495838, 1069.3555851309357, 1076.9870114046978, 1084.6319806319441, 1092.2904449995174, 1099.9623571140482, 1107.6476699960892, 1115.3463370743607, 1123.058312180106, 1130.7835495415541, 1138.5220037784854, 1146.273629896901, 1154.0383832837879, 1161.816219701986, 1169.607095285146, 1177.4109665327808, 1185.2277903054078, 1193.0575238197798, 1200.9001246442001, 1208.7555506939248, 1216.6237602266442, 1224.5047118380478, 1232.3983644574657, 1240.3046773435874, 1248.2236100802568, 1256.1551225723395, 1264.099175041662, 1272.0557280230228, 1280.0247423602691, 1288.0061792024444, 1295.9999999999995, 1304.006166501068, 1312.0246407478062, 1320.0553850727929, 1328.0983620954903, 1336.1535347187651, 1344.2208661254647, 1352.3003197750522, 1360.3918594002962, 1368.4954490040145, 1376.6110528558709, 1384.7386354892244, 1392.8781616980295, 1401.0295965337855, 1409.1929053025353, 1417.3680535619119, 1425.5550071182327, 1433.7537320236374, 1441.9641945732744, 1450.1863613025282, 1458.4201989842913, 1466.6656746262797, 1474.9227554683875, 1483.1914089800841, 1491.4716028578516, 1499.7633050226596, 1508.0664836174794, 1516.3811070048375, 1524.7071437644029, 1533.0445626906128, 1541.3933327903342, 1549.7534232805581, 1558.1248035861302, 1566.507443337515, 1574.9013123685909, 1583.3063807144795, 1591.7226186094069, 1600.1499964845941, 1608.58848496618, 1617.0380548731737, 1625.4986772154357, 1633.9703231916887, 1642.4529641875577, 1650.9465717736346, 1659.4511177035752, 1667.9665739122186, 1676.4929125137353, 1685.030105799801, 1693.5781262377957, 1702.136946469027, 1710.7065393069795, 1719.2868777355877, 1727.8779349075323, 1736.4796841425596, 1745.092098925825, 1753.7151529062583, 1762.3488198949503, 1770.9930738635628, 1779.6478889427597, 1788.3132394206564, 1796.9890997412947, 1805.6754445031333, 1814.3722484575621, 1823.0794865074322, 1831.7971337056094, 1840.5251652535437, 1849.2635564998579, 1858.0122829389563, 1866.7713202096493, 1875.5406440937966, 1884.3202305149687, 1893.110055537124, 1901.9100953633042, 1910.7203263343454, 1919.5407249276057, 1928.3712677557098, 1937.2119315653083, 1946.0626932358525, 1954.923529778386, 1963.79441833435, 1972.6753361744036, 1981.5662606972594, 1990.467169428533, 1999.3780400196069, 2008.2988502465078, 2017.2295780087982, 2026.1702013284819, 2035.1206983489212, 2044.0810473337688, 2053.0512266659125, 2062.0312148464309, 2071.0209904935646, 2080.0205323416958, 2089.0298192403443, 2098.0488301531714, 2107.0775441569995, 2116.115940440839, 2125.1639983049317, 2134.2216971597995, 2143.2890165253098, 2152.3659360297484, 2161.4524354089031, 2170.5484945051617, 2179.6540932666144, 2188.7692117461711, 2197.8938301006888, 2207.0279285901042, 2216.1714875765838, 2225.324487523676, 2234.4869089954782, 2243.6587326558101, 2252.8399392673982, 2262.0305096910702, 2271.2304248849537, 2280.4396659036897, 2289.6582138976523, 2298.8860501121762, 2308.1231558867926, 2317.3695126544767, 2326.6251019409005, 2335.8899053636933, 2345.1639046317132, 2354.4470815443233, 2363.7394179906792, 2373.0408959490205, 2382.3514974859731, 2391.6712047558558, 2400.9999999999991, 2410.3378655460651, 2419.6847838073813, 2429.0407372822747, 2438.4057085534191, 2447.7796802871858, 2457.1626352330004, 2466.5545562227112, 2475.9554261699564, 2485.3652280695474, 2494.7839449968492, 2504.2115601071737, 2513.6480566351788, 2523.0934178942675, 2532.5476272760025, 2542.0106682495189, 2551.482524360948, 2560.9631792328441, 2570.4526165636184, 2579.9508201269791, 2589.4577737713744, 2598.9734614194458, 2608.4978670674823, 2618.0309747848837, 2627.5727687136259, 2637.1232330677353, 2646.6823521327647, 2656.2501102652768, 2665.8264918923328, 2675.4114815109842, 2685.0050636877722, 2694.6072230582295, 2704.2179443263894, 2713.8372122642972, 2723.4650117115279, 2733.1013275747096, 2742.7461448270483, 2752.3994485078601, 2762.0612237221085, 2771.7314556399419, 2781.4101294962406, 2791.0972305901655, 2800.7927442847094, 2810.4966560062589, 2820.2089512441521, 2829.9296155502466, 2839.6586345384894, 2849.3959938844923, 2859.1416793251065, 2868.8956766580086, 2878.6579717412847, 2888.4285504930212, 2898.2073988908974, 2907.9945029717837, 2917.789848831344, 2927.5934226236377, 2937.4052105607311, 2947.2251989123079, 2957.0533740052865, 2966.8897222234368, 2976.734230007005, 2986.5868838523397, 2996.4476703115197, 3006.3165759919889, 3016.1935875561908, 3026.0786917212095, 3035.9718752584108, 3045.8731249930906, 3055.7824278041207, 3065.6997706236039, 3075.625140436528, 3085.5585242804245, 3095.4999092450298, 3105.4492824719491, 3115.4066311543256, 3125.3719425365089, 3135.3452039137287, 3145.3264026317715, 3155.3155260866592, 3165.3125617243295, 3175.3174970403229, 3185.3303195794679, 3195.35101693557, 3205.3795767511078, 3215.4159867169251, 3225.460234571929, 3235.5123081027928, 3245.5721951436558, 3255.63988357583, 3265.7153613275095, 3275.7986163734795, 3285.8896367348289, 3295.9884104786665, 3306.0949257178395, 3316.2091706106517, 3326.331133360588, 3336.4608022160378, 3346.5981654700231, 3356.7432114599264, 3366.8959285672249, 3377.0563052172211, 3387.2243298787821, 3397.3999910640764, 3407.5832773283128, 3417.7741772694862, 3427.9726795281199, 3438.1787727870123, 3448.3924457709873, 3458.6136872466445, 3468.8424860221107, 3479.0788309467976, 3489.3227109111554, 3499.5741148464344, 3509.8330317244445, 3520.0994505573185, 3530.3733603972751, 3540.6547503363886, 3550.9436095063534, 3561.239927078258, 3571.5436922623535, 3581.8548943078308, 3592.1735225025936, 3602.4995661730372, 3612.8330146838275, 3623.1738574376814, 3633.5220838751502, 3643.8776834744031, 3654.2406457510142, 3664.6109602577494, 3674.9886165843564, 3685.3736043573545, 3695.7659132398294, 3706.1655329312248, 3716.5724531671399, 3726.9866637191262, 3737.4081543944876, 3747.8369150360782, 3758.2729355221072, 3768.7162057659411, 3779.1667157159077, 3789.6244553551055, 3800.0894147012082, 3810.5615838062768, 3821.0409527565694, 3831.5275116723533, 3842.0212507077194, 3852.522160050396, 3863.0302299215673, 3873.5454505756893, 3884.0678123003108, 3894.5973054158922, 3905.1339202756285, 3915.6776472652732, 3926.2284768029604, 3936.7863993390338, 3947.3514053558706, 3957.9234853677135, 3968.5026299204969, 3979.0888295916798, 3989.6820749900776, 4000.2823567556948, 4010.8896655595613, 4021.5039921035655, 4032.1253271202945, 4042.7536613728694, 4053.3889856547858, 4064.0312907897551, 4074.6805676315448, 4085.3368070638221, 4095.9999999999982, 4106.6701373830711, 4117.347210185475, 4128.0312094089259, 4138.722126084268, 4149.4199512713267, 4160.1246760587583, 4170.8362915638982, 4181.5547889326181, 4192.2801593391769, 4203.0123939860741, 4213.7514841039101, 4224.4974209512384, 4235.2501958144258, 4246.0098000075095, 4256.7762248720574, 4267.549461777031, 4278.3295021186423, 4289.1163373202198, 4299.9099588320714, 4310.7103581313495, 4321.5175267219138, 4332.3314561342004, 4343.152137925088, 4353.9795636777671, 4364.8137250016052, 4375.6546135320223, 4386.5022209303588, 4397.3565388837469, 4408.2175591049827, 4419.0852733324018, 4429.9596733297531, 4440.8407508860728, 4451.7284978155603, 4462.6229059574571, 4473.5239671759227, 4484.4316733599126, 4495.3460164230582, 4506.2669883035496, 4517.1945809640119, 4528.1287863913894, 4539.069596596828, 4550.0170036155587, 4560.9709995067806, 4571.931576353546, 4582.898726262647, 4593.8724413645004, 4604.8527138130348, 4615.8395357855816, 4626.8328994827571, 4637.8327971283588, 4648.8392209692511, 4659.8521632752563, 4670.8716163390473, 4681.8975724760394, 4692.9300240242837, 4703.9689633443595, 4715.0143828192668, 4726.0662748543255, 4737.1246318770682, 4748.1894463371373, 4759.2607107061804, 4770.3384174777493, 4781.4225591671993, 4792.5131283115852, 4803.6101174695614, 4814.7135192212854, 4825.8233261683154, 4836.9395309335096, 4848.0621261609349, 4859.1911045157631, 4870.3264586841779, 4881.4681813732768, 4892.6162653109768, 4903.7707032459193, 4914.931487947375, 4926.0986122051509, 4937.2720688294967, 4948.4518506510112, 4959.637950520555, 4970.8303613091521, 4982.0290759079044, 4993.2340872278974, 5004.4453882001153, 5015.6629717753467, 5026.8868309241007, 5038.1169586365131, 5049.353347922266, 5060.5959918104927, 5071.8448833496996, 5083.1000156076734, 5094.3613816713996, 5105.6289746469747, 5116.9027876595246, 5128.18281385312, 5139.4690463906918, 5150.7614784539473, 5162.0601032432933, 5173.3649139777472, 5184.6759038948594, 5195.9930662506322, 5207.3163943194386, 5218.6458813939435, 5229.9815207850224, 5241.3233058216847, 5252.6712298509919, 5264.025286237983, 5275.3854683655954, 5286.7517696345885, 5298.1241834634639, 5309.5027032883945, 5320.887322563146, 5332.2780347589978, 5343.6748333646756, 5355.0777118862716, 5366.4866638471722, 5377.901682787985, 5389.3227622664635, 5400.749895857437, 5412.1830771527357, 5423.622299761123, 5435.067557308219, 5446.5188434364318, 5457.9761518048872, 5469.4394760893592, 5480.9088099821975, 5492.3841471922606, 5503.8654814448455, 5515.3528064816201, 5526.846116060552, 5538.3454039558474, 5549.8506639578736, 5561.3618898731029, 5572.8790755240361, 5584.4022147491451, 5595.9313014027975, 5607.4663293552012, 5619.0072924923297, 5630.5541847158656, 5642.1069999431284, 5653.665732107017, 5665.230375155943, 5676.8009230537655, 5688.3773697797333, 5699.9597093284156, 5711.5479357096474, 5723.1420429484588, 5734.7420250850209, 5746.347876174581, 5757.9595902874016, 5769.5771615087006, 5781.2005839385911, 5792.8298516920213, 5804.4649588987149, 5816.1058997031105, 5827.7526682643065, 5839.4052587559972, 5851.0636653664196, 5862.7278822982908, 5874.3979037687541, 5886.0737240093204, 5897.7553372658094, 5909.4427377982956, 5921.1359198810505, 5932.8348778024874, 5944.5396058651031, 5956.2500983854261, 5967.9663496939575, 5979.6883541351208, 5991.4161060672022, 6003.1495998623004, 6014.8888299062692, 6026.6337905986684, 6038.3844763527022, 6050.1408815951781, 6061.9030007664414, 6073.6708283203316, 6085.4443587241267, 6097.2235864584891, 6109.0085060174197, 6120.7991119081998, 6132.595398651345, 6144.3973607805519, 6156.2049928426459, 6168.0182893975361, 6179.8372450181578, 6191.6618542904307, 6203.4921118132024, 6215.3280121982016, 6227.1695500699925, 6239.0167200659189, 6250.8695168360628, 6262.7279350431891, 6274.5919693627056, 6286.4616144826068, 6298.3368651034316, 6310.2177159382172, 6322.1041617124456, 6333.9961971640032, 6345.8938170431311, 6357.7970161123785, 6369.7057891465583, 6381.6201309327007, 6393.5400362700075, 6405.4654999698032, 6417.3965168554978, 6429.3330817625329, 6441.2751895383453, 6453.2228350423138, 6465.176013145724, 6477.134718731716, 6489.0989466952469, 6501.0686919430445, 6513.0439493935628, 6525.0247139769417, 6537.010980634961, 6549.002744321001, 6560.9999999999973, 6573.0027426483985, 6585.0109672541284, 6597.0246688165371, 6609.0438423463656, 6621.0684828657004, 6633.0985854079354, 6645.134145017727, 6657.1751567509573, 6669.2216156746908, 6681.2735168671343, 6693.3308554176001, 6705.3936264264594, 6717.461825005108, 6729.535446275926, 6741.6144853722335, 6753.6989374382601, 6765.7887976290967, 6777.8840611106634, 6789.9847230596661, 6802.0907786635626, 6814.2022231205201, 6826.3190516393797, 6838.4412594396181, 6850.5688417513074, 6862.701793815083, 6874.840110882099, 6886.9837882139991, 6899.1328210828724, 6911.2872047712199, 6923.4469345719199, 6935.6120057881863, 6947.7824137335365, 6959.9581537317536, 6972.1392211168532, 6984.3256112330409, 6996.5173194346862, 7008.7143410862773, 7020.9166715623942, 7033.1243062476678, 7045.3372405367481, 7057.5554698342685, 7069.7789895548103, 7082.0077951228714, 7094.2418819728273, 7106.4812455489018, 7118.7258813051285, 7130.9757847053224, 7143.2309512230404, 7155.4913763415516, 7167.7570555538041, 7180.0279843623894, 7192.3041582795131, 7204.5855728269571, 7216.8722235360519, 7229.1641059476406, 7241.4612156120484, 7253.7635480890503, 7266.0710989478375, 7278.3838637669869, 7290.7018381344296, 7303.0250176474174, 7315.3533979124932, 7327.6869745454596, 7340.0257431713462, 7352.3696994243801, 7364.7188389479543, 7377.0731573945968, 7389.4326504259407, 7401.7973137126937, 7414.1671429346061, 7426.5421337804428, 7438.922281947951, 7451.3075831438346, 7463.6980330837177, 7476.0936274921214, 7488.4943621024304, 7500.9002326568652, 7513.3112349064522, 7525.7273646109943, 7538.1486175390446, 7550.5749894678729, 7563.0064761834419, 7575.4430734803736, 7587.8847771619248, 7600.3315830399597, 7612.7834869349153, 7625.24048467578, 7637.7025721000637, 7650.1697450537677, 7662.6419993913596, 7675.1193309757446, 7687.6017356782404, 7700.0892093785433, 7712.5817479647112, 7725.079347333125, 7737.5820033884729, 7750.0897120437139, 7762.6024692200581, 7775.1202708469355, 7787.6431128619733, 7800.1709912109645, 7812.7039018478481, 7825.2418407346768, 7837.7848038415968, 7850.3327871468155, 7862.8857866365806, 7875.4437983051539, 7888.006818154784, 7900.5748421956796, 7913.1478664459901, 7925.725886931772, 7938.3088996869719, 7950.8969007533951, 7963.4898861806851, 7976.0878520262959, 7988.6907943554688, 8001.2987092412086, 8013.911592764257, 8026.5294410130691, 8039.1522500837891, 8051.7800160802271, 8064.412735113835, 8077.0504033036796, 8089.6930167764222, 8102.3405716662946, 8114.9930641150731, 8127.6504902720571, 8140.3128462940449, 8152.9801283453098, 8165.6523325975786, 8178.3294552300049, 8191.0114924291529, 8203.6984403889655, 8216.3902953107463, 8229.0870534031419, 8241.7887108821069, 8254.4952639708936, 8267.2067089000211, 8279.9230419072574, 8292.6442592375952, 8305.3703571432306, 8318.101331883543, 8330.8371797250657, 8343.577896941475, 8356.3234798135582, 8369.0739246291978, 8381.8292276833508, 8394.5893852780209, 8407.3543937222421, 8420.1242493320569, 8432.8989484304948, 8445.6784873475499, 8458.4628624201578, 8471.2520699921806, 8484.0461064143838, 8496.8449680444082, 8509.6486512467636, 8522.4571523927953, 8535.270467860666, 8548.0885940353437, 8560.9115273085663, 8573.7392640788403, 8586.5718007514006, 8599.4091337382069, 8612.2512594579148, 8625.0981743358552, 8637.9498748040205, 8650.8063573010386, 8663.6676182721567, 8676.533654169225, 8689.4044614506638, 8702.2800365814601, 8715.1603760331418, 8728.0454762837508, 8740.9353338178389, 8753.8299451264356, 8766.7293067070332, 8779.6334150635721, 8792.5422667064158, 8805.4558581523324, 8818.3741859244819, 8831.2972465523908, 8844.2250365719356, 8857.1575525253265, 8870.0947909610859, 8883.0367484340295, 8895.9834215052524, 8908.934806742107, 8921.8909007181846, 8934.8517000132997, 8947.817201213471, 8960.7874009109, 8973.7622957039603, 8986.7418821971733, 8999.7261570011924, 9012.7151167327884, 9025.7087580148236, 9038.7070774762469, 9051.7100717520643, 9064.7177374833282, 9077.7300713171153, 9090.7470699065179, 9103.7687299106146, 9116.7950479944648, 9129.8260208290812, 9142.8616450914233, 9155.9019174643727, 9168.9468346367157, 9181.9963933031358, 9195.0505901641845, 9208.1094219262741, 9221.1728853016557, 9234.240977008405, 9247.3136937704076, 9260.3910323173386, 9273.472989384647, 9286.5595617135423, 9299.6507460509747, 9312.7465391496207, 9325.8469377678684, 9338.9519386698012, 9352.0615386251757, 9365.1757344094131, 9378.2945228035842, 9391.4179005943843, 9404.5458645741273, 9417.6784115407263, 9430.8155382976747, 9443.9572416540359, 9457.1035184244265, 9470.2543654290002, 9483.4097794934296, 9496.5697574488931, 9509.7342961320664, 9522.9033923850911, 9536.0770430555804, 9549.2552449965824, 9562.4379950665825, 9575.6252901294793, 9588.8171270545736, 9602.0135027165488, 9615.2144139954635, 9628.4198577767274, 9641.629830951093, 9654.844330414644, 9668.0633530687719, 9681.286895820167, 9694.5149555808002, 9707.7475292679192, 9720.9846138040157, 9734.2262061168276, 9747.4723031393187, 9760.7229018096641, 9773.9779990712323, 9787.2375918725811, 9800.5016771674327, 9813.7702519146696, 9827.0433130783094, 9840.3208576275028, 9853.602882536512, 9866.8893847846994, 9880.1803613565116, 9893.4758092414686, 9906.7757254341523, 9920.0801069341851, 9933.3889507462245, 9946.7022538799429, 9960.0200133500221, 9973.3422261761298, 9986.6688893829159, 9999.9999999999945, 10013.335555061929, 10026.675551608221, 10040.019986683301, 10053.368857336509, 10066.722160622081, 10080.079893599144, 10093.442053331697, 10106.808636888598, 10120.179641343551, 10133.555063775095, 10146.934901266595, 10160.31915090622, 10173.707809786936, 10187.100875006496, 10200.498343667417, 10213.900212876984, 10227.306479747222, 10240.717141394889, 10254.132194941467, 10267.551637513146, 10280.975466240814, 10294.40367826004, 10307.836270711066, 10321.273240738796, 10334.71458549278, 10348.160302127204, 10361.610387800878, 10375.064839677221, 10388.523654924258, 10401.986830714593, 10415.454364225412, 10428.926252638465, 10442.402493140049, 10455.883082921007, 10469.368019176709, 10482.85729910704, 10496.350919916393, 10509.848878813653, 10523.351173012188, 10536.857799729838, 10550.3687561889, 10563.884039616123, 10577.403647242685, 10590.927576304197, 10604.455824040679, 10617.988387696556, 10631.525264520642, 10645.066451766135, 10658.611946690598, 10672.161746555956, 10685.715848628475, 10699.274250178762, 10712.836948481747, 10726.403940816675, 10739.975224467091, 10753.550796720834, 10767.130654870027, 10780.714796211059, 10794.303218044579, 10807.895917675487, 10821.492892412922, 10835.094139570248, 10848.699656465047, 10862.309440419107, 10875.923488758415, 10889.541798813138, 10903.16436791762, 10916.791193410372, 10930.422272634056, 10944.05760293548, 10957.697181665582, 10971.341006179427, 10984.98907383619, 10998.641381999149, 11012.297928035676, 11025.958709317223, 11039.623723219316, 11053.292967121541, 11066.966438407539, 11080.64413446499, 11094.326052685608, 11108.012190465128, 11121.702545203296, 11135.397114303863, 11149.095895174571, 11162.798885227143, 11176.506081877278, 11190.217482544635, 11203.933084652828, 11217.652885629415, 11231.376882905886, 11245.105073917659, 11258.837456104062, 11272.574026908333, 11286.314783777601, 11300.059724162888, 11313.808845519083, 11327.562145304952, 11341.319620983111, 11355.081270020033, 11368.847089886023, 11382.617078055218, 11396.391232005579, 11410.169549218874, 11423.952027180676, 11437.738663380349, 11451.529455311042, 11465.324400469679, 11479.123496356951, 11492.926740477304, 11506.734130338931, 11520.545663453764, 11534.361337337466, 11548.181149509423, 11562.005097492724, 11575.83317881417, 11589.665391004253, 11603.501731597149, 11617.342198130715, 11631.186788146468, 11645.035499189589, 11658.888328808911, 11672.745274556904, 11686.606333989675, 11700.471504666955, 11714.340784152086, 11728.214170012021, 11742.091659817312, 11755.973251142101, 11769.858941564111, 11783.748728664636, 11797.642610028539, 11811.540583244237, 11825.442645903697, 11839.34879560242, 11853.259029939445, 11867.173346517333, 11881.091742942155, 11895.014216823492, 11908.940765774427, 11922.871387411526, 11936.806079354839, 11950.744839227897, 11964.687664657684, 11978.634553274653, 11992.585502712702, 12006.540510609168, 12020.499574604828, 12034.462692343877, 12048.429861473938, 12062.401079646032, 12076.376344514589, 12090.355653737433, 12104.339004975769, 12118.326395894188, 12132.317824160644, 12146.313287446457, 12160.312783426305, 12174.316309778205, 12188.323864183525, 12202.335444326955, 12216.351047896511, 12230.370672583531, 12244.394316082657, 12258.421976091831, 12272.453650312296, 12286.489336448574, 12300.529032208471, 12314.572735303058, 12328.620443446678, 12342.672154356922, 12356.727865754638, 12370.787575363909, 12384.851280912055, 12398.918980129623, 12412.990670750381, 12427.066350511306, 12441.146017152583, 12455.229668417589, 12469.317302052901, 12483.40891580827, 12497.50450743663, 12511.604074694078, 12525.707615339878, 12539.815127136444, 12553.926607849342, 12568.042055247275, 12582.161467102082, 12596.284841188726, 12610.41217528529, 12624.543467172971, 12638.678714636069, 12652.817915461985, 12666.961067441209, 12681.108168367316, 12695.259216036962, 12709.414208249869, 12723.573142808827, 12737.736017519681, 12751.902830191326, 12766.073578635704, 12780.248260667788, 12794.426874105588, 12808.609416770132, 12822.795886485468, 12836.986281078653, 12851.180598379744, 12865.378836221802, 12879.580992440871, 12893.787064875984, 12907.997051369144, 12922.210949765335, 12936.428757912496, 12950.650473661524, 12964.876094866273, 12979.105619383534, 12993.339045073039, 13007.576369797454, 13021.817591422368, 13036.062707816285, 13050.311716850629, 13064.564616399723, 13078.821404340792, 13093.082078553954, 13107.346636922217, 13121.615077331464, 13135.887397670458, 13150.163595830827, 13164.44366970706, 13178.727617196502, 13193.015436199352, 13207.307124618648, 13221.602680360265, 13235.902101332911, 13250.205385448118, 13264.512530620239, 13278.823534766434, 13293.138395806676, 13307.457111663734, 13321.779680263176, 13336.106099533356, 13350.436367405409, 13364.77048181325, 13379.108440693562, 13393.450241985796, 13407.795883632158, 13422.145363577607, 13436.498679769853, 13450.855830159346, 13465.216812699266, 13479.581625345529, 13493.950266056772, 13508.32273279435, 13522.699023522329, 13537.079136207483, 13551.463068819286, 13565.850819329906, 13580.2423857142, 13594.63776594971, 13609.036958016657, 13623.439959897927, 13637.846769579081, 13652.257385048335, 13666.67180429656, 13681.090025317284, 13695.512046106669, 13709.937864663521, 13724.367478989278, 13738.800887088004, 13753.238086966385, 13767.679076633727, 13782.123854101939, 13796.572417385545, 13811.024764501659, 13825.480893469998, 13839.94080231286, 13854.404489055134, 13868.871951724283, 13883.34318835034, 13897.818196965914, 13912.296975606168, 13926.779522308825, 13941.26583511416, 13955.755912064991, 13970.249751206682, 13984.747350587126, 13999.248708256751, 14013.753822268511, 14028.262690677873, 14042.775311542828, 14057.291682923867, 14071.811802883994, 14086.335669488704, 14100.863280805994, 14115.394634906341, 14129.92972986271, 14144.468563750548, 14159.01113464777, 14173.55744063476, 14188.107479794369, 14202.661250211901, 14217.218749975118, 14231.779977174227, 14246.344929901879, 14260.913606253163, 14275.486004325601, 14290.062122219146, 14304.641958036171, 14319.225509881464, 14333.812775862236, 14348.403754088098, 14362.998442671067, 14377.59683972556, 14392.198943368388, 14406.804751718748, 14421.414262898223, 14436.027475030774, 14450.64438624274, 14465.264994662828, 14479.889298422106, 14494.517295654005, 14509.148984494313, 14523.784363081166, 14538.423429555049, 14553.066182058781, 14567.712618737527, 14582.362737738777, 14597.016537212348, 14611.674015310382, 14626.33517018734, 14640.999999999993, 14655.668502907418, 14670.340677071003, 14685.016520654426, 14699.696031823671, 14714.379208746999, 14729.066049594967, 14743.756552540408, 14758.45071575843, 14773.148537426418, 14787.850015724018, 14802.555148833142, 14817.263934937961, 14831.976372224897, 14846.692458882624, 14861.41219310206, 14876.135573076363, 14890.862597000923, 14905.593263073371, 14920.327569493558, 14935.065514463557, 14949.807096187662, 14964.552312872382, 14979.301162726431, 14994.053643960735, 15008.809754788414, 15023.569493424788, 15038.332858087369, 15053.099846995858, 15067.870458372134, 15082.644690440264, 15097.422541426484, 15112.204009559202, 15126.989093068994, 15141.777790188597, 15156.570099152905, 15171.366018198967, 15186.165545565986, 15200.968679495301, 15215.775418230402, 15230.585760016909, 15245.399703102579, 15260.217245737298, 15275.038386173073, 15289.863122664035, 15304.691453466432, 15319.523376838621, 15334.358891041069, 15349.197994336346, 15364.040684989128, 15378.886961266177, 15393.736821436356, 15408.590263770609, 15423.447286541972, 15438.307888025554, 15453.172066498542, 15468.039820240196, 15482.91114753184, 15497.786046656869, 15512.664515900733, 15527.546553550939, 15542.432157897045, 15557.32132723066, 15572.214059845435, 15587.110354037064, 15602.010208103273, 15616.913620343823, 15631.820589060506, 15646.731112557136, 15661.645189139546, 15676.562817115593, 15691.483994795139, 15706.408720490062, 15721.336992514242, 15736.268809183561, 15751.204168815901, 15766.143069731135, 15781.085510251132, 15796.03148869974, 15810.981003402798, 15825.934052688119, 15840.890634885489, 15855.850748326673, 15870.814391345401, 15885.781562277361, 15900.752259460214, 15915.726481233565, 15930.704225938984, 15945.685491919978, 15960.670277522009, 15975.658581092481, 15990.65040098073, 16005.645735538035, 16020.644583117599, 16035.646942074556, 16050.652810765967, 16065.662187550806, 16080.675070789974, 16095.691458846273, 16110.711350084424, 16125.734742871053, 16140.761635574685, 16155.792026565747, 16170.825914216561, 16185.863296901338, 16200.904172996183, 16215.948540879079, 16230.996398929899, 16246.047745530386, 16261.102579064163, 16276.160897916721, 16291.22270047542, 16306.287985129484, 16321.356750269995, 16336.428994289896, 16351.504715583982, 16366.5839125489, 16381.666583583141, 16396.752727087041, 16411.842341462776, 16426.935425114363, 16442.031976447644, 16457.131993870298, 16472.235475791829, 16487.342420623561, 16502.452826778641, 16517.566692672033, 16532.684016720516, 16547.804797342676, 16562.929032958902, 16578.056721991394, 16593.18786286415, 16608.322454002962, 16623.460493835417, 16638.601980790896, 16653.746913300558, 16668.895289797354, 16684.047108716015, 16699.202368493046, 16714.361067566726, 16729.523204377107, 16744.688777366009, 16759.857784977012, 16775.030225655464, 16790.206097848466, 16805.385400004874, 16820.568130575302, 16835.754288012104, 16850.943870769381, 16866.136877302983, 16881.333306070494, 16896.53315553123, 16911.736424146249, 16926.943110378332, 16942.153212691992, 16957.366729553454, 16972.583659430682, 16987.804000793338, 17003.027752112816, 17018.254911862205, 17033.485478516312, 17048.719450551645, 17063.956826446421, 17079.197604680547, 17094.44178373563, 17109.689362094967, 17124.940338243552, 17140.194710668064, 17155.452477856852, 17170.713638299967, 17185.978190489128, 17201.246132917724, 17216.517464080825, 17231.792182475165, 17247.070286599141, 17262.351774952826, 17277.636646037936, 17292.924898357855, 17308.216530417623, 17323.511540723921, 17338.809927785089, 17354.111690111105, 17369.416826213594, 17384.725334605821, 17400.037213802683, 17415.352462320716, 17430.67107867809, 17445.993061394587, 17461.318408991636, 17476.647119992274, 17491.979192921168, 17507.314626304586, 17522.653418670423, 17537.995568548187, 17553.341074468986, 17568.689934965536, 17584.042148572156, 17599.397713824768, 17614.75662926089, 17630.118893419625, 17645.484504841683, 17660.853462069354, 17676.225763646511, 17691.601408118619, 17706.980394032718, 17722.362719937424, 17737.748384382936, 17753.137385921014, 17768.529723104999, 17783.92539448979, 17799.324398631856, 17814.726734089225, 17830.13239942148, 17845.541393189767, 17860.95371395678, 17876.369360286772, 17891.788330745527, 17907.210623900395, 17922.636238320254, 17938.065172575527, 17953.497425238176, 17968.932994881692, 17984.371880081104, 17999.814079412972, 18015.259591455371, 18030.708414787914, 18046.160547991731, 18061.615989649465, 18077.074738345284, 18092.536792664861, 18108.002151195393, 18123.470812525571, 18138.942775245599, 18154.418037947191, 18169.896599223546, 18185.37845766938, 18200.863611880886, 18216.352060455767, 18231.843801993204, 18247.338835093873, 18262.837158359936, 18278.338770395032, 18293.84366980429, 18309.351855194309, 18324.863325173166, 18340.378078350412, 18355.896113337069, 18371.417428745623, 18386.942023190033, 18402.469895285718, 18418.00104364955, 18433.53546689987, 18449.073163656474, 18464.614132540602, 18480.158372174956, 18495.705881183676, 18511.256658192357, 18526.810701828035, 18542.368010719183, 18557.928583495715, 18573.492418788985, 18589.059515231773, 18604.629871458303, 18620.203486104212, 18635.78035780658, 18651.360485203899, 18666.943866936086, 18682.53050164448, 18698.120387971841, 18713.713524562332, 18729.30991006154, 18744.909543116457, 18760.512422375479, 18776.118546488418, 18791.727914106479, 18807.340523882274, 18822.95637446981, 18838.575464524489, 18854.197792703111, 18869.823357663863, 18885.452158066328, 18901.08419257147, 18916.719459841639, 18932.357958540564, 18947.999687333362, 18963.644644886521, 18979.292829867907, 18994.944240946759, 19010.598876793687, 19026.256736080668, 19041.917817481048, 19057.582119669532, 19073.2496413222, 19088.920381116473, 19104.594337731145, 19120.271509846356, 19135.951896143604, 19151.635495305738, 19167.322306016948, 19183.012326962784, 19198.705556830122, 19214.401994307198, 19230.101638083579, 19245.804486850167, 19261.510539299208, 19277.219794124274, 19292.932250020265, 19308.647905683421, 19324.366759811302, 19340.088811102793, 19355.8140582581, 19371.542499978754, 19387.2741349676, 19403.008961928797, 19418.746979567823, 19434.488186591469, 19450.232581707827, 19465.980163626304, 19481.730931057613, 19497.484882713761, 19513.242017308068, 19529.002333555141, 19544.765830170898, 19560.532505872539, 19576.302359378566, 19592.075389408761, 19607.851594684209, 19623.630973927269, 19639.41352586159, 19655.199249212103, 19670.988142705017, 19686.780205067826, 19702.575435029288, 19718.373831319448, 19734.175392669615, 19749.980117812371, 19765.788005481569, 19781.599054412323, 19797.413263341008, 19813.230631005274, 19829.051156144014, 19844.874837497395, 19860.701673806827, 19876.531663814985, 19892.364806265789, 19908.201099904403, 19924.040543477258, 19939.883135732012, 19955.728875417579, 19971.577761284105, 19987.429792082985, 20003.284966566847, 20019.14328348956, 20035.004741606219, 20050.869339673161, 20066.737076447946, 20082.607950689362, 20098.481961157428, 20114.359106613385, 20130.239385819699, 20146.122797540058, 20162.009340539353, 20177.899013583716, 20193.791815440476, 20209.687744878182, 20225.586800666591, 20241.488981576669, 20257.394286380597, 20273.302713851754, 20289.214262764715, 20305.128931895277, 20321.046720020415, 20336.967625918318, 20352.891648368361, 20368.818786151114, 20384.749038048347, 20400.682402843009, 20416.618879319249, 20432.558466262391, 20448.501162458953, 20464.446966696629, 20480.395877764302, 20496.347894452025, 20512.303015551031, 20528.261239853735, 20544.22256615372, 20560.186993245738, 20576.15451992572, 20592.125144990758, 20608.098867239107, 20624.075685470198, 20640.055598484618, 20656.038605084115, 20672.024704071595, 20688.013894251126, 20704.006174427926, 20720.001543408373, 20735.999999999989, 20752.001543011454, 20768.006171252597, 20784.013883534382, 20800.024678668931, 20816.038555469506, 20832.055512750507, 20848.075549327474, 20864.098664017085, 20880.124855637161, 20896.154123006647, 20912.186464945626, 20928.221880275312, 20944.260367818049, 20960.301926397311, 20976.346554837684, 20992.394251964895, 21008.445016605787, 21024.498847588318, 21040.555743741574, 21056.615703895754, 21072.678726882168, 21088.744811533252, 21104.813956682538, 21120.886161164683, 21136.961423815443, 21153.039743471683, 21169.121118971379, 21185.205549153605, 21201.293032858535, 21217.383568927453, 21233.477156202731, 21249.573793527841, 21265.673479747358, 21281.776213706937, 21297.881994253334, 21313.990820234398, 21330.102690499054, 21346.21760389733, 21362.335559280327, 21378.456555500241, 21394.580591410333, 21410.707665864964, 21426.83777771956, 21442.970925830628, 21459.107109055756, 21475.246326253604, 21491.388576283895, 21507.533858007431, 21523.682170286087, 21539.833511982797, 21555.987881961566, 21572.145279087465, 21588.305702226615, 21604.469150246216, 21620.635622014521, 21636.805116400832, 21652.977632275521, 21669.153168510009, 21685.331723976764, 21701.513297549318, 21717.697888102244, 21733.885494511167, 21750.076115652759, 21766.269750404736, 21782.466397645861, 21798.666056255934, 21814.868725115801, 21831.074403107345, 21847.283089113484, 21863.494782018177, 21879.709480706417, 21895.927184064229, 21912.147890978667, 21928.371600337818, 21944.598311030797, 21960.828021947746, 21977.060731979829, 21993.296440019243, 22009.535144959198, 22025.77684569393, 22042.021541118691, 22058.269230129757, 22074.519911624411, 22090.773584500959, 22107.030247658717, 22123.289899998013, 22139.552540420187, 22155.818167827587, 22172.086781123569, 22188.358379212495, 22204.632960999726, 22220.910525391639, 22237.191071295601, 22253.474597619981, 22269.761103274148, 22286.050587168469, 22302.343048214312, 22318.638485324027, 22334.936897410968, 22351.23828338947, 22367.542642174871, 22383.849972683485, 22400.160273832618, 22416.473544540564, 22432.789783726603, 22449.108990310986, 22465.431163214958, 22481.75630136074, 22498.084403671528, 22514.415469071497, 22530.749496485802, 22547.086484840562, 22563.426433062879, 22579.769340080824, 22596.115204823436, 22612.464026220721, 22628.815803203655, 22645.170534704179, 22661.5282196552, 22677.888856990587, 22694.252445645168, 22710.618984554734, 22726.988472656034, 22743.360908886778, 22759.736292185622, 22776.114621492186, 22792.495895747044, 22808.880113891719, 22825.267274868678, 22841.657377621348, 22858.050421094096, 22874.446404232243, 22890.845325982053, 22907.247185290722, 22923.651981106406, 22940.059712378195, 22956.470378056114, 22972.883977091129, 22989.300508435153, 23005.719971041017, 23022.142363862498, 23038.567685854305, 23054.995935972078, 23071.427113172387, 23087.86121641273, 23104.298244651531, 23120.738196848146, 23137.181071962848, 23153.626868956846, 23170.075586792263, 23186.527224432142, 23202.981780840448, 23219.439254982066, 23235.899645822796, 23252.362952329357, 23268.829173469378, 23285.298308211408, 23301.770355524899, 23318.245314380223, 23334.723183748658, 23351.203962602387, 23367.687649914504, 23384.174244659007, 23400.663745810798, 23417.15615234568, 23433.651463240367, 23450.149677472462, 23466.650794020472, 23483.154811863806, 23499.661729982763, 23516.171547358543, 23532.684262973235, 23549.199875809823, 23565.718384852185, 23582.239789085092, 23598.764087494197, 23615.291279066041, 23631.821362788058, 23648.354337648565, 23664.890202636761, 23681.428956742733, 23697.970598957443, 23714.515128272738, 23731.062543681343, 23747.612844176863, 23764.166028753778, 23780.72209640744, 23797.281046134085, 23813.842876930816, 23830.407587795606, 23846.975177727301, 23863.545645725622, 23880.11899079115, 23896.695211925336, 23913.274308130498, 23929.856278409821, 23946.441121767348, 23963.028837207989, 23979.619423737513, 23996.212880362549, 24012.809206090584, 24029.408399929966, 24046.010460889898, 24062.615387980433, 24079.223180212492, 24095.833836597827, 24112.447356149063, 24129.063737879667, 24145.682980803951, 24162.305083937081, 24178.930046295067, 24195.557866894767, 24212.188544753884, 24228.822078890964, 24245.458468325389, 24262.097712077397, 24278.739809168052, 24295.384758619261, 24312.032559453768, 24328.683210695162, 24345.336711367858, 24361.993060497109, 24378.652257108995, 24395.314300230442, 24411.979188889192, 24428.646922113825, 24445.317498933746, 24461.990918379193, 24478.667179481225, 24495.346281271726, 24512.028222783407, 24528.713003049801, 24545.400621105266, 24562.091075984976, 24578.784366724925, 24595.480492361927, 24612.179451933614, 24628.881244478438, 24645.585869035654, 24662.293324645343, 24679.003610348394, 24695.716725186514, 24712.432668202211, 24729.151438438807, 24745.873034940436, 24762.597456752032, 24779.324702919344, 24796.054772488926, 24812.787664508123, 24829.5233780251, 24846.261912088819, 24863.003265749034, 24879.747438056307, 24896.494428062004, 24913.244234818278, 24929.996857378079, 24946.752294795166, 24963.510546124078, 24980.271610420157, 24997.035486739525, 25013.802174139113, 25030.571671676629, 25047.343978410572, 25064.119093400237, 25080.897015705697, 25097.677744387816, 25114.461278508239, 25131.2476171294, 25148.036759314517, 25164.828704127583, 25181.623450633375, 25198.42099789745, 25215.221344986145, 25232.024490966574, 25248.830434906627, 25265.639175874974, 25282.450712941049, 25299.265045175071, 25316.082171648024, 25332.902091431668, 25349.724803598532, 25366.550307221914, 25383.378601375884, 25400.209685135269, 25417.043557575678, 25433.880217773472, 25450.719664805783, 25467.561897750507, 25484.406915686297, 25501.254717692573, 25518.105302849512, 25534.958670238051, 25551.814818939893, 25568.67374803748, 25585.535456614027, 25602.399943753502, 25619.267208540619, 25636.137250060852, 25653.010067400432, 25669.885659646327, 25686.76402588627, 25703.645165208734, 25720.529076702944, 25737.415759458876, 25754.305212567244, 25771.197435119517, 25788.092426207899, 25804.990184925344, 25821.890710365547, 25838.794001622944, 25855.700057792714, 25872.608877970775, 25889.520461253778, 25906.434806739118, 25923.351913524923, 25940.271780710063, 25957.194407394138, 25974.11979267748, 25991.047935661154, 26007.978835446964, 26024.912491137442, 26041.848901835841, 26058.788066646157, 26075.729984673108, 26092.674655022136, 26109.622076799409, 26126.572249111829, 26143.525171067016, 26160.480841773315, 26177.43926033979, 26194.400425876229, 26211.364337493149, 26228.330994301767, 26245.30039541404, 26262.272539942627, 26279.247427000919, 26296.225055703002, 26313.205425163702, 26330.188534498539, 26347.174382823756, 26364.162969256304, 26381.154292913852, 26398.148352914774, 26415.145148378149, 26432.144678423778, 26449.146942172156, 26466.151938744493, 26483.159667262702, 26500.170126849403, 26517.183316627921, 26534.199235722277, 26551.217883257199, 26568.239258358124, 26585.263360151173, 26602.290187763181, 26619.319740321676, 26636.352016954883, 26653.387016791727, 26670.424738961825, 26687.465182595493, 26704.508346823739, 26721.554230778267, 26738.602833591467, 26755.65415439643, 26772.708192326929, 26789.764946517433, 26806.824416103096, 26823.886600219761, 26840.95149800396, 26858.019108592915, 26875.089431124517, 26892.162464737365, 26909.238208570721, 26926.316661764544, 26943.397823459472, 26960.481692796813, 26977.568268918571, 26994.657550967422, 27011.749538086722, 27028.844229420498, 27045.941624113464, 27063.041721311005, 27080.144520159181, 27097.250019804727, 27114.35821939505, 27131.469118078236, 27148.582715003027, 27165.699009318858, 27182.818000175819, 27199.939686724665, 27217.064068116837, 27234.191143504428, 27251.320912040203, 27268.453372877593, 27285.588525170693, 27302.726368074269, 27319.866900743735, 27337.010122335181, 27354.156032005358, 27371.304628911668, 27388.455912212183, 27405.609881065626, 27422.766534631384, 27439.925872069507, 27457.087892540683, 27474.252595206275, 27491.419979228293, 27508.5900437694, 27525.762787992917, 27542.93821106281, 27560.116312143706, 27577.297090400876, 27594.480545000242, 27611.666675108383, 27628.855479892518, 27646.046958520514, 27663.241110160889, 27680.437933982801, 27697.637429156068, 27714.839594851132, 27732.04443023909, 27749.251934491687, 27766.462106781299, 27783.674946280949, 27800.890452164302, 27818.108623605654, 27835.329459779954, 27852.55295986278, 27869.779123030345, 27887.007948459504, 27904.239435327745, 27921.473582813196, 27938.710390094613, 27955.949856351392, 27973.19198076355, 27990.436762511745, 28007.684200777272, 28024.934294742041, 28042.187043588601, 28059.442446500128, 28076.700502660427, 28093.961211253929, 28111.224571465693, 28128.490582481401, 28145.759243487362, 28163.030553670509, 28180.304512218394, 28197.581118319198, 28214.860371161725, 28232.14226993539, 28249.42681383024, 28266.71400203693, 28284.003833746745, 28301.296308151585, 28318.591424443959, 28335.889181817001, 28353.189579464462, 28370.492616580705, 28387.798292360701, 28405.106606000048, 28422.417556694945, 28439.731143642206, 28457.047366039264, 28474.366223084147, 28491.687713975512, 28509.011837912611, 28526.338594095305, 28543.667981724069, 28560.999999999982, 28578.334648124732, 28595.671925300605, 28613.011830730498, 28630.354363617909, 28647.699523166943, 28665.0473085823, 28682.397719069289, 28699.750753833818, 28717.10641208239, 28734.464693022121, 28751.825595860708, 28769.189119806462, 28786.55526406828, 28803.924027855664, 28821.295410378701, 28838.669410848088, 28856.046028475103, 28873.425262471628, 28890.80711205013, 28908.191576423673, 28925.578654805915, 28942.968346411097, 28960.360650454055, 28977.755566150216, 28995.153092715591, 29012.553229366786, 29029.955975320987, 29047.361329795975, 29064.769292010107, 29082.179861182336, 29099.593036532187, 29117.00881727978, 29134.427202645813, 29151.848191851568, 29169.271784118911, 29186.697978670283, 29204.126774728706, 29221.55817151779, 29238.992168261717, 29256.42876418525, 29273.867958513725, 29291.309750473058, 29308.754139289747, 29326.201124190855, 29343.65070440403, 29361.102879157483, 29378.557647680012, 29396.015009200975, 29413.474962950309, 29430.937508158524, 29448.402644056692, 29465.870369876469, 29483.340684850071, 29500.81358821028, 29518.289079190454, 29535.767157024511, 29553.247820946945, 29570.731070192807, 29588.216903997723, 29605.70532159787, 29623.19632223, 29640.689905131429, 29658.186069540028, 29675.684814694236, 29693.186139833047, 29710.690044196028, 29728.196527023298, 29745.705587555527, 29763.217225033964, 29780.731438700397, 29798.248227797183, 29815.76759156723, 29833.289529254005, 29850.81404010153, 29868.341123354381, 29885.870778257693, 29903.403004057145, 29920.937799998974, 29938.475165329975, 29956.015099297485, 29973.557601149394, 29991.102670134147, 30008.650305500738, 30026.200506498706, 30043.753272378144, 30061.308602389683, 30078.866495784507, 30096.426951814352, 30113.989969731494, 30131.55554878875, 30149.123688239491, 30166.694387337629, 30184.267645337608, 30201.843461494434, 30219.42183506364, 30237.002765301309, 30254.586251464058, 30272.172292809046, 30289.760888593977, 30307.35203807709, 30324.94574051716, 30342.541995173502, 30360.140801305966, 30377.742158174944, 30395.346065041358, 30412.952521166666, 30430.561525812864, 30448.173078242475, 30465.787177718561, 30483.403823504719, 30501.02301486507, 30518.644751064272, 30536.269031367516, 30553.895855040515, 30571.525221349519, 30589.157129561307, 30606.791578943175, 30624.428568762964, 30642.06809828903, 30659.710166790261, 30677.35477353607, 30695.001917796391, 30712.651598841687, 30730.303815942945, 30747.958568371676, 30765.615855399912, 30783.275676300211, 30800.938030345646, 30818.602916809814, 30836.270334966837, 30853.940284091354, 30871.612763458521, 30889.287772344011, 30906.965310024025, 30924.645375775272, 30942.327968874983, 30960.013088600903, 30977.700734231294, 30995.390905044929, 31013.083600321101, 31030.778819339619, 31048.476561380798, 31066.17682572547, 31083.879611654978, 31101.584918451179, 31119.29274539644, 31137.003091773637, 31154.715956866155, 31172.431339957893, 31190.14924033326, 31207.869657277162, 31225.592590075023, 31243.318038012771, 31261.046000376838, 31278.776476454172, 31296.50946553221, 31314.24496689891, 31331.98297984272, 31349.7235036526, 31367.466537618013, 31385.212081028923, 31402.960133175795, 31420.710693349596, 31438.463760841791, 31456.219334944351, 31473.977414949743, 31491.738000150934, 31509.501089841389, 31527.266683315069, 31545.034779866437, 31562.80537879045, 31580.578479382562, 31598.35408093872, 31616.132182755369, 31633.91278412945, 31651.695884358396, 31669.481482740131, 31687.269578573076, 31705.060171156143, 31722.853259788735, 31740.648843770748, 31758.446922402567, 31776.247494985066, 31794.050560819614, 31811.85611920806, 31829.664169452753, 31847.474710856521, 31865.287742722685, 31883.103264355046, 31900.921275057899, 31918.741774136019, 31936.564760894671, 31954.390234639599, 31972.21819467704, 31990.048640313704, 32007.881570856793, 32025.716985613984, 32043.554883893445, 32061.395265003815, 32079.238128254223, 32097.083472954269, 32114.931298414049, 32132.781603944117, 32150.634388855524, 32168.48965245979, 32186.347394068915, 32204.207612995371, 32222.07030855212, 32239.935480052583, 32257.803126810672, 32275.673248140767, 32293.545843357719, 32311.420911776862, 32329.298452713996, 32347.178465485395, 32365.060949407813, 32382.945903798463, 32400.83332797504, 32418.723221255706, 32436.615582959093, 32454.510412404306, 32472.407708910916, 32490.307471798966, 32508.209700388961, 32526.114394001877, 32544.021551959166, 32561.931173582732, 32579.843258194956, 32597.757805118679, 32615.674813677211, 32633.594283194328, 32651.516212994258, 32669.440602401712, 32687.367450741847, 32705.296757340297, 32723.228521523146, 32741.162742616943, 32759.099419948703, 32777.038552845901, 32794.980140636464, 32812.924182648792, 32830.87067821173, 32848.819626654593, 32866.77102730715, 32884.724879499619, 32902.681182562686, 32920.639935827494, 32938.601138625643, 32956.56479028918, 32974.530890150607, 32992.499437542894, 33010.470431799447, 33028.443872254145, 33046.419758241311, 33064.39808909571, 33082.378864152583, 33100.36208274759, 33118.347744216881, 33136.335847897026, 33154.326393125062, 33172.31937923847, 33190.314805575174, 33208.312671473555, 33226.312976272442, 33244.315719311111, 33262.320899929284, 33280.328517467125, 33298.33857126526, 33316.351060664747, 33334.365985007091, 33352.383343634239, 33370.403135888591, 33388.42536111299, 33406.450018650721, 33424.477107845501, 33442.506628041512, 33460.53857858335, 33478.572958816083, 33496.609768085189, 33514.649005736617, 33532.690671116739, 33550.734763572356, 33568.781282450735, 33586.830227099563, 33604.881596866973, 33622.935391101528, 33640.991609152239, 33659.050250368542, 33677.111314100322, 33695.174799697881, 33713.240706511984, 33731.309033893805, 33749.37978119497, 33767.452947767531, 33785.528532963974, 33803.606536137209, 33821.686956640602, 33839.769793827938, 33857.855047053425, 33875.942715671707, 33894.032799037872, 33912.125296507431, 33930.220207436316, 33948.317531180888, 33966.417267097961, 33984.519414544746, 34002.623972878901, 34020.730941458511, 34038.840319642077, 34056.952106788536, 34075.066302257255, 34093.182905408015, 34111.301915601027, 34129.42333219693, 34147.547154556785, 34165.673382042078, 34183.80201401472, 34201.933049837033, 34220.06648887178, 34238.202330482141, 34256.340574031703, 34274.481218884495, 34292.624264404949, 34310.769709957938, 34328.91755490873, 34347.067798623029, 34365.220440466954, 34383.375479807051, 34401.532916010263, 34419.692748443973, 34437.854976475966, 34456.01959947445, 34474.18661680806, 34492.356027845817, 34510.527831957188, 34528.702028512052, 34546.878616880676, 34565.05759643377, 34583.238966542449, 34601.422726578232, 34619.608875913065, 34637.797413919296, 34655.988339969692, 34674.181653437423, 34692.37735369608, 34710.575440119668, 34728.775912082579, 34746.978768959649, 34765.184010126082, 34783.391634957537, 34801.60164283005, 34819.814033120063, 34838.028805204456, 34856.24595846048, 34874.465492265823, 34892.687405998557, 34910.911699037177, 34929.138370760564, 34947.367420548027, 34965.598847779271, 34983.832651834389, 35002.068832093908, 35020.307387938738, 35038.548318750189, 35056.79162390998, 35075.03730280025, 35093.285354803513, 35111.535779302685, 35129.788575681116, 35148.043743322516, 35166.301281611013, 35184.561189931141, 35202.823467667826, 35221.088114206388, 35239.355128932555, 35257.624511232447, 35275.896260492584, 35294.170376099886, 35312.446857441668, 35330.725703905628, 35349.006914879887, 35367.290489752944, 35385.576427913686, 35403.864728751418, 35422.155391655811, 35440.448416016967, 35458.743801225341, 35477.041546671804, 35495.341651747622, 35513.644115844436, 35531.948938354304, 35550.256118669655, 35568.565656183309, 35586.877550288496, 35605.191800378816, 35623.508405848268, 35641.827366091238, 35660.148680502505, 35678.472348477233, 35696.798369410979, 35715.126742699678, 35733.457467739659, 35751.790543927644, 35770.125970660738, 35788.46374733642, 35806.803873352568, 35825.146348107453, 35843.49117099971, 35861.838341428367, 35880.187858792851, 35898.539722492955, 35916.893931928862, 35935.250486501129, 35953.609385610718, 35971.970628658957, 35990.334215047558, 36008.700144178612, 36027.068415454596, 36045.439028278372, 36063.811982053165, 36082.187276182609, 36100.564910070694, 36118.944883121789, 36137.327194740654, 36155.711844332429, 36174.098831302617, 36192.488155057115, 36210.87981500219, 36229.273810544473, 36247.670141091003, 36266.068806049167, 36284.469804826738, 36302.873136831862, 36321.278801473069, 36339.686798159251, 36358.097126299683, 36376.509785304013, 36394.924774582258, 36413.342093544816, 36431.761741602444, 36450.183718166292, 36468.608022647859, 36487.034654459028, 36505.463613012063, 36523.894897719583, 36542.328507994578, 36560.764443250409, 36579.202702900831, 36597.643286359926, 36616.086193042182, 36634.531422362437, 36652.978973735895, 36671.428846578143, 36689.881040305125, 36708.335554333149, 36726.792388078902, 36745.251540959427, 36763.713012392138, 36782.176801794812, 36800.642908585593, 36819.111332182983, 36837.582072005869, 36856.055127473483, 36874.530498005421, 36893.008183021651, 36911.488181942506, 36929.970494188674, 36948.455119181206, 36966.942056341519, 36985.431305091392, 37003.922864852961, 37022.416735048733, 37040.912915101559, 37059.411404434657, 37077.91220247162, 37096.415308636388, 37114.920722353243, 37133.428443046862, 37151.938470142253, 37170.450803064785, 37188.965441240209, 37207.482384094597, 37226.001631054402, 37244.523181546429, 37263.047034997842, 37281.573190836149, 37300.101648489224, 37318.632407385296, 37337.165466952945, 37355.700826621112, 37374.238485819085, 37392.778443976509, 37411.320700523385, 37429.865254890057, 37448.412106507232, 37466.961254805974, 37485.512699217681, 37504.066439174116, 37522.622474107404, 37541.180803449992, 37559.741426634704, 37578.304343094693, 37596.869552263488, 37615.43705357494, 37634.006846463279, 37652.578930363044, 37671.153304709165, 37689.729968936896, 37708.308922481847, 37726.890164779965, 37745.473695267559, 37764.059513381275, 37782.647618558112, 37801.238010235415, 37819.830687850859, 37838.425650842495, 37857.022898648691, 37875.622430708172, 37894.224246460013, 37912.828345343616, 37931.434726798747, 37950.043390265506, 37968.654335184328, 37987.267560995999, 38005.883067141665, 38024.500853062775, 38043.120918201159, 38061.743261998963, 38080.367883898682, 38098.994783343158, 38117.623959775563, 38136.255412639417, 38154.889141378575, 38173.525145437234, 38192.163424259939, 38210.803977291551, 38229.446803977284, 38248.091903762703, 38266.739276093685, 38285.388920416466, 38304.040836177606, 38322.695022824002, 38341.351479802899, 38360.010206561863, 38378.671202548816, 38397.334467211993, 38415.999999999978, 38434.667800361683, 38453.33786774637, 38472.010201603611, 38490.684801383337, 38509.361666535784, 38528.040796511552, 38546.722190761553, 38565.405848737035, 38584.091769889594, 38602.779953671132, 38621.470399533908, 38640.163106930493, 38658.858075313794, 38677.555304137059, 38696.254792853862, 38714.956540918094, 38733.660547783991, 38752.366812906112, 38771.075335739348, 38789.78611573892, 38808.499152360368, 38827.214445059573, 38845.931993292739, 38864.651796516388, 38883.373854187383, 38902.098165762916, 38920.824730700486, 38939.553548457938, 38958.284618493431, 38977.017940265461, 38995.753513232834, 39014.491336854699, 39033.231410590517, 39051.973733900079, 39070.718306243485, 39089.465127081188, 39108.214195873945, 39126.965512082832, 39145.719075169261, 39164.474884594965, 39183.232939821988, 39201.99324031271, 39220.755785529815, 39239.52057493633, 39258.287607995589, 39277.056884171245, 39295.828402927284, 39314.602163728006, 39333.378166038019, 39352.15640932227, 39370.936893046004, 39389.719616674811, 39408.504579674584, 39427.291781511522, 39446.081221652174, 39464.872899563372, 39483.666814712291, 39502.462966566411, 39521.261354593538, 39540.06197826178, 39558.864837039568, 39577.669930395656, 39596.47725779911, 39615.286818719302, 39634.098612625923, 39652.912638988993, 39671.728897278823, 39690.547386966064, 39709.368107521652, 39728.191058416858, 39747.016239123259, 39765.84364911275, 39784.673287857528, 39803.505154830105, 39822.339249503319, 39841.175571350293, 39860.014119844491, 39878.854894459677, 39897.697894669909, 39916.54311994958, 39935.390569773372, 39954.240243616303, 39973.092140953675, 39991.946261261117, 40010.802604014549, 40029.661168690225, 40048.521954764678, 40067.384961714779, 40086.250189017679, 40105.117636150855, 40123.98730259209, 40142.859187819471, 40161.733291311379, 40180.609612546526, 40199.488151003912, 40218.368906162854, 40237.25187750296, 40256.137064504153, 40275.024466646668, 40293.914083411029, 40312.805914278084, 40331.699958728961, 40350.596216245103, 40369.494686308273, 40388.39536840051, 40407.298262004173, 40426.20336660192, 40445.110681676706, 40464.020206711793, 40482.931941190756, 40501.845884597446, 40520.762036416032, 40539.680396130985, 40558.600963227072, 40577.523737189367, 40596.448717503234, 40615.375903654342, 40634.305295128659, 40653.236891412453, 40672.170691992294, 40691.106696355047, 40710.044903987873, 40728.985314378238, 40747.927927013901, 40766.872741382918, 40785.819756973651, 40804.768973274746, 40823.720389775161, 40842.674005964131, 40861.629821331211, 40880.587835366234, 40899.548047559321, 40918.510457400931, 40937.475064381761, 40956.441867992849, 40975.410867725499, 40994.382063071331, 41013.355453522236, 41032.331038570417, 41051.308817708363, 41070.288790428858, 41089.270956224987, 41108.255314590111, 41127.241865017888, 41146.23060700229, 41165.221540037543, 41184.214663618193, 41203.209977239079, 41222.207480395307, 41241.207172582297, 41260.209053295752, 41279.213122031659, 41298.219378286303, 41317.227821556255, 41336.23845133838, 41355.251267129832, 41374.266268428037, 41393.283454730743, 41412.302825535953, 41431.324380341983, 41450.348118647416, 41469.374039951144, 41488.402143752326, 41507.432429550427, 41526.464896845187, 41545.499545136627, 41564.536373925075, 41583.575382711126, 41602.616570995662, 41621.659938279874, 41640.705484065205, 41659.753207853406, 41678.803109146495, 41697.855187446803, 41716.909442256911, 41735.965873079709, 41755.02447941836, 41774.085260776315, 41793.148216657297, 41812.213346565331, 41831.280650004708, 41850.350126480014, 41869.421775496106, 41888.495596558132, 41907.571589171515, 41926.649752841957, 41945.730087075463, 41964.812591378286, 41983.897265256979, 42002.984108218378, 42022.073119769593, 42041.164299418015, 42060.257646671307, 42079.353161037419, 42098.450842024591, 42117.550689141324, 42136.652701896404, 42155.756879798893, 42174.863222358137, 42193.971729083758, 42213.082399485655, 42232.195233074002, 42251.310229359246, 42270.427387852127, 42289.546708063644, 42308.668189505079, 42327.791831687995, 42346.917634124227, 42366.045596325886, 42385.175717805352, 42404.307998075295, 42423.442436648642, 42442.579033038608, 42461.717786758672, 42480.858697322597, 42500.001764244422, 42519.146987038446, 42538.294365219248, 42557.443898301688, 42576.595585800882, 42595.749427232236, 42614.90542211142, 42634.063569954378, 42653.223870277317, 42672.386322596729, 42691.55092642938, 42710.717681292292, 42729.886586702756, 42749.057642178363, 42768.23084723694, 42787.406201396603, 42806.58370417574, 42825.76335509299, 42844.945153667286, 42864.129099417805, 42883.315191864014, 42902.503430525649, 42921.693814922692, 42940.88634457541, 42960.081019004348, 42979.277837730297, 42998.476800274322, 43017.677906157769, 43036.881154902228, 43056.086546029583, 43075.294079061961, 43094.503753521763, 43113.715568931671, 43132.929524814601, 43152.145620693766, 43171.363856092619, 43190.584230534907, 43209.806743544621, 43229.031394646016, 43248.258183363621, 43267.487109222224, 43286.718171746885, 43305.951370462906, 43325.186704895881, 43344.42417457165, 43363.663779016322, 43382.905517756262, 43402.149390318104, 43421.395396228749, 43440.643535015348, 43459.89380620532, 43479.146209326354, 43498.400743906379, 43517.657409473606, 43536.916205556496, 43556.177131683784, 43575.44018738444, 43594.705372187724, 43613.972685623135, 43633.242127220445, 43652.513696509668, 43671.787393021099, 43691.063216285271, 43710.341165833001, 43729.621241195346, 43748.903441903625, 43768.187767489413, 43787.474217484552, 43806.762791421126, 43826.053488831501, 43845.346309248278, 43864.641252204325, 43883.938317232765, 43903.237503866971, 43922.538811640596, 43941.842240087513, 43961.147788741881, 43980.455457138101, 43999.765244810835, 44019.077151295001, 44038.391176125755, 44057.70731883854, 44077.02557896902, 44096.345956053141, 44115.668449627083, 44134.993059227287, 44154.319784390456, 44173.648624653535, 44192.979579553728, 44212.312648628489, 44231.647831415532, 44250.985127452805, 44270.324536278538, 44289.666057431183, 44309.009690449464, 44328.355434872348, 44347.703290239064, 44367.053256089079, 44386.405331962109, 44405.759517398139, 44425.115811937387, 44444.474215120332, 44463.834726487694, 44483.197345580462, 44502.562071939843, 44521.928905107328, 44541.297844624634, 44560.668890033732, 44580.042040876848, 44599.417296696454, 44618.794657035272, 44638.174121436256, 44657.555689442641, 44676.939360597877, 44696.325134445673, 44715.713010530002, 44735.102988395054, 44754.495067585296, 44773.88924764542, 44793.285528120374, 44812.683908555344, 44832.084388495779, 44851.486967487363, 44870.891645076015, 44890.298420807922, 44909.707294229491, 44929.118264887409, 44948.531332328566, 44967.946496100136, 44987.363755749502, 45006.783110824319, 45026.204560872473, 45045.628105442098, 45065.053744081561, 45084.48147633949, 45103.911301764747, 45123.343219906426, 45142.777230313885, 45162.21333253671, 45181.651526124733, 45201.091810628037, 45220.534185596924, 45239.978650581965, 45259.425205133957, 45278.873848803938, 45298.324581143192, 45317.777401703235, 45337.232310035848, 45356.68930569302, 45376.148388226997, 45395.60955719027, 45415.072812135557, 45434.538152615823, 45454.005578184282, 45473.475088394356, 45492.946682799746, 45512.420360954362, 45531.896122412363, 45551.373966728155, 45570.853893456362, 45590.33590215187, 45609.819992369776, 45629.306163665438, 45648.794415594442, 45668.284747712612, 45687.777159576006, 45707.27165074092, 45726.768220763894, 45746.266869201696, 45765.767595611323, 45785.270399550034, 45804.775280575297, 45824.282238244828, 45843.79127211657, 45863.302381748719, 45882.815566699683, 45902.33082652813, 45921.848160792935, 45941.367569053225, 45960.889050868354, 45980.41260579793, 45999.938233401757, 46019.465933239902, 46038.995704872657, 46058.527547860547, 46078.06146176433, 46097.597446144995, 46117.135500563774, 46136.675624582109, 46156.217817761702, 46175.762079664462, 46195.308409852543, 46214.856807888333, 46234.407273334444, 46253.959805753715, 46273.51440470924, 46293.071069764315, 46312.629800482478, 46332.190596427499, 46351.753457163381, 46371.318382254351, 46390.885371264863, 46410.45442375962, 46430.025539303526, 46449.598717461733, 46469.17395779962, 46488.751259882782, 46508.33062327707, 46527.912047548532, 46547.495532263471, 46567.081076988397, 46586.668681290059, 46606.258344735434, 46625.850066891719, 46645.443847326351, 46665.039685606986, 46684.637581301497, 46704.237533978005, 46723.839543204842, 46743.443608550573, 46763.049729583989, 46782.657905874104, 46802.268136990162, 46821.880422501628, 46841.494761978196, 46861.111154989776, 46880.729601106526, 46900.350099898795, 46919.97265093719, 46939.597253792526, 46959.223908035841, 46978.852613238392, 46998.483368971691, 47018.11617480743, 47037.751030317551, 47057.387935074221, 47077.026888649809, 47096.66789061694, 47116.310940548428, 47135.956038017328, 47155.603182596918, 47175.252373860698, 47194.903611382375, 47214.556894735892, 47234.212223495422, 47253.869597235338, 47273.52901553025, 47293.19047795498, 47312.853984084577, 47332.519533494306, 47352.187125759658, 47371.856760456343, 47391.528437160297, 47411.202155447652, 47430.877914894787, 47450.555715078299, 47470.235555574982, 47489.917435961863, 47509.601355816201, 47529.287314715453, 47548.975312237308, 47568.665347959672, 47588.357421460656, 47608.051532318605, 47627.747680112072, 47647.445864419846, 47667.14608482091, 47686.848340894474, 47706.552632219973, 47726.258958377046, 47745.967318945557, 47765.677713505589, 47785.390141637428, 47805.104602921601, 47824.821096938824, 47844.539623270044, 47864.260181496429, 47883.982771199349, 47903.707391960394, 47923.434043361369, 47943.162724984308, 47962.893436411439, 47982.626177225218, 48002.36094700831, 48022.097745343599, 48041.836571814172, 48061.57742600335, 48081.32030749465, 48101.065215871815, 48120.81215071879, 48140.56111161974, 48160.312098159047, 48180.065109921306, 48199.820146491307, 48219.577207454073, 48239.336292394844, 48259.097400899045, 48278.860532552339, 48298.625686940592, 48318.392863649875, 48338.162062266485, 48357.933282376915, 48377.706523567889, 48397.481785426316, 48417.259067539344, 48437.038369494308, 48456.819690878765, 48476.603031280487, 48496.388390287451, 48516.175767487839, 48535.965162470042, 48555.756574822684, 48575.550004134566, 48595.345449994718, 48615.142911992378, 48634.942389716991, 48654.743882758201, 48674.547390705877, 48694.352913150084, 48714.160449681112, 48733.969999889443, 48753.781563365759, 48773.595139700978, 48793.410728486211, 48813.228329312769, 48833.047941772187, 48852.869565456189, 48872.693199956717, 48892.518844865925, 48912.346499776155, 48932.176164279976, 48952.007837970152, 48971.841520439666, 48991.677211281676, 49011.514910089587, 49031.354616456978, 49051.196329977654, 49071.04005024561, 49090.885776855059, 49110.733509400408, 49130.583247476279, 49150.434990677488, 49170.288738599062, 49190.144490836232, 49210.002246984441, 49229.86200663932, 49249.723769396718, 49269.587534852675, 49289.453302603448, 49309.32107224549, 49329.190843375451, 49349.062615590192, 49368.936388486785, 49388.812161662492, 49408.689934714785, 49428.569707241324, 49448.45147883999, 49468.335249108866, 49488.22101764621, 49508.108784050521, 49527.99854792047, 49547.890308854934, 49567.784066453009, 49587.679820313977, 49607.57757003732, 49627.477315222721, 49647.379055470075, 49667.28279037946, 49687.188519551179, 49707.096242585707, 49727.005959083741, 49746.917668646165, 49766.831370874068, 49786.747065368734, 49806.66475173166, 49826.584429564515, 49846.506098469203, 49866.429758047794, 49886.355407902578, 49906.283047636032, 49926.212676850846, 49946.144295149883, 49966.077902136225, 49986.013497413151, 50005.951080584135, 50025.890651252834, 50045.832209023123, 50065.775753499074, 50085.721284284933, 50105.668800985164, 50125.618303204428, 50145.569790547575, 50165.523262619652, 50185.478719025901, 50205.436159371769, 50225.395583262893, 50245.356990305103, 50265.320380104429, 50285.285752267104, 50305.253106399534, 50325.222442108337, 50345.193759000336, 50365.16705668252, 50385.142334762102, 50405.119592846473, 50425.098830543218, 50445.080047460127, 50465.063243205179, 50485.048417386541, 50505.035569612577, 50525.024699491856, 50545.015806633128, 50565.008890645338, 50585.003951137631, 50605.00098771933, 50624.999999999971, 50645.000987589265, 50665.003950097132, 50685.008887133677, 50705.015798309192, 50725.024683234165, 50745.035541519283, 50765.048372775411, 50785.063176613621, 50805.079952645159, 50825.098700481489, 50845.119419734241, 50865.142110015244, 50885.166770936521, 50905.193402110279, 50925.222003148934, 50945.252573665071, 50965.285113271471, 50985.319621581119, 51005.356098207172, 51025.394542762981, 51045.434954862096, 51065.477334118244, 51085.521680145357, 51105.567992557546, 51125.616270969113, 51145.66651499454, 51165.718724248516, 51185.772898345916, 51205.829036901778, 51225.887139531362, 51245.947205850105, 51266.009235473619, 51286.073228017718, 51306.139183098399, 51326.207100331856, 51346.276979334456, 51366.348819722756, 51386.42262111351, 51406.498383123653, 51426.57610537031, 51446.655787470787, 51466.737429042587, 51486.82102970338, 51506.906589071048, 51526.994106763632, 51547.083582399391, 51567.175015596738, 51587.268405974297, 51607.363753150858, 51627.461056745415, 51647.56031637713, 51667.661531665362, 51687.764702229651, 51707.869827689727, 51727.976907665499, 51748.085941777055, 51768.196929644677, 51788.309870888836, 51808.42476513017, 51828.541611989524, 51848.660411087905, 51868.781162046515, 51888.90386448674, 51909.028518030143, 51929.155122298485, 51949.283676913685, 51969.414181497872, 51989.546635673345, 52009.681039062583, 52029.817391288263, 52049.955691973213, 52070.095940740481, 52090.238137213273, 52110.382281014987, 52130.5283717692, 52150.676409099666, 52170.826392630333, 52190.97832198532, 52211.132196788931, 52231.288016665654, 52251.445781240145, 52271.60549013727, 52291.76714298204, 52311.930739399664, 52332.096279015546, 52352.263761455244, 52372.433186344519, 52392.604553309284, 52412.777861975665, 52432.953111969946, 52453.130302918595, 52473.309434448267, 52493.490506185793, 52513.67351775818, 52533.858468792605, 52554.045358916446, 52574.234187757254, 52594.42495494274, 52614.617660100812, 52634.812302859558, 52655.008882847229, 52675.20739969227, 52695.407853023295, 52715.610242469098, 52735.814567658657, 52756.02082822111, 52776.229023785803, 52796.439153982225, 52816.651218440056, 52836.865216789171, 52857.081148659599, 52877.29901368155, 52897.518811485425, 52917.740541701773, 52937.964203961354, 52958.18979789508, 52978.417323134046, 52998.646779309529, 53018.878166052978, 53039.111482996006, 53059.346729770419, 53079.583906008193, 53099.823011341483, 53120.0640454026, 53140.307007824063, 53160.551898238533, 53180.79871627887, 53201.047461578091, 53221.2981337694, 53241.550732486176, 53261.805257361964, 53282.061708030487, 53302.32008412564, 53322.580385281493, 53342.842611132299, 53363.106761312469, 53383.372835456597, 53403.640833199453, 53423.910754175973, 53444.18259802126, 53464.456364370613, 53484.732052859479, 53505.009663123499, 53525.289194798468, 53545.570647520362, 53565.854020925333, 53586.139314649699, 53606.426528329954, 53626.715661602764, 53647.006714104959, 53667.299685473547, 53687.59457534572, 53707.891383358816, 53728.190109150361, 53748.490752358055, 53768.793312619753, 53789.09778957349, 53809.404182857485, 53829.712492110106, 53850.022716969899, 53870.334857075584, 53890.648912066055, 53910.964881580367, 53931.28276525774, 53951.602562737586, 53971.924273659461, 53992.24789766311, 54012.57343438844, 54032.90088347553, 54053.23024456462, 54073.561517296133, 54093.894701310644, 54114.22979624891, 54134.566801751855, 54154.90571746057, 54175.246543016314, 54195.589278060506, 54215.933922234755, 54236.280475180814, 54256.628936540626, 54276.97930595628, 54297.331583070045, 54317.685767524359, 54338.041858961828, 54358.399857025215, 54378.759761357462, 54399.121571601667, 54419.485287401105, 54439.850908399218, 54460.218434239614, 54480.587864566056, 54500.95919902248, 54521.332437252997, 54541.707578901878, 54562.084623613555, 54582.46357103264, 54602.844420803893, 54623.227172572246, 54643.611825982807, 54663.998380680838, 54684.386836311773, 54704.777192521207, 54725.169448954897, 54745.563605258772, 54765.959661078923, 54786.357616061614, 54806.757469853255, 54827.159222100439, 54847.562872449904, 54867.968420548583, 54888.375866043534, 54908.785208582012, 54929.196447811417, 54949.609583379322, 54970.024614933463, 54990.441542121727, 55010.86036459219, 55031.28108199306, 55051.703693972733, 55072.128200179759, 55092.554600262847, 55112.982893870874, 55133.413080652877, 55153.845160258061, 55174.279132335789, 55194.714996535586, 55215.152752507143, 55235.592399900306, 55256.033938365079, 55276.477367551655, 55296.92268711036, 55317.369896691685, 55337.818995946305, 55358.269984525024, 55378.72286207883, 55399.177628258869, 55419.634282716441, 55440.092825103013, 55460.553255070205, 55481.015572269804, 55501.479776353764, 55521.945866974187, 55542.413843783339, 55562.883706433655, 55583.355454577715, 55603.82908786826, 55624.304605958219, 55644.782008500639, 55665.261295148754, 55685.742465555952, 55706.225519375774, 55726.710456261928, 55747.197275868275, 55767.685977848843, 55788.176561857814, 55808.669027549528, 55829.163374578478, 55849.659602599328, 55870.157711266889, 55890.657700236145, 55911.159569162221, 55931.663317700411, 55952.168945506164, 55972.676452235086, 55993.185837542944, 56013.697101085651, 56034.210242519301, 56054.72526150012, 56075.242157684508, 56095.760930729011, 56116.281580290342, 56136.804106025367, 56157.328507591104, 56177.85478464474, 56198.382936843598, 56218.912963845185, 56239.444865307138, 56259.978640887268, 56280.514290243525, 56301.051813034042, 56321.591208917082, 56342.13247755108, 56362.675618594607, 56383.220631706419, 56403.767516545398, 56424.316272770608, 56444.866900041241, 56465.419398016667, 56485.973766356394, 56506.530004720102, 56527.088112767611, 56547.648090158902, 56568.209936554107, 56588.773651613519, 56609.339234997584, 56629.9066863669, 56650.47600538221, 56671.04719170442, 56691.620244994599, 56712.195164913959, 56732.771951123868, 56753.350603285835, 56773.931121061541, 56794.513504112823, 56815.097752101647, 56835.683864690152, 56856.271841540627, 56876.86168231551, 56897.453386677393, 56918.046954289028, 56938.642384813298, 56959.239677913261, 56979.838833252121, 57000.439850493225, 57021.04272930009, 57041.647469336371, 57062.254070265873, 57082.862531752558, 57103.472853460553, 57124.085035054108, 57144.699076197649, 57165.314976555739, 57185.932735793103, 57206.552353574611, 57227.173829565276, 57247.797163430281, 57268.42235483494, 57289.049403444733, 57309.678308925286, 57330.30907094237, 57350.941689161911, 57371.576163249985, 57392.212492872815, 57412.850677696784, 57433.490717388406, 57454.132611614368, 57474.776360041491, 57495.421962336746, 57516.069418167266, 57536.718727200314, 57557.36988910332, 57578.022903543861, 57598.677770189643, 57619.334488708548, 57639.993058768589, 57660.653480037938, 57681.315752184906, 57701.979874877965, 57722.64584778573, 57743.31367057695, 57763.983342920546, 57784.654864485572, 57805.328234941233, 57826.003453956881, 57846.680521202026, 57867.359436346305, 57888.040199059527, 57908.722809011633, 57929.407265872709, 57950.093569313001, 57970.781719002895, 57991.471714612911, 58012.16355581375, 58032.857242276223, 58053.552773671312, 58074.25014967013, 58094.949369943948, 58115.650434164185, 58136.353342002389, 58157.058093130276, 58177.764687219693, 58198.47312394264, 58219.183402971255, 58239.895523977837, 58260.609486634821, 58281.325290614775, 58302.042935590434, 58322.762421234678, 58343.483747220511, 58364.206913221096, 58384.931918909751, 58405.658763959924, 58426.3874480452, 58447.117970839339, 58467.85033201622, 58488.584531249864, 58509.320568214462, 58530.058442584334, 58550.798154033931, 58571.539702237875, 58592.283086870906, 58613.028307607929, 58633.775364123983, 58654.52425609425, 58675.274983194053, 58696.027545098877, 58716.781941484325, 58737.538172026158, 58758.296236400274, 58779.056134282728, 58799.817865349694, 58820.581429277503, 58841.346825742643, 58862.114054421712, 58882.883114991484, 58903.654007128847, 58924.426730510851, 58945.201284814684, 58965.977669717664, 58986.755884897269, 59007.535930031117, 59028.317804796949, 59049.101508872664, 59069.887041936301, 59090.674403666046, 59111.463593740213, 59132.254611837263, 59153.047457635803, 59173.84213081457, 59194.638631052461, 59215.436958028506, 59236.237111421855, 59257.039090911829, 59277.842896177877, 59298.648526899589, 59319.455982756685, 59340.26526342905, 59361.076368596696, 59381.889297939757, 59402.704051138542, 59423.520627873484, 59444.339027825139, 59465.159250674224, 59485.9812961016, 59506.805163788253, 59527.630853415307, 59548.458364664046, 59569.287697215863, 59590.118850752311, 59610.951824955089, 59631.786619506012, 59652.623234087048, 59673.461668380311, 59694.301922068029, 59715.143994832593, 59735.987886356525, 59756.833596322482, 59777.681124413255, 59798.530470311794, 59819.381633701159, 59840.234614264569, 59861.089411685381, 59881.94602564707, 59902.804455833269, 59923.664701927737, 59944.526763614384, 59965.390640577243, 59986.256332500488, 60007.123839068438, 60027.993159965539, 60048.864294876381, 60069.737243485688, 60090.612005478324, 60111.488580539284, 60132.366968353708, 60153.247168606867, 60174.129180984164, 60195.013005171153, 60215.898640853513, 60236.786087717061, 60257.675345447751, 60278.566413731671, 60299.459292255044, 60320.353980704247, 60341.25047876576, 60362.148786126229, 60383.048902472423, 60403.950827491237, 60424.854560869717, 60445.76010229504, 60466.667451454516, 60487.57660803559, 60508.487571725847, 60529.400342212997, 60550.314919184893, 60571.231302329521, 60592.149491335003, 60613.069485889588, 60633.991285681674, 60654.914890399785, 60675.840299732568, 60696.767513368832, 60717.696530997484, 60738.627352307602, 60759.55997698837, 60780.494404729128, 60801.430635219323, 60822.368668148556, 60843.308503206565, 60864.250140083204, 60885.193578468468, 60906.138818052495, 60927.085858525541, 60948.034699578006, 60968.985340900421, 60989.937782183442, 61010.892023117864, 61031.848063394616, 61052.805902704764, 61073.765540739492, 61094.726977190134, 61115.690211748137, 61136.655244105103, 61157.622073952742, 61178.590700982917, 61199.561124887616, 61220.533345358948, 61241.507362089171, 61262.483174770663, 61283.460783095943, 61304.440186757645, 61325.421385448557, 61346.404378861582, 61367.389166689762, 61388.375748626262, 61409.364124364387, 61430.354293597571, 61451.346256019373, 61472.340011323497, 61493.335559203762, 61514.332899354122, 61535.332031468672, 61556.332955241618, 61577.335670367313, 61598.340176540238, 61619.346473454993, 61640.354560806329, 61661.3644382891, 61682.376105598312, 61703.389562429089, 61724.404808476691, 61745.42184343651, 61766.440667004063, 61787.461278874987, 61808.483678745069, 61829.507866310203, 61850.533841266435, 61871.561603309929, 61892.591152136971, 61913.622487443987, 61934.655608927525, 61955.690516284267, 61976.727209211022, 61997.765687404724, 62018.805950562448, 62039.847998381381, 62060.891830558845, 62081.93744679229, 62102.984846779298, 62124.034030217575, 62145.084996804966, 62166.137746239416, 62187.19227821903, 62208.248592442025, 62229.306688606739, 62250.366566411656, 62271.428225555377, 62292.491665736627, 62313.556886654267, 62334.623888007271, 62355.692669494762, 62376.763230815974, 62397.835571670272, 62418.909691757144, 62439.98559077621, 62461.063268427228, 62482.142724410049, 62503.223958424685, 62524.306970171267, 62545.39175935003, 62566.478325661366, 62587.566668805768, 62608.656788483881, 62629.748684396451, 62650.842356244357, 62671.937803728622, 62693.035026550366, 62714.134024410858, 62735.234797011479, 62756.337344053733, 62777.441665239276, 62798.547760269852, 62819.655628847358, 62840.765270673801, 62861.876685451323, 62882.989872882186, 62904.104832668774, 62925.221564513602, 62946.340068119309, 62967.460343188657, 62988.582389424526, 63009.70620652994, 63030.831794208025, 63051.959152162039, 63073.08828009537, 63094.219177711529, 63115.351844714154, 63136.486280806988, 63157.622485693922, 63178.760459078956, 63199.900200666219, 63221.041710159967, 63242.184987264569, 63263.330031684534, 63284.476843124474, 63305.625421289144, 63326.775765883409, 63347.927876612259, 63369.081753180813, 63390.237395294316, 63411.39480265812, 63432.553974977716, 63453.714911958712, 63474.877613306839, 63496.042078727944, 63517.208307927998, 63538.376300613119, 63559.546056489504, 63580.717575263516, 63601.890856641607, 63623.065900330374, 63644.242706036515, 63665.421273466869, 63686.601602328381, 63707.783692328136, 63728.967543173334, 63750.153154571279, 63771.340526229418, 63792.529657855317, 63813.720549156649, 63834.913199841227, 63856.107609616978, 63877.303778191941, 63898.501705274284, 63919.7013905723, 63940.902833794404, 63962.106034649114, 63983.310992845094, 64004.517708091109, 64025.726180096048, 64046.936408568938, 64068.1483932189, 64089.362133755196, 64110.577629887193, 64131.794881324393, 64153.013887776404, 64174.234648952966, 64195.457164563937, 64216.681434319289, 64237.907457929112, 64259.135235103626, 64280.36476555316, 64301.596048988169, 64322.829085119236, 64344.06387365704, 64365.300414312398, 64386.538706796251, 64407.778750819634, 64429.020546093721, 64450.26409232981, 64471.509389239291, 64492.756436533709, 64514.005233924705, 64535.255781124033, 64556.50807784358, 64577.762123795357, 64599.017918691468, 64620.275462244172, 64641.534754165805, 64662.795794168844, 64684.058581965895, 64705.323117269661, 64726.589399792974, 64747.857429248776, 64769.127205350138, 64790.398727810236, 64811.671996342375, 64832.947010659969, 64854.223770476558, 64875.502275505794, 64896.782525461451, 64918.064520057414, 64939.348259007682, 64960.633742026388, 64981.920968827762, 65003.209939126165, 65024.500652636067, 65045.793109072067, 65067.087308148861, 65088.383249581282, 65109.680933084259, 65130.980358372864, 65152.28152516226, 65173.584433167736, 65194.889082104703, 65216.195471688683, 65237.503601635319, 65258.813471660353, 65280.125081479666, 65301.438430809241, 65322.753519365178, 65344.070346863708, 65365.388913021146, 65386.709217553958, 65408.031260178701, 65429.355040612056, 65450.680558570821, 65472.00781377191, 65493.336805932355, 65514.66753476928, 65535.999999999956, 65557.334201341757, 65578.670138512171, 65600.007811228788, 65621.347219209332, 65642.688362171626, 65664.031239833639, 65685.375851913413, 65706.722198129137, 65728.070278199084, 65749.420091841661, 65770.771638775404, 65792.124918718939, 65813.479931391004, 65834.836676510458, 65856.195153796303, 65877.5553629676, 65898.917303743554, 65920.280975843489, 65941.646378986843, 65963.013512893158, 65984.382377282076, 66005.752971873386, 66027.125296386963, 66048.499350542799, 66069.875134061018, 66091.252646661844, 66112.631888065618, 66134.01285799277, 66155.395556163887, 66176.779982299631, 66198.166136120795, 66219.554017348273, 66240.943625703105, 66262.334960906388, 66283.728022679396, 66305.122810743444, 66326.519324820023, 66347.917564630698, 66369.317529897162, 66390.719220341227, 66412.122635684791, 66433.527775649884, 66454.934639958636, 66476.343228333324, 66497.753540496284, 66519.165576169995, 66540.57933507704, 66561.994816940118, 66583.412021482043, 66604.830948425733, 66626.251597494222, 66647.673968410629, 66669.098060898235, 66690.523874680381, 66711.951409480564, 66733.380665022371, 66754.811641029475, 66776.244337225711, 66797.678753334985, 66819.11488908132, 66840.552744188884, 66861.992318381905, 66883.433611384738, 66904.876622921889, 66926.321352717903, 66947.767800497502, 66969.215965985466, 66990.665848906734, 67012.117448986304, 67033.570765949335, 67055.025799521056, 67076.482549426815, 67097.941015392076, 67119.401197142433, 67140.863094403554, 67162.326706901222, 67183.792034361351, 67205.259076509959, 67226.72783307315, 67248.198303777172, 67269.670488348347, 67291.144386513144, 67312.619997998088, 67334.09732252988, 67355.576359835293, 67377.057109641188, 67398.53957167457, 67420.023745662547, 67441.50963133233, 67462.99722841123, 67484.486536626689, 67505.977555706224, 67527.470285377494, 67548.964725368263, 67570.460875406367, 67591.9587352198, 67613.458304536631, 67634.95958308503, 67656.462570593329, 67677.967266789899, 67699.473671403248, 67720.981784162024, 67742.491604794923, 67764.003133030797, 67785.516368598575, 67807.031311227314, 67828.547960646174, 67850.066316584402, 67871.58637877139, 67893.108146936589, 67914.63162080961, 67936.156800120138, 67957.683684597971, 67979.212273973011, 68000.742567975263, 68022.274566334876, 68043.808268782057, 68065.343675047145, 68086.880784860579, 68108.419597952918, 68129.960114054789, 68151.502332896969, 68173.04625421032, 68194.591877725834, 68216.139203174564, 68237.688230287706, 68259.238958796544, 68280.791388432481, 68302.345518927032, 68323.901350011787, 68345.458881418483, 68367.018112878912, 68388.579044125028, 68410.141674888844, 68431.706004902502, 68453.272033898262, 68474.839761608455, 68496.409187765545, 68517.980312102081, 68539.553134350732, 68561.127654244279, 68582.70387151558, 68604.281785897634, 68625.861397123503, 68647.44270492639, 68669.025709039604, 68690.610409196524, 68712.196805130661, 68733.784896575627, 68755.374683265123, 68776.966164932994, 68798.559341313128, 68820.154212139591, 68841.750777146473, 68863.349036068044, 68884.948988638629, 68906.550634592684, 68928.153973664739, 68949.75900558944, 68971.365730101577, 68992.974146935987, 69014.584255827634, 69036.196056511588, 69057.809548723017, 69079.424732197207, 69101.041606669532, 69122.660171875468, 69144.280427550606, 69165.902373430625, 69187.526009251334, 69209.151334748618, 69230.778349658474, 69252.40705371699, 69274.037446660412, 69295.669528225, 69317.303298147192, 69338.938756163494, 69360.575902010532, 69382.214735425005, 69403.855256143754, 69425.497463903681, 69447.141358441833, 69468.78693949533, 69490.434206801394, 69512.083160097391, 69533.733799120717, 69555.386123608929, 69577.04013329967, 69598.695827930685, 69620.353207239794, 69642.012270964973, 69663.67301884426, 69685.335450615792, 69706.999566017839, 69728.665364788743, 69750.332846666963, 69772.002011391058, 69793.672858699691, 69815.345388331611, 69837.019600025669, 69858.695493520849, 69880.373068556204, 69902.052324870907, 69923.733262204216, 69945.415880295492, 69967.100178884211, 69988.786157709939, 70010.473816512356, 70032.163155031216, 70053.854173006403, 70075.546870177874, 70097.241246285717, 70118.937301070109, 70140.635034271298, 70162.334445629691, 70184.035534885741, 70205.738301780017, 70227.442746053217, 70249.1488674461, 70270.856665699539, 70292.566140554511, 70314.277291752107, 70335.990119033493, 70357.704622139936, 70379.420800812819, 70401.138654793613, 70422.85818382389, 70444.579387645339, 70466.302265999722, 70488.026818628918, 70509.753045274876, 70531.480945679708, 70553.210519585555, 70574.941766734701, 70596.674686869505, 70618.409279732456, 70640.145545066101, 70661.883482613106, 70683.623092116264, 70705.364373318414, 70727.107325962526, 70748.851949791671, 70770.598244549008, 70792.346209977783, 70814.095845821372, 70835.847151823225, 70857.600127726895, 70879.354773276034, 70901.111088214413, 70922.869072285859, 70944.628725234332, 70966.390046803877, 70988.153036738629, 71009.917694782853, 71031.684020680885, 71053.45201417715, 71075.221675016204, 71096.993002942661, 71118.765997701266, 71140.540659036851, 71162.316986694335, 71184.09498041874, 71205.874639955218, 71227.655965048951, 71249.438955445294, 71271.223610889632, 71293.009931127483, 71314.797915904477, 71336.587564966307, 71358.378878058764, 71380.171854927772, 71401.966495319313, 71423.762798979486, 71445.560765654489, 71467.360395090596, 71489.161687034211, 71510.964641231811, 71532.769257429973, 71554.575535375348, 71576.383474814749, 71598.19307549503, 71620.004337163133, 71641.817259566145, 71663.631842451214, 71685.4480855656, 71707.26598865664, 71729.085551471784, 71750.906773758586, 71772.729655264673, 71794.554195737772, 71816.380394925713, 71838.208252576442, 71860.037768437964, 71881.868942258385, 71903.701773785942, 71925.536262768932, 71947.372408955751, 71969.210212094898, 71991.049671934976, 72012.890788224686, 72034.73356071279, 72056.577989148165, 72078.424073279821, 72100.271812856794, 72122.121207628254, 72143.97225734347, 72165.824961751801, 72187.679320602692, 72209.53533364569, 72231.393000630429, 72253.252321306645, 72275.113295424177, 72296.975922732949, 72318.840202982959, 72340.706135924338, 72362.573721307272, 72384.442958882093, 72406.313848399179, 72428.186389609036, 72450.060582262216, 72471.936426109431, 72493.813920901433, 72515.693066389096, 72537.573862323392, 72559.456308455352, 72581.340404536139, 72603.226150316987, 72625.113545549248, 72647.002589984331, 72668.893283373764, 72690.785625469172, 72712.679616022273, 72734.575254784853, 72756.472541508803, 72778.371475946144, 72800.272057848939, 72822.174286969355, 72844.07816305969, 72865.983685872285, 72887.890855159596, 72909.799670674183, 72931.710132168693, 72953.622239395845, 72975.535992108475, 72997.451390059519, 73019.368433001961, 73041.287120688925, 73063.207452873612, 73085.129429309294, 73107.053049749389, 73128.978313947344, 73150.905221656736, 73172.833772631217, 73194.763966624567, 73216.695803390612, 73238.62928268328, 73260.564404256627, 73282.501167864757, 73304.439573261901, 73326.379620202337, 73348.321308440485, 73370.264637730841, 73392.209607827957, 73414.156218486532, 73436.104469461323, 73458.054360507173, 73480.005891379056, 73501.959061831993, 73523.913871621116, 73545.870320501665, 73567.828408228932, 73589.78813455833, 73611.749499245358, 73633.712502045615, 73655.677142714747, 73677.643421008557, 73699.611336682879, 73721.580889493693, 73743.552079197019, 73765.524905548999, 73787.499368305856, 73809.475467223907, 73831.453202059551, 73853.432572569291, 73875.413578509717, 73897.396219637507, 73919.380495709411, 73941.36640648231, 73963.353951713143, 73985.343131158952, 74007.333944576865, 74029.326391724098, 74051.320472357969, 74073.316186235883, 74095.313533115303, 74117.312512753837, 74139.313124909138, 74161.315369338976, 74183.319245801191, 74205.324754053727, 74227.331893854629, 74249.340664961986, 74271.351067134034, 74293.363100129049, 74315.376763705441, 74337.392057621662, 74359.408981636298, 74381.427535508003, 74403.447718995507, 74425.469531857671, 74447.492973853383, 74469.518044741693, 74491.54474428168, 74513.573072232539, 74535.603028353551, 74557.634612404087, 74579.667824143602, 74601.702663331642, 74623.739129727837, 74645.777223091936, 74667.816943183716, 74689.858289763113, 74711.901262590094, 74733.945861424741, 74755.992086027225, 74778.039936157802, 74800.089411576817, 74822.140512044702, 74844.193237321961, 74866.24758716923, 74888.303561347187, 74910.36115961663, 74932.420381738411, 74954.481227473516, 74976.543696582972, 74998.607788827925, 75020.673503969607, 75042.740841769322, 75064.809801988464, 75086.88038438854, 75108.952588731103, 75131.026414777836, 75153.101862290467, 75175.178931030852, 75197.257620760924, 75219.33793124267, 75241.419862238225, 75263.503413509738, 75285.588584819503, 75307.675375929874, 75329.763786603318, 75351.853816602365, 75373.945465689612, 75396.038733627807, 75418.133620179724, 75440.230125108254, 75462.32824817636, 75484.427989147109, 75506.529347783653, 75528.63232384919, 75550.736917107075, 75572.843127320695, 75594.950954253538, 75617.060397669193, 75639.171457331307, 75661.284133003646, 75683.398424450032, 75705.514331434402, 75727.631853720741, 75749.750991073175, 75771.871743255862, 75793.994110033076, 75816.118091169177, 75838.243686428585, 75860.370895575848, 75882.499718375562, 75904.630154592422, 75926.762203991224, 75948.895866336825, 75971.031141394182, 75993.168028928325, 76015.306528704401, 76037.4466404876, 76059.588364043215, 76081.731699136653, 76103.876645533353, 76126.023202998884, 76148.171371298871, 76170.321150199044, 76192.472539465205, 76214.625538863256, 76236.780148159174, 76258.936367119008, 76281.094195508922, 76303.253633095141, 76325.414679643975, 76347.577334921851, 76369.741598695226, 76391.907470730686, 76414.074950794879, 76436.244038654564, 76458.414734076548, 76480.587036827754, 76502.760946675175, 76524.936463385893, 76547.11358672705, 76569.292316465915, 76591.472652369819, 76613.654594206164, 76635.838141742468, 76658.023294746308, 76680.210052985349, 76702.398416227341, 76724.588384240138, 76746.779956791637, 76768.973133649866, 76791.167914582897, 76813.364299358902, 76835.562287746157, 76857.761879512967, 76879.963074427797, 76902.165872259109, 76924.37027277553, 76946.576275745727, 76968.783880938441, 76990.993088122515, 77013.203897066895, 77035.416307540567, 77057.630319312622, 77079.845932152239, 77102.063145828695, 77124.281960111301, 77146.50237476948, 77168.724389572759, 77190.948004290723, 77213.173218693031, 77235.400032549442, 77257.628445629802, 77279.858457704031, 77302.090068542122, 77324.323277914169, 77346.558085590339, 77368.794491340886, 77391.032494936138, 77413.272096146524, 77435.51329474253, 77457.756090494731, 77480.000483173804, 77502.246472550498, 77524.494058395634, 77546.743240480107, 77568.994018574944, 77591.246392451198, 77613.500361880026, 77635.755926632657, 77658.013086480438, 77680.271841194757, 77702.532190547092, 77724.794134309021, 77747.057672252195, 77769.322804148323, 77791.589529769248, 77813.857848886837, 77836.127761273063, 77858.399266699998, 77880.67236493979, 77902.947055764627, 77925.223338946831, 77947.50121425878, 77969.780681472927, 77992.061740361838, 78014.344390698127, 78036.628632254491, 78058.914464803747, 78081.201888118725, 78103.490901972415, 78125.781506137821, 78148.073700388064, 78170.367484496339, 78192.662858235926, 78214.959821380166, 78237.258373702498, 78259.558514976452, 78281.860244975614, 78304.163563473659, 78326.468470244363, 78348.77496506153, 78371.083047699125, 78393.392717931114, 78415.703975531578, 78438.016820274701, 78460.331251934695, 78482.647270285903, 78504.964875102727, 78527.284066159627, 78549.604843231195, 78571.927206092048, 78594.251154516911, 78616.576688280606, 78638.903807157985, 78661.232510924034, 78683.562799353778, 78705.894672222363, 78728.228129304945, 78750.563170376859, 78772.899795213423, 78795.238003590101, 78817.577795282399, 78839.919170065928, 78862.262127716356, 78884.606668009452, 78906.952790721043, 78929.300495627045, 78951.64978250346, 78974.000651126378, 78996.353101271932, 79018.707132716358, 79041.062745235977, 79063.41993860717, 79085.778712606436, 79108.139067010285, 79130.501001595389, 79152.864516138419, 79175.22961041618, 79197.596284205531, 79219.96453728342, 79242.33436942687, 79264.705780412987, 79287.078770018954, 79309.453338022009, 79331.829484199508, 79354.207208328866, 79376.586510187582, 79398.967389553218, 79421.349846203433, 79443.733879915948, 79466.119490468584, 79488.50667763922, 79510.895441205823, 79533.285780946433, 79555.677696639163, 79578.071188062226, 79600.466254993895, 79622.862897212515, 79645.261114496549, 79667.660906624471, 79690.062273374875, 79712.465214526455, 79734.869729857935, 79757.275819148126, 79779.683482175955, 79802.092718720378, 79824.503528560454, 79846.915911475327, 79869.329867244203, 79891.745395646343, 79914.162496461155, 79936.581169468045, 79959.001414446553, 79981.423231176261, 80003.846619436852, 80026.271579008084, 80048.698109669771, 80071.12621120183, 80093.555883384237, 80115.987125997053, 80138.419938820414, 80160.854321634528, 80183.290274219689, 80205.727796356281, 80228.166887824715, 80250.607548405547, 80273.049777879336, 80295.493576026798, 80317.938942628651, 80340.385877465727, 80362.834380318949, 80385.28445096928, 80407.736089197788, 80430.189294785596, 80452.644067513917, 80475.100407164035, 80497.558313517322, 80520.017786355209, 80542.478825459213, 80564.941430610925, 80587.405601592007, 80609.871338184195, 80632.338640169342, 80654.8075073293, 80677.277939446067, 80699.749936301683, 80722.223497678278, 80744.698623358039, 80767.17531312324, 80789.653566756242, 80812.133384039465, 80834.614764755403, 80857.097708686648, 80879.582215615854, 80902.068285325731, 80924.555917599093, 80947.045112218824, 80969.535868967869, 80992.028187629272, 81014.522067986123, 81037.017509821613, 81059.514512919006, 81082.013077061609, 81104.513202032831, 81127.014887616184, 81149.518133595193, 81172.022939753486, 81194.529305874807, 81217.037231742899, 81239.546717141639, 81262.057761854958, 81284.570365666848, 81307.084528361403, 81329.600249722775, 81352.117529535186, 81374.636367582949, 81397.156763650448, 81419.678717522125, 81442.202228982511, 81464.727297816222, 81487.253923807933, 81509.782106742379, 81532.311846404409, 81554.843142578902, 81577.375995050839, 81599.910403605274, 81622.446368027333, 81644.983888102215, 81667.522963615178, 81690.063594351581, 81712.605780096841, 81735.149520636449, 81757.694815755967, 81780.241665241047, 81802.79006887741, 81825.340026450824, 81847.891537747171, 81870.444602552379, 81892.999220652477, 81915.555391833506, 81938.113115881672, 81960.672392583176, 81983.233221724338, 82005.795603091537, 82028.359536471224, 82050.925021649906, 82073.492058414209, 82096.060646550788, 82118.630785846399, 82141.202476087841, 82163.775717062032, 82186.35050855593, 82208.926850356569, 82231.504742251054, 82254.084184026578, 82276.665175470393, 82299.24771636985, 82321.831806512317, 82344.417445685307, 82367.004633676348, 82389.593370273054, 82412.183655263143, 82434.775488434374, 82457.368869574595, 82479.963798471697, 82502.560274913689, 82525.158298688606, 82547.757869584602, 82570.35898738986, 82592.961651892678, 82615.565862881398, 82638.171620144421, 82660.778923470265, 82683.387772647475, 82705.998167464713, 82728.610107710658, 82751.223593174116, 82773.83862364394, 82796.45519890904, 82819.073318758441, 82841.692982981185, 82864.314191366429, 82886.936943703375, 82909.561239781324, 82932.187079389638, 82954.814462317736, 82977.443388355125, 83000.073857291369, 83022.70586891612, 83045.339423019104, 83067.974519390089, 83090.611157818959, 83113.249338095629, 83135.8890600101, 83158.530323352461, 83181.173127912858, 83203.817473481497, 83226.463359848669, 83249.11078680474, 83271.759754140134, 83294.410261645375, 83317.062309111003, 83339.715896327703, 83362.371023086147, 83385.027689177165, 83407.685894391587, 83430.345638520361, 83453.006921354478, 83475.669742685001, 83498.334102303095, 83520.999999999942, 83543.667435566866, 83566.336408795192, 83589.006919476349, 83611.678967401851, 83634.352552363242, 83657.027674152167, 83679.704332560359, 83702.382527379552, 83725.062258401638, 83747.743525418511, 83770.42632822218, 83793.110666604684, 83815.796540358162, 83838.483949274829, 83861.172893146941, 83883.863371766842, 83906.555384926964, 83929.248932419752, 83951.944014037799, 83974.640629573696, 83997.338778820151, 84020.038461569929, 84042.739677615857, 84065.442426750829, 84088.146708767847, 84110.852523459922, 84133.559870620171, 84156.268750041796, 84178.979161518029, 84201.691104842204, 84224.404579807713, 84247.119586208006, 84269.83612383662, 84292.55419248715, 84315.273791953281, 84337.994922028738, 84360.717582507335, 84383.441773182945, 84406.167493849513, 84428.894744301069, 84451.623524331691, 84474.353833735542, 84497.085672306828, 84519.819039839858, 84542.553936128999, 84565.290360968676, 84588.028314153402, 84610.767795477717, 84633.508804736295, 84656.251341723822, 84678.995406235073, 84701.740998064924, 84724.488117008252, 84747.236762860062, 84769.986935415407, 84792.73863446941, 84815.491859817252, 84838.246611254188, 84861.002888575575, 84883.760691576768, 84906.520020053256, 84929.28087380057, 84952.043252614312, 84974.807156290146, 84997.572584623806, 85020.339537411113, 85043.108014447949, 85065.878015530237, 85088.649540453989, 85111.422589015303, 85134.197161010321, 85156.973256235244, 85179.750874486374, 85202.530015560071, 85225.310679252725, 85248.092865360857, 85270.876573681016, 85293.661804009811, 85316.448556143951, 85339.236829880188, 85362.026625015351, 85384.817941346351, 85407.610778670132, 85430.405136783724, 85453.201015484257, 85475.998414568865, 85498.797333834795, 85521.597773079353, 85544.399732099904, 85567.203210693886, 85590.008208658808, 85612.814725792239, 85635.62276189182, 85658.432316755265, 85681.243390180331, 85704.055981964877, 85726.870091906807, 85749.685719804082, 85772.502865454764, 85795.321528656961, 85818.141709208852, 85840.963406908675, 85863.78662155474, 85886.611352945445, 85909.437600879217, 85932.26536515457, 85955.094645570091, 85977.92544192441, 86000.757754016275, 86023.591581644432, 86046.426924607746, 86069.263782705122, 86092.102155735556, 86114.942043498071, 86137.783445791807, 86160.626362415918, 86183.470793169676, 86206.316737852379, 86229.164196263402, 86252.013168202204, 86274.863653468303, 86297.715651861261, 86320.569163180728, 86343.424187226425, 86366.280723798132, 86389.138772695675, 86411.998333718977, 86434.859406668009, 86457.721991342827, 86480.586087543532, 86503.451695070296, 86526.318813723352, 86549.187443303032, 86572.057583609683, 86594.929234443756, 86617.802395605773, 86640.677066896271, 86663.553248115903, 86686.43093906538, 86709.310139545443, 86732.190849356964, 86755.073068300815, 86777.956796177954, 86800.842032789442, 86823.728777936354, 86846.617031419853, 86869.506793041175, 86892.398062601613, 86915.290839902518, 86938.185124745316, 86961.080916931489, 86983.978216262592, 87006.87702254027, 87029.777335566177, 87052.67915514209, 87075.582481069796, 87098.487313151185, 87121.39365118822, 87144.301494982894, 87167.210844337285, 87190.121699053532, 87213.034058933845, 87235.947923780506, 87258.863293395829, 87281.780167582241, 87304.698546142172, 87327.618428878181, 87350.539815592856, 87373.462706088845, 87396.387100168897, 87419.312997635774, 87442.240398292357, 87465.16930194154, 87488.099708386319, 87511.031617429733, 87533.965028874911, 87556.899942525008, 87579.836358183282, 87602.774275653021, 87625.713694737613, 87648.654615240492, 87671.597036965148, 87694.540959715145, 87717.486383294105, 87740.433307505737, 87763.381732153779, 87786.331657042057, 87809.283081974456, 87832.236006754916, 87855.190431187453, 87878.146355076155, 87901.103778225151, 87924.062700438633, 87947.023121520891, 87969.985041276246, 87992.948459509105, 88015.913376023906, 88038.879790625171, 88061.847703117513, 88084.817113305573, 88107.788020994049, 88130.760425987726, 88153.734328091465, 88176.709727110137, 88199.686622848749, 88222.665015112303, 88245.644903705906, 88268.626288434709, 88291.609169103947, 88314.593545518903, 88337.579417484914, 88360.566784807408, 88383.555647291854, 88406.546004743795, 88429.537856968818, 88452.531203772611, 88475.52604496089, 88498.522380339447, 88521.52020971413, 88544.519532890874, 88567.520349675644, 88590.522659874507, 88613.526463293543, 88636.531759738922, 88659.538549016899, 88682.546830933745, 88705.556605295846, 88728.567871909589, 88751.580630581491, 88774.594881118086, 88797.610623325963, 88820.62785701183, 88843.646581982393, 88866.666798044462, 88889.688505004888, 88912.711702670611, 88935.7363908486, 88958.762569345898, 88981.790237969632, 89004.81939652696, 89027.850044825114, 89050.882182671412, 89073.9158098732, 89096.950926237885, 89119.987531572973, 89143.025625686001, 89166.065208384563, 89189.106279476357, 89212.148838769106, 89235.192886070581, 89258.238421188667, 89281.285443931265, 89304.333954106376, 89327.383951522017, 89350.435435986306, 89373.488407307406, 89396.542865293537, 89419.598809753006, 89442.656240494165, 89465.715157325409, 89488.775560055219, 89511.837448492137, 89534.900822444746, 89557.965681721733, 89581.032026131812, 89604.099855483742, 89627.169169586399, 89650.239968248672, 89673.312251279538, 89696.386018488018, 89719.461269683205, 89742.53800467425, 89765.616223270365, 89788.69592528083, 89811.777110514988, 89834.859778782207, 89857.943929891975, 89881.029563653807, 89904.116679877261, 89927.205278372014, 89950.29535894774, 89973.386921414218, 89996.479965581268, 90019.574491258769, 90042.670498256688, 90065.767986385021, 90088.866955453836, 90111.967405273259, 90135.069335653476, 90158.172746404758, 90181.277637337407, 90204.384008261797, 90227.49185898836, 90250.601189327586, 90273.711999090039, 90296.824288086325, 90319.938056127125, 90343.053303023189, 90366.170028585286, 90389.288232624298, 90412.407914951138, 90435.529075376777, 90458.651713712257, 90481.775829768681, 90504.901423357209, 90528.028494289058, 90551.157042375504, 90574.287067427911, 90597.418569257643, 90620.551547676194, 90643.686002495073, 90666.821933525847, 90689.959340580186, 90713.098223469773, 90736.238582006365, 90759.380416001804, 90782.523725267951, 90805.668509616764, 90828.814768860233, 90851.962502810435, 90875.11171127946, 90898.262394079517, 90921.414551022855, 90944.568181921743, 90967.72328658856, 90990.879864835719, 91014.037916475718, 91037.19744132107, 91060.358439184391, 91083.520909878338, 91106.684853215629, 91129.850269009039, 91153.017157071401, 91176.185517215621, 91199.355349254649, 91222.526653001492, 91245.699428269247, 91268.873674871036, 91292.049392620058, 91315.226581329553, 91338.405240812834, 91361.585370883287, 91384.766971354344, 91407.950042039476, 91431.134582752245, 91454.320593306256, 91477.508073515171, 91500.697023192712, 91523.887442152685, 91547.07933020893, 91570.272687175326, 91593.467512865856, 91616.663807094534, 91639.861569675442, 91663.060800422725, 91686.261499150554, 91709.463665673218, 91732.66729980502, 91755.872401360321, 91779.078970153569, 91802.287005999257, 91825.49650871192, 91848.707478106167, 91871.91991399668, 91895.133816198169, 91918.349184525418, 91941.566018793281, 91964.784318816659, 91988.004084410495, 92011.22531538982, 92034.448011569708, 92057.672172765277, 92080.897798791746, 92104.124889464365, 92127.353444598411, 92150.58346400928, 92173.814947512379, 92197.04789492322, 92220.282306057314, 92243.518180730272, 92266.755518757753, 92289.994319955469, 92313.234584139194, 92336.476311124774, 92359.719500728082, 92382.964152765067, 92406.210267051734, 92429.457843404161, 92452.706881638471, 92475.957381570814, 92499.209343017443, 92522.462765794655, 92545.717649718805, 92568.973994606305, 92592.231800273614, 92615.491066537259, 92638.751793213814, 92662.01398011994, 92685.277627072326, 92708.54273388772, 92731.809300382942, 92755.077326374871, 92778.346811680414, 92801.617756116568, 92824.890159500384, 92848.164021648947, 92871.439342379424, 92894.716121509016, 92917.994358855023, 92941.274054234746, 92964.555207465572, 92987.837818364962, 93011.121886750407, 93034.407412439468, 93057.694395249753, 93080.982834998955, 93104.272731504767, 93127.564084584999, 93150.856894057491, 93174.15115974014, 93197.446881450916, 93220.744059007804, 93244.04269222889, 93267.342780932304, 93290.644324936235, 93313.947324058914, 93337.251778118633, 93360.557686933767, 93383.865050322696, 93407.173868103928, 93430.484140095941, 93453.795866117362, 93477.109045986799, 93500.423679522952, 93523.739766544561, 93547.057306870454, 93570.376300319491, 93593.696746710571, 93617.018645862699, 93640.341997594893, 93663.666801726242, 93686.993058075881, 93710.320766463032, 93733.64992670693, 93756.980538626914, 93780.312602042337, 93803.646116772637, 93826.981082637285, 93850.317499455836, 93873.655367047861, 93896.994685233032, 93920.335453831038, 93943.677672661666, 93967.021341544707, 93990.366460300051, 94013.713028747632, 94037.061046707429, 94060.410513999494, 94083.761430443905, 94107.113795860845, 94130.467610070496, 94153.822872893157, 94177.179584149111, 94200.537743658759, 94223.897351242529, 94247.25840672091, 94270.620909914433, 94293.98486064373, 94317.350258729421, 94340.71710399224, 94364.085396252936, 94387.455135332348, 94410.82632105134, 94434.198953230851, 94457.573031691878, 94480.948556255447, 94504.325526742658, 94527.70394297468, 94551.083804772716, 94574.465111958023, 94597.847864351934, 94621.232061775823, 94644.617704051096, 94668.004790999272, 94691.393322441872, 94714.783298200506, 94738.174718096794, 94761.567581952477, 94784.961889589307, 94808.357640829097, 94831.754835493703, 94855.153473405066, 94878.553554385173, 94901.955078256055, 94925.358044839784, 94948.762453958523, 94972.168305434476, 94995.575599089891, 95018.984334747074, 95042.394512228391, 95065.806131356265, 95089.219191953176, 95112.633693841635, 95136.04963684424, 95159.467020783617, 95182.885845482466, 95206.306110763529, 95229.727816449609, 95253.150962363579, 95276.575548328314, 95300.001574166803, 95323.429039702052, 95346.857944757154, 95370.288289155214, 95393.720072719429, 95417.153295273019, 95440.587956639298, 95464.024056641589, 95487.461595103305, 95510.900571847902, 95534.340986698866, 95557.782839479783, 95581.226130014256, 95604.670858125959, 95628.117023638595, 95651.564626375985, 95675.013666161918, 95698.464142820303, 95721.916056175076, 95745.369406050231, 95768.824192269807, 95792.280414657915, 95815.738073038709, 95839.197167236387, 95862.657697075221, 95886.11966237954, 95909.583062973688, 95933.047898682111, 95956.514169329268, 95979.981874739708, 96003.451014738006, 96026.921589148798, 96050.393597796792, 96073.867040506724, 96097.341917103375, 96120.818227411626, 96144.295971256375, 96167.775148462577, 96191.255758855244, 96214.737802259449, 96238.221278500292, 96261.70618740299, 96285.192528792715, 96308.680302494788, 96332.169508334526, 96355.660146137321, 96379.152215728609, 96402.645716933868, 96426.14064957868, 96449.637013488609, 96473.134808489311, 96496.63403440651, 96520.134691065963, 96543.636778293469, 96567.140295914898, 96590.645243756153, 96614.151621643221, 96637.659429402134, 96661.168666858954, 96684.679333839798, 96708.191430170875, 96731.70495567839, 96755.219910188665, 96778.736293528011, 96802.254105522836, 96825.77334599958, 96849.29401478474, 96872.816111704873, 96896.339636586577, 96919.864589256511, 96943.390969541389, 96966.918777267958, 96990.448012263048, 97013.978674353522, 97037.510763366285, 97061.044279128328, 97084.579221466673, 97108.115590208385, 97131.653385180587, 97155.19260621049, 97178.733253125291, 97202.2753257523, 97225.81882391886, 97249.363747452342, 97272.910096180189, 97296.457869929916, 97320.007068529041, 97343.557691805196, 97367.109739586012, 97390.663211699197, 97414.218107972498, 97437.774428233737, 97461.332172310766, 97484.891340031507, 97508.451931223899, 97532.013945715982, 97555.577383335811, 97579.142243911512, 97602.708527271257, 97626.276233243261, 97649.845361655811, 97673.415912337223, 97696.987885115886, 97720.561279820206, 97744.1360962787, 97767.712334319876, 97791.289993772341, 97814.869074464703, 97838.449576225685, 97862.031498883996, 97885.614842268449, 97909.199606207883, 97932.785790531183, 97956.37339506732, 97979.962419645264, 98003.552864094076, 98027.144728242856, 98050.738011920766, 98074.332714956996, 98097.928837180807, 98121.526378421506, 98145.125338508456, 98168.725717271067, 98192.327514538789, 98215.930730141132, 98239.535363907664, 98263.141415668011, 98286.748885251814, 98310.357772488816, 98333.968077208759, 98357.579799241488, 98381.192938416847, 98404.807494564782, 98428.42346751524, 98452.040857098269, 98475.659663143917, 98499.27988548232, 98522.901523943656, 98546.524578358163, 98570.149048556093, 98593.774934367786, 98617.402235623624, 98641.030952154048, 98664.661083789513, 98688.292630360564, 98711.925591697771, 98735.559967631794, 98759.195757993293, 98782.832962613014, 98806.471581321734, 98830.111613950285, 98853.753060329575, 98877.39592029051, 98901.040193664099, 98924.68588028138, 98948.33297997342, 98971.981492571387, 98995.63141790645, 99019.282755809851, 99042.935506112874, 99066.589668646877, 99090.245243243233, 99113.902229733401, 99137.560627948857, 99161.220437721131, 99184.881658881859, 99208.544291262631, 99232.208334695169, 99255.87378901121, 99279.540654042547, 99303.208929621018, 99326.878615578535, 99350.549711746993, 99374.222217958435, 99397.896134044888, 99421.571459838422, 99445.248195171211, 99468.926339875441, 99492.605893783344, 99516.286856727209, 99539.969228539398, 99563.653009052287, 99587.338198098325, 99611.024795510006, 99634.712801119866, 99658.402214760499, 99682.093036264545, 99705.785265464699, 99729.478902193689, 99753.173946284325, 99776.870397569437, 99800.56825588191, 99824.267521054688, 99847.968192920773, 99871.670271313182, 99895.373756065004, 99919.078647009388, 99942.78494397951, 99966.492646808634, 99990.20175533001, 100013.91226937699, 100037.62418878295, 100061.33751338134, 100085.05224300563, 100108.76837748935, 100132.4859166661, 100156.2048603695, 100179.92520843323, 100203.64696069101, 100227.37011697664, 100251.09467712394, 100274.82064096678, 100298.54800833909, 100322.27677907483, 100346.00695300807, 100369.73852997283, 100393.47150980328, 100417.20589233354, 100440.94167739789, 100464.67886483055, 100488.41745446586, 100512.1574461382, 100535.89883968196, 100559.64163493161, 100583.38583172169, 100607.13142988674, 100630.87842926137, 100654.62682968024, 100678.37663097809, 100702.12783298964, 100725.88043554971, 100749.63443849317, 100773.38984165489, 100797.14664486986, 100820.90484797307, 100844.66445079957, 100868.42545318443, 100892.18785496285, 100915.95165596998, 100939.71685604109, 100963.48345501146, 100987.25145271645, 101011.02084899142, 101034.79164367182, 101058.56383659317, 101082.33742759094, 101106.11241650078, 101129.88880315828, 101153.66658739912, 101177.44576905905, 101201.22634797383, 101225.00832397929, 101248.7916969113, 101272.57646660579, 101296.36263289873, 101320.15019562612, 101343.93915462404, 101367.7295097286, 101391.52126077596, 101415.31440760233, 101439.10895004397, 101462.9048879372, 101486.70222111834, 101510.50094942382, 101534.30107269008, 101558.10259075361, 101581.90550345098, 101605.70981061876, 101629.5155120936, 101653.32260771218, 101677.13109731126, 101700.9409807276, 101724.75225779804, 101748.56492835947, 101772.37899224881, 101796.19444930303, 101820.01129935916, 101843.82954225427, 101867.64917782549, 101891.47020590997, 101915.29262634492, 101939.11643896763, 101962.94164361537, 101986.76824012553, 102010.59622833549, 102034.42560808272, 102058.25637920471, 102082.08854153901, 102105.9220949232, 102129.75703919494, 102153.59337419191, 102177.43109975185, 102201.27021571253, 102225.1107219118, 102248.95261818753, 102272.79590437764, 102296.64058032009, 102320.48664585294, 102344.33410081422, 102368.18294504205, 102392.03317837461, 102415.88480065008, 102439.73781170673, 102463.59221138287, 102487.44799951684, 102511.30517594704, 102535.1637405119, 102559.02369304992, 102582.88503339965, 102606.74776139967, 102630.61187688859, 102654.4773797051, 102678.34426968795, 102702.21254667587, 102726.08221050771, 102749.95326102231, 102773.8256980586, 102797.69952145554, 102821.57473105213, 102845.45132668741, 102869.32930820051, 102893.20867543056, 102917.08942821674, 102940.97156639832, 102964.85508981455, 102988.73999830478, 103012.6262917084, 103036.51396986481, 103060.40303261351, 103084.293479794, 103108.18531124585, 103132.07852680866, 103155.97312632212, 103179.8691096259, 103203.76647655977, 103227.66522696352, 103251.56536067701, 103275.46687754011, 103299.36977739276, 103323.27406007495, 103347.1797254267, 103371.0867732881, 103394.99520349925, 103418.90501590034, 103442.81621033157, 103466.72878663319, 103490.64274464553, 103514.55808420894, 103538.4748051638, 103562.39290735057, 103586.31239060973, 103610.23325478184, 103634.15549970744, 103658.07912522719, 103682.00413118176, 103705.93051741188, 103729.85828375829, 103753.78743006183, 103777.71795616332, 103801.64986190372, 103825.58314712394, 103849.51781166498, 103873.4538553679, 103897.39127807376, 103921.33007962372, 103945.27025985894, 103969.21181862066, 103993.15475575015, 104017.0990710887, 104041.0447644777, 104064.99183575854, 104088.94028477269, 104112.89011136163, 104136.84131536692, 104160.79389663014, 104184.74785499295, 104208.70319029699, 104232.65990238401, 104256.61799109577, 104280.57745627411, 104304.53829776087, 104328.50051539797, 104352.46410902737, 104376.42907849104, 104400.39542363105, 104424.36314428948, 104448.33224030846, 104472.3027115302, 104496.27455779689, 104520.24777895081, 104544.22237483428, 104568.19834528965, 104592.17569015936, 104616.15440928582, 104640.13450251156, 104664.1159696791, 104688.09881063103, 104712.08302520998, 104736.06861325864, 104760.05557461972, 104784.043909136, 104808.03361665027, 104832.0246970054, 104856.01715004431, 104880.01097560991, 104904.00617354522, 104928.00274369326, 104952.00068589712, 104975.99999999993, 105000.00068584486, 105024.00274327511, 105048.00617213396, 105072.0109722647, 105096.0171435107, 105120.02468571534, 105144.03359872208, 105168.04388237436, 105192.05553651576, 105216.06856098982, 105240.08295564017, 105264.09872031047, 105288.11585484444, 105312.13435908582, 105336.1542328784, 105360.17547606604, 105384.19808849262, 105408.22207000206, 105432.24742043833, 105456.27413964548, 105480.30222746753, 105504.33168374863, 105528.36250833291, 105552.39470106458, 105576.42826178786, 105600.46319034706, 105624.49948658649, 105648.53715035053, 105672.5761814836, 105696.61657983017, 105720.65834523473, 105744.70147754184, 105768.7459765961, 105792.79184224214, 105816.83907432464, 105840.88767268835, 105864.93763717801, 105888.98896763846, 105913.04166391456, 105937.09572585119, 105961.15115329332, 105985.20794608595, 106009.26610407409, 106033.32562710284, 106057.38651501729, 106081.44876766266, 106105.51238488412, 106129.57736652695, 106153.64371243643, 106177.71142245791, 106201.78049643678, 106225.85093421848, 106249.92273564848, 106273.99590057228, 106298.07042883546, 106322.14632028362, 106346.22357476239, 106370.30219211751, 106394.38217219469, 106418.46351483969, 106442.54621989837, 106466.63028721658, 106490.71571664025, 106514.80250801529, 106538.89066118775, 106562.98017600364, 106587.07105230905, 106611.16328995011, 106635.25688877302, 106659.35184862395, 106683.44816934918, 106707.54585079502, 106731.64489280782, 106755.74529523395, 106779.84705791986, 106803.95018071201, 106828.05466345693, 106852.16050600118, 106876.26770819137, 106900.37626987413, 106924.48619089619, 106948.59747110425, 106972.71011034511, 106996.82410846559, 107020.93946531253, 107045.05618073288, 107069.17425457356, 107093.29368668159, 107117.41447690397, 107141.53662508781, 107165.66013108024, 107189.7849947284, 107213.91121587952, 107238.03879438085, 107262.16773007967, 107286.29802282334, 107310.42967245923, 107334.56267883476, 107358.69704179741, 107382.83276119467, 107406.96983687414, 107431.10826868335, 107455.24805646999, 107479.38920008171, 107503.53169936626, 107527.67555417139, 107551.82076434491, 107575.96732973469, 107600.11525018861, 107624.26452555459, 107648.41515568066, 107672.56714041479, 107696.72047960508, 107720.87517309963, 107745.03122074658, 107769.18862239413, 107793.34737789053, 107817.50748708403, 107841.66894982298, 107865.83176595572, 107889.99593533068, 107914.16145779629, 107938.32833320105, 107962.49656139348, 107986.66614222217, 108010.83707553572, 108035.00936118282, 108059.18299901215, 108083.35798887245, 108107.53433061253, 108131.71202408121, 108155.89106912735, 108180.07146559987, 108204.25321334775, 108228.43631221994, 108252.62076206553, 108276.80656273357, 108300.99371407321, 108325.18221593359, 108349.37206816394, 108373.56327061349, 108397.75582313156, 108421.94972556747, 108446.1449777706, 108470.34157959036, 108494.53953087622, 108518.73883147769, 108542.93948124432, 108567.14148002568, 108591.34482767139, 108615.54952403114, 108639.75556895464, 108663.96296229165, 108688.17170389196, 108712.38179360541, 108736.59323128188, 108760.80601677128, 108785.02014992358, 108809.23563058881, 108833.45245861699, 108857.67063385822, 108881.89015616261, 108906.11102538036, 108930.33324136167, 108954.55680395682, 108978.78171301607, 109003.00796838976, 109027.23556992831, 109051.46451748211, 109075.69481090162, 109099.92645003737, 109124.15943473989, 109148.39376485976, 109172.62944024763, 109196.86646075416, 109221.10482623006, 109245.34453652608, 109269.58559149304, 109293.82799098175, 109318.07173484311, 109342.31682292801, 109366.56325508743, 109390.81103117237, 109415.06015103387, 109439.31061452301, 109463.56242149093, 109487.8155717888, 109512.07006526781, 109536.3259017792, 109560.58308117429, 109584.8416033044, 109609.1014680209, 109633.36267517522, 109657.62522461878, 109681.88911620311, 109706.15434977971, 109730.4209252002, 109754.68884231619, 109778.95810097932, 109803.22870104131, 109827.50064235389, 109851.77392476884, 109876.04854813802, 109900.32451231324, 109924.60181714644, 109948.88046248957, 109973.1604481946, 109997.44177411357, 110021.72444009855, 110046.00844600165, 110070.29379167501, 110094.58047697082, 110118.86850174134, 110143.15786583882, 110167.44856911557, 110191.74061142397, 110216.03399261639, 110240.32871254528, 110264.62477106311, 110288.9221680224, 110313.22090327571, 110337.52097667565, 110361.82238807483, 110386.12513732594, 110410.42922428172, 110434.73464879491, 110459.04141071832, 110483.34950990479, 110507.6589462072, 110531.96971947847, 110556.28182957157, 110580.5952763395, 110604.91005963532, 110629.22617931209, 110653.54363522294, 110677.86242722106, 110702.18255515963, 110726.50401889188, 110750.82681827113, 110775.1509531507, 110799.47642338395, 110823.80322882428, 110848.13136932514, 110872.46084474004, 110896.79165492248, 110921.12379972603, 110945.4572790043, 110969.79209261097, 110994.12824039967, 111018.46572222417, 111042.80453793822, 111067.14468739564, 111091.48617045028, 111115.82898695602, 111140.1731367668, 111164.51861973655, 111188.86543571933, 111213.21358456917, 111237.56306614014, 111261.91388028639, 111286.26602686207, 111310.61950572141, 111334.97431671864, 111359.33045970804, 111383.68793454397, 111408.04674108078, 111432.40687917286, 111456.76834867468, 111481.13114944073, 111505.49528132551, 111529.86074418361, 111554.22753786964, 111578.59566223821, 111602.96511714405, 111627.33590244185, 111651.7080179864, 111676.08146363248, 111700.45623923496, 111724.8323446487, 111749.20977972864, 111773.58854432974, 111797.96863830699, 111822.35006151545, 111846.73281381019, 111871.11689504632, 111895.50230507903, 111919.8890437635, 111944.27711095495, 111968.6665065087, 111993.05723028004, 112017.44928212435, 112041.842661897, 112066.23736945343, 112090.63340464912, 112115.03076733962, 112139.42945738042, 112163.82947462716, 112188.23081893545, 112212.63349016097, 112237.03748815943, 112261.44281278658, 112285.84946389822, 112310.25744135017, 112334.66674499828, 112359.07737469849, 112383.48933030672, 112407.90261167898, 112432.31721867126, 112456.73315113965, 112481.15040894024, 112505.56899192919, 112529.98889996267, 112554.41013289688, 112578.8326905881, 112603.25657289263, 112627.68177966679, 112652.10831076698, 112676.53616604958, 112700.96534537108, 112725.39584858794, 112749.82767555672, 112774.26082613398, 112798.6953001763, 112823.13109754038, 112847.56821808286, 112872.00666166049, 112896.44642813003, 112920.88751734827, 112945.32992917208, 112969.77366345831, 112994.21872006389, 113018.66509884578, 113043.11279966099, 113067.56182236652, 113092.01216681948, 113116.46383287695, 113140.9168203961, 113165.37112923413, 113189.82675924824, 113214.28371029573, 113238.74198223387, 113263.20157492002, 113287.66248821157, 113312.12472196593, 113336.58827604055, 113361.05315029295, 113385.51934458067, 113409.98685876124, 113434.45569269233, 113458.92584623155, 113483.39731923661, 113507.87011156522, 113532.34422307517, 113556.81965362425, 113581.2964030703, 113605.77447127122, 113630.25385808491, 113654.73456336933, 113679.2165869825, 113703.69992878241, 113728.18458862718, 113752.67056637487, 113777.15786188368, 113801.64647501177, 113826.13640561736, 113850.62765355874, 113875.12021869418, 113899.61410088204, 113924.1092999807, 113948.60581584855, 113973.10364834407, 113997.60279732574, 114022.1032626521, 114046.60504418171, 114071.10814177318, 114095.61255528514, 114120.11828457628, 114144.62532950533, 114169.13368993104, 114193.6433657122, 114218.15435670764, 114242.66666277625, 114267.18028377694, 114291.69521956862, 114316.21147001031, 114340.72903496103, 114365.24791427983, 114389.7681078258, 114414.2896154581, 114438.81243703589, 114463.33657241837, 114487.8620214648, 114512.38878403447, 114536.91685998671, 114561.44624918087, 114585.97695147636, 114610.5089667326, 114635.04229480909, 114659.57693556532, 114684.11288886084, 114708.65015455526, 114733.18873250818, 114757.72862257928, 114782.26982462825, 114806.81233851484, 114831.35616409882, 114855.90130123998, 114880.44774979822, 114904.99550963337, 114929.5445806054, 114954.09496257425, 114978.64665539992, 115003.19965894247, 115027.75397306195, 115052.30959761847, 115076.86653247218, 115101.42477748329, 115125.984332512, 115150.54519741859, 115175.10737206334, 115199.67085630659, 115224.23565000873, 115248.80175303014, 115273.3691652313, 115297.93788647266, 115322.50791661476, 115347.07925551817, 115371.65190304347, 115396.22585905129, 115420.80112340231, 115445.37769595724, 115469.95557657682, 115494.53476512182, 115519.11526145306, 115543.69706543141, 115568.28017691776, 115592.86459577303, 115617.4503218582, 115642.03735503425, 115666.62569516223, 115691.21534210323, 115715.80629571836, 115740.39855586876, 115764.99212241563, 115789.58699522018, 115814.18317414368, 115838.78065904744, 115863.37944979276, 115887.97954624105, 115912.5809482537, 115937.18365569216, 115961.78766841792, 115986.39298629249, 116010.99960917742, 116035.60753693432, 116060.21676942479, 116084.82730651053, 116109.43914805322, 116134.0522939146, 116158.66674395646, 116183.2824980406, 116207.89955602887, 116232.51791778316, 116257.13758316539, 116281.75855203751, 116306.38082426153, 116331.00439969949, 116355.62927821343, 116380.25545966547, 116404.88294391775, 116429.51173083246, 116454.14182027178, 116478.77321209799, 116503.40590617337, 116528.03990236025, 116552.67520052097, 116577.31180051794, 116601.94970221359, 116626.5889054704, 116651.22941015086, 116675.87121611751, 116700.51432323294, 116725.15873135976, 116749.8044403606, 116774.45145009817, 116799.0997604352, 116823.74937123443, 116848.40028235866, 116873.05249367072, 116897.70600503348, 116922.36081630984, 116947.01692736275, 116971.67433805518, 116996.33304825013, 117020.99305781067, 117045.65436659988, 117070.31697448085, 117094.98088131678, 117119.64608697082, 117144.31259130624, 117168.98039418629, 117193.64949547425, 117218.31989503348, 117242.99159272734, 117267.66458841923, 117292.33888197262, 117317.01447325097, 117341.6913621178, 117366.36954843666, 117391.04903207115, 117415.72981288488, 117440.41189074152, 117465.09526550474, 117489.77993703831, 117514.46590520597, 117539.15316987153, 117563.84173089883, 117588.53158815173, 117613.22274149416, 117637.91519079007, 117662.60893590341, 117687.30397669821, 117712.00031303853, 117736.69794478847, 117761.39687181212, 117786.09709397367, 117810.7986111373, 117835.50142316725, 117860.20552992777, 117884.91093128319, 117909.6176270978, 117934.32561723603, 117959.03490156225, 117983.74547994092, 118008.45735223651, 118033.17051831353, 118057.88497803656, 118082.60073127014, 118107.31777787894, 118132.03611772758, 118156.75575068076, 118181.47667660323, 118206.19889535972, 118230.92240681504, 118255.64721083404, 118280.37330728157, 118305.10069602253, 118329.82937692189, 118354.55934984458, 118379.29061465565, 118404.02317122012, 118428.75701940308, 118453.49215906965, 118478.22859008498, 118502.96631231424, 118527.70532562268, 118552.44562987552, 118577.18722493808, 118601.93011067568, 118626.67428695368, 118651.41975363747, 118676.16651059251, 118700.91455768423, 118725.66389477813, 118750.41452173979, 118775.16643843475, 118799.91964472862, 118824.67414048707, 118849.42992557574, 118874.18699986035, 118898.94536320666, 118923.70501548045, 118948.46595654752, 118973.22818627374, 118997.99170452499, 119022.7565111672, 119047.52260606633, 119072.28998908834, 119097.0586600993, 119121.82861896523, 119146.59986555226, 119171.3723997265, 119196.14622135412, 119220.92133030134, 119245.69772643436, 119270.47540961947, 119295.25437972297, 119320.03463661121, 119344.81618015055, 119369.5990102074, 119394.38312664822, 119419.16852933947, 119443.95521814766, 119468.74319293935, 119493.53245358112, 119518.32299993958, 119543.11483188139, 119567.90794927324, 119592.70235198183, 119617.49803987393, 119642.29501281632, 119667.09327067583, 119691.89281331931, 119716.69364061367, 119741.49575242582, 119766.29914862274, 119791.10382907141, 119815.90979363887, 119840.71704219218, 119865.52557459843, 119890.33539072477, 119915.14649043836, 119939.95887360642, 119964.77254009615, 119989.58748977486, 120014.40372250983, 120039.22123816841, 120064.04003661797, 120088.86011772591, 120113.6814813597, 120138.5041273868, 120163.3280556747, 120188.15326609099, 120212.97975850321, 120237.807532779, 120262.63658878599, 120287.46692639188, 120312.29854546436, 120337.13144587121, 120361.9656274802, 120386.80109015915, 120411.63783377589, 120436.47585819835, 120461.31516329442, 120486.15574893207, 120510.99761497928, 120535.84076130406, 120560.68518777451, 120585.53089425867, 120610.3778806247, 120635.22614674074, 120660.07569247499, 120684.92651769568, 120709.77862227106, 120734.63200606944, 120759.48666895913, 120784.3426108085, 120809.19983148595, 120834.05833085992, 120858.91810879884, 120883.77916517125, 120908.64149984565, 120933.5051126906, 120958.37000357473, 120983.23617236665, 121008.10361893504, 121032.97234314861, 121057.84234487606, 121082.71362398617, 121107.58618034775, 121132.46001382964, 121157.33512430069, 121182.21151162982, 121207.08917568595, 121231.96811633807, 121256.84833345517, 121281.72982690629, 121306.61259656049, 121331.49664228689, 121356.38196395461, 121381.26856143285, 121406.15643459078, 121431.04558329767, 121455.93600742276, 121480.82770683538, 121505.72068140487, 121530.61493100057, 121555.51045549192, 121580.40725474835, 121605.30532863933, 121630.20467703436, 121655.10529980299, 121680.00719681478, 121704.91036793934, 121729.81481304632, 121754.72053200539, 121779.62752468624, 121804.53579095862, 121829.44533069231, 121854.3561437571, 121879.26823002285, 121904.1815893594, 121929.09622163669, 121954.01212672464, 121978.92930449323, 122003.84775481246, 122028.76747755238, 122053.68847258303, 122078.61073977455, 122103.53427899707, 122128.45909012076, 122153.38517301581, 122178.31252755247, 122203.24115360099, 122228.17105103172, 122253.10221971494, 122278.03465952107, 122302.96837032049, 122327.90335198362, 122352.83960438096, 122377.777127383, 122402.71592086025, 122427.65598468333, 122452.59731872278, 122477.53992284928, 122502.48379693348, 122527.42894084606, 122552.37535445779, 122577.32303763942, 122602.27199026172, 122627.22221219557, 122652.17370331181, 122677.12646348133, 122702.08049257506, 122727.03579046397, 122751.99235701906, 122776.95019211136, 122801.9092956119, 122826.8696673918, 122851.83130732219, 122876.79421527422, 122901.75839111909, 122926.72383472799, 122951.69054597223, 122976.65852472307, 123001.62777085182, 123026.59828422987, 123051.57006472857, 123076.54311221937, 123101.5174265737, 123126.49300766307, 123151.46985535898, 123176.44796953299, 123201.42735005668, 123226.40799680166, 123251.38990963959, 123276.37308844214, 123301.35753308103, 123326.343243428, 123351.33021935483, 123376.31846073334, 123401.30796743535, 123426.29873933276, 123451.29077629748, 123476.28407820144, 123501.2786449166, 123526.27447631498, 123551.27157226863, 123576.26993264959, 123601.26955732999, 123626.27044618195, 123651.27259907764, 123676.27601588926, 123701.28069648903, 123726.28664074924, 123751.29384854218, 123776.30231974016, 123801.31205421555, 123826.32305184075, 123851.33531248817, 123876.34883603029, 123901.36362233957, 123926.37967128855, 123951.39698274979, 123976.41555659588, 124001.43539269941, 124026.45649093305, 124051.47885116948, 124076.50247328142, 124101.5273571416, 124126.55350262282, 124151.58090959788, 124176.60957793961, 124201.63950752091, 124226.67069821467, 124251.70314989384, 124276.73686243138, 124301.7718357003, 124326.80806957364, 124351.84556392446, 124376.88431862585, 124401.92433355095, 124426.96560857294, 124452.00814356498, 124477.05193840031, 124502.0969929522, 124527.14330709392, 124552.19088069882, 124577.23971364023, 124602.28980579154, 124627.34115702618, 124652.3937672176, 124677.44763623926, 124702.50276396469, 124727.55915026742, 124752.61679502104, 124777.67569809916, 124802.73585937542, 124827.79727872348, 124852.85995601704, 124877.92389112986, 124902.98908393568, 124928.05553430831, 124953.1232421216, 124978.19220724938, 125003.26242956554, 125028.33390894404, 125053.40664525882, 125078.48063838384, 125103.55588819318, 125128.63239456083, 125153.71015736091, 125178.78917646752, 125203.86945175481, 125228.95098309696, 125254.03377036817, 125279.1178134427, 125304.20311219479, 125329.28966649878, 125354.37747622898, 125379.46654125977, 125404.55686146552, 125429.6484367207, 125454.74126689974, 125479.83535187715, 125504.93069152744, 125530.02728572517, 125555.12513434493, 125580.22423726133, 125605.32459434902, 125630.4262054827, 125655.52907053704, 125680.63318938682, 125705.73856190679, 125730.84518797178, 125755.9530674566, 125781.06220023613, 125806.17258618528, 125831.28422517896, 125856.39711709213, 125881.51126179981, 125906.62665917698, 125931.74330909875, 125956.86121144016, 125981.98036607634, 126007.10077288245, 126032.22243173365, 126057.34534250517, 126082.46950507225, 126107.59491931014, 126132.72158509417, 126157.84950229966, 126182.97867080198, 126208.10909047653, 126233.24076119871, 126258.37368284403, 126283.50785528794, 126308.64327840599, 126333.77995207369, 126358.91787616667, 126384.0570505605, 126409.19747513086, 126434.3391497534, 126459.48207430386, 126484.62624865794, 126509.77167269142, 126534.9183462801, 126560.06626929982, 126585.21544162642, 126610.36586313581, 126635.51753370393, 126660.67045320668, 126685.82462152008, 126710.98003852014, 126736.13670408291, 126761.29461808444, 126786.45378040087, 126811.61419090834, 126836.77584948298, 126861.93875600102, 126887.10291033868, 126912.26831237224, 126937.43496197795, 126962.60285903217, 126987.77200341123, 127012.94239499152, 127038.11403364947, 127063.2869192615, 127088.46105170409, 127113.63643085376, 127138.81305658702, 127163.99092878048, 127189.17004731069, 127214.35041205429, 127239.53202288797, 127264.71487968838, 127289.89898233226, 127315.08433069635, 127340.27092465744, 127365.45876409234, 127390.64784887788, 127415.83817889093, 127441.02975400841, 127466.22257410725, 127491.41663906439, 127516.61194875685, 127541.80850306165, 127567.00630185583, 127592.20534501647, 127617.4056324207, 127642.60716394568, 127667.80993946856, 127693.01395886653, 127718.21922201688, 127743.42572879682, 127768.63347908368, 127793.84247275478, 127819.05270968749, 127844.26418975917, 127869.47691284724, 127894.69087882918, 127919.90608758242, 127945.12253898452, 127970.34023291297, 127995.55916924537, 128020.77934785932, 128046.00076863244, 128071.22343144237, 128096.44733616684, 128121.67248268353, 128146.89887087021, 128172.12650060465, 128197.35537176467, 128222.5854842281, 128247.81683787282, 128273.04943257671, 128298.28326821771, 128323.51834467379, 128348.75466182294, 128373.99221954317, 128399.23101771252, 128424.47105620909, 128449.71233491098, 128474.95485369631, 128500.19861244329, 128525.44361103009, 128550.68984933494, 128575.93732723613, 128601.18604461191, 128626.43600134061, 128651.68719730059, 128676.93963237021, 128702.1933064279, 128727.44821935208, 128752.70437102125, 128777.96176131385, 128803.22039010846, 128828.48025728362, 128853.74136271792, 128879.00370628996, 128904.26728787841, 128929.53210736193, 128954.79816461923, 128980.06545952905, 129005.33399197015, 129030.60376182134, 129055.87476896142, 129081.14701326926, 129106.42049462376, 129131.6952129038, 129156.97116798835, 129182.24835975636, 129207.52678808685, 129232.80645285884, 129258.08735395141, 129283.36949124365, 129308.65286461466, 129333.9374739436, 129359.22331910966, 129384.51039999202, 129409.79871646997, 129435.08826842274, 129460.37905572963, 129485.67107826998, 129510.96433592314, 129536.25882856851, 129561.55455608548, 129586.85151835352, 129612.14971525209, 129637.4491466607, 129662.74981245887, 129688.0517125262, 129713.35484674224, 129738.65921498663, 129763.96481713903, 129789.27165307909, 129814.57972268655, 129839.88902584116, 129865.19956242264, 129890.51133231082, 129915.82433538554, 129941.13857152662, 129966.45404061397, 129991.7707425275, 130017.08867714716, 130042.4078443529, 130067.72824402474, 130093.04987604271, 130118.37274028687, 130143.69683663732, 130169.02216497416, 130194.34872517755, 130219.67651712766, 130245.0055407047, 130270.33579578891, 130295.66728226055, 130320.99999999991, 130346.33394888733, 130371.66912880314, 130397.00553962773, 130422.34318124152, 130447.68205352494, 130473.02215635845, 130498.36348962256, 130523.70605319779, 130549.0498469647, 130574.39487080388, 130599.74112459592, 130625.08860822149, 130650.43732156123, 130675.78726449587, 130701.13843690613, 130726.49083867275, 130751.84446967654, 130777.19932979831, 130802.5554189189, 130827.91273691918, 130853.27128368006, 130878.63105908247, 130903.99206300738, 130929.35429533575, 130954.71775594862, 130980.08244472703, 131005.44836155206, 131030.81550630482, 131056.18387886642, 131081.55347911804, 131106.92430694087, 131132.29636221612, 131157.66964482504, 131183.0441546489, 131208.41989156904, 131233.79685546676, 131259.17504622342, 131284.55446372041, 131309.93510783918, 131335.31697846117, 131360.70007546784, 131386.0843987407, 131411.46994816128, 131436.85672361116, 131462.24472497194, 131487.63395212521, 131513.02440495262, 131538.41608333588, 131563.80898715663, 131589.2031162967, 131614.59847063778, 131639.9950500617, 131665.39285445024, 131690.79188368531, 131716.19213764873, 131741.59361622241, 131766.99631928833, 131792.40024672839, 131817.80539842462, 131843.21177425905, 131868.61937411371, 131894.02819787065, 131919.43824541202, 131944.84951661993, 131970.26201137656, 131995.67572956407, 132021.09067106468, 132046.50683576067, 132071.9242235343, 132097.34283426782, 132122.76266784366, 132148.1837241441, 132173.60600305157, 132199.02950444847, 132224.45422821722, 132249.88017424036, 132275.30734240031, 132300.73573257966, 132326.16534466096, 132351.59617852676, 132377.02823405969, 132402.46151114244, 132427.89600965759, 132453.33172948789, 132478.76867051609, 132504.20683262491, 132529.64621569714, 132555.08681961559, 132580.5286442631, 132605.97168952253, 132631.41595527678, 132656.86144140881, 132682.30814780149, 132707.75607433787, 132733.20522090094, 132758.65558737374, 132784.10717363929, 132809.55997958075, 132835.01400508118, 132860.46925002377, 132885.92571429166, 132911.38339776811, 132936.84230033628, 132962.30242187946, 132987.76376228096, 133013.22632142407, 133038.69009919214, 133064.15509546854, 133089.62131013666, 133115.08874307995, 133140.55739418184, 133166.02726332581, 133191.49835039541, 133216.97065527414, 133242.44417784561, 133267.91891799335, 133293.39487560102, 133318.87205055228, 133344.35044273079, 133369.83005202023, 133395.31087830439, 133420.79292146701, 133446.27618139185, 133471.76065796276, 133497.24635106357, 133522.73326057816, 133548.22138639039, 133573.71072838426, 133599.20128644365, 133624.69306045261, 133650.1860502951, 133675.68025585517, 133701.1756770169, 133726.67231366437, 133752.17016568172, 133777.66923295305, 133803.16951536259, 133828.67101279454, 133854.17372513309, 133879.67765226253, 133905.18279406714, 133930.68915043125, 133956.19672123916, 133981.70550637526, 134007.21550572399, 134032.7267191697, 134058.23914659687, 134083.75278789, 134109.26764293358, 134134.78371161217, 134160.30099381026, 134185.8194894125, 134211.33919830353, 134236.8601203679, 134262.38225549037, 134287.90560355558, 134313.43016444831, 134338.95593805326, 134364.48292425525, 134390.01112293909, 134415.54053398955, 134441.07115729159, 134466.60299273001, 134492.1360401898, 134517.67029955584, 134543.20577071316, 134568.74245354676, 134594.28034794159, 134619.81945378278, 134645.35977095537, 134670.90129934452, 134696.4440388353, 134721.98798931291, 134747.53315066252, 134773.07952276937, 134798.62710551871, 134824.17589879577, 134849.72590248589, 134875.27711647438, 134900.82954064661, 134926.38317488792, 134951.93801908373, 134977.49407311951, 135003.05133688069, 135028.60981025276, 135054.16949312127, 135079.73038537172, 135105.29248688967, 135130.85579756077, 135156.42031727062, 135181.98604590484, 135207.55298334916, 135233.12112948924, 135258.69048421088, 135284.26104739975, 135309.83281894168, 135335.4057987225, 135360.97998662802, 135386.55538254412, 135412.13198635669, 135437.70979795168, 135463.28881721498, 135488.86904403262, 135514.45047829056, 135540.03311987486, 135565.61696867159, 135591.20202456677, 135616.78828744654, 135642.37575719706, 135667.96443370447, 135693.55431685498, 135719.14540653475, 135744.73770263011, 135770.33120502727, 135795.92591361253, 135821.52182827223, 135847.11894889272, 135872.7172753604, 135898.31680756161, 135923.91754538284, 135949.51948871053, 135975.12263743114, 136000.72699143123, 136026.33255059729, 136051.93931481591, 136077.54728397369, 136103.15645795723, 136128.76683665317, 136154.37841994822, 136179.99120772901, 136205.60519988232, 136231.2203962949, 136256.83679685349, 136282.45440144493, 136308.07320995603, 136333.69322227367, 136359.31443828469, 136384.93685787608, 136410.56048093468, 136436.18530734754, 136461.81133700156, 136487.43856978384, 136513.06700558143, 136538.6966442813, 136564.32748577066, 136589.95952993655, 136615.59277666616, 136641.22722584667, 136666.86287736523, 136692.49973110916, 136718.13778696564, 136743.77704482197, 136769.41750456547, 136795.05916608346, 136820.70202926331, 136846.34609399244, 136871.99136015819, 136897.63782764805, 136923.28549634948, 136948.93436614997, 136974.58443693706, 137000.23570859825, 137025.88818102115, 137051.54185409332, 137077.19672770242, 137102.85280173609, 137128.51007608202, 137154.16855062786, 137179.82822526142, 137205.48909987041, 137231.15117434258, 137256.8144485658, 137282.47892242789, 137308.14459581667, 137333.81146862009, 137359.47954072602, 137385.14881202241, 137410.81928239719, 137436.49095173844, 137462.16381993407, 137487.83788687221, 137513.51315244089, 137539.18961652822, 137564.86727902229, 137590.54613981131, 137616.22619878338, 137641.90745582676, 137667.58991082967, 137693.27356368033, 137718.95841426702, 137744.64446247809, 137770.33170820182, 137796.02015132661, 137821.70979174081, 137847.40062933284, 137873.09266399115, 137898.78589560417, 137924.48032406042, 137950.17594924837, 137975.8727710566, 138001.57078937365, 138027.27000408815, 138052.97041508864, 138078.67202226384, 138104.3748255024, 138130.07882469296, 138155.78401972432, 138181.49041048516, 138207.1979968643, 138232.9067787505, 138258.61675603263, 138284.32792859949, 138310.04029633995, 138335.75385914298, 138361.46861689744, 138387.18456949232, 138412.90171681659, 138438.62005875923, 138464.33959520931, 138490.06032605586, 138515.78225118798, 138541.50537049473, 138567.2296838653, 138592.95519118884, 138618.68189235451, 138644.40978725153, 138670.13887576913, 138695.86915779658, 138721.60063322316, 138747.33330193823, 138773.06716383106, 138798.80221879104, 138824.53846670757, 138850.27590747006, 138876.01454096794, 138901.7543670907, 138927.49538572782, 138953.2375967688, 138978.9810001032, 139004.72559562061, 139030.47138321059, 139056.2183627628, 139081.96653416683, 139107.71589731239, 139133.46645208917, 139159.21819838689, 139184.97113609532, 139210.72526510421, 139236.48058530336, 139262.23709658257, 139287.99479883176, 139313.75369194071, 139339.51377579942, 139365.27505029776, 139391.03751532568, 139416.80117077316, 139442.56601653024, 139468.33205248689, 139494.09927853322, 139519.86769455927, 139545.63730045516, 139571.408096111, 139597.18008141697, 139622.95325626322, 139648.72762054001, 139674.5031741375, 139700.27991694602, 139726.05784885579, 139751.83696975713, 139777.61727954043, 139803.39877809596, 139829.18146531415, 139854.96534108539, 139880.75040530015, 139906.53665784886, 139932.32409862199, 139958.11272751007, 139983.90254440365, 140009.69354919327, 140035.48574176949, 140061.27912202294, 140087.07368984428, 140112.86944512415, 140138.66638775321, 140164.4645176222, 140190.26383462184, 140216.06433864293, 140241.86602957622, 140267.66890731253, 140293.47297174268, 140319.27822275754, 140345.08466024802, 140370.89228410498, 140396.70109421943, 140422.51109048226, 140448.32227278448, 140474.13464101712, 140499.94819507122, 140525.76293483781, 140551.57886020801, 140577.3959710729, 140603.21426732364, 140629.03374885136, 140654.85441554731, 140680.67626730262, 140706.49930400858, 140732.32352555645, 140758.1489318375, 140783.97552274304, 140809.80329816442, 140835.63225799298, 140861.46240212015, 140887.29373043729, 140913.12624283586, 140938.95993920733, 140964.79481944317, 140990.63088343487, 141016.46813107401, 141042.30656225214, 141068.14617686081, 141093.98697479168, 141119.82895593636, 141145.6721201865, 141171.51646743377, 141197.36199756994, 141223.20871048668, 141249.05660607578, 141274.90568422904, 141300.75594483822, 141326.6073877952, 141352.4600129918, 141378.31382031992, 141404.16880967148, 141430.02498093838, 141455.8823340126, 141481.74086878612, 141507.60058515094, 141533.46148299909, 141559.32356222265, 141585.18682271364, 141611.05126436421, 141636.9168870665, 141662.78369071262, 141688.65167519479, 141714.5208404052, 141740.39118623605, 141766.26271257963, 141792.1354193282, 141818.00930637406, 141843.88437360956, 141869.760620927, 141895.6380482188, 141921.51665537735, 141947.39644229505, 141973.27740886438, 141999.15955497778, 142025.04288052776, 142050.92738540689, 142076.81306950765, 142102.69993272264, 142128.58797494444, 142154.47719606571, 142180.36759597904, 142206.25917457714, 142232.15193175265, 142258.04586739838, 142283.94098140698, 142309.83727367126, 142335.73474408401, 142361.63339253806, 142387.5332189262, 142413.43422314132, 142439.33640507635, 142465.23976462413, 142491.14430167765, 142517.05001612983, 142542.95690787368, 142568.86497680223, 142594.77422280848, 142620.68464578551, 142646.5962456264, 142672.50902222423, 142698.42297547215, 142724.33810526333, 142750.25441149093, 142776.17189404817, 142802.09055282827, 142828.01038772447, 142853.93139863008, 142879.85358543837, 142905.77694804268, 142931.70148633636, 142957.62720021277, 142983.55408956532, 143009.48215428743, 143035.41139427255, 143061.34180941415, 143087.27339960571, 143113.20616474075, 143139.14010471283, 143165.07521941551, 143191.01150874238, 143216.94897258704, 143242.88761084314, 143268.82742340435, 143294.76841016437, 143320.71057101688, 143346.65390585564, 143372.59841457437, 143398.54409706692, 143424.49095322701, 143450.43898294857, 143476.38818612538, 143502.33856265133, 143528.29011242036, 143554.24283532638, 143580.19673126334, 143606.1518001252, 143632.10804180597, 143658.06545619969, 143684.02404320039, 143709.98380270213, 143735.944734599, 143761.90683878519, 143787.87011515474, 143813.83456360188, 143839.8001840208, 143865.76697630569, 143891.73494035081, 143917.7040760504, 143943.67438329876, 143969.6458619902, 143995.61851201905, 144021.59233327967, 144047.56732566646, 144073.54348907378, 144099.52082339607, 144125.49932852783, 144151.4790043635, 144177.45985079758, 144203.44186772458, 144229.42505503909, 144255.40941263564, 144281.39494040885, 144307.38163825331, 144333.36950606373, 144359.35854373468, 144385.34875116093, 144411.34012823718, 144437.33267485813, 144463.32639091855, 144489.32127631325, 144515.31733093705, 144541.31455468474, 144567.3129474512, 144593.3125091313, 144619.31323961995, 144645.31513881206, 144671.31820660262, 144697.32244288657, 144723.32784755889, 144749.33442051467, 144775.34216164888, 144801.35107085665, 144827.36114803303, 144853.37239307314, 144879.38480587213, 144905.39838632516, 144931.41313432742, 144957.4290497741, 144983.44613256046, 145009.46438258173, 145035.48379973322, 145061.50438391021, 145087.52613500805, 145113.54905292206, 145139.57313754765, 145165.59838878017, 145191.62480651509, 145217.65239064783, 145243.68114107384, 145269.71105768863, 145295.74214038774, 145321.77438906668, 145347.80780362099, 145373.84238394629, 145399.87812993818, 145425.91504149229, 145451.95311850426, 145477.9923608698, 145504.03276848458, 145530.07434124436, 145556.11707904484, 145582.16098178181, 145608.20604935108, 145634.25228164849, 145660.29967856981, 145686.34824001096, 145712.39796586783, 145738.4488560363, 145764.50091041232, 145790.55412889185, 145816.60851137087, 145842.66405774537, 145868.72076791141, 145894.77864176501, 145920.83767920226, 145946.89788011924, 145972.95924441208, 145999.02177197693, 146025.08546270995, 146051.15031650732, 146077.21633326527, 146103.28351288004, 146129.35185524789, 146155.42136026506, 146181.49202782792, 146207.56385783272, 146233.63685017588, 146259.71100475377, 146285.78632146274, 146311.86280019928, 146337.94044085976, 146364.01924334071, 146390.09920753856, 146416.18033334985, 146442.26262067116, 146468.34606939898, 146494.43067942993, 146520.51645066062, 146546.60338298764, 146572.69147630769, 146598.78073051744, 146624.87114551352, 146650.96272119274, 146677.05545745179, 146703.14935418745, 146729.2444112965, 146755.34062867577, 146781.43800622207, 146807.53654383228, 146833.63624140329, 146859.73709883197, 146885.83911601527, 146911.94229285014, 146938.04662923355, 146964.15212506248, 146990.25878023397, 147016.36659464505, 147042.47556819281, 147068.58570077427, 147094.6969922866, 147120.80944262692, 147146.92305169237, 147173.03781938017, 147199.15374558745, 147225.27083021149, 147251.38907314953, 147277.50847429881, 147303.62903355664, 147329.75075082036, 147355.87362598727, 147381.99765895473, 147408.12284962015, 147434.24919788091, 147460.37670363448, 147486.50536677826, 147512.63518720976, 147538.76616482646, 147564.89829952587, 147591.03159120557, 147617.16603976308, 147643.30164509601, 147669.43840710199, 147695.57632567859, 147721.71540072354, 147747.85563213445, 147773.99701980909, 147800.13956364512, 147826.28326354033, 147852.42811939248, 147878.57413109933, 147904.72129855872, 147930.86962166851, 147957.01910032652, 147983.16973443062, 148009.32152387875, 148035.47446856883, 148061.62856839882, 148087.78382326665, 148113.94023307035, 148140.09779770792, 148166.25651707739, 148192.41639107687, 148218.57741960438, 148244.73960255808, 148270.90293983606, 148297.0674313365, 148323.23307695755, 148349.39987659742, 148375.56783015432, 148401.73693752653, 148427.90719861226, 148454.07861330983, 148480.25118151752, 148506.42490313368, 148532.59977805667, 148558.77580618486, 148584.95298741665, 148611.13132165043, 148637.31080878471, 148663.49144871789, 148689.6732413485, 148715.85618657502, 148742.040284296, 148768.22553440998, 148794.41193681557, 148820.59949141133, 148846.78819809589, 148872.97805676793, 148899.16906732606, 148925.36122966901, 148951.55454369547, 148977.74900930419, 149003.9446263939, 149030.1413948634, 149056.33931461151, 149082.53838553699, 149108.73860753875, 149134.9399805156, 149161.14250436646, 149187.34617899026, 149213.5510042859, 149239.75698015234, 149265.96410648854, 149292.17238319354, 149318.38181016635, 149344.59238730598, 149370.80411451156, 149397.01699168212, 149423.23101871679, 149449.44619551473, 149475.66252197503, 149501.87999799693, 149528.0986234796, 149554.31839832227, 149580.53932242419, 149606.76139568459, 149632.98461800278, 149659.20898927809, 149685.43450940982, 149711.66117829733, 149737.88899584001, 149764.11796193724, 149790.34807648844, 149816.57933939309, 149842.81175055061, 149869.04530986046, 149895.28001722222, 149921.51587253538, 149947.75287569952, 149973.99102661415, 150000.23032517891, 150026.47077129342, 150052.71236485732, 150078.95510577026, 150105.1989939319, 150131.444029242, 150157.69021160025, 150183.93754090639, 150210.18601706024, 150236.43563996154, 150262.68640951012, 150288.93832560582, 150315.19138814852, 150341.44559703805, 150367.70095217437, 150393.95745345735, 150420.21510078697, 150446.47389406321, 150472.73383318601, 150498.99491805542, 150525.25714857146, 150551.52052463419, 150577.78504614369, 150604.05071300003, 150630.31752510337, 150656.58548235384, 150682.85458465159, 150709.1248318968, 150735.39622398972, 150761.66876083051, 150787.9424423195, 150814.21726835691, 150840.49323884305, 150866.77035367821, 150893.04861276277, 150919.32801599705, 150945.60856328148, 150971.89025451642, 150998.17308960229, 151024.45706843957, 151050.74219092872, 151077.02845697021, 151103.31586646455, 151129.60441931229, 151155.894115414, 151182.1849546702, 151208.47693698155, 151234.77006224863, 151261.06433037209, 151287.35974125259, 151313.65629479082, 151339.95399088747, 151366.25282944329, 151392.55281035902, 151418.85393353543, 151445.1561988733, 151471.45960627345, 151497.76415563675, 151524.06984686397, 151550.37667985607, 151576.68465451393, 151602.99377073845, 151629.30402843058, 151655.61542749128, 151681.92796782157, 151708.24164932242, 151734.55647189484, 151760.87243543993, 151787.18953985872, 151813.50778505235, 151839.82717092187, 151866.14769736846, 151892.46936429327, 151918.79217159748, 151945.11611918229, 151971.44120694889, 151997.76743479856, 152024.09480263255, 152050.42331035214, 152076.75295785864, 152103.08374505339, 152129.41567183775, 152155.74873811303, 152182.08294378067, 152208.41828874208, 152234.75477289871, 152261.09239615197, 152287.43115840337, 152313.77105955439, 152340.11209950657, 152366.45427816146, 152392.79759542056, 152419.14205118554, 152445.48764535793, 152471.8343778394, 152498.18224853161, 152524.53125733617, 152550.88140415482, 152577.23268888926, 152603.58511144121, 152629.93867171241, 152656.29336960468, 152682.64920501978, 152709.00617785956, 152735.36428802583, 152761.72353542043, 152788.08391994529, 152814.44544150229, 152840.80809999333, 152867.17189532038, 152893.53682738543, 152919.90289609041, 152946.27010133737, 152972.63844302832, 152999.00792106529, 153025.37853535041, 153051.7502857857, 153078.12317227334, 153104.4971947154, 153130.8723530141, 153157.24864707157, 153183.62607679001, 153210.00464207167, 153236.38434281875, 153262.76517893354, 153289.14715031831, 153315.53025687535, 153341.91449850702, 153368.2998751156, 153394.68638660354, 153421.07403287315, 153447.46281382689, 153473.85272936718, 153500.24377939643, 153526.63596381716, 153553.02928253182, 153579.42373544298, 153605.81932245308, 153632.21604346478, 153658.61389838057, 153685.0128871031, 153711.41300953497, 153737.81426557881, 153764.21665513728, 153790.62017811305, 153817.02483440886, 153843.43062392739, 153869.83754657139, 153896.24560224367, 153922.65479084692, 153949.06511228404, 153975.4765664578, 154001.88915327107, 154028.30287262669, 154054.71772442761, 154081.13370857667, 154107.55082497682, 154133.96907353101, 154160.38845414223, 154186.80896671346, 154213.23061114774, 154239.65338734805, 154266.07729521746, 154292.50233465908, 154318.92850557598, 154345.35580787127, 154371.7842414481, 154398.21380620965, 154424.64450205903, 154451.07632889951, 154477.50928663427, 154503.94337516659, 154530.37859439969, 154556.81494423689, 154583.25242458144, 154609.69103533673, 154636.13077640603, 154662.57164769279, 154689.01364910032, 154715.45678053208, 154741.90104189145, 154768.34643308193, 154794.79295400696, 154821.24060457002, 154847.68938467462, 154874.13929422433, 154900.59033312264, 154927.04250127316, 154953.49579857948, 154979.95022494521, 155006.40578027396, 155032.86246446942, 155059.32027743524, 155085.77921907514, 155112.2392892928, 155138.70048799197, 155165.16281507642, 155191.62627044989, 155218.09085401625, 155244.55656567923, 155271.02340534274, 155297.49137291059, 155323.96046828668, 155350.4306913749, 155376.90204207919, 155403.37452030348, 155429.84812595171, 155456.32285892789, 155482.79871913602, 155509.27570648011, 155535.75382086422, 155562.23306219239, 155588.71343036872, 155615.19492529731, 155641.67754688227, 155668.16129502779, 155694.64616963797, 155721.13217061706, 155747.61929786921, 155774.10755129869, 155800.59693080973, 155827.08743630661, 155853.57906769359, 155880.07182487496, 155906.56570775513, 155933.06071623837, 155959.55685022907, 155986.05410963166, 156012.5524943505, 156039.05200429002, 156065.55263935472, 156092.054399449, 156118.5572844774, 156145.06129434443, 156171.5664289546, 156198.07268821247, 156224.5800720226, 156251.08858028959, 156277.59821291809, 156304.10896981266, 156330.62085087801, 156357.1338560188, 156383.64798513969, 156410.16323814544, 156436.67961494075, 156463.1971154304, 156489.71573951913, 156516.23548711176, 156542.75635811311, 156569.27835242799, 156595.80146996127, 156622.32571061782, 156648.85107430254, 156675.37756092031, 156701.90517037612, 156728.43390257491, 156754.96375742162, 156781.49473482129, 156808.02683467892, 156834.5600568995, 156861.09440138817, 156887.62986804993, 156914.16645678994, 156940.70416751326, 156967.24300012505, 156993.78295453047, 157020.32403063469, 157046.8662283429, 157073.40954756032, 157099.9539881922, 157126.49955014378, 157153.04623332032, 157179.59403762716, 157206.14296296958, 157232.69300925292, 157259.24417638258, 157285.79646426387, 157312.34987280221, 157338.90440190304, 157365.46005147175, 157392.01682141385, 157418.57471163478, 157445.13372204005, 157471.69385253513, 157498.25510302564, 157524.81747341706, 157551.38096361503, 157577.9455735251, 157604.51130305286, 157631.07815210402, 157657.64612058419, 157684.21520839902, 157710.78541545427, 157737.35674165559, 157763.92918690876, 157790.50275111952, 157817.07743419363, 157843.65323603692, 157870.23015655516, 157896.80819565422, 157923.3873532399, 157949.96762921812, 157976.54902349479, 158003.13153597576, 158029.71516656701, 158056.29991517449, 158082.88578170416, 158109.47276606198, 158136.06086815402, 158162.65008788629, 158189.24042516484, 158215.83187989573, 158242.42445198505, 158269.01814133892, 158295.61294786347, 158322.20887146486, 158348.80591204923, 158375.4040695228, 158402.00334379176, 158428.60373476235, 158455.2052423408, 158481.80786643337, 158508.41160694641, 158535.01646378616, 158561.62243685898, 158588.2295260712, 158614.8377313292, 158641.44705253936, 158668.05748960807, 158694.66904244179, 158721.28171094693, 158747.89549502998, 158774.5103945974, 158801.12640955573, 158827.74353981143, 158854.36178527112, 158880.9811458413, 158907.60162142856, 158934.22321193956, 158960.84591728085, 158987.46973735912, 159014.09467208097, 159040.72072135314, 159067.3478850823, 159093.97616317519, 159120.60555553852, 159147.23606207906, 159173.8676827036, 159200.50041731889, 159227.13426583182, 159253.76922814918, 159280.40530417781, 159307.04249382461, 159333.68079699649, 159360.32021360032, 159386.96074354305, 159413.60238673165, 159440.24514307309, 159466.88901247433, 159493.53399484244, 159520.18009008438, 159546.82729810724, 159573.47561881805, 159600.12505212394, 159626.77559793202, 159653.42725614941, 159680.08002668325, 159706.73390944069, 159733.38890432892, 159760.04501125516, 159786.70223012666, 159813.36056085059, 159840.02000333427, 159866.68055748497, 159893.34222320997, 159920.00500041663, 159946.66888901225, 159973.33388890422, 159999.99999999988, 160026.66722220668, 160053.33555543202, 160080.0049995833, 160106.67555456801, 160133.3472202936, 160160.0199966676, 160186.6938835975, 160213.36888099083, 160240.04498875517, 160266.72220679806, 160293.40053502709, 160320.07997334987, 160346.76052167406, 160373.44217990729, 160400.1249479572, 160426.80882573154, 160453.49381313793, 160480.17991008417, 160506.86711647795, 160533.55543222709, 160560.24485723933, 160586.93539142248, 160613.62703468435, 160640.31978693281, 160667.01364807569, 160693.70861802087, 160720.40469667627, 160747.1018839498, 160773.80017974938, 160800.49958398298, 160827.20009655855, 160853.90171738411, 160880.60444636765, 160907.30828341722, 160934.01322844089, 160960.71928134665, 160987.42644204266, 161014.13471043704, 161040.84408643784, 161067.55456995327, 161094.26616089148, 161120.97885916062, 161147.69266466892, 161174.40757732463, 161201.12359703594, 161227.84072371112, 161254.55895725847, 161281.27829758628, 161307.99874460287, 161334.72029821656, 161361.44295833571, 161388.1667248687, 161414.89159772391, 161441.61757680977, 161468.34466203468, 161495.07285330712, 161521.80215053557, 161548.53255362847, 161575.26406249436, 161601.99667704175, 161628.7303971792, 161655.46522281526, 161682.20115385848, 161708.93819021754, 161735.67633180099, 161762.41557851751, 161789.15593027571, 161815.89738698432, 161842.63994855201, 161869.38361488748, 161896.1283858995, 161922.87426149679, 161949.62124158812, 161976.36932608229, 162003.1185148881, 162029.8688079144, 162056.62020507001, 162083.37270626382, 162110.12631140469, 162136.88102040152, 162163.63683316324, 162190.39374959879, 162217.15176961714, 162243.91089312723, 162270.67112003808, 162297.43245025873, 162324.19488369819, 162350.9584202655, 162377.72305986975, 162404.48880242003, 162431.25564782543, 162458.02359599507, 162484.79264683815, 162511.56280026378, 162538.33405618116, 162565.10641449949, 162591.87987512801, 162618.65443797593, 162645.43010295252, 162672.20686996708, 162698.98473892888, 162725.76370974723, 162752.54378233149, 162779.32495659095, 162806.10723243505, 162832.89060977317, 162859.67508851466, 162886.46066856899, 162913.24734984562, 162940.03513225398, 162966.82401570358, 162993.6140001039, 163020.40508536444, 163047.19727139481, 163073.99055810447, 163100.78494540305, 163127.58043320014, 163154.37702140535, 163181.17470992831, 163207.97349867865, 163234.77338756606, 163261.57437650024, 163288.37646539087, 163315.17965414765, 163341.98394268038, 163368.78933089875, 163395.59581871261, 163422.40340603172, 163449.2120927659, 163476.02187882498, 163502.83276411882, 163529.6447485573, 163556.45783205028, 163583.2720145077, 163610.08729583945, 163636.90367595552, 163663.72115476584, 163690.53973218042, 163717.35940810922, 163744.18018246227, 163771.00205514964, 163797.82502608138, 163824.64909516752, 163851.4742623182, 163878.3005274435, 163905.12789045356, 163931.95635125853, 163958.78590976857, 163985.61656589387, 164012.44831954464, 164039.28117063109, 164066.11511906344, 164092.95016475199, 164119.78630760699, 164146.62354753874, 164173.46188445756, 164200.30131827376, 164227.14184889771, 164253.98347623978, 164280.82620021031, 164307.67002071979, 164334.51493767856, 164361.3609509971, 164388.20806058586, 164415.05626635533, 164441.905568216, 164468.75596607837, 164495.607459853, 164522.4600494504, 164549.31373478117, 164576.16851575591, 164603.02439228518, 164629.88136427966, 164656.73943164994, 164683.59859430668, 164710.45885216061, 164737.32020512238, 164764.1826531027, 164791.04619601235, 164817.91083376206, 164844.77656626256, 164871.64339342469, 164898.51131515924, 164925.38033137703, 164952.25044198887, 164979.1216469057, 165005.9939460383, 165032.86733929763, 165059.7418265946, 165086.61740784015, 165113.4940829452 }; #else #ifdef BIG_IQ_TABLE #define IQ_TABLE_SIZE 8192 #else #define IQ_TABLE_SIZE 1026 #endif ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = { REAL_CONST(0.0), REAL_CONST(1.0/8.0), REAL_CONST(2.5198420997897464/8.0), REAL_CONST(4.3267487109222245/8.0), REAL_CONST(6.3496042078727974/8.0), REAL_CONST(8.5498797333834844/8.0), REAL_CONST(10.902723556992836/8.0), REAL_CONST(13.390518279406722/8.0), REAL_CONST(15.999999999999998/8.0), REAL_CONST(18.720754407467133/8.0), REAL_CONST(21.544346900318832/8.0), REAL_CONST(24.463780996262464/8.0), REAL_CONST(27.47314182127996/8.0), REAL_CONST(30.567350940369842/8.0), REAL_CONST(33.741991698453212/8.0), REAL_CONST(36.993181114957046/8.0), REAL_CONST(40.317473596635935/8.0), REAL_CONST(43.711787041189993/8.0), REAL_CONST(47.173345095760126/8.0), REAL_CONST(50.699631325716943/8.0), REAL_CONST(54.288352331898118/8.0), REAL_CONST(57.937407704003519/8.0), REAL_CONST(61.6448652744185/8.0), REAL_CONST(65.408940536585988/8.0), REAL_CONST(69.227979374755591/8.0), REAL_CONST(73.100443455321638/8.0), REAL_CONST(77.024897778591622/8.0), REAL_CONST(80.999999999999986/8.0), REAL_CONST(85.024491212518527/8.0), REAL_CONST(89.097187944889555/8.0), REAL_CONST(93.216975178615741/8.0), REAL_CONST(97.382800224133163/8.0), REAL_CONST(101.59366732596474/8.0), REAL_CONST(105.84863288986224/8.0), REAL_CONST(110.14680124343441/8.0), REAL_CONST(114.4873208566006/8.0), REAL_CONST(118.86938096020653/8.0), REAL_CONST(123.29220851090024/8.0), REAL_CONST(127.75506545836058/8.0), REAL_CONST(132.25724627755247/8.0), REAL_CONST(136.79807573413572/8.0), REAL_CONST(141.37690685569191/8.0), REAL_CONST(145.99311908523086/8.0), REAL_CONST(150.6461165966291/8.0), REAL_CONST(155.33532675434674/8.0), REAL_CONST(160.06019870205279/8.0), REAL_CONST(164.82020206673349/8.0), REAL_CONST(169.61482576651861/8.0), REAL_CONST(174.44357691188537/8.0), REAL_CONST(179.30597979112557/8.0), REAL_CONST(184.20157493201927/8.0), REAL_CONST(189.12991823257562/8.0), REAL_CONST(194.09058015449685/8.0), REAL_CONST(199.08314497371677/8.0), REAL_CONST(204.1072100829694/8.0), REAL_CONST(209.16238534187647/8.0), REAL_CONST(214.24829247050752/8.0), REAL_CONST(219.36456448277784/8.0), REAL_CONST(224.51084515641216/8.0), REAL_CONST(229.6867885365223/8.0), REAL_CONST(234.89205847013176/8.0), REAL_CONST(240.12632816923249/8.0), REAL_CONST(245.38927980018505/8.0), REAL_CONST(250.68060409747261/8.0), REAL_CONST(255.99999999999991/8.0), REAL_CONST(261.34717430828869/8.0), REAL_CONST(266.72184136106449/8.0), REAL_CONST(272.12372272986045/8.0), REAL_CONST(277.55254693037961/8.0), REAL_CONST(283.0080491494619/8.0), REAL_CONST(288.48997098659891/8.0), REAL_CONST(293.99806020902247/8.0), REAL_CONST(299.53207051947408/8.0), REAL_CONST(305.0917613358298/8.0), REAL_CONST(310.67689758182206/8.0), REAL_CONST(316.28724948815585/8.0), REAL_CONST(321.92259240337177/8.0), REAL_CONST(327.58270661385535/8.0), REAL_CONST(333.26737717243742/8.0), REAL_CONST(338.97639373507025/8.0), REAL_CONST(344.70955040510125/8.0), REAL_CONST(350.46664558470013/8.0), REAL_CONST(356.24748183302603/8.0), REAL_CONST(362.05186573075139/8.0), REAL_CONST(367.87960775058258/8.0), REAL_CONST(373.73052213344511/8.0), REAL_CONST(379.60442677002078/8.0), REAL_CONST(385.50114308734607/8.0), REAL_CONST(391.42049594019937/8.0), REAL_CONST(397.36231350702371/8.0), REAL_CONST(403.32642719014467/8.0), REAL_CONST(409.31267152006262/8.0), REAL_CONST(415.32088406360799/8.0), REAL_CONST(421.35090533576471/8.0), REAL_CONST(427.40257871497619/8.0), REAL_CONST(433.4757503617617/8.0), REAL_CONST(439.5702691404793/8.0), REAL_CONST(445.68598654408271/8.0), REAL_CONST(451.82275662172759/8.0), REAL_CONST(457.98043590909128/8.0), REAL_CONST(464.15888336127773/8.0), REAL_CONST(470.35796028818726/8.0), REAL_CONST(476.5775302922363/8.0), REAL_CONST(482.81745920832043/8.0), REAL_CONST(489.07761504591741/8.0), REAL_CONST(495.35786793323581/8.0), REAL_CONST(501.65809006331688/8.0), REAL_CONST(507.97815564200368/8.0), REAL_CONST(514.31794083769648/8.0), REAL_CONST(520.67732373281672/8.0), REAL_CONST(527.05618427690604/8.0), REAL_CONST(533.45440424129174/8.0), REAL_CONST(539.87186717525128/8.0), REAL_CONST(546.30845836361505/8.0), REAL_CONST(552.76406478574609/8.0), REAL_CONST(559.23857507584194/8.0), REAL_CONST(565.73187948450413/8.0), REAL_CONST(572.24386984152341/8.0), REAL_CONST(578.77443951983378/8.0), REAL_CONST(585.32348340058843/8.0), REAL_CONST(591.89089783931263/8.0), REAL_CONST(598.47658063309257/8.0), REAL_CONST(605.08043098876044/8.0), REAL_CONST(611.70234949203643/8.0), REAL_CONST(618.3422380775919/8.0), REAL_CONST(624.99999999999977/8.0), REAL_CONST(631.67553980553748/8.0), REAL_CONST(638.36876330481164/8.0), REAL_CONST(645.07957754617485/8.0), REAL_CONST(651.80789078990415/8.0), REAL_CONST(658.55361248311499/8.0), REAL_CONST(665.31665323538357/8.0), REAL_CONST(672.09692479505225/8.0), REAL_CONST(678.8943400261943/8.0), REAL_CONST(685.70881288621433/8.0), REAL_CONST(692.540258404062/8.0), REAL_CONST(699.38859265903977/8.0), REAL_CONST(706.25373276018058/8.0), REAL_CONST(713.13559682617972/8.0), REAL_CONST(720.03410396586037/8.0), REAL_CONST(726.94917425915435/8.0), REAL_CONST(733.88072873858209/8.0), REAL_CONST(740.82868937121543/8.0), REAL_CONST(747.79297904110535/8.0), REAL_CONST(754.77352153216191/8.0), REAL_CONST(761.77024151147043/8.0), REAL_CONST(768.78306451302956/8.0), REAL_CONST(775.81191692189896/8.0), REAL_CONST(782.85672595874246/8.0), REAL_CONST(789.91741966475445/8.0), REAL_CONST(796.99392688695798/8.0), REAL_CONST(804.08617726386274/8.0), REAL_CONST(811.19410121147098/8.0), REAL_CONST(818.31762990962227/8.0), REAL_CONST(825.45669528866563/8.0), REAL_CONST(832.61123001644864/8.0), REAL_CONST(839.78116748561604/8.0), REAL_CONST(846.96644180120552/8.0), REAL_CONST(854.16698776853514/8.0), REAL_CONST(861.38274088137143/8.0), REAL_CONST(868.61363731036977/8.0), REAL_CONST(875.85961389178203/8.0), REAL_CONST(883.12060811641959/8.0), REAL_CONST(890.39655811886757/8.0), REAL_CONST(897.68740266694181/8.0), REAL_CONST(904.99308115138172/8.0), REAL_CONST(912.31353357577188/8.0), REAL_CONST(919.64870054668756/8.0), REAL_CONST(926.99852326405619/8.0), REAL_CONST(934.36294351172899/8.0), REAL_CONST(941.74190364825859/8.0), REAL_CONST(949.13534659787422/8.0), REAL_CONST(956.54321584165211/8.0), REAL_CONST(963.96545540887348/8.0), REAL_CONST(971.40200986856541/8.0), REAL_CONST(978.85282432122176/8.0), REAL_CONST(986.31784439069588/8.0), REAL_CONST(993.7970162162635/8.0), REAL_CONST(1001.29028644485/8.0), REAL_CONST(1008.797602223418/8.0), REAL_CONST(1016.3189111915103/8.0), REAL_CONST(1023.8541614739464/8.0), REAL_CONST(1031.4033016736653/8.0), REAL_CONST(1038.9662808647138/8.0), REAL_CONST(1046.5430485853758/8.0), REAL_CONST(1054.1335548314366/8.0), REAL_CONST(1061.7377500495838/8.0), REAL_CONST(1069.3555851309357/8.0), REAL_CONST(1076.9870114046978/8.0), REAL_CONST(1084.6319806319441/8.0), REAL_CONST(1092.2904449995174/8.0), REAL_CONST(1099.9623571140482/8.0), REAL_CONST(1107.6476699960892/8.0), REAL_CONST(1115.3463370743607/8.0), REAL_CONST(1123.058312180106/8.0), REAL_CONST(1130.7835495415541/8.0), REAL_CONST(1138.5220037784854/8.0), REAL_CONST(1146.273629896901/8.0), REAL_CONST(1154.0383832837879/8.0), REAL_CONST(1161.816219701986/8.0), REAL_CONST(1169.607095285146/8.0), REAL_CONST(1177.4109665327808/8.0), REAL_CONST(1185.2277903054078/8.0), REAL_CONST(1193.0575238197798/8.0), REAL_CONST(1200.9001246442001/8.0), REAL_CONST(1208.7555506939248/8.0), REAL_CONST(1216.6237602266442/8.0), REAL_CONST(1224.5047118380478/8.0), REAL_CONST(1232.3983644574657/8.0), REAL_CONST(1240.3046773435874/8.0), REAL_CONST(1248.2236100802568/8.0), REAL_CONST(1256.1551225723395/8.0), REAL_CONST(1264.099175041662/8.0), REAL_CONST(1272.0557280230228/8.0), REAL_CONST(1280.0247423602691/8.0), REAL_CONST(1288.0061792024444/8.0), REAL_CONST(1295.9999999999995/8.0), REAL_CONST(1304.006166501068/8.0), REAL_CONST(1312.0246407478062/8.0), REAL_CONST(1320.0553850727929/8.0), REAL_CONST(1328.0983620954903/8.0), REAL_CONST(1336.1535347187651/8.0), REAL_CONST(1344.2208661254647/8.0), REAL_CONST(1352.3003197750522/8.0), REAL_CONST(1360.3918594002962/8.0), REAL_CONST(1368.4954490040145/8.0), REAL_CONST(1376.6110528558709/8.0), REAL_CONST(1384.7386354892244/8.0), REAL_CONST(1392.8781616980295/8.0), REAL_CONST(1401.0295965337855/8.0), REAL_CONST(1409.1929053025353/8.0), REAL_CONST(1417.3680535619119/8.0), REAL_CONST(1425.5550071182327/8.0), REAL_CONST(1433.7537320236374/8.0), REAL_CONST(1441.9641945732744/8.0), REAL_CONST(1450.1863613025282/8.0), REAL_CONST(1458.4201989842913/8.0), REAL_CONST(1466.6656746262797/8.0), REAL_CONST(1474.9227554683875/8.0), REAL_CONST(1483.1914089800841/8.0), REAL_CONST(1491.4716028578516/8.0), REAL_CONST(1499.7633050226596/8.0), REAL_CONST(1508.0664836174794/8.0), REAL_CONST(1516.3811070048375/8.0), REAL_CONST(1524.7071437644029/8.0), REAL_CONST(1533.0445626906128/8.0), REAL_CONST(1541.3933327903342/8.0), REAL_CONST(1549.7534232805581/8.0), REAL_CONST(1558.1248035861302/8.0), REAL_CONST(1566.507443337515/8.0), REAL_CONST(1574.9013123685909/8.0), REAL_CONST(1583.3063807144795/8.0), REAL_CONST(1591.7226186094069/8.0), REAL_CONST(1600.1499964845941/8.0), REAL_CONST(1608.58848496618/8.0), REAL_CONST(1617.0380548731737/8.0), REAL_CONST(1625.4986772154357/8.0), REAL_CONST(1633.9703231916887/8.0), REAL_CONST(1642.4529641875577/8.0), REAL_CONST(1650.9465717736346/8.0), REAL_CONST(1659.4511177035752/8.0), REAL_CONST(1667.9665739122186/8.0), REAL_CONST(1676.4929125137353/8.0), REAL_CONST(1685.030105799801/8.0), REAL_CONST(1693.5781262377957/8.0), REAL_CONST(1702.136946469027/8.0), REAL_CONST(1710.7065393069795/8.0), REAL_CONST(1719.2868777355877/8.0), REAL_CONST(1727.8779349075323/8.0), REAL_CONST(1736.4796841425596/8.0), REAL_CONST(1745.092098925825/8.0), REAL_CONST(1753.7151529062583/8.0), REAL_CONST(1762.3488198949503/8.0), REAL_CONST(1770.9930738635628/8.0), REAL_CONST(1779.6478889427597/8.0), REAL_CONST(1788.3132394206564/8.0), REAL_CONST(1796.9890997412947/8.0), REAL_CONST(1805.6754445031333/8.0), REAL_CONST(1814.3722484575621/8.0), REAL_CONST(1823.0794865074322/8.0), REAL_CONST(1831.7971337056094/8.0), REAL_CONST(1840.5251652535437/8.0), REAL_CONST(1849.2635564998579/8.0), REAL_CONST(1858.0122829389563/8.0), REAL_CONST(1866.7713202096493/8.0), REAL_CONST(1875.5406440937966/8.0), REAL_CONST(1884.3202305149687/8.0), REAL_CONST(1893.110055537124/8.0), REAL_CONST(1901.9100953633042/8.0), REAL_CONST(1910.7203263343454/8.0), REAL_CONST(1919.5407249276057/8.0), REAL_CONST(1928.3712677557098/8.0), REAL_CONST(1937.2119315653083/8.0), REAL_CONST(1946.0626932358525/8.0), REAL_CONST(1954.923529778386/8.0), REAL_CONST(1963.79441833435/8.0), REAL_CONST(1972.6753361744036/8.0), REAL_CONST(1981.5662606972594/8.0), REAL_CONST(1990.467169428533/8.0), REAL_CONST(1999.3780400196069/8.0), REAL_CONST(2008.2988502465078/8.0), REAL_CONST(2017.2295780087982/8.0), REAL_CONST(2026.1702013284819/8.0), REAL_CONST(2035.1206983489212/8.0), REAL_CONST(2044.0810473337688/8.0), REAL_CONST(2053.0512266659125/8.0), REAL_CONST(2062.0312148464309/8.0), REAL_CONST(2071.0209904935646/8.0), REAL_CONST(2080.0205323416958/8.0), REAL_CONST(2089.0298192403443/8.0), REAL_CONST(2098.0488301531714/8.0), REAL_CONST(2107.0775441569995/8.0), REAL_CONST(2116.115940440839/8.0), REAL_CONST(2125.1639983049317/8.0), REAL_CONST(2134.2216971597995/8.0), REAL_CONST(2143.2890165253098/8.0), REAL_CONST(2152.3659360297484/8.0), REAL_CONST(2161.4524354089031/8.0), REAL_CONST(2170.5484945051617/8.0), REAL_CONST(2179.6540932666144/8.0), REAL_CONST(2188.7692117461711/8.0), REAL_CONST(2197.8938301006888/8.0), REAL_CONST(2207.0279285901042/8.0), REAL_CONST(2216.1714875765838/8.0), REAL_CONST(2225.324487523676/8.0), REAL_CONST(2234.4869089954782/8.0), REAL_CONST(2243.6587326558101/8.0), REAL_CONST(2252.8399392673982/8.0), REAL_CONST(2262.0305096910702/8.0), REAL_CONST(2271.2304248849537/8.0), REAL_CONST(2280.4396659036897/8.0), REAL_CONST(2289.6582138976523/8.0), REAL_CONST(2298.8860501121762/8.0), REAL_CONST(2308.1231558867926/8.0), REAL_CONST(2317.3695126544767/8.0), REAL_CONST(2326.6251019409005/8.0), REAL_CONST(2335.8899053636933/8.0), REAL_CONST(2345.1639046317132/8.0), REAL_CONST(2354.4470815443233/8.0), REAL_CONST(2363.7394179906792/8.0), REAL_CONST(2373.0408959490205/8.0), REAL_CONST(2382.3514974859731/8.0), REAL_CONST(2391.6712047558558/8.0), REAL_CONST(2400.9999999999991/8.0), REAL_CONST(2410.3378655460651/8.0), REAL_CONST(2419.6847838073813/8.0), REAL_CONST(2429.0407372822747/8.0), REAL_CONST(2438.4057085534191/8.0), REAL_CONST(2447.7796802871858/8.0), REAL_CONST(2457.1626352330004/8.0), REAL_CONST(2466.5545562227112/8.0), REAL_CONST(2475.9554261699564/8.0), REAL_CONST(2485.3652280695474/8.0), REAL_CONST(2494.7839449968492/8.0), REAL_CONST(2504.2115601071737/8.0), REAL_CONST(2513.6480566351788/8.0), REAL_CONST(2523.0934178942675/8.0), REAL_CONST(2532.5476272760025/8.0), REAL_CONST(2542.0106682495189/8.0), REAL_CONST(2551.482524360948/8.0), REAL_CONST(2560.9631792328441/8.0), REAL_CONST(2570.4526165636184/8.0), REAL_CONST(2579.9508201269791/8.0), REAL_CONST(2589.4577737713744/8.0), REAL_CONST(2598.9734614194458/8.0), REAL_CONST(2608.4978670674823/8.0), REAL_CONST(2618.0309747848837/8.0), REAL_CONST(2627.5727687136259/8.0), REAL_CONST(2637.1232330677353/8.0), REAL_CONST(2646.6823521327647/8.0), REAL_CONST(2656.2501102652768/8.0), REAL_CONST(2665.8264918923328/8.0), REAL_CONST(2675.4114815109842/8.0), REAL_CONST(2685.0050636877722/8.0), REAL_CONST(2694.6072230582295/8.0), REAL_CONST(2704.2179443263894/8.0), REAL_CONST(2713.8372122642972/8.0), REAL_CONST(2723.4650117115279/8.0), REAL_CONST(2733.1013275747096/8.0), REAL_CONST(2742.7461448270483/8.0), REAL_CONST(2752.3994485078601/8.0), REAL_CONST(2762.0612237221085/8.0), REAL_CONST(2771.7314556399419/8.0), REAL_CONST(2781.4101294962406/8.0), REAL_CONST(2791.0972305901655/8.0), REAL_CONST(2800.7927442847094/8.0), REAL_CONST(2810.4966560062589/8.0), REAL_CONST(2820.2089512441521/8.0), REAL_CONST(2829.9296155502466/8.0), REAL_CONST(2839.6586345384894/8.0), REAL_CONST(2849.3959938844923/8.0), REAL_CONST(2859.1416793251065/8.0), REAL_CONST(2868.8956766580086/8.0), REAL_CONST(2878.6579717412847/8.0), REAL_CONST(2888.4285504930212/8.0), REAL_CONST(2898.2073988908974/8.0), REAL_CONST(2907.9945029717837/8.0), REAL_CONST(2917.789848831344/8.0), REAL_CONST(2927.5934226236377/8.0), REAL_CONST(2937.4052105607311/8.0), REAL_CONST(2947.2251989123079/8.0), REAL_CONST(2957.0533740052865/8.0), REAL_CONST(2966.8897222234368/8.0), REAL_CONST(2976.734230007005/8.0), REAL_CONST(2986.5868838523397/8.0), REAL_CONST(2996.4476703115197/8.0), REAL_CONST(3006.3165759919889/8.0), REAL_CONST(3016.1935875561908/8.0), REAL_CONST(3026.0786917212095/8.0), REAL_CONST(3035.9718752584108/8.0), REAL_CONST(3045.8731249930906/8.0), REAL_CONST(3055.7824278041207/8.0), REAL_CONST(3065.6997706236039/8.0), REAL_CONST(3075.625140436528/8.0), REAL_CONST(3085.5585242804245/8.0), REAL_CONST(3095.4999092450298/8.0), REAL_CONST(3105.4492824719491/8.0), REAL_CONST(3115.4066311543256/8.0), REAL_CONST(3125.3719425365089/8.0), REAL_CONST(3135.3452039137287/8.0), REAL_CONST(3145.3264026317715/8.0), REAL_CONST(3155.3155260866592/8.0), REAL_CONST(3165.3125617243295/8.0), REAL_CONST(3175.3174970403229/8.0), REAL_CONST(3185.3303195794679/8.0), REAL_CONST(3195.35101693557/8.0), REAL_CONST(3205.3795767511078/8.0), REAL_CONST(3215.4159867169251/8.0), REAL_CONST(3225.460234571929/8.0), REAL_CONST(3235.5123081027928/8.0), REAL_CONST(3245.5721951436558/8.0), REAL_CONST(3255.63988357583/8.0), REAL_CONST(3265.7153613275095/8.0), REAL_CONST(3275.7986163734795/8.0), REAL_CONST(3285.8896367348289/8.0), REAL_CONST(3295.9884104786665/8.0), REAL_CONST(3306.0949257178395/8.0), REAL_CONST(3316.2091706106517/8.0), REAL_CONST(3326.331133360588/8.0), REAL_CONST(3336.4608022160378/8.0), REAL_CONST(3346.5981654700231/8.0), REAL_CONST(3356.7432114599264/8.0), REAL_CONST(3366.8959285672249/8.0), REAL_CONST(3377.0563052172211/8.0), REAL_CONST(3387.2243298787821/8.0), REAL_CONST(3397.3999910640764/8.0), REAL_CONST(3407.5832773283128/8.0), REAL_CONST(3417.7741772694862/8.0), REAL_CONST(3427.9726795281199/8.0), REAL_CONST(3438.1787727870123/8.0), REAL_CONST(3448.3924457709873/8.0), REAL_CONST(3458.6136872466445/8.0), REAL_CONST(3468.8424860221107/8.0), REAL_CONST(3479.0788309467976/8.0), REAL_CONST(3489.3227109111554/8.0), REAL_CONST(3499.5741148464344/8.0), REAL_CONST(3509.8330317244445/8.0), REAL_CONST(3520.0994505573185/8.0), REAL_CONST(3530.3733603972751/8.0), REAL_CONST(3540.6547503363886/8.0), REAL_CONST(3550.9436095063534/8.0), REAL_CONST(3561.239927078258/8.0), REAL_CONST(3571.5436922623535/8.0), REAL_CONST(3581.8548943078308/8.0), REAL_CONST(3592.1735225025936/8.0), REAL_CONST(3602.4995661730372/8.0), REAL_CONST(3612.8330146838275/8.0), REAL_CONST(3623.1738574376814/8.0), REAL_CONST(3633.5220838751502/8.0), REAL_CONST(3643.8776834744031/8.0), REAL_CONST(3654.2406457510142/8.0), REAL_CONST(3664.6109602577494/8.0), REAL_CONST(3674.9886165843564/8.0), REAL_CONST(3685.3736043573545/8.0), REAL_CONST(3695.7659132398294/8.0), REAL_CONST(3706.1655329312248/8.0), REAL_CONST(3716.5724531671399/8.0), REAL_CONST(3726.9866637191262/8.0), REAL_CONST(3737.4081543944876/8.0), REAL_CONST(3747.8369150360782/8.0), REAL_CONST(3758.2729355221072/8.0), REAL_CONST(3768.7162057659411/8.0), REAL_CONST(3779.1667157159077/8.0), REAL_CONST(3789.6244553551055/8.0), REAL_CONST(3800.0894147012082/8.0), REAL_CONST(3810.5615838062768/8.0), REAL_CONST(3821.0409527565694/8.0), REAL_CONST(3831.5275116723533/8.0), REAL_CONST(3842.0212507077194/8.0), REAL_CONST(3852.522160050396/8.0), REAL_CONST(3863.0302299215673/8.0), REAL_CONST(3873.5454505756893/8.0), REAL_CONST(3884.0678123003108/8.0), REAL_CONST(3894.5973054158922/8.0), REAL_CONST(3905.1339202756285/8.0), REAL_CONST(3915.6776472652732/8.0), REAL_CONST(3926.2284768029604/8.0), REAL_CONST(3936.7863993390338/8.0), REAL_CONST(3947.3514053558706/8.0), REAL_CONST(3957.9234853677135/8.0), REAL_CONST(3968.5026299204969/8.0), REAL_CONST(3979.0888295916798/8.0), REAL_CONST(3989.6820749900776/8.0), REAL_CONST(4000.2823567556948/8.0), REAL_CONST(4010.8896655595613/8.0), REAL_CONST(4021.5039921035655/8.0), REAL_CONST(4032.1253271202945/8.0), REAL_CONST(4042.7536613728694/8.0), REAL_CONST(4053.3889856547858/8.0), REAL_CONST(4064.0312907897551/8.0), REAL_CONST(4074.6805676315448/8.0), REAL_CONST(4085.3368070638221/8.0), REAL_CONST(4095.9999999999982/8.0), REAL_CONST(4106.6701373830711/8.0), REAL_CONST(4117.347210185475/8.0), REAL_CONST(4128.0312094089259/8.0), REAL_CONST(4138.722126084268/8.0), REAL_CONST(4149.4199512713267/8.0), REAL_CONST(4160.1246760587583/8.0), REAL_CONST(4170.8362915638982/8.0), REAL_CONST(4181.5547889326181/8.0), REAL_CONST(4192.2801593391769/8.0), REAL_CONST(4203.0123939860741/8.0), REAL_CONST(4213.7514841039101/8.0), REAL_CONST(4224.4974209512384/8.0), REAL_CONST(4235.2501958144258/8.0), REAL_CONST(4246.0098000075095/8.0), REAL_CONST(4256.7762248720574/8.0), REAL_CONST(4267.549461777031/8.0), REAL_CONST(4278.3295021186423/8.0), REAL_CONST(4289.1163373202198/8.0), REAL_CONST(4299.9099588320714/8.0), REAL_CONST(4310.7103581313495/8.0), REAL_CONST(4321.5175267219138/8.0), REAL_CONST(4332.3314561342004/8.0), REAL_CONST(4343.152137925088/8.0), REAL_CONST(4353.9795636777671/8.0), REAL_CONST(4364.8137250016052/8.0), REAL_CONST(4375.6546135320223/8.0), REAL_CONST(4386.5022209303588/8.0), REAL_CONST(4397.3565388837469/8.0), REAL_CONST(4408.2175591049827/8.0), REAL_CONST(4419.0852733324018/8.0), REAL_CONST(4429.9596733297531/8.0), REAL_CONST(4440.8407508860728/8.0), REAL_CONST(4451.7284978155603/8.0), REAL_CONST(4462.6229059574571/8.0), REAL_CONST(4473.5239671759227/8.0), REAL_CONST(4484.4316733599126/8.0), REAL_CONST(4495.3460164230582/8.0), REAL_CONST(4506.2669883035496/8.0), REAL_CONST(4517.1945809640119/8.0), REAL_CONST(4528.1287863913894/8.0), REAL_CONST(4539.069596596828/8.0), REAL_CONST(4550.0170036155587/8.0), REAL_CONST(4560.9709995067806/8.0), REAL_CONST(4571.931576353546/8.0), REAL_CONST(4582.898726262647/8.0), REAL_CONST(4593.8724413645004/8.0), REAL_CONST(4604.8527138130348/8.0), REAL_CONST(4615.8395357855816/8.0), REAL_CONST(4626.8328994827571/8.0), REAL_CONST(4637.8327971283588/8.0), REAL_CONST(4648.8392209692511/8.0), REAL_CONST(4659.8521632752563/8.0), REAL_CONST(4670.8716163390473/8.0), REAL_CONST(4681.8975724760394/8.0), REAL_CONST(4692.9300240242837/8.0), REAL_CONST(4703.9689633443595/8.0), REAL_CONST(4715.0143828192668/8.0), REAL_CONST(4726.0662748543255/8.0), REAL_CONST(4737.1246318770682/8.0), REAL_CONST(4748.1894463371373/8.0), REAL_CONST(4759.2607107061804/8.0), REAL_CONST(4770.3384174777493/8.0), REAL_CONST(4781.4225591671993/8.0), REAL_CONST(4792.5131283115852/8.0), REAL_CONST(4803.6101174695614/8.0), REAL_CONST(4814.7135192212854/8.0), REAL_CONST(4825.8233261683154/8.0), REAL_CONST(4836.9395309335096/8.0), REAL_CONST(4848.0621261609349/8.0), REAL_CONST(4859.1911045157631/8.0), REAL_CONST(4870.3264586841779/8.0), REAL_CONST(4881.4681813732768/8.0), REAL_CONST(4892.6162653109768/8.0), REAL_CONST(4903.7707032459193/8.0), REAL_CONST(4914.931487947375/8.0), REAL_CONST(4926.0986122051509/8.0), REAL_CONST(4937.2720688294967/8.0), REAL_CONST(4948.4518506510112/8.0), REAL_CONST(4959.637950520555/8.0), REAL_CONST(4970.8303613091521/8.0), REAL_CONST(4982.0290759079044/8.0), REAL_CONST(4993.2340872278974/8.0), REAL_CONST(5004.4453882001153/8.0), REAL_CONST(5015.6629717753467/8.0), REAL_CONST(5026.8868309241007/8.0), REAL_CONST(5038.1169586365131/8.0), REAL_CONST(5049.353347922266/8.0), REAL_CONST(5060.5959918104927/8.0), REAL_CONST(5071.8448833496996/8.0), REAL_CONST(5083.1000156076734/8.0), REAL_CONST(5094.3613816713996/8.0), REAL_CONST(5105.6289746469747/8.0), REAL_CONST(5116.9027876595246/8.0), REAL_CONST(5128.18281385312/8.0), REAL_CONST(5139.4690463906918/8.0), REAL_CONST(5150.7614784539473/8.0), REAL_CONST(5162.0601032432933/8.0), REAL_CONST(5173.3649139777472/8.0), REAL_CONST(5184.6759038948594/8.0), REAL_CONST(5195.9930662506322/8.0), REAL_CONST(5207.3163943194386/8.0), REAL_CONST(5218.6458813939435/8.0), REAL_CONST(5229.9815207850224/8.0), REAL_CONST(5241.3233058216847/8.0), REAL_CONST(5252.6712298509919/8.0), REAL_CONST(5264.025286237983/8.0), REAL_CONST(5275.3854683655954/8.0), REAL_CONST(5286.7517696345885/8.0), REAL_CONST(5298.1241834634639/8.0), REAL_CONST(5309.5027032883945/8.0), REAL_CONST(5320.887322563146/8.0), REAL_CONST(5332.2780347589978/8.0), REAL_CONST(5343.6748333646756/8.0), REAL_CONST(5355.0777118862716/8.0), REAL_CONST(5366.4866638471722/8.0), REAL_CONST(5377.901682787985/8.0), REAL_CONST(5389.3227622664635/8.0), REAL_CONST(5400.749895857437/8.0), REAL_CONST(5412.1830771527357/8.0), REAL_CONST(5423.622299761123/8.0), REAL_CONST(5435.067557308219/8.0), REAL_CONST(5446.5188434364318/8.0), REAL_CONST(5457.9761518048872/8.0), REAL_CONST(5469.4394760893592/8.0), REAL_CONST(5480.9088099821975/8.0), REAL_CONST(5492.3841471922606/8.0), REAL_CONST(5503.8654814448455/8.0), REAL_CONST(5515.3528064816201/8.0), REAL_CONST(5526.846116060552/8.0), REAL_CONST(5538.3454039558474/8.0), REAL_CONST(5549.8506639578736/8.0), REAL_CONST(5561.3618898731029/8.0), REAL_CONST(5572.8790755240361/8.0), REAL_CONST(5584.4022147491451/8.0), REAL_CONST(5595.9313014027975/8.0), REAL_CONST(5607.4663293552012/8.0), REAL_CONST(5619.0072924923297/8.0), REAL_CONST(5630.5541847158656/8.0), REAL_CONST(5642.1069999431284/8.0), REAL_CONST(5653.665732107017/8.0), REAL_CONST(5665.230375155943/8.0), REAL_CONST(5676.8009230537655/8.0), REAL_CONST(5688.3773697797333/8.0), REAL_CONST(5699.9597093284156/8.0), REAL_CONST(5711.5479357096474/8.0), REAL_CONST(5723.1420429484588/8.0), REAL_CONST(5734.7420250850209/8.0), REAL_CONST(5746.347876174581/8.0), REAL_CONST(5757.9595902874016/8.0), REAL_CONST(5769.5771615087006/8.0), REAL_CONST(5781.2005839385911/8.0), REAL_CONST(5792.8298516920213/8.0), REAL_CONST(5804.4649588987149/8.0), REAL_CONST(5816.1058997031105/8.0), REAL_CONST(5827.7526682643065/8.0), REAL_CONST(5839.4052587559972/8.0), REAL_CONST(5851.0636653664196/8.0), REAL_CONST(5862.7278822982908/8.0), REAL_CONST(5874.3979037687541/8.0), REAL_CONST(5886.0737240093204/8.0), REAL_CONST(5897.7553372658094/8.0), REAL_CONST(5909.4427377982956/8.0), REAL_CONST(5921.1359198810505/8.0), REAL_CONST(5932.8348778024874/8.0), REAL_CONST(5944.5396058651031/8.0), REAL_CONST(5956.2500983854261/8.0), REAL_CONST(5967.9663496939575/8.0), REAL_CONST(5979.6883541351208/8.0), REAL_CONST(5991.4161060672022/8.0), REAL_CONST(6003.1495998623004/8.0), REAL_CONST(6014.8888299062692/8.0), REAL_CONST(6026.6337905986684/8.0), REAL_CONST(6038.3844763527022/8.0), REAL_CONST(6050.1408815951781/8.0), REAL_CONST(6061.9030007664414/8.0), REAL_CONST(6073.6708283203316/8.0), REAL_CONST(6085.4443587241267/8.0), REAL_CONST(6097.2235864584891/8.0), REAL_CONST(6109.0085060174197/8.0), REAL_CONST(6120.7991119081998/8.0), REAL_CONST(6132.595398651345/8.0), REAL_CONST(6144.3973607805519/8.0), REAL_CONST(6156.2049928426459/8.0), REAL_CONST(6168.0182893975361/8.0), REAL_CONST(6179.8372450181578/8.0), REAL_CONST(6191.6618542904307/8.0), REAL_CONST(6203.4921118132024/8.0), REAL_CONST(6215.3280121982016/8.0), REAL_CONST(6227.1695500699925/8.0), REAL_CONST(6239.0167200659189/8.0), REAL_CONST(6250.8695168360628/8.0), REAL_CONST(6262.7279350431891/8.0), REAL_CONST(6274.5919693627056/8.0), REAL_CONST(6286.4616144826068/8.0), REAL_CONST(6298.3368651034316/8.0), REAL_CONST(6310.2177159382172/8.0), REAL_CONST(6322.1041617124456/8.0), REAL_CONST(6333.9961971640032/8.0), REAL_CONST(6345.8938170431311/8.0), REAL_CONST(6357.7970161123785/8.0), REAL_CONST(6369.7057891465583/8.0), REAL_CONST(6381.6201309327007/8.0), REAL_CONST(6393.5400362700075/8.0), REAL_CONST(6405.4654999698032/8.0), REAL_CONST(6417.3965168554978/8.0), REAL_CONST(6429.3330817625329/8.0), REAL_CONST(6441.2751895383453/8.0), REAL_CONST(6453.2228350423138/8.0), REAL_CONST(6465.176013145724/8.0), REAL_CONST(6477.134718731716/8.0), REAL_CONST(6489.0989466952469/8.0), REAL_CONST(6501.0686919430445/8.0), REAL_CONST(6513.0439493935628/8.0), REAL_CONST(6525.0247139769417/8.0), REAL_CONST(6537.010980634961/8.0), REAL_CONST(6549.002744321001/8.0), REAL_CONST(6560.9999999999973/8.0), REAL_CONST(6573.0027426483985/8.0), REAL_CONST(6585.0109672541284/8.0), REAL_CONST(6597.0246688165371/8.0), REAL_CONST(6609.0438423463656/8.0), REAL_CONST(6621.0684828657004/8.0), REAL_CONST(6633.0985854079354/8.0), REAL_CONST(6645.134145017727/8.0), REAL_CONST(6657.1751567509573/8.0), REAL_CONST(6669.2216156746908/8.0), REAL_CONST(6681.2735168671343/8.0), REAL_CONST(6693.3308554176001/8.0), REAL_CONST(6705.3936264264594/8.0), REAL_CONST(6717.461825005108/8.0), REAL_CONST(6729.535446275926/8.0), REAL_CONST(6741.6144853722335/8.0), REAL_CONST(6753.6989374382601/8.0), REAL_CONST(6765.7887976290967/8.0), REAL_CONST(6777.8840611106634/8.0), REAL_CONST(6789.9847230596661/8.0), REAL_CONST(6802.0907786635626/8.0), REAL_CONST(6814.2022231205201/8.0), REAL_CONST(6826.3190516393797/8.0), REAL_CONST(6838.4412594396181/8.0), REAL_CONST(6850.5688417513074/8.0), REAL_CONST(6862.701793815083/8.0), REAL_CONST(6874.840110882099/8.0), REAL_CONST(6886.9837882139991/8.0), REAL_CONST(6899.1328210828724/8.0), REAL_CONST(6911.2872047712199/8.0), REAL_CONST(6923.4469345719199/8.0), REAL_CONST(6935.6120057881863/8.0), REAL_CONST(6947.7824137335365/8.0), REAL_CONST(6959.9581537317536/8.0), REAL_CONST(6972.1392211168532/8.0), REAL_CONST(6984.3256112330409/8.0), REAL_CONST(6996.5173194346862/8.0), REAL_CONST(7008.7143410862773/8.0), REAL_CONST(7020.9166715623942/8.0), REAL_CONST(7033.1243062476678/8.0), REAL_CONST(7045.3372405367481/8.0), REAL_CONST(7057.5554698342685/8.0), REAL_CONST(7069.7789895548103/8.0), REAL_CONST(7082.0077951228714/8.0), REAL_CONST(7094.2418819728273/8.0), REAL_CONST(7106.4812455489018/8.0), REAL_CONST(7118.7258813051285/8.0), REAL_CONST(7130.9757847053224/8.0), REAL_CONST(7143.2309512230404/8.0), REAL_CONST(7155.4913763415516/8.0), REAL_CONST(7167.7570555538041/8.0), REAL_CONST(7180.0279843623894/8.0), REAL_CONST(7192.3041582795131/8.0), REAL_CONST(7204.5855728269571/8.0), REAL_CONST(7216.8722235360519/8.0), REAL_CONST(7229.1641059476406/8.0), REAL_CONST(7241.4612156120484/8.0), REAL_CONST(7253.7635480890503/8.0), REAL_CONST(7266.0710989478375/8.0), REAL_CONST(7278.3838637669869/8.0), REAL_CONST(7290.7018381344296/8.0), REAL_CONST(7303.0250176474174/8.0), REAL_CONST(7315.3533979124932/8.0), REAL_CONST(7327.6869745454596/8.0), REAL_CONST(7340.0257431713462/8.0), REAL_CONST(7352.3696994243801/8.0), REAL_CONST(7364.7188389479543/8.0), REAL_CONST(7377.0731573945968/8.0), REAL_CONST(7389.4326504259407/8.0), REAL_CONST(7401.7973137126937/8.0), REAL_CONST(7414.1671429346061/8.0), REAL_CONST(7426.5421337804428/8.0), REAL_CONST(7438.922281947951/8.0), REAL_CONST(7451.3075831438346/8.0), REAL_CONST(7463.6980330837177/8.0), REAL_CONST(7476.0936274921214/8.0), REAL_CONST(7488.4943621024304/8.0), REAL_CONST(7500.9002326568652/8.0), REAL_CONST(7513.3112349064522/8.0), REAL_CONST(7525.7273646109943/8.0), REAL_CONST(7538.1486175390446/8.0), REAL_CONST(7550.5749894678729/8.0), REAL_CONST(7563.0064761834419/8.0), REAL_CONST(7575.4430734803736/8.0), REAL_CONST(7587.8847771619248/8.0), REAL_CONST(7600.3315830399597/8.0), REAL_CONST(7612.7834869349153/8.0), REAL_CONST(7625.24048467578/8.0), REAL_CONST(7637.7025721000637/8.0), REAL_CONST(7650.1697450537677/8.0), REAL_CONST(7662.6419993913596/8.0), REAL_CONST(7675.1193309757446/8.0), REAL_CONST(7687.6017356782404/8.0), REAL_CONST(7700.0892093785433/8.0), REAL_CONST(7712.5817479647112/8.0), REAL_CONST(7725.079347333125/8.0), REAL_CONST(7737.5820033884729/8.0), REAL_CONST(7750.0897120437139/8.0), REAL_CONST(7762.6024692200581/8.0), REAL_CONST(7775.1202708469355/8.0), REAL_CONST(7787.6431128619733/8.0), REAL_CONST(7800.1709912109645/8.0), REAL_CONST(7812.7039018478481/8.0), REAL_CONST(7825.2418407346768/8.0), REAL_CONST(7837.7848038415968/8.0), REAL_CONST(7850.3327871468155/8.0), REAL_CONST(7862.8857866365806/8.0), REAL_CONST(7875.4437983051539/8.0), REAL_CONST(7888.006818154784/8.0), REAL_CONST(7900.5748421956796/8.0), REAL_CONST(7913.1478664459901/8.0), REAL_CONST(7925.725886931772/8.0), REAL_CONST(7938.3088996869719/8.0), REAL_CONST(7950.8969007533951/8.0), REAL_CONST(7963.4898861806851/8.0), REAL_CONST(7976.0878520262959/8.0), REAL_CONST(7988.6907943554688/8.0), REAL_CONST(8001.2987092412086/8.0), REAL_CONST(8013.911592764257/8.0), REAL_CONST(8026.5294410130691/8.0), REAL_CONST(8039.1522500837891/8.0), REAL_CONST(8051.7800160802271/8.0), REAL_CONST(8064.412735113835/8.0), REAL_CONST(8077.0504033036796/8.0), REAL_CONST(8089.6930167764222/8.0), REAL_CONST(8102.3405716662946/8.0), REAL_CONST(8114.9930641150731/8.0), REAL_CONST(8127.6504902720571/8.0), REAL_CONST(8140.3128462940449/8.0), REAL_CONST(8152.9801283453098/8.0), REAL_CONST(8165.6523325975786/8.0), REAL_CONST(8178.3294552300049/8.0), REAL_CONST(8191.0114924291529/8.0), REAL_CONST(8203.6984403889655/8.0), REAL_CONST(8216.3902953107463/8.0), REAL_CONST(8229.0870534031419/8.0), REAL_CONST(8241.7887108821069/8.0), REAL_CONST(8254.4952639708936/8.0), REAL_CONST(8267.2067089000211/8.0), REAL_CONST(8279.9230419072574/8.0), REAL_CONST(8292.6442592375952/8.0), REAL_CONST(8305.3703571432306/8.0), REAL_CONST(8318.101331883543/8.0), REAL_CONST(8330.8371797250657/8.0), REAL_CONST(8343.577896941475/8.0), REAL_CONST(8356.3234798135582/8.0), REAL_CONST(8369.0739246291978/8.0), REAL_CONST(8381.8292276833508/8.0), REAL_CONST(8394.5893852780209/8.0), REAL_CONST(8407.3543937222421/8.0), REAL_CONST(8420.1242493320569/8.0), REAL_CONST(8432.8989484304948/8.0), REAL_CONST(8445.6784873475499/8.0), REAL_CONST(8458.4628624201578/8.0), REAL_CONST(8471.2520699921806/8.0), REAL_CONST(8484.0461064143838/8.0), REAL_CONST(8496.8449680444082/8.0), REAL_CONST(8509.6486512467636/8.0), REAL_CONST(8522.4571523927953/8.0), REAL_CONST(8535.270467860666/8.0), REAL_CONST(8548.0885940353437/8.0), REAL_CONST(8560.9115273085663/8.0), REAL_CONST(8573.7392640788403/8.0), REAL_CONST(8586.5718007514006/8.0), REAL_CONST(8599.4091337382069/8.0), REAL_CONST(8612.2512594579148/8.0), REAL_CONST(8625.0981743358552/8.0), REAL_CONST(8637.9498748040205/8.0), REAL_CONST(8650.8063573010386/8.0), REAL_CONST(8663.6676182721567/8.0), REAL_CONST(8676.533654169225/8.0), REAL_CONST(8689.4044614506638/8.0), REAL_CONST(8702.2800365814601/8.0), REAL_CONST(8715.1603760331418/8.0), REAL_CONST(8728.0454762837508/8.0), REAL_CONST(8740.9353338178389/8.0), REAL_CONST(8753.8299451264356/8.0), REAL_CONST(8766.7293067070332/8.0), REAL_CONST(8779.6334150635721/8.0), REAL_CONST(8792.5422667064158/8.0), REAL_CONST(8805.4558581523324/8.0), REAL_CONST(8818.3741859244819/8.0), REAL_CONST(8831.2972465523908/8.0), REAL_CONST(8844.2250365719356/8.0), REAL_CONST(8857.1575525253265/8.0), REAL_CONST(8870.0947909610859/8.0), REAL_CONST(8883.0367484340295/8.0), REAL_CONST(8895.9834215052524/8.0), REAL_CONST(8908.934806742107/8.0), REAL_CONST(8921.8909007181846/8.0), REAL_CONST(8934.8517000132997/8.0), REAL_CONST(8947.817201213471/8.0), REAL_CONST(8960.7874009109/8.0), REAL_CONST(8973.7622957039603/8.0), REAL_CONST(8986.7418821971733/8.0), REAL_CONST(8999.7261570011924/8.0), REAL_CONST(9012.7151167327884/8.0), REAL_CONST(9025.7087580148236/8.0), REAL_CONST(9038.7070774762469/8.0), REAL_CONST(9051.7100717520643/8.0), REAL_CONST(9064.7177374833282/8.0), REAL_CONST(9077.7300713171153/8.0), REAL_CONST(9090.7470699065179/8.0), REAL_CONST(9103.7687299106146/8.0), REAL_CONST(9116.7950479944648/8.0), REAL_CONST(9129.8260208290812/8.0), REAL_CONST(9142.8616450914233/8.0), REAL_CONST(9155.9019174643727/8.0), REAL_CONST(9168.9468346367157/8.0), REAL_CONST(9181.9963933031358/8.0), REAL_CONST(9195.0505901641845/8.0), REAL_CONST(9208.1094219262741/8.0), REAL_CONST(9221.1728853016557/8.0), REAL_CONST(9234.240977008405/8.0), REAL_CONST(9247.3136937704076/8.0), REAL_CONST(9260.3910323173386/8.0), REAL_CONST(9273.472989384647/8.0), REAL_CONST(9286.5595617135423/8.0), REAL_CONST(9299.6507460509747/8.0), REAL_CONST(9312.7465391496207/8.0), REAL_CONST(9325.8469377678684/8.0), REAL_CONST(9338.9519386698012/8.0), REAL_CONST(9352.0615386251757/8.0), REAL_CONST(9365.1757344094131/8.0), REAL_CONST(9378.2945228035842/8.0), REAL_CONST(9391.4179005943843/8.0), REAL_CONST(9404.5458645741273/8.0), REAL_CONST(9417.6784115407263/8.0), REAL_CONST(9430.8155382976747/8.0), REAL_CONST(9443.9572416540359/8.0), REAL_CONST(9457.1035184244265/8.0), REAL_CONST(9470.2543654290002/8.0), REAL_CONST(9483.4097794934296/8.0), REAL_CONST(9496.5697574488931/8.0), REAL_CONST(9509.7342961320664/8.0), REAL_CONST(9522.9033923850911/8.0), REAL_CONST(9536.0770430555804/8.0), REAL_CONST(9549.2552449965824/8.0), REAL_CONST(9562.4379950665825/8.0), REAL_CONST(9575.6252901294793/8.0), REAL_CONST(9588.8171270545736/8.0), REAL_CONST(9602.0135027165488/8.0), REAL_CONST(9615.2144139954635/8.0), REAL_CONST(9628.4198577767274/8.0), REAL_CONST(9641.629830951093/8.0), REAL_CONST(9654.844330414644/8.0), REAL_CONST(9668.0633530687719/8.0), REAL_CONST(9681.286895820167/8.0), REAL_CONST(9694.5149555808002/8.0), REAL_CONST(9707.7475292679192/8.0), REAL_CONST(9720.9846138040157/8.0), REAL_CONST(9734.2262061168276/8.0), REAL_CONST(9747.4723031393187/8.0), REAL_CONST(9760.7229018096641/8.0), REAL_CONST(9773.9779990712323/8.0), REAL_CONST(9787.2375918725811/8.0), REAL_CONST(9800.5016771674327/8.0), REAL_CONST(9813.7702519146696/8.0), REAL_CONST(9827.0433130783094/8.0), REAL_CONST(9840.3208576275028/8.0), REAL_CONST(9853.602882536512/8.0), REAL_CONST(9866.8893847846994/8.0), REAL_CONST(9880.1803613565116/8.0), REAL_CONST(9893.4758092414686/8.0), REAL_CONST(9906.7757254341523/8.0), REAL_CONST(9920.0801069341851/8.0), REAL_CONST(9933.3889507462245/8.0), REAL_CONST(9946.7022538799429/8.0), REAL_CONST(9960.0200133500221/8.0), REAL_CONST(9973.3422261761298/8.0), REAL_CONST(9986.6688893829159/8.0), REAL_CONST(9999.9999999999945/8.0), REAL_CONST(10013.335555061929/8.0), REAL_CONST(10026.675551608221/8.0), REAL_CONST(10040.019986683301/8.0), REAL_CONST(10053.368857336509/8.0), REAL_CONST(10066.722160622081/8.0), REAL_CONST(10080.079893599144/8.0), REAL_CONST(10093.442053331697/8.0), REAL_CONST(10106.808636888598/8.0), REAL_CONST(10120.179641343551/8.0), REAL_CONST(10133.555063775095/8.0), REAL_CONST(10146.934901266595/8.0), REAL_CONST(10160.31915090622/8.0), REAL_CONST(10173.707809786936/8.0), REAL_CONST(10187.100875006496/8.0), REAL_CONST(10200.498343667417/8.0), REAL_CONST(10213.900212876984/8.0), REAL_CONST(10227.306479747222/8.0), REAL_CONST(10240.717141394889/8.0), REAL_CONST(10254.132194941467/8.0), REAL_CONST(10267.551637513146/8.0), REAL_CONST(10280.975466240814/8.0), REAL_CONST(10294.40367826004/8.0), REAL_CONST(10307.836270711066/8.0), REAL_CONST(10321.273240738796/8.0), REAL_CONST(10334.71458549278/8.0) #ifdef BIG_IQ_TABLE ,REAL_CONST(10348.160302127204/8.0), REAL_CONST(10361.610387800878/8.0), REAL_CONST(10375.064839677221/8.0), REAL_CONST(10388.523654924258/8.0), REAL_CONST(10401.986830714593/8.0), REAL_CONST(10415.454364225412/8.0), REAL_CONST(10428.926252638465/8.0), REAL_CONST(10442.402493140049/8.0), REAL_CONST(10455.883082921007/8.0), REAL_CONST(10469.368019176709/8.0), REAL_CONST(10482.85729910704/8.0), REAL_CONST(10496.350919916393/8.0), REAL_CONST(10509.848878813653/8.0), REAL_CONST(10523.351173012188/8.0), REAL_CONST(10536.857799729838/8.0), REAL_CONST(10550.3687561889/8.0), REAL_CONST(10563.884039616123/8.0), REAL_CONST(10577.403647242685/8.0), REAL_CONST(10590.927576304197/8.0), REAL_CONST(10604.455824040679/8.0), REAL_CONST(10617.988387696556/8.0), REAL_CONST(10631.525264520642/8.0), REAL_CONST(10645.066451766135/8.0), REAL_CONST(10658.611946690598/8.0), REAL_CONST(10672.161746555956/8.0), REAL_CONST(10685.715848628475/8.0), REAL_CONST(10699.274250178762/8.0), REAL_CONST(10712.836948481747/8.0), REAL_CONST(10726.403940816675/8.0), REAL_CONST(10739.975224467091/8.0), REAL_CONST(10753.550796720834/8.0), REAL_CONST(10767.130654870027/8.0), REAL_CONST(10780.714796211059/8.0), REAL_CONST(10794.303218044579/8.0), REAL_CONST(10807.895917675487/8.0), REAL_CONST(10821.492892412922/8.0), REAL_CONST(10835.094139570248/8.0), REAL_CONST(10848.699656465047/8.0), REAL_CONST(10862.309440419107/8.0), REAL_CONST(10875.923488758415/8.0), REAL_CONST(10889.541798813138/8.0), REAL_CONST(10903.16436791762/8.0), REAL_CONST(10916.791193410372/8.0), REAL_CONST(10930.422272634056/8.0), REAL_CONST(10944.05760293548/8.0), REAL_CONST(10957.697181665582/8.0), REAL_CONST(10971.341006179427/8.0), REAL_CONST(10984.98907383619/8.0), REAL_CONST(10998.641381999149/8.0), REAL_CONST(11012.297928035676/8.0), REAL_CONST(11025.958709317223/8.0), REAL_CONST(11039.623723219316/8.0), REAL_CONST(11053.292967121541/8.0), REAL_CONST(11066.966438407539/8.0), REAL_CONST(11080.64413446499/8.0), REAL_CONST(11094.326052685608/8.0), REAL_CONST(11108.012190465128/8.0), REAL_CONST(11121.702545203296/8.0), REAL_CONST(11135.397114303863/8.0), REAL_CONST(11149.095895174571/8.0), REAL_CONST(11162.798885227143/8.0), REAL_CONST(11176.506081877278/8.0), REAL_CONST(11190.217482544635/8.0), REAL_CONST(11203.933084652828/8.0), REAL_CONST(11217.652885629415/8.0), REAL_CONST(11231.376882905886/8.0), REAL_CONST(11245.105073917659/8.0), REAL_CONST(11258.837456104062/8.0), REAL_CONST(11272.574026908333/8.0), REAL_CONST(11286.314783777601/8.0), REAL_CONST(11300.059724162888/8.0), REAL_CONST(11313.808845519083/8.0), REAL_CONST(11327.562145304952/8.0), REAL_CONST(11341.319620983111/8.0), REAL_CONST(11355.081270020033/8.0), REAL_CONST(11368.847089886023/8.0), REAL_CONST(11382.617078055218/8.0), REAL_CONST(11396.391232005579/8.0), REAL_CONST(11410.169549218874/8.0), REAL_CONST(11423.952027180676/8.0), REAL_CONST(11437.738663380349/8.0), REAL_CONST(11451.529455311042/8.0), REAL_CONST(11465.324400469679/8.0), REAL_CONST(11479.123496356951/8.0), REAL_CONST(11492.926740477304/8.0), REAL_CONST(11506.734130338931/8.0), REAL_CONST(11520.545663453764/8.0), REAL_CONST(11534.361337337466/8.0), REAL_CONST(11548.181149509423/8.0), REAL_CONST(11562.005097492724/8.0), REAL_CONST(11575.83317881417/8.0), REAL_CONST(11589.665391004253/8.0), REAL_CONST(11603.501731597149/8.0), REAL_CONST(11617.342198130715/8.0), REAL_CONST(11631.186788146468/8.0), REAL_CONST(11645.035499189589/8.0), REAL_CONST(11658.888328808911/8.0), REAL_CONST(11672.745274556904/8.0), REAL_CONST(11686.606333989675/8.0), REAL_CONST(11700.471504666955/8.0), REAL_CONST(11714.340784152086/8.0), REAL_CONST(11728.214170012021/8.0), REAL_CONST(11742.091659817312/8.0), REAL_CONST(11755.973251142101/8.0), REAL_CONST(11769.858941564111/8.0), REAL_CONST(11783.748728664636/8.0), REAL_CONST(11797.642610028539/8.0), REAL_CONST(11811.540583244237/8.0), REAL_CONST(11825.442645903697/8.0), REAL_CONST(11839.34879560242/8.0), REAL_CONST(11853.259029939445/8.0), REAL_CONST(11867.173346517333/8.0), REAL_CONST(11881.091742942155/8.0), REAL_CONST(11895.014216823492/8.0), REAL_CONST(11908.940765774427/8.0), REAL_CONST(11922.871387411526/8.0), REAL_CONST(11936.806079354839/8.0), REAL_CONST(11950.744839227897/8.0), REAL_CONST(11964.687664657684/8.0), REAL_CONST(11978.634553274653/8.0), REAL_CONST(11992.585502712702/8.0), REAL_CONST(12006.540510609168/8.0), REAL_CONST(12020.499574604828/8.0), REAL_CONST(12034.462692343877/8.0), REAL_CONST(12048.429861473938/8.0), REAL_CONST(12062.401079646032/8.0), REAL_CONST(12076.376344514589/8.0), REAL_CONST(12090.355653737433/8.0), REAL_CONST(12104.339004975769/8.0), REAL_CONST(12118.326395894188/8.0), REAL_CONST(12132.317824160644/8.0), REAL_CONST(12146.313287446457/8.0), REAL_CONST(12160.312783426305/8.0), REAL_CONST(12174.316309778205/8.0), REAL_CONST(12188.323864183525/8.0), REAL_CONST(12202.335444326955/8.0), REAL_CONST(12216.351047896511/8.0), REAL_CONST(12230.370672583531/8.0), REAL_CONST(12244.394316082657/8.0), REAL_CONST(12258.421976091831/8.0), REAL_CONST(12272.453650312296/8.0), REAL_CONST(12286.489336448574/8.0), REAL_CONST(12300.529032208471/8.0), REAL_CONST(12314.572735303058/8.0), REAL_CONST(12328.620443446678/8.0), REAL_CONST(12342.672154356922/8.0), REAL_CONST(12356.727865754638/8.0), REAL_CONST(12370.787575363909/8.0), REAL_CONST(12384.851280912055/8.0), REAL_CONST(12398.918980129623/8.0), REAL_CONST(12412.990670750381/8.0), REAL_CONST(12427.066350511306/8.0), REAL_CONST(12441.146017152583/8.0), REAL_CONST(12455.229668417589/8.0), REAL_CONST(12469.317302052901/8.0), REAL_CONST(12483.40891580827/8.0), REAL_CONST(12497.50450743663/8.0), REAL_CONST(12511.604074694078/8.0), REAL_CONST(12525.707615339878/8.0), REAL_CONST(12539.815127136444/8.0), REAL_CONST(12553.926607849342/8.0), REAL_CONST(12568.042055247275/8.0), REAL_CONST(12582.161467102082/8.0), REAL_CONST(12596.284841188726/8.0), REAL_CONST(12610.41217528529/8.0), REAL_CONST(12624.543467172971/8.0), REAL_CONST(12638.678714636069/8.0), REAL_CONST(12652.817915461985/8.0), REAL_CONST(12666.961067441209/8.0), REAL_CONST(12681.108168367316/8.0), REAL_CONST(12695.259216036962/8.0), REAL_CONST(12709.414208249869/8.0), REAL_CONST(12723.573142808827/8.0), REAL_CONST(12737.736017519681/8.0), REAL_CONST(12751.902830191326/8.0), REAL_CONST(12766.073578635704/8.0), REAL_CONST(12780.248260667788/8.0), REAL_CONST(12794.426874105588/8.0), REAL_CONST(12808.609416770132/8.0), REAL_CONST(12822.795886485468/8.0), REAL_CONST(12836.986281078653/8.0), REAL_CONST(12851.180598379744/8.0), REAL_CONST(12865.378836221802/8.0), REAL_CONST(12879.580992440871/8.0), REAL_CONST(12893.787064875984/8.0), REAL_CONST(12907.997051369144/8.0), REAL_CONST(12922.210949765335/8.0), REAL_CONST(12936.428757912496/8.0), REAL_CONST(12950.650473661524/8.0), REAL_CONST(12964.876094866273/8.0), REAL_CONST(12979.105619383534/8.0), REAL_CONST(12993.339045073039/8.0), REAL_CONST(13007.576369797454/8.0), REAL_CONST(13021.817591422368/8.0), REAL_CONST(13036.062707816285/8.0), REAL_CONST(13050.311716850629/8.0), REAL_CONST(13064.564616399723/8.0), REAL_CONST(13078.821404340792/8.0), REAL_CONST(13093.082078553954/8.0), REAL_CONST(13107.346636922217/8.0), REAL_CONST(13121.615077331464/8.0), REAL_CONST(13135.887397670458/8.0), REAL_CONST(13150.163595830827/8.0), REAL_CONST(13164.44366970706/8.0), REAL_CONST(13178.727617196502/8.0), REAL_CONST(13193.015436199352/8.0), REAL_CONST(13207.307124618648/8.0), REAL_CONST(13221.602680360265/8.0), REAL_CONST(13235.902101332911/8.0), REAL_CONST(13250.205385448118/8.0), REAL_CONST(13264.512530620239/8.0), REAL_CONST(13278.823534766434/8.0), REAL_CONST(13293.138395806676/8.0), REAL_CONST(13307.457111663734/8.0), REAL_CONST(13321.779680263176/8.0), REAL_CONST(13336.106099533356/8.0), REAL_CONST(13350.436367405409/8.0), REAL_CONST(13364.77048181325/8.0), REAL_CONST(13379.108440693562/8.0), REAL_CONST(13393.450241985796/8.0), REAL_CONST(13407.795883632158/8.0), REAL_CONST(13422.145363577607/8.0), REAL_CONST(13436.498679769853/8.0), REAL_CONST(13450.855830159346/8.0), REAL_CONST(13465.216812699266/8.0), REAL_CONST(13479.581625345529/8.0), REAL_CONST(13493.950266056772/8.0), REAL_CONST(13508.32273279435/8.0), REAL_CONST(13522.699023522329/8.0), REAL_CONST(13537.079136207483/8.0), REAL_CONST(13551.463068819286/8.0), REAL_CONST(13565.850819329906/8.0), REAL_CONST(13580.2423857142/8.0), REAL_CONST(13594.63776594971/8.0), REAL_CONST(13609.036958016657/8.0), REAL_CONST(13623.439959897927/8.0), REAL_CONST(13637.846769579081/8.0), REAL_CONST(13652.257385048335/8.0), REAL_CONST(13666.67180429656/8.0), REAL_CONST(13681.090025317284/8.0), REAL_CONST(13695.512046106669/8.0), REAL_CONST(13709.937864663521/8.0), REAL_CONST(13724.367478989278/8.0), REAL_CONST(13738.800887088004/8.0), REAL_CONST(13753.238086966385/8.0), REAL_CONST(13767.679076633727/8.0), REAL_CONST(13782.123854101939/8.0), REAL_CONST(13796.572417385545/8.0), REAL_CONST(13811.024764501659/8.0), REAL_CONST(13825.480893469998/8.0), REAL_CONST(13839.94080231286/8.0), REAL_CONST(13854.404489055134/8.0), REAL_CONST(13868.871951724283/8.0), REAL_CONST(13883.34318835034/8.0), REAL_CONST(13897.818196965914/8.0), REAL_CONST(13912.296975606168/8.0), REAL_CONST(13926.779522308825/8.0), REAL_CONST(13941.26583511416/8.0), REAL_CONST(13955.755912064991/8.0), REAL_CONST(13970.249751206682/8.0), REAL_CONST(13984.747350587126/8.0), REAL_CONST(13999.248708256751/8.0), REAL_CONST(14013.753822268511/8.0), REAL_CONST(14028.262690677873/8.0), REAL_CONST(14042.775311542828/8.0), REAL_CONST(14057.291682923867/8.0), REAL_CONST(14071.811802883994/8.0), REAL_CONST(14086.335669488704/8.0), REAL_CONST(14100.863280805994/8.0), REAL_CONST(14115.394634906341/8.0), REAL_CONST(14129.92972986271/8.0), REAL_CONST(14144.468563750548/8.0), REAL_CONST(14159.01113464777/8.0), REAL_CONST(14173.55744063476/8.0), REAL_CONST(14188.107479794369/8.0), REAL_CONST(14202.661250211901/8.0), REAL_CONST(14217.218749975118/8.0), REAL_CONST(14231.779977174227/8.0), REAL_CONST(14246.344929901879/8.0), REAL_CONST(14260.913606253163/8.0), REAL_CONST(14275.486004325601/8.0), REAL_CONST(14290.062122219146/8.0), REAL_CONST(14304.641958036171/8.0), REAL_CONST(14319.225509881464/8.0), REAL_CONST(14333.812775862236/8.0), REAL_CONST(14348.403754088098/8.0), REAL_CONST(14362.998442671067/8.0), REAL_CONST(14377.59683972556/8.0), REAL_CONST(14392.198943368388/8.0), REAL_CONST(14406.804751718748/8.0), REAL_CONST(14421.414262898223/8.0), REAL_CONST(14436.027475030774/8.0), REAL_CONST(14450.64438624274/8.0), REAL_CONST(14465.264994662828/8.0), REAL_CONST(14479.889298422106/8.0), REAL_CONST(14494.517295654005/8.0), REAL_CONST(14509.148984494313/8.0), REAL_CONST(14523.784363081166/8.0), REAL_CONST(14538.423429555049/8.0), REAL_CONST(14553.066182058781/8.0), REAL_CONST(14567.712618737527/8.0), REAL_CONST(14582.362737738777/8.0), REAL_CONST(14597.016537212348/8.0), REAL_CONST(14611.674015310382/8.0), REAL_CONST(14626.33517018734/8.0), REAL_CONST(14640.999999999993/8.0), REAL_CONST(14655.668502907418/8.0), REAL_CONST(14670.340677071003/8.0), REAL_CONST(14685.016520654426/8.0), REAL_CONST(14699.696031823671/8.0), REAL_CONST(14714.379208746999/8.0), REAL_CONST(14729.066049594967/8.0), REAL_CONST(14743.756552540408/8.0), REAL_CONST(14758.45071575843/8.0), REAL_CONST(14773.148537426418/8.0), REAL_CONST(14787.850015724018/8.0), REAL_CONST(14802.555148833142/8.0), REAL_CONST(14817.263934937961/8.0), REAL_CONST(14831.976372224897/8.0), REAL_CONST(14846.692458882624/8.0), REAL_CONST(14861.41219310206/8.0), REAL_CONST(14876.135573076363/8.0), REAL_CONST(14890.862597000923/8.0), REAL_CONST(14905.593263073371/8.0), REAL_CONST(14920.327569493558/8.0), REAL_CONST(14935.065514463557/8.0), REAL_CONST(14949.807096187662/8.0), REAL_CONST(14964.552312872382/8.0), REAL_CONST(14979.301162726431/8.0), REAL_CONST(14994.053643960735/8.0), REAL_CONST(15008.809754788414/8.0), REAL_CONST(15023.569493424788/8.0), REAL_CONST(15038.332858087369/8.0), REAL_CONST(15053.099846995858/8.0), REAL_CONST(15067.870458372134/8.0), REAL_CONST(15082.644690440264/8.0), REAL_CONST(15097.422541426484/8.0), REAL_CONST(15112.204009559202/8.0), REAL_CONST(15126.989093068994/8.0), REAL_CONST(15141.777790188597/8.0), REAL_CONST(15156.570099152905/8.0), REAL_CONST(15171.366018198967/8.0), REAL_CONST(15186.165545565986/8.0), REAL_CONST(15200.968679495301/8.0), REAL_CONST(15215.775418230402/8.0), REAL_CONST(15230.585760016909/8.0), REAL_CONST(15245.399703102579/8.0), REAL_CONST(15260.217245737298/8.0), REAL_CONST(15275.038386173073/8.0), REAL_CONST(15289.863122664035/8.0), REAL_CONST(15304.691453466432/8.0), REAL_CONST(15319.523376838621/8.0), REAL_CONST(15334.358891041069/8.0), REAL_CONST(15349.197994336346/8.0), REAL_CONST(15364.040684989128/8.0), REAL_CONST(15378.886961266177/8.0), REAL_CONST(15393.736821436356/8.0), REAL_CONST(15408.590263770609/8.0), REAL_CONST(15423.447286541972/8.0), REAL_CONST(15438.307888025554/8.0), REAL_CONST(15453.172066498542/8.0), REAL_CONST(15468.039820240196/8.0), REAL_CONST(15482.91114753184/8.0), REAL_CONST(15497.786046656869/8.0), REAL_CONST(15512.664515900733/8.0), REAL_CONST(15527.546553550939/8.0), REAL_CONST(15542.432157897045/8.0), REAL_CONST(15557.32132723066/8.0), REAL_CONST(15572.214059845435/8.0), REAL_CONST(15587.110354037064/8.0), REAL_CONST(15602.010208103273/8.0), REAL_CONST(15616.913620343823/8.0), REAL_CONST(15631.820589060506/8.0), REAL_CONST(15646.731112557136/8.0), REAL_CONST(15661.645189139546/8.0), REAL_CONST(15676.562817115593/8.0), REAL_CONST(15691.483994795139/8.0), REAL_CONST(15706.408720490062/8.0), REAL_CONST(15721.336992514242/8.0), REAL_CONST(15736.268809183561/8.0), REAL_CONST(15751.204168815901/8.0), REAL_CONST(15766.143069731135/8.0), REAL_CONST(15781.085510251132/8.0), REAL_CONST(15796.03148869974/8.0), REAL_CONST(15810.981003402798/8.0), REAL_CONST(15825.934052688119/8.0), REAL_CONST(15840.890634885489/8.0), REAL_CONST(15855.850748326673/8.0), REAL_CONST(15870.814391345401/8.0), REAL_CONST(15885.781562277361/8.0), REAL_CONST(15900.752259460214/8.0), REAL_CONST(15915.726481233565/8.0), REAL_CONST(15930.704225938984/8.0), REAL_CONST(15945.685491919978/8.0), REAL_CONST(15960.670277522009/8.0), REAL_CONST(15975.658581092481/8.0), REAL_CONST(15990.65040098073/8.0), REAL_CONST(16005.645735538035/8.0), REAL_CONST(16020.644583117599/8.0), REAL_CONST(16035.646942074556/8.0), REAL_CONST(16050.652810765967/8.0), REAL_CONST(16065.662187550806/8.0), REAL_CONST(16080.675070789974/8.0), REAL_CONST(16095.691458846273/8.0), REAL_CONST(16110.711350084424/8.0), REAL_CONST(16125.734742871053/8.0), REAL_CONST(16140.761635574685/8.0), REAL_CONST(16155.792026565747/8.0), REAL_CONST(16170.825914216561/8.0), REAL_CONST(16185.863296901338/8.0), REAL_CONST(16200.904172996183/8.0), REAL_CONST(16215.948540879079/8.0), REAL_CONST(16230.996398929899/8.0), REAL_CONST(16246.047745530386/8.0), REAL_CONST(16261.102579064163/8.0), REAL_CONST(16276.160897916721/8.0), REAL_CONST(16291.22270047542/8.0), REAL_CONST(16306.287985129484/8.0), REAL_CONST(16321.356750269995/8.0), REAL_CONST(16336.428994289896/8.0), REAL_CONST(16351.504715583982/8.0), REAL_CONST(16366.5839125489/8.0), REAL_CONST(16381.666583583141/8.0), REAL_CONST(16396.752727087041/8.0), REAL_CONST(16411.842341462776/8.0), REAL_CONST(16426.935425114363/8.0), REAL_CONST(16442.031976447644/8.0), REAL_CONST(16457.131993870298/8.0), REAL_CONST(16472.235475791829/8.0), REAL_CONST(16487.342420623561/8.0), REAL_CONST(16502.452826778641/8.0), REAL_CONST(16517.566692672033/8.0), REAL_CONST(16532.684016720516/8.0), REAL_CONST(16547.804797342676/8.0), REAL_CONST(16562.929032958902/8.0), REAL_CONST(16578.056721991394/8.0), REAL_CONST(16593.18786286415/8.0), REAL_CONST(16608.322454002962/8.0), REAL_CONST(16623.460493835417/8.0), REAL_CONST(16638.601980790896/8.0), REAL_CONST(16653.746913300558/8.0), REAL_CONST(16668.895289797354/8.0), REAL_CONST(16684.047108716015/8.0), REAL_CONST(16699.202368493046/8.0), REAL_CONST(16714.361067566726/8.0), REAL_CONST(16729.523204377107/8.0), REAL_CONST(16744.688777366009/8.0), REAL_CONST(16759.857784977012/8.0), REAL_CONST(16775.030225655464/8.0), REAL_CONST(16790.206097848466/8.0), REAL_CONST(16805.385400004874/8.0), REAL_CONST(16820.568130575302/8.0), REAL_CONST(16835.754288012104/8.0), REAL_CONST(16850.943870769381/8.0), REAL_CONST(16866.136877302983/8.0), REAL_CONST(16881.333306070494/8.0), REAL_CONST(16896.53315553123/8.0), REAL_CONST(16911.736424146249/8.0), REAL_CONST(16926.943110378332/8.0), REAL_CONST(16942.153212691992/8.0), REAL_CONST(16957.366729553454/8.0), REAL_CONST(16972.583659430682/8.0), REAL_CONST(16987.804000793338/8.0), REAL_CONST(17003.027752112816/8.0), REAL_CONST(17018.254911862205/8.0), REAL_CONST(17033.485478516312/8.0), REAL_CONST(17048.719450551645/8.0), REAL_CONST(17063.956826446421/8.0), REAL_CONST(17079.197604680547/8.0), REAL_CONST(17094.44178373563/8.0), REAL_CONST(17109.689362094967/8.0), REAL_CONST(17124.940338243552/8.0), REAL_CONST(17140.194710668064/8.0), REAL_CONST(17155.452477856852/8.0), REAL_CONST(17170.713638299967/8.0), REAL_CONST(17185.978190489128/8.0), REAL_CONST(17201.246132917724/8.0), REAL_CONST(17216.517464080825/8.0), REAL_CONST(17231.792182475165/8.0), REAL_CONST(17247.070286599141/8.0), REAL_CONST(17262.351774952826/8.0), REAL_CONST(17277.636646037936/8.0), REAL_CONST(17292.924898357855/8.0), REAL_CONST(17308.216530417623/8.0), REAL_CONST(17323.511540723921/8.0), REAL_CONST(17338.809927785089/8.0), REAL_CONST(17354.111690111105/8.0), REAL_CONST(17369.416826213594/8.0), REAL_CONST(17384.725334605821/8.0), REAL_CONST(17400.037213802683/8.0), REAL_CONST(17415.352462320716/8.0), REAL_CONST(17430.67107867809/8.0), REAL_CONST(17445.993061394587/8.0), REAL_CONST(17461.318408991636/8.0), REAL_CONST(17476.647119992274/8.0), REAL_CONST(17491.979192921168/8.0), REAL_CONST(17507.314626304586/8.0), REAL_CONST(17522.653418670423/8.0), REAL_CONST(17537.995568548187/8.0), REAL_CONST(17553.341074468986/8.0), REAL_CONST(17568.689934965536/8.0), REAL_CONST(17584.042148572156/8.0), REAL_CONST(17599.397713824768/8.0), REAL_CONST(17614.75662926089/8.0), REAL_CONST(17630.118893419625/8.0), REAL_CONST(17645.484504841683/8.0), REAL_CONST(17660.853462069354/8.0), REAL_CONST(17676.225763646511/8.0), REAL_CONST(17691.601408118619/8.0), REAL_CONST(17706.980394032718/8.0), REAL_CONST(17722.362719937424/8.0), REAL_CONST(17737.748384382936/8.0), REAL_CONST(17753.137385921014/8.0), REAL_CONST(17768.529723104999/8.0), REAL_CONST(17783.92539448979/8.0), REAL_CONST(17799.324398631856/8.0), REAL_CONST(17814.726734089225/8.0), REAL_CONST(17830.13239942148/8.0), REAL_CONST(17845.541393189767/8.0), REAL_CONST(17860.95371395678/8.0), REAL_CONST(17876.369360286772/8.0), REAL_CONST(17891.788330745527/8.0), REAL_CONST(17907.210623900395/8.0), REAL_CONST(17922.636238320254/8.0), REAL_CONST(17938.065172575527/8.0), REAL_CONST(17953.497425238176/8.0), REAL_CONST(17968.932994881692/8.0), REAL_CONST(17984.371880081104/8.0), REAL_CONST(17999.814079412972/8.0), REAL_CONST(18015.259591455371/8.0), REAL_CONST(18030.708414787914/8.0), REAL_CONST(18046.160547991731/8.0), REAL_CONST(18061.615989649465/8.0), REAL_CONST(18077.074738345284/8.0), REAL_CONST(18092.536792664861/8.0), REAL_CONST(18108.002151195393/8.0), REAL_CONST(18123.470812525571/8.0), REAL_CONST(18138.942775245599/8.0), REAL_CONST(18154.418037947191/8.0), REAL_CONST(18169.896599223546/8.0), REAL_CONST(18185.37845766938/8.0), REAL_CONST(18200.863611880886/8.0), REAL_CONST(18216.352060455767/8.0), REAL_CONST(18231.843801993204/8.0), REAL_CONST(18247.338835093873/8.0), REAL_CONST(18262.837158359936/8.0), REAL_CONST(18278.338770395032/8.0), REAL_CONST(18293.84366980429/8.0), REAL_CONST(18309.351855194309/8.0), REAL_CONST(18324.863325173166/8.0), REAL_CONST(18340.378078350412/8.0), REAL_CONST(18355.896113337069/8.0), REAL_CONST(18371.417428745623/8.0), REAL_CONST(18386.942023190033/8.0), REAL_CONST(18402.469895285718/8.0), REAL_CONST(18418.00104364955/8.0), REAL_CONST(18433.53546689987/8.0), REAL_CONST(18449.073163656474/8.0), REAL_CONST(18464.614132540602/8.0), REAL_CONST(18480.158372174956/8.0), REAL_CONST(18495.705881183676/8.0), REAL_CONST(18511.256658192357/8.0), REAL_CONST(18526.810701828035/8.0), REAL_CONST(18542.368010719183/8.0), REAL_CONST(18557.928583495715/8.0), REAL_CONST(18573.492418788985/8.0), REAL_CONST(18589.059515231773/8.0), REAL_CONST(18604.629871458303/8.0), REAL_CONST(18620.203486104212/8.0), REAL_CONST(18635.78035780658/8.0), REAL_CONST(18651.360485203899/8.0), REAL_CONST(18666.943866936086/8.0), REAL_CONST(18682.53050164448/8.0), REAL_CONST(18698.120387971841/8.0), REAL_CONST(18713.713524562332/8.0), REAL_CONST(18729.30991006154/8.0), REAL_CONST(18744.909543116457/8.0), REAL_CONST(18760.512422375479/8.0), REAL_CONST(18776.118546488418/8.0), REAL_CONST(18791.727914106479/8.0), REAL_CONST(18807.340523882274/8.0), REAL_CONST(18822.95637446981/8.0), REAL_CONST(18838.575464524489/8.0), REAL_CONST(18854.197792703111/8.0), REAL_CONST(18869.823357663863/8.0), REAL_CONST(18885.452158066328/8.0), REAL_CONST(18901.08419257147/8.0), REAL_CONST(18916.719459841639/8.0), REAL_CONST(18932.357958540564/8.0), REAL_CONST(18947.999687333362/8.0), REAL_CONST(18963.644644886521/8.0), REAL_CONST(18979.292829867907/8.0), REAL_CONST(18994.944240946759/8.0), REAL_CONST(19010.598876793687/8.0), REAL_CONST(19026.256736080668/8.0), REAL_CONST(19041.917817481048/8.0), REAL_CONST(19057.582119669532/8.0), REAL_CONST(19073.2496413222/8.0), REAL_CONST(19088.920381116473/8.0), REAL_CONST(19104.594337731145/8.0), REAL_CONST(19120.271509846356/8.0), REAL_CONST(19135.951896143604/8.0), REAL_CONST(19151.635495305738/8.0), REAL_CONST(19167.322306016948/8.0), REAL_CONST(19183.012326962784/8.0), REAL_CONST(19198.705556830122/8.0), REAL_CONST(19214.401994307198/8.0), REAL_CONST(19230.101638083579/8.0), REAL_CONST(19245.804486850167/8.0), REAL_CONST(19261.510539299208/8.0), REAL_CONST(19277.219794124274/8.0), REAL_CONST(19292.932250020265/8.0), REAL_CONST(19308.647905683421/8.0), REAL_CONST(19324.366759811302/8.0), REAL_CONST(19340.088811102793/8.0), REAL_CONST(19355.8140582581/8.0), REAL_CONST(19371.542499978754/8.0), REAL_CONST(19387.2741349676/8.0), REAL_CONST(19403.008961928797/8.0), REAL_CONST(19418.746979567823/8.0), REAL_CONST(19434.488186591469/8.0), REAL_CONST(19450.232581707827/8.0), REAL_CONST(19465.980163626304/8.0), REAL_CONST(19481.730931057613/8.0), REAL_CONST(19497.484882713761/8.0), REAL_CONST(19513.242017308068/8.0), REAL_CONST(19529.002333555141/8.0), REAL_CONST(19544.765830170898/8.0), REAL_CONST(19560.532505872539/8.0), REAL_CONST(19576.302359378566/8.0), REAL_CONST(19592.075389408761/8.0), REAL_CONST(19607.851594684209/8.0), REAL_CONST(19623.630973927269/8.0), REAL_CONST(19639.41352586159/8.0), REAL_CONST(19655.199249212103/8.0), REAL_CONST(19670.988142705017/8.0), REAL_CONST(19686.780205067826/8.0), REAL_CONST(19702.575435029288/8.0), REAL_CONST(19718.373831319448/8.0), REAL_CONST(19734.175392669615/8.0), REAL_CONST(19749.980117812371/8.0), REAL_CONST(19765.788005481569/8.0), REAL_CONST(19781.599054412323/8.0), REAL_CONST(19797.413263341008/8.0), REAL_CONST(19813.230631005274/8.0), REAL_CONST(19829.051156144014/8.0), REAL_CONST(19844.874837497395/8.0), REAL_CONST(19860.701673806827/8.0), REAL_CONST(19876.531663814985/8.0), REAL_CONST(19892.364806265789/8.0), REAL_CONST(19908.201099904403/8.0), REAL_CONST(19924.040543477258/8.0), REAL_CONST(19939.883135732012/8.0), REAL_CONST(19955.728875417579/8.0), REAL_CONST(19971.577761284105/8.0), REAL_CONST(19987.429792082985/8.0), REAL_CONST(20003.284966566847/8.0), REAL_CONST(20019.14328348956/8.0), REAL_CONST(20035.004741606219/8.0), REAL_CONST(20050.869339673161/8.0), REAL_CONST(20066.737076447946/8.0), REAL_CONST(20082.607950689362/8.0), REAL_CONST(20098.481961157428/8.0), REAL_CONST(20114.359106613385/8.0), REAL_CONST(20130.239385819699/8.0), REAL_CONST(20146.122797540058/8.0), REAL_CONST(20162.009340539353/8.0), REAL_CONST(20177.899013583716/8.0), REAL_CONST(20193.791815440476/8.0), REAL_CONST(20209.687744878182/8.0), REAL_CONST(20225.586800666591/8.0), REAL_CONST(20241.488981576669/8.0), REAL_CONST(20257.394286380597/8.0), REAL_CONST(20273.302713851754/8.0), REAL_CONST(20289.214262764715/8.0), REAL_CONST(20305.128931895277/8.0), REAL_CONST(20321.046720020415/8.0), REAL_CONST(20336.967625918318/8.0), REAL_CONST(20352.891648368361/8.0), REAL_CONST(20368.818786151114/8.0), REAL_CONST(20384.749038048347/8.0), REAL_CONST(20400.682402843009/8.0), REAL_CONST(20416.618879319249/8.0), REAL_CONST(20432.558466262391/8.0), REAL_CONST(20448.501162458953/8.0), REAL_CONST(20464.446966696629/8.0), REAL_CONST(20480.395877764302/8.0), REAL_CONST(20496.347894452025/8.0), REAL_CONST(20512.303015551031/8.0), REAL_CONST(20528.261239853735/8.0), REAL_CONST(20544.22256615372/8.0), REAL_CONST(20560.186993245738/8.0), REAL_CONST(20576.15451992572/8.0), REAL_CONST(20592.125144990758/8.0), REAL_CONST(20608.098867239107/8.0), REAL_CONST(20624.075685470198/8.0), REAL_CONST(20640.055598484618/8.0), REAL_CONST(20656.038605084115/8.0), REAL_CONST(20672.024704071595/8.0), REAL_CONST(20688.013894251126/8.0), REAL_CONST(20704.006174427926/8.0), REAL_CONST(20720.001543408373/8.0), REAL_CONST(20735.999999999989/8.0), REAL_CONST(20752.001543011454/8.0), REAL_CONST(20768.006171252597/8.0), REAL_CONST(20784.013883534382/8.0), REAL_CONST(20800.024678668931/8.0), REAL_CONST(20816.038555469506/8.0), REAL_CONST(20832.055512750507/8.0), REAL_CONST(20848.075549327474/8.0), REAL_CONST(20864.098664017085/8.0), REAL_CONST(20880.124855637161/8.0), REAL_CONST(20896.154123006647/8.0), REAL_CONST(20912.186464945626/8.0), REAL_CONST(20928.221880275312/8.0), REAL_CONST(20944.260367818049/8.0), REAL_CONST(20960.301926397311/8.0), REAL_CONST(20976.346554837684/8.0), REAL_CONST(20992.394251964895/8.0), REAL_CONST(21008.445016605787/8.0), REAL_CONST(21024.498847588318/8.0), REAL_CONST(21040.555743741574/8.0), REAL_CONST(21056.615703895754/8.0), REAL_CONST(21072.678726882168/8.0), REAL_CONST(21088.744811533252/8.0), REAL_CONST(21104.813956682538/8.0), REAL_CONST(21120.886161164683/8.0), REAL_CONST(21136.961423815443/8.0), REAL_CONST(21153.039743471683/8.0), REAL_CONST(21169.121118971379/8.0), REAL_CONST(21185.205549153605/8.0), REAL_CONST(21201.293032858535/8.0), REAL_CONST(21217.383568927453/8.0), REAL_CONST(21233.477156202731/8.0), REAL_CONST(21249.573793527841/8.0), REAL_CONST(21265.673479747358/8.0), REAL_CONST(21281.776213706937/8.0), REAL_CONST(21297.881994253334/8.0), REAL_CONST(21313.990820234398/8.0), REAL_CONST(21330.102690499054/8.0), REAL_CONST(21346.21760389733/8.0), REAL_CONST(21362.335559280327/8.0), REAL_CONST(21378.456555500241/8.0), REAL_CONST(21394.580591410333/8.0), REAL_CONST(21410.707665864964/8.0), REAL_CONST(21426.83777771956/8.0), REAL_CONST(21442.970925830628/8.0), REAL_CONST(21459.107109055756/8.0), REAL_CONST(21475.246326253604/8.0), REAL_CONST(21491.388576283895/8.0), REAL_CONST(21507.533858007431/8.0), REAL_CONST(21523.682170286087/8.0), REAL_CONST(21539.833511982797/8.0), REAL_CONST(21555.987881961566/8.0), REAL_CONST(21572.145279087465/8.0), REAL_CONST(21588.305702226615/8.0), REAL_CONST(21604.469150246216/8.0), REAL_CONST(21620.635622014521/8.0), REAL_CONST(21636.805116400832/8.0), REAL_CONST(21652.977632275521/8.0), REAL_CONST(21669.153168510009/8.0), REAL_CONST(21685.331723976764/8.0), REAL_CONST(21701.513297549318/8.0), REAL_CONST(21717.697888102244/8.0), REAL_CONST(21733.885494511167/8.0), REAL_CONST(21750.076115652759/8.0), REAL_CONST(21766.269750404736/8.0), REAL_CONST(21782.466397645861/8.0), REAL_CONST(21798.666056255934/8.0), REAL_CONST(21814.868725115801/8.0), REAL_CONST(21831.074403107345/8.0), REAL_CONST(21847.283089113484/8.0), REAL_CONST(21863.494782018177/8.0), REAL_CONST(21879.709480706417/8.0), REAL_CONST(21895.927184064229/8.0), REAL_CONST(21912.147890978667/8.0), REAL_CONST(21928.371600337818/8.0), REAL_CONST(21944.598311030797/8.0), REAL_CONST(21960.828021947746/8.0), REAL_CONST(21977.060731979829/8.0), REAL_CONST(21993.296440019243/8.0), REAL_CONST(22009.535144959198/8.0), REAL_CONST(22025.77684569393/8.0), REAL_CONST(22042.021541118691/8.0), REAL_CONST(22058.269230129757/8.0), REAL_CONST(22074.519911624411/8.0), REAL_CONST(22090.773584500959/8.0), REAL_CONST(22107.030247658717/8.0), REAL_CONST(22123.289899998013/8.0), REAL_CONST(22139.552540420187/8.0), REAL_CONST(22155.818167827587/8.0), REAL_CONST(22172.086781123569/8.0), REAL_CONST(22188.358379212495/8.0), REAL_CONST(22204.632960999726/8.0), REAL_CONST(22220.910525391639/8.0), REAL_CONST(22237.191071295601/8.0), REAL_CONST(22253.474597619981/8.0), REAL_CONST(22269.761103274148/8.0), REAL_CONST(22286.050587168469/8.0), REAL_CONST(22302.343048214312/8.0), REAL_CONST(22318.638485324027/8.0), REAL_CONST(22334.936897410968/8.0), REAL_CONST(22351.23828338947/8.0), REAL_CONST(22367.542642174871/8.0), REAL_CONST(22383.849972683485/8.0), REAL_CONST(22400.160273832618/8.0), REAL_CONST(22416.473544540564/8.0), REAL_CONST(22432.789783726603/8.0), REAL_CONST(22449.108990310986/8.0), REAL_CONST(22465.431163214958/8.0), REAL_CONST(22481.75630136074/8.0), REAL_CONST(22498.084403671528/8.0), REAL_CONST(22514.415469071497/8.0), REAL_CONST(22530.749496485802/8.0), REAL_CONST(22547.086484840562/8.0), REAL_CONST(22563.426433062879/8.0), REAL_CONST(22579.769340080824/8.0), REAL_CONST(22596.115204823436/8.0), REAL_CONST(22612.464026220721/8.0), REAL_CONST(22628.815803203655/8.0), REAL_CONST(22645.170534704179/8.0), REAL_CONST(22661.5282196552/8.0), REAL_CONST(22677.888856990587/8.0), REAL_CONST(22694.252445645168/8.0), REAL_CONST(22710.618984554734/8.0), REAL_CONST(22726.988472656034/8.0), REAL_CONST(22743.360908886778/8.0), REAL_CONST(22759.736292185622/8.0), REAL_CONST(22776.114621492186/8.0), REAL_CONST(22792.495895747044/8.0), REAL_CONST(22808.880113891719/8.0), REAL_CONST(22825.267274868678/8.0), REAL_CONST(22841.657377621348/8.0), REAL_CONST(22858.050421094096/8.0), REAL_CONST(22874.446404232243/8.0), REAL_CONST(22890.845325982053/8.0), REAL_CONST(22907.247185290722/8.0), REAL_CONST(22923.651981106406/8.0), REAL_CONST(22940.059712378195/8.0), REAL_CONST(22956.470378056114/8.0), REAL_CONST(22972.883977091129/8.0), REAL_CONST(22989.300508435153/8.0), REAL_CONST(23005.719971041017/8.0), REAL_CONST(23022.142363862498/8.0), REAL_CONST(23038.567685854305/8.0), REAL_CONST(23054.995935972078/8.0), REAL_CONST(23071.427113172387/8.0), REAL_CONST(23087.86121641273/8.0), REAL_CONST(23104.298244651531/8.0), REAL_CONST(23120.738196848146/8.0), REAL_CONST(23137.181071962848/8.0), REAL_CONST(23153.626868956846/8.0), REAL_CONST(23170.075586792263/8.0), REAL_CONST(23186.527224432142/8.0), REAL_CONST(23202.981780840448/8.0), REAL_CONST(23219.439254982066/8.0), REAL_CONST(23235.899645822796/8.0), REAL_CONST(23252.362952329357/8.0), REAL_CONST(23268.829173469378/8.0), REAL_CONST(23285.298308211408/8.0), REAL_CONST(23301.770355524899/8.0), REAL_CONST(23318.245314380223/8.0), REAL_CONST(23334.723183748658/8.0), REAL_CONST(23351.203962602387/8.0), REAL_CONST(23367.687649914504/8.0), REAL_CONST(23384.174244659007/8.0), REAL_CONST(23400.663745810798/8.0), REAL_CONST(23417.15615234568/8.0), REAL_CONST(23433.651463240367/8.0), REAL_CONST(23450.149677472462/8.0), REAL_CONST(23466.650794020472/8.0), REAL_CONST(23483.154811863806/8.0), REAL_CONST(23499.661729982763/8.0), REAL_CONST(23516.171547358543/8.0), REAL_CONST(23532.684262973235/8.0), REAL_CONST(23549.199875809823/8.0), REAL_CONST(23565.718384852185/8.0), REAL_CONST(23582.239789085092/8.0), REAL_CONST(23598.764087494197/8.0), REAL_CONST(23615.291279066041/8.0), REAL_CONST(23631.821362788058/8.0), REAL_CONST(23648.354337648565/8.0), REAL_CONST(23664.890202636761/8.0), REAL_CONST(23681.428956742733/8.0), REAL_CONST(23697.970598957443/8.0), REAL_CONST(23714.515128272738/8.0), REAL_CONST(23731.062543681343/8.0), REAL_CONST(23747.612844176863/8.0), REAL_CONST(23764.166028753778/8.0), REAL_CONST(23780.72209640744/8.0), REAL_CONST(23797.281046134085/8.0), REAL_CONST(23813.842876930816/8.0), REAL_CONST(23830.407587795606/8.0), REAL_CONST(23846.975177727301/8.0), REAL_CONST(23863.545645725622/8.0), REAL_CONST(23880.11899079115/8.0), REAL_CONST(23896.695211925336/8.0), REAL_CONST(23913.274308130498/8.0), REAL_CONST(23929.856278409821/8.0), REAL_CONST(23946.441121767348/8.0), REAL_CONST(23963.028837207989/8.0), REAL_CONST(23979.619423737513/8.0), REAL_CONST(23996.212880362549/8.0), REAL_CONST(24012.809206090584/8.0), REAL_CONST(24029.408399929966/8.0), REAL_CONST(24046.010460889898/8.0), REAL_CONST(24062.615387980433/8.0), REAL_CONST(24079.223180212492/8.0), REAL_CONST(24095.833836597827/8.0), REAL_CONST(24112.447356149063/8.0), REAL_CONST(24129.063737879667/8.0), REAL_CONST(24145.682980803951/8.0), REAL_CONST(24162.305083937081/8.0), REAL_CONST(24178.930046295067/8.0), REAL_CONST(24195.557866894767/8.0), REAL_CONST(24212.188544753884/8.0), REAL_CONST(24228.822078890964/8.0), REAL_CONST(24245.458468325389/8.0), REAL_CONST(24262.097712077397/8.0), REAL_CONST(24278.739809168052/8.0), REAL_CONST(24295.384758619261/8.0), REAL_CONST(24312.032559453768/8.0), REAL_CONST(24328.683210695162/8.0), REAL_CONST(24345.336711367858/8.0), REAL_CONST(24361.993060497109/8.0), REAL_CONST(24378.652257108995/8.0), REAL_CONST(24395.314300230442/8.0), REAL_CONST(24411.979188889192/8.0), REAL_CONST(24428.646922113825/8.0), REAL_CONST(24445.317498933746/8.0), REAL_CONST(24461.990918379193/8.0), REAL_CONST(24478.667179481225/8.0), REAL_CONST(24495.346281271726/8.0), REAL_CONST(24512.028222783407/8.0), REAL_CONST(24528.713003049801/8.0), REAL_CONST(24545.400621105266/8.0), REAL_CONST(24562.091075984976/8.0), REAL_CONST(24578.784366724925/8.0), REAL_CONST(24595.480492361927/8.0), REAL_CONST(24612.179451933614/8.0), REAL_CONST(24628.881244478438/8.0), REAL_CONST(24645.585869035654/8.0), REAL_CONST(24662.293324645343/8.0), REAL_CONST(24679.003610348394/8.0), REAL_CONST(24695.716725186514/8.0), REAL_CONST(24712.432668202211/8.0), REAL_CONST(24729.151438438807/8.0), REAL_CONST(24745.873034940436/8.0), REAL_CONST(24762.597456752032/8.0), REAL_CONST(24779.324702919344/8.0), REAL_CONST(24796.054772488926/8.0), REAL_CONST(24812.787664508123/8.0), REAL_CONST(24829.5233780251/8.0), REAL_CONST(24846.261912088819/8.0), REAL_CONST(24863.003265749034/8.0), REAL_CONST(24879.747438056307/8.0), REAL_CONST(24896.494428062004/8.0), REAL_CONST(24913.244234818278/8.0), REAL_CONST(24929.996857378079/8.0), REAL_CONST(24946.752294795166/8.0), REAL_CONST(24963.510546124078/8.0), REAL_CONST(24980.271610420157/8.0), REAL_CONST(24997.035486739525/8.0), REAL_CONST(25013.802174139113/8.0), REAL_CONST(25030.571671676629/8.0), REAL_CONST(25047.343978410572/8.0), REAL_CONST(25064.119093400237/8.0), REAL_CONST(25080.897015705697/8.0), REAL_CONST(25097.677744387816/8.0), REAL_CONST(25114.461278508239/8.0), REAL_CONST(25131.2476171294/8.0), REAL_CONST(25148.036759314517/8.0), REAL_CONST(25164.828704127583/8.0), REAL_CONST(25181.623450633375/8.0), REAL_CONST(25198.42099789745/8.0), REAL_CONST(25215.221344986145/8.0), REAL_CONST(25232.024490966574/8.0), REAL_CONST(25248.830434906627/8.0), REAL_CONST(25265.639175874974/8.0), REAL_CONST(25282.450712941049/8.0), REAL_CONST(25299.265045175071/8.0), REAL_CONST(25316.082171648024/8.0), REAL_CONST(25332.902091431668/8.0), REAL_CONST(25349.724803598532/8.0), REAL_CONST(25366.550307221914/8.0), REAL_CONST(25383.378601375884/8.0), REAL_CONST(25400.209685135269/8.0), REAL_CONST(25417.043557575678/8.0), REAL_CONST(25433.880217773472/8.0), REAL_CONST(25450.719664805783/8.0), REAL_CONST(25467.561897750507/8.0), REAL_CONST(25484.406915686297/8.0), REAL_CONST(25501.254717692573/8.0), REAL_CONST(25518.105302849512/8.0), REAL_CONST(25534.958670238051/8.0), REAL_CONST(25551.814818939893/8.0), REAL_CONST(25568.67374803748/8.0), REAL_CONST(25585.535456614027/8.0), REAL_CONST(25602.399943753502/8.0), REAL_CONST(25619.267208540619/8.0), REAL_CONST(25636.137250060852/8.0), REAL_CONST(25653.010067400432/8.0), REAL_CONST(25669.885659646327/8.0), REAL_CONST(25686.76402588627/8.0), REAL_CONST(25703.645165208734/8.0), REAL_CONST(25720.529076702944/8.0), REAL_CONST(25737.415759458876/8.0), REAL_CONST(25754.305212567244/8.0), REAL_CONST(25771.197435119517/8.0), REAL_CONST(25788.092426207899/8.0), REAL_CONST(25804.990184925344/8.0), REAL_CONST(25821.890710365547/8.0), REAL_CONST(25838.794001622944/8.0), REAL_CONST(25855.700057792714/8.0), REAL_CONST(25872.608877970775/8.0), REAL_CONST(25889.520461253778/8.0), REAL_CONST(25906.434806739118/8.0), REAL_CONST(25923.351913524923/8.0), REAL_CONST(25940.271780710063/8.0), REAL_CONST(25957.194407394138/8.0), REAL_CONST(25974.11979267748/8.0), REAL_CONST(25991.047935661154/8.0), REAL_CONST(26007.978835446964/8.0), REAL_CONST(26024.912491137442/8.0), REAL_CONST(26041.848901835841/8.0), REAL_CONST(26058.788066646157/8.0), REAL_CONST(26075.729984673108/8.0), REAL_CONST(26092.674655022136/8.0), REAL_CONST(26109.622076799409/8.0), REAL_CONST(26126.572249111829/8.0), REAL_CONST(26143.525171067016/8.0), REAL_CONST(26160.480841773315/8.0), REAL_CONST(26177.43926033979/8.0), REAL_CONST(26194.400425876229/8.0), REAL_CONST(26211.364337493149/8.0), REAL_CONST(26228.330994301767/8.0), REAL_CONST(26245.30039541404/8.0), REAL_CONST(26262.272539942627/8.0), REAL_CONST(26279.247427000919/8.0), REAL_CONST(26296.225055703002/8.0), REAL_CONST(26313.205425163702/8.0), REAL_CONST(26330.188534498539/8.0), REAL_CONST(26347.174382823756/8.0), REAL_CONST(26364.162969256304/8.0), REAL_CONST(26381.154292913852/8.0), REAL_CONST(26398.148352914774/8.0), REAL_CONST(26415.145148378149/8.0), REAL_CONST(26432.144678423778/8.0), REAL_CONST(26449.146942172156/8.0), REAL_CONST(26466.151938744493/8.0), REAL_CONST(26483.159667262702/8.0), REAL_CONST(26500.170126849403/8.0), REAL_CONST(26517.183316627921/8.0), REAL_CONST(26534.199235722277/8.0), REAL_CONST(26551.217883257199/8.0), REAL_CONST(26568.239258358124/8.0), REAL_CONST(26585.263360151173/8.0), REAL_CONST(26602.290187763181/8.0), REAL_CONST(26619.319740321676/8.0), REAL_CONST(26636.352016954883/8.0), REAL_CONST(26653.387016791727/8.0), REAL_CONST(26670.424738961825/8.0), REAL_CONST(26687.465182595493/8.0), REAL_CONST(26704.508346823739/8.0), REAL_CONST(26721.554230778267/8.0), REAL_CONST(26738.602833591467/8.0), REAL_CONST(26755.65415439643/8.0), REAL_CONST(26772.708192326929/8.0), REAL_CONST(26789.764946517433/8.0), REAL_CONST(26806.824416103096/8.0), REAL_CONST(26823.886600219761/8.0), REAL_CONST(26840.95149800396/8.0), REAL_CONST(26858.019108592915/8.0), REAL_CONST(26875.089431124517/8.0), REAL_CONST(26892.162464737365/8.0), REAL_CONST(26909.238208570721/8.0), REAL_CONST(26926.316661764544/8.0), REAL_CONST(26943.397823459472/8.0), REAL_CONST(26960.481692796813/8.0), REAL_CONST(26977.568268918571/8.0), REAL_CONST(26994.657550967422/8.0), REAL_CONST(27011.749538086722/8.0), REAL_CONST(27028.844229420498/8.0), REAL_CONST(27045.941624113464/8.0), REAL_CONST(27063.041721311005/8.0), REAL_CONST(27080.144520159181/8.0), REAL_CONST(27097.250019804727/8.0), REAL_CONST(27114.35821939505/8.0), REAL_CONST(27131.469118078236/8.0), REAL_CONST(27148.582715003027/8.0), REAL_CONST(27165.699009318858/8.0), REAL_CONST(27182.818000175819/8.0), REAL_CONST(27199.939686724665/8.0), REAL_CONST(27217.064068116837/8.0), REAL_CONST(27234.191143504428/8.0), REAL_CONST(27251.320912040203/8.0), REAL_CONST(27268.453372877593/8.0), REAL_CONST(27285.588525170693/8.0), REAL_CONST(27302.726368074269/8.0), REAL_CONST(27319.866900743735/8.0), REAL_CONST(27337.010122335181/8.0), REAL_CONST(27354.156032005358/8.0), REAL_CONST(27371.304628911668/8.0), REAL_CONST(27388.455912212183/8.0), REAL_CONST(27405.609881065626/8.0), REAL_CONST(27422.766534631384/8.0), REAL_CONST(27439.925872069507/8.0), REAL_CONST(27457.087892540683/8.0), REAL_CONST(27474.252595206275/8.0), REAL_CONST(27491.419979228293/8.0), REAL_CONST(27508.5900437694/8.0), REAL_CONST(27525.762787992917/8.0), REAL_CONST(27542.93821106281/8.0), REAL_CONST(27560.116312143706/8.0), REAL_CONST(27577.297090400876/8.0), REAL_CONST(27594.480545000242/8.0), REAL_CONST(27611.666675108383/8.0), REAL_CONST(27628.855479892518/8.0), REAL_CONST(27646.046958520514/8.0), REAL_CONST(27663.241110160889/8.0), REAL_CONST(27680.437933982801/8.0), REAL_CONST(27697.637429156068/8.0), REAL_CONST(27714.839594851132/8.0), REAL_CONST(27732.04443023909/8.0), REAL_CONST(27749.251934491687/8.0), REAL_CONST(27766.462106781299/8.0), REAL_CONST(27783.674946280949/8.0), REAL_CONST(27800.890452164302/8.0), REAL_CONST(27818.108623605654/8.0), REAL_CONST(27835.329459779954/8.0), REAL_CONST(27852.55295986278/8.0), REAL_CONST(27869.779123030345/8.0), REAL_CONST(27887.007948459504/8.0), REAL_CONST(27904.239435327745/8.0), REAL_CONST(27921.473582813196/8.0), REAL_CONST(27938.710390094613/8.0), REAL_CONST(27955.949856351392/8.0), REAL_CONST(27973.19198076355/8.0), REAL_CONST(27990.436762511745/8.0), REAL_CONST(28007.684200777272/8.0), REAL_CONST(28024.934294742041/8.0), REAL_CONST(28042.187043588601/8.0), REAL_CONST(28059.442446500128/8.0), REAL_CONST(28076.700502660427/8.0), REAL_CONST(28093.961211253929/8.0), REAL_CONST(28111.224571465693/8.0), REAL_CONST(28128.490582481401/8.0), REAL_CONST(28145.759243487362/8.0), REAL_CONST(28163.030553670509/8.0), REAL_CONST(28180.304512218394/8.0), REAL_CONST(28197.581118319198/8.0), REAL_CONST(28214.860371161725/8.0), REAL_CONST(28232.14226993539/8.0), REAL_CONST(28249.42681383024/8.0), REAL_CONST(28266.71400203693/8.0), REAL_CONST(28284.003833746745/8.0), REAL_CONST(28301.296308151585/8.0), REAL_CONST(28318.591424443959/8.0), REAL_CONST(28335.889181817001/8.0), REAL_CONST(28353.189579464462/8.0), REAL_CONST(28370.492616580705/8.0), REAL_CONST(28387.798292360701/8.0), REAL_CONST(28405.106606000048/8.0), REAL_CONST(28422.417556694945/8.0), REAL_CONST(28439.731143642206/8.0), REAL_CONST(28457.047366039264/8.0), REAL_CONST(28474.366223084147/8.0), REAL_CONST(28491.687713975512/8.0), REAL_CONST(28509.011837912611/8.0), REAL_CONST(28526.338594095305/8.0), REAL_CONST(28543.667981724069/8.0), REAL_CONST(28560.999999999982/8.0), REAL_CONST(28578.334648124732/8.0), REAL_CONST(28595.671925300605/8.0), REAL_CONST(28613.011830730498/8.0), REAL_CONST(28630.354363617909/8.0), REAL_CONST(28647.699523166943/8.0), REAL_CONST(28665.0473085823/8.0), REAL_CONST(28682.397719069289/8.0), REAL_CONST(28699.750753833818/8.0), REAL_CONST(28717.10641208239/8.0), REAL_CONST(28734.464693022121/8.0), REAL_CONST(28751.825595860708/8.0), REAL_CONST(28769.189119806462/8.0), REAL_CONST(28786.55526406828/8.0), REAL_CONST(28803.924027855664/8.0), REAL_CONST(28821.295410378701/8.0), REAL_CONST(28838.669410848088/8.0), REAL_CONST(28856.046028475103/8.0), REAL_CONST(28873.425262471628/8.0), REAL_CONST(28890.80711205013/8.0), REAL_CONST(28908.191576423673/8.0), REAL_CONST(28925.578654805915/8.0), REAL_CONST(28942.968346411097/8.0), REAL_CONST(28960.360650454055/8.0), REAL_CONST(28977.755566150216/8.0), REAL_CONST(28995.153092715591/8.0), REAL_CONST(29012.553229366786/8.0), REAL_CONST(29029.955975320987/8.0), REAL_CONST(29047.361329795975/8.0), REAL_CONST(29064.769292010107/8.0), REAL_CONST(29082.179861182336/8.0), REAL_CONST(29099.593036532187/8.0), REAL_CONST(29117.00881727978/8.0), REAL_CONST(29134.427202645813/8.0), REAL_CONST(29151.848191851568/8.0), REAL_CONST(29169.271784118911/8.0), REAL_CONST(29186.697978670283/8.0), REAL_CONST(29204.126774728706/8.0), REAL_CONST(29221.55817151779/8.0), REAL_CONST(29238.992168261717/8.0), REAL_CONST(29256.42876418525/8.0), REAL_CONST(29273.867958513725/8.0), REAL_CONST(29291.309750473058/8.0), REAL_CONST(29308.754139289747/8.0), REAL_CONST(29326.201124190855/8.0), REAL_CONST(29343.65070440403/8.0), REAL_CONST(29361.102879157483/8.0), REAL_CONST(29378.557647680012/8.0), REAL_CONST(29396.015009200975/8.0), REAL_CONST(29413.474962950309/8.0), REAL_CONST(29430.937508158524/8.0), REAL_CONST(29448.402644056692/8.0), REAL_CONST(29465.870369876469/8.0), REAL_CONST(29483.340684850071/8.0), REAL_CONST(29500.81358821028/8.0), REAL_CONST(29518.289079190454/8.0), REAL_CONST(29535.767157024511/8.0), REAL_CONST(29553.247820946945/8.0), REAL_CONST(29570.731070192807/8.0), REAL_CONST(29588.216903997723/8.0), REAL_CONST(29605.70532159787/8.0), REAL_CONST(29623.19632223/8.0), REAL_CONST(29640.689905131429/8.0), REAL_CONST(29658.186069540028/8.0), REAL_CONST(29675.684814694236/8.0), REAL_CONST(29693.186139833047/8.0), REAL_CONST(29710.690044196028/8.0), REAL_CONST(29728.196527023298/8.0), REAL_CONST(29745.705587555527/8.0), REAL_CONST(29763.217225033964/8.0), REAL_CONST(29780.731438700397/8.0), REAL_CONST(29798.248227797183/8.0), REAL_CONST(29815.76759156723/8.0), REAL_CONST(29833.289529254005/8.0), REAL_CONST(29850.81404010153/8.0), REAL_CONST(29868.341123354381/8.0), REAL_CONST(29885.870778257693/8.0), REAL_CONST(29903.403004057145/8.0), REAL_CONST(29920.937799998974/8.0), REAL_CONST(29938.475165329975/8.0), REAL_CONST(29956.015099297485/8.0), REAL_CONST(29973.557601149394/8.0), REAL_CONST(29991.102670134147/8.0), REAL_CONST(30008.650305500738/8.0), REAL_CONST(30026.200506498706/8.0), REAL_CONST(30043.753272378144/8.0), REAL_CONST(30061.308602389683/8.0), REAL_CONST(30078.866495784507/8.0), REAL_CONST(30096.426951814352/8.0), REAL_CONST(30113.989969731494/8.0), REAL_CONST(30131.55554878875/8.0), REAL_CONST(30149.123688239491/8.0), REAL_CONST(30166.694387337629/8.0), REAL_CONST(30184.267645337608/8.0), REAL_CONST(30201.843461494434/8.0), REAL_CONST(30219.42183506364/8.0), REAL_CONST(30237.002765301309/8.0), REAL_CONST(30254.586251464058/8.0), REAL_CONST(30272.172292809046/8.0), REAL_CONST(30289.760888593977/8.0), REAL_CONST(30307.35203807709/8.0), REAL_CONST(30324.94574051716/8.0), REAL_CONST(30342.541995173502/8.0), REAL_CONST(30360.140801305966/8.0), REAL_CONST(30377.742158174944/8.0), REAL_CONST(30395.346065041358/8.0), REAL_CONST(30412.952521166666/8.0), REAL_CONST(30430.561525812864/8.0), REAL_CONST(30448.173078242475/8.0), REAL_CONST(30465.787177718561/8.0), REAL_CONST(30483.403823504719/8.0), REAL_CONST(30501.02301486507/8.0), REAL_CONST(30518.644751064272/8.0), REAL_CONST(30536.269031367516/8.0), REAL_CONST(30553.895855040515/8.0), REAL_CONST(30571.525221349519/8.0), REAL_CONST(30589.157129561307/8.0), REAL_CONST(30606.791578943175/8.0), REAL_CONST(30624.428568762964/8.0), REAL_CONST(30642.06809828903/8.0), REAL_CONST(30659.710166790261/8.0), REAL_CONST(30677.35477353607/8.0), REAL_CONST(30695.001917796391/8.0), REAL_CONST(30712.651598841687/8.0), REAL_CONST(30730.303815942945/8.0), REAL_CONST(30747.958568371676/8.0), REAL_CONST(30765.615855399912/8.0), REAL_CONST(30783.275676300211/8.0), REAL_CONST(30800.938030345646/8.0), REAL_CONST(30818.602916809814/8.0), REAL_CONST(30836.270334966837/8.0), REAL_CONST(30853.940284091354/8.0), REAL_CONST(30871.612763458521/8.0), REAL_CONST(30889.287772344011/8.0), REAL_CONST(30906.965310024025/8.0), REAL_CONST(30924.645375775272/8.0), REAL_CONST(30942.327968874983/8.0), REAL_CONST(30960.013088600903/8.0), REAL_CONST(30977.700734231294/8.0), REAL_CONST(30995.390905044929/8.0), REAL_CONST(31013.083600321101/8.0), REAL_CONST(31030.778819339619/8.0), REAL_CONST(31048.476561380798/8.0), REAL_CONST(31066.17682572547/8.0), REAL_CONST(31083.879611654978/8.0), REAL_CONST(31101.584918451179/8.0), REAL_CONST(31119.29274539644/8.0), REAL_CONST(31137.003091773637/8.0), REAL_CONST(31154.715956866155/8.0), REAL_CONST(31172.431339957893/8.0), REAL_CONST(31190.14924033326/8.0), REAL_CONST(31207.869657277162/8.0), REAL_CONST(31225.592590075023/8.0), REAL_CONST(31243.318038012771/8.0), REAL_CONST(31261.046000376838/8.0), REAL_CONST(31278.776476454172/8.0), REAL_CONST(31296.50946553221/8.0), REAL_CONST(31314.24496689891/8.0), REAL_CONST(31331.98297984272/8.0), REAL_CONST(31349.7235036526/8.0), REAL_CONST(31367.466537618013/8.0), REAL_CONST(31385.212081028923/8.0), REAL_CONST(31402.960133175795/8.0), REAL_CONST(31420.710693349596/8.0), REAL_CONST(31438.463760841791/8.0), REAL_CONST(31456.219334944351/8.0), REAL_CONST(31473.977414949743/8.0), REAL_CONST(31491.738000150934/8.0), REAL_CONST(31509.501089841389/8.0), REAL_CONST(31527.266683315069/8.0), REAL_CONST(31545.034779866437/8.0), REAL_CONST(31562.80537879045/8.0), REAL_CONST(31580.578479382562/8.0), REAL_CONST(31598.35408093872/8.0), REAL_CONST(31616.132182755369/8.0), REAL_CONST(31633.91278412945/8.0), REAL_CONST(31651.695884358396/8.0), REAL_CONST(31669.481482740131/8.0), REAL_CONST(31687.269578573076/8.0), REAL_CONST(31705.060171156143/8.0), REAL_CONST(31722.853259788735/8.0), REAL_CONST(31740.648843770748/8.0), REAL_CONST(31758.446922402567/8.0), REAL_CONST(31776.247494985066/8.0), REAL_CONST(31794.050560819614/8.0), REAL_CONST(31811.85611920806/8.0), REAL_CONST(31829.664169452753/8.0), REAL_CONST(31847.474710856521/8.0), REAL_CONST(31865.287742722685/8.0), REAL_CONST(31883.103264355046/8.0), REAL_CONST(31900.921275057899/8.0), REAL_CONST(31918.741774136019/8.0), REAL_CONST(31936.564760894671/8.0), REAL_CONST(31954.390234639599/8.0), REAL_CONST(31972.21819467704/8.0), REAL_CONST(31990.048640313704/8.0), REAL_CONST(32007.881570856793/8.0), REAL_CONST(32025.716985613984/8.0), REAL_CONST(32043.554883893445/8.0), REAL_CONST(32061.395265003815/8.0), REAL_CONST(32079.238128254223/8.0), REAL_CONST(32097.083472954269/8.0), REAL_CONST(32114.931298414049/8.0), REAL_CONST(32132.781603944117/8.0), REAL_CONST(32150.634388855524/8.0), REAL_CONST(32168.48965245979/8.0), REAL_CONST(32186.347394068915/8.0), REAL_CONST(32204.207612995371/8.0), REAL_CONST(32222.07030855212/8.0), REAL_CONST(32239.935480052583/8.0), REAL_CONST(32257.803126810672/8.0), REAL_CONST(32275.673248140767/8.0), REAL_CONST(32293.545843357719/8.0), REAL_CONST(32311.420911776862/8.0), REAL_CONST(32329.298452713996/8.0), REAL_CONST(32347.178465485395/8.0), REAL_CONST(32365.060949407813/8.0), REAL_CONST(32382.945903798463/8.0), REAL_CONST(32400.83332797504/8.0), REAL_CONST(32418.723221255706/8.0), REAL_CONST(32436.615582959093/8.0), REAL_CONST(32454.510412404306/8.0), REAL_CONST(32472.407708910916/8.0), REAL_CONST(32490.307471798966/8.0), REAL_CONST(32508.209700388961/8.0), REAL_CONST(32526.114394001877/8.0), REAL_CONST(32544.021551959166/8.0), REAL_CONST(32561.931173582732/8.0), REAL_CONST(32579.843258194956/8.0), REAL_CONST(32597.757805118679/8.0), REAL_CONST(32615.674813677211/8.0), REAL_CONST(32633.594283194328/8.0), REAL_CONST(32651.516212994258/8.0), REAL_CONST(32669.440602401712/8.0), REAL_CONST(32687.367450741847/8.0), REAL_CONST(32705.296757340297/8.0), REAL_CONST(32723.228521523146/8.0), REAL_CONST(32741.162742616943/8.0), REAL_CONST(32759.099419948703/8.0), REAL_CONST(32777.038552845901/8.0), REAL_CONST(32794.980140636464/8.0), REAL_CONST(32812.924182648792/8.0), REAL_CONST(32830.87067821173/8.0), REAL_CONST(32848.819626654593/8.0), REAL_CONST(32866.77102730715/8.0), REAL_CONST(32884.724879499619/8.0), REAL_CONST(32902.681182562686/8.0), REAL_CONST(32920.639935827494/8.0), REAL_CONST(32938.601138625643/8.0), REAL_CONST(32956.56479028918/8.0), REAL_CONST(32974.530890150607/8.0), REAL_CONST(32992.499437542894/8.0), REAL_CONST(33010.470431799447/8.0), REAL_CONST(33028.443872254145/8.0), REAL_CONST(33046.419758241311/8.0), REAL_CONST(33064.39808909571/8.0), REAL_CONST(33082.378864152583/8.0), REAL_CONST(33100.36208274759/8.0), REAL_CONST(33118.347744216881/8.0), REAL_CONST(33136.335847897026/8.0), REAL_CONST(33154.326393125062/8.0), REAL_CONST(33172.31937923847/8.0), REAL_CONST(33190.314805575174/8.0), REAL_CONST(33208.312671473555/8.0), REAL_CONST(33226.312976272442/8.0), REAL_CONST(33244.315719311111/8.0), REAL_CONST(33262.320899929284/8.0), REAL_CONST(33280.328517467125/8.0), REAL_CONST(33298.33857126526/8.0), REAL_CONST(33316.351060664747/8.0), REAL_CONST(33334.365985007091/8.0), REAL_CONST(33352.383343634239/8.0), REAL_CONST(33370.403135888591/8.0), REAL_CONST(33388.42536111299/8.0), REAL_CONST(33406.450018650721/8.0), REAL_CONST(33424.477107845501/8.0), REAL_CONST(33442.506628041512/8.0), REAL_CONST(33460.53857858335/8.0), REAL_CONST(33478.572958816083/8.0), REAL_CONST(33496.609768085189/8.0), REAL_CONST(33514.649005736617/8.0), REAL_CONST(33532.690671116739/8.0), REAL_CONST(33550.734763572356/8.0), REAL_CONST(33568.781282450735/8.0), REAL_CONST(33586.830227099563/8.0), REAL_CONST(33604.881596866973/8.0), REAL_CONST(33622.935391101528/8.0), REAL_CONST(33640.991609152239/8.0), REAL_CONST(33659.050250368542/8.0), REAL_CONST(33677.111314100322/8.0), REAL_CONST(33695.174799697881/8.0), REAL_CONST(33713.240706511984/8.0), REAL_CONST(33731.309033893805/8.0), REAL_CONST(33749.37978119497/8.0), REAL_CONST(33767.452947767531/8.0), REAL_CONST(33785.528532963974/8.0), REAL_CONST(33803.606536137209/8.0), REAL_CONST(33821.686956640602/8.0), REAL_CONST(33839.769793827938/8.0), REAL_CONST(33857.855047053425/8.0), REAL_CONST(33875.942715671707/8.0), REAL_CONST(33894.032799037872/8.0), REAL_CONST(33912.125296507431/8.0), REAL_CONST(33930.220207436316/8.0), REAL_CONST(33948.317531180888/8.0), REAL_CONST(33966.417267097961/8.0), REAL_CONST(33984.519414544746/8.0), REAL_CONST(34002.623972878901/8.0), REAL_CONST(34020.730941458511/8.0), REAL_CONST(34038.840319642077/8.0), REAL_CONST(34056.952106788536/8.0), REAL_CONST(34075.066302257255/8.0), REAL_CONST(34093.182905408015/8.0), REAL_CONST(34111.301915601027/8.0), REAL_CONST(34129.42333219693/8.0), REAL_CONST(34147.547154556785/8.0), REAL_CONST(34165.673382042078/8.0), REAL_CONST(34183.80201401472/8.0), REAL_CONST(34201.933049837033/8.0), REAL_CONST(34220.06648887178/8.0), REAL_CONST(34238.202330482141/8.0), REAL_CONST(34256.340574031703/8.0), REAL_CONST(34274.481218884495/8.0), REAL_CONST(34292.624264404949/8.0), REAL_CONST(34310.769709957938/8.0), REAL_CONST(34328.91755490873/8.0), REAL_CONST(34347.067798623029/8.0), REAL_CONST(34365.220440466954/8.0), REAL_CONST(34383.375479807051/8.0), REAL_CONST(34401.532916010263/8.0), REAL_CONST(34419.692748443973/8.0), REAL_CONST(34437.854976475966/8.0), REAL_CONST(34456.01959947445/8.0), REAL_CONST(34474.18661680806/8.0), REAL_CONST(34492.356027845817/8.0), REAL_CONST(34510.527831957188/8.0), REAL_CONST(34528.702028512052/8.0), REAL_CONST(34546.878616880676/8.0), REAL_CONST(34565.05759643377/8.0), REAL_CONST(34583.238966542449/8.0), REAL_CONST(34601.422726578232/8.0), REAL_CONST(34619.608875913065/8.0), REAL_CONST(34637.797413919296/8.0), REAL_CONST(34655.988339969692/8.0), REAL_CONST(34674.181653437423/8.0), REAL_CONST(34692.37735369608/8.0), REAL_CONST(34710.575440119668/8.0), REAL_CONST(34728.775912082579/8.0), REAL_CONST(34746.978768959649/8.0), REAL_CONST(34765.184010126082/8.0), REAL_CONST(34783.391634957537/8.0), REAL_CONST(34801.60164283005/8.0), REAL_CONST(34819.814033120063/8.0), REAL_CONST(34838.028805204456/8.0), REAL_CONST(34856.24595846048/8.0), REAL_CONST(34874.465492265823/8.0), REAL_CONST(34892.687405998557/8.0), REAL_CONST(34910.911699037177/8.0), REAL_CONST(34929.138370760564/8.0), REAL_CONST(34947.367420548027/8.0), REAL_CONST(34965.598847779271/8.0), REAL_CONST(34983.832651834389/8.0), REAL_CONST(35002.068832093908/8.0), REAL_CONST(35020.307387938738/8.0), REAL_CONST(35038.548318750189/8.0), REAL_CONST(35056.79162390998/8.0), REAL_CONST(35075.03730280025/8.0), REAL_CONST(35093.285354803513/8.0), REAL_CONST(35111.535779302685/8.0), REAL_CONST(35129.788575681116/8.0), REAL_CONST(35148.043743322516/8.0), REAL_CONST(35166.301281611013/8.0), REAL_CONST(35184.561189931141/8.0), REAL_CONST(35202.823467667826/8.0), REAL_CONST(35221.088114206388/8.0), REAL_CONST(35239.355128932555/8.0), REAL_CONST(35257.624511232447/8.0), REAL_CONST(35275.896260492584/8.0), REAL_CONST(35294.170376099886/8.0), REAL_CONST(35312.446857441668/8.0), REAL_CONST(35330.725703905628/8.0), REAL_CONST(35349.006914879887/8.0), REAL_CONST(35367.290489752944/8.0), REAL_CONST(35385.576427913686/8.0), REAL_CONST(35403.864728751418/8.0), REAL_CONST(35422.155391655811/8.0), REAL_CONST(35440.448416016967/8.0), REAL_CONST(35458.743801225341/8.0), REAL_CONST(35477.041546671804/8.0), REAL_CONST(35495.341651747622/8.0), REAL_CONST(35513.644115844436/8.0), REAL_CONST(35531.948938354304/8.0), REAL_CONST(35550.256118669655/8.0), REAL_CONST(35568.565656183309/8.0), REAL_CONST(35586.877550288496/8.0), REAL_CONST(35605.191800378816/8.0), REAL_CONST(35623.508405848268/8.0), REAL_CONST(35641.827366091238/8.0), REAL_CONST(35660.148680502505/8.0), REAL_CONST(35678.472348477233/8.0), REAL_CONST(35696.798369410979/8.0), REAL_CONST(35715.126742699678/8.0), REAL_CONST(35733.457467739659/8.0), REAL_CONST(35751.790543927644/8.0), REAL_CONST(35770.125970660738/8.0), REAL_CONST(35788.46374733642/8.0), REAL_CONST(35806.803873352568/8.0), REAL_CONST(35825.146348107453/8.0), REAL_CONST(35843.49117099971/8.0), REAL_CONST(35861.838341428367/8.0), REAL_CONST(35880.187858792851/8.0), REAL_CONST(35898.539722492955/8.0), REAL_CONST(35916.893931928862/8.0), REAL_CONST(35935.250486501129/8.0), REAL_CONST(35953.609385610718/8.0), REAL_CONST(35971.970628658957/8.0), REAL_CONST(35990.334215047558/8.0), REAL_CONST(36008.700144178612/8.0), REAL_CONST(36027.068415454596/8.0), REAL_CONST(36045.439028278372/8.0), REAL_CONST(36063.811982053165/8.0), REAL_CONST(36082.187276182609/8.0), REAL_CONST(36100.564910070694/8.0), REAL_CONST(36118.944883121789/8.0), REAL_CONST(36137.327194740654/8.0), REAL_CONST(36155.711844332429/8.0), REAL_CONST(36174.098831302617/8.0), REAL_CONST(36192.488155057115/8.0), REAL_CONST(36210.87981500219/8.0), REAL_CONST(36229.273810544473/8.0), REAL_CONST(36247.670141091003/8.0), REAL_CONST(36266.068806049167/8.0), REAL_CONST(36284.469804826738/8.0), REAL_CONST(36302.873136831862/8.0), REAL_CONST(36321.278801473069/8.0), REAL_CONST(36339.686798159251/8.0), REAL_CONST(36358.097126299683/8.0), REAL_CONST(36376.509785304013/8.0), REAL_CONST(36394.924774582258/8.0), REAL_CONST(36413.342093544816/8.0), REAL_CONST(36431.761741602444/8.0), REAL_CONST(36450.183718166292/8.0), REAL_CONST(36468.608022647859/8.0), REAL_CONST(36487.034654459028/8.0), REAL_CONST(36505.463613012063/8.0), REAL_CONST(36523.894897719583/8.0), REAL_CONST(36542.328507994578/8.0), REAL_CONST(36560.764443250409/8.0), REAL_CONST(36579.202702900831/8.0), REAL_CONST(36597.643286359926/8.0), REAL_CONST(36616.086193042182/8.0), REAL_CONST(36634.531422362437/8.0), REAL_CONST(36652.978973735895/8.0), REAL_CONST(36671.428846578143/8.0), REAL_CONST(36689.881040305125/8.0), REAL_CONST(36708.335554333149/8.0), REAL_CONST(36726.792388078902/8.0), REAL_CONST(36745.251540959427/8.0), REAL_CONST(36763.713012392138/8.0), REAL_CONST(36782.176801794812/8.0), REAL_CONST(36800.642908585593/8.0), REAL_CONST(36819.111332182983/8.0), REAL_CONST(36837.582072005869/8.0), REAL_CONST(36856.055127473483/8.0), REAL_CONST(36874.530498005421/8.0), REAL_CONST(36893.008183021651/8.0), REAL_CONST(36911.488181942506/8.0), REAL_CONST(36929.970494188674/8.0), REAL_CONST(36948.455119181206/8.0), REAL_CONST(36966.942056341519/8.0), REAL_CONST(36985.431305091392/8.0), REAL_CONST(37003.922864852961/8.0), REAL_CONST(37022.416735048733/8.0), REAL_CONST(37040.912915101559/8.0), REAL_CONST(37059.411404434657/8.0), REAL_CONST(37077.91220247162/8.0), REAL_CONST(37096.415308636388/8.0), REAL_CONST(37114.920722353243/8.0), REAL_CONST(37133.428443046862/8.0), REAL_CONST(37151.938470142253/8.0), REAL_CONST(37170.450803064785/8.0), REAL_CONST(37188.965441240209/8.0), REAL_CONST(37207.482384094597/8.0), REAL_CONST(37226.001631054402/8.0), REAL_CONST(37244.523181546429/8.0), REAL_CONST(37263.047034997842/8.0), REAL_CONST(37281.573190836149/8.0), REAL_CONST(37300.101648489224/8.0), REAL_CONST(37318.632407385296/8.0), REAL_CONST(37337.165466952945/8.0), REAL_CONST(37355.700826621112/8.0), REAL_CONST(37374.238485819085/8.0), REAL_CONST(37392.778443976509/8.0), REAL_CONST(37411.320700523385/8.0), REAL_CONST(37429.865254890057/8.0), REAL_CONST(37448.412106507232/8.0), REAL_CONST(37466.961254805974/8.0), REAL_CONST(37485.512699217681/8.0), REAL_CONST(37504.066439174116/8.0), REAL_CONST(37522.622474107404/8.0), REAL_CONST(37541.180803449992/8.0), REAL_CONST(37559.741426634704/8.0), REAL_CONST(37578.304343094693/8.0), REAL_CONST(37596.869552263488/8.0), REAL_CONST(37615.43705357494/8.0), REAL_CONST(37634.006846463279/8.0), REAL_CONST(37652.578930363044/8.0), REAL_CONST(37671.153304709165/8.0), REAL_CONST(37689.729968936896/8.0), REAL_CONST(37708.308922481847/8.0), REAL_CONST(37726.890164779965/8.0), REAL_CONST(37745.473695267559/8.0), REAL_CONST(37764.059513381275/8.0), REAL_CONST(37782.647618558112/8.0), REAL_CONST(37801.238010235415/8.0), REAL_CONST(37819.830687850859/8.0), REAL_CONST(37838.425650842495/8.0), REAL_CONST(37857.022898648691/8.0), REAL_CONST(37875.622430708172/8.0), REAL_CONST(37894.224246460013/8.0), REAL_CONST(37912.828345343616/8.0), REAL_CONST(37931.434726798747/8.0), REAL_CONST(37950.043390265506/8.0), REAL_CONST(37968.654335184328/8.0), REAL_CONST(37987.267560995999/8.0), REAL_CONST(38005.883067141665/8.0), REAL_CONST(38024.500853062775/8.0), REAL_CONST(38043.120918201159/8.0), REAL_CONST(38061.743261998963/8.0), REAL_CONST(38080.367883898682/8.0), REAL_CONST(38098.994783343158/8.0), REAL_CONST(38117.623959775563/8.0), REAL_CONST(38136.255412639417/8.0), REAL_CONST(38154.889141378575/8.0), REAL_CONST(38173.525145437234/8.0), REAL_CONST(38192.163424259939/8.0), REAL_CONST(38210.803977291551/8.0), REAL_CONST(38229.446803977284/8.0), REAL_CONST(38248.091903762703/8.0), REAL_CONST(38266.739276093685/8.0), REAL_CONST(38285.388920416466/8.0), REAL_CONST(38304.040836177606/8.0), REAL_CONST(38322.695022824002/8.0), REAL_CONST(38341.351479802899/8.0), REAL_CONST(38360.010206561863/8.0), REAL_CONST(38378.671202548816/8.0), REAL_CONST(38397.334467211993/8.0), REAL_CONST(38415.999999999978/8.0), REAL_CONST(38434.667800361683/8.0), REAL_CONST(38453.33786774637/8.0), REAL_CONST(38472.010201603611/8.0), REAL_CONST(38490.684801383337/8.0), REAL_CONST(38509.361666535784/8.0), REAL_CONST(38528.040796511552/8.0), REAL_CONST(38546.722190761553/8.0), REAL_CONST(38565.405848737035/8.0), REAL_CONST(38584.091769889594/8.0), REAL_CONST(38602.779953671132/8.0), REAL_CONST(38621.470399533908/8.0), REAL_CONST(38640.163106930493/8.0), REAL_CONST(38658.858075313794/8.0), REAL_CONST(38677.555304137059/8.0), REAL_CONST(38696.254792853862/8.0), REAL_CONST(38714.956540918094/8.0), REAL_CONST(38733.660547783991/8.0), REAL_CONST(38752.366812906112/8.0), REAL_CONST(38771.075335739348/8.0), REAL_CONST(38789.78611573892/8.0), REAL_CONST(38808.499152360368/8.0), REAL_CONST(38827.214445059573/8.0), REAL_CONST(38845.931993292739/8.0), REAL_CONST(38864.651796516388/8.0), REAL_CONST(38883.373854187383/8.0), REAL_CONST(38902.098165762916/8.0), REAL_CONST(38920.824730700486/8.0), REAL_CONST(38939.553548457938/8.0), REAL_CONST(38958.284618493431/8.0), REAL_CONST(38977.017940265461/8.0), REAL_CONST(38995.753513232834/8.0), REAL_CONST(39014.491336854699/8.0), REAL_CONST(39033.231410590517/8.0), REAL_CONST(39051.973733900079/8.0), REAL_CONST(39070.718306243485/8.0), REAL_CONST(39089.465127081188/8.0), REAL_CONST(39108.214195873945/8.0), REAL_CONST(39126.965512082832/8.0), REAL_CONST(39145.719075169261/8.0), REAL_CONST(39164.474884594965/8.0), REAL_CONST(39183.232939821988/8.0), REAL_CONST(39201.99324031271/8.0), REAL_CONST(39220.755785529815/8.0), REAL_CONST(39239.52057493633/8.0), REAL_CONST(39258.287607995589/8.0), REAL_CONST(39277.056884171245/8.0), REAL_CONST(39295.828402927284/8.0), REAL_CONST(39314.602163728006/8.0), REAL_CONST(39333.378166038019/8.0), REAL_CONST(39352.15640932227/8.0), REAL_CONST(39370.936893046004/8.0), REAL_CONST(39389.719616674811/8.0), REAL_CONST(39408.504579674584/8.0), REAL_CONST(39427.291781511522/8.0), REAL_CONST(39446.081221652174/8.0), REAL_CONST(39464.872899563372/8.0), REAL_CONST(39483.666814712291/8.0), REAL_CONST(39502.462966566411/8.0), REAL_CONST(39521.261354593538/8.0), REAL_CONST(39540.06197826178/8.0), REAL_CONST(39558.864837039568/8.0), REAL_CONST(39577.669930395656/8.0), REAL_CONST(39596.47725779911/8.0), REAL_CONST(39615.286818719302/8.0), REAL_CONST(39634.098612625923/8.0), REAL_CONST(39652.912638988993/8.0), REAL_CONST(39671.728897278823/8.0), REAL_CONST(39690.547386966064/8.0), REAL_CONST(39709.368107521652/8.0), REAL_CONST(39728.191058416858/8.0), REAL_CONST(39747.016239123259/8.0), REAL_CONST(39765.84364911275/8.0), REAL_CONST(39784.673287857528/8.0), REAL_CONST(39803.505154830105/8.0), REAL_CONST(39822.339249503319/8.0), REAL_CONST(39841.175571350293/8.0), REAL_CONST(39860.014119844491/8.0), REAL_CONST(39878.854894459677/8.0), REAL_CONST(39897.697894669909/8.0), REAL_CONST(39916.54311994958/8.0), REAL_CONST(39935.390569773372/8.0), REAL_CONST(39954.240243616303/8.0), REAL_CONST(39973.092140953675/8.0), REAL_CONST(39991.946261261117/8.0), REAL_CONST(40010.802604014549/8.0), REAL_CONST(40029.661168690225/8.0), REAL_CONST(40048.521954764678/8.0), REAL_CONST(40067.384961714779/8.0), REAL_CONST(40086.250189017679/8.0), REAL_CONST(40105.117636150855/8.0), REAL_CONST(40123.98730259209/8.0), REAL_CONST(40142.859187819471/8.0), REAL_CONST(40161.733291311379/8.0), REAL_CONST(40180.609612546526/8.0), REAL_CONST(40199.488151003912/8.0), REAL_CONST(40218.368906162854/8.0), REAL_CONST(40237.25187750296/8.0), REAL_CONST(40256.137064504153/8.0), REAL_CONST(40275.024466646668/8.0), REAL_CONST(40293.914083411029/8.0), REAL_CONST(40312.805914278084/8.0), REAL_CONST(40331.699958728961/8.0), REAL_CONST(40350.596216245103/8.0), REAL_CONST(40369.494686308273/8.0), REAL_CONST(40388.39536840051/8.0), REAL_CONST(40407.298262004173/8.0), REAL_CONST(40426.20336660192/8.0), REAL_CONST(40445.110681676706/8.0), REAL_CONST(40464.020206711793/8.0), REAL_CONST(40482.931941190756/8.0), REAL_CONST(40501.845884597446/8.0), REAL_CONST(40520.762036416032/8.0), REAL_CONST(40539.680396130985/8.0), REAL_CONST(40558.600963227072/8.0), REAL_CONST(40577.523737189367/8.0), REAL_CONST(40596.448717503234/8.0), REAL_CONST(40615.375903654342/8.0), REAL_CONST(40634.305295128659/8.0), REAL_CONST(40653.236891412453/8.0), REAL_CONST(40672.170691992294/8.0), REAL_CONST(40691.106696355047/8.0), REAL_CONST(40710.044903987873/8.0), REAL_CONST(40728.985314378238/8.0), REAL_CONST(40747.927927013901/8.0), REAL_CONST(40766.872741382918/8.0), REAL_CONST(40785.819756973651/8.0), REAL_CONST(40804.768973274746/8.0), REAL_CONST(40823.720389775161/8.0), REAL_CONST(40842.674005964131/8.0), REAL_CONST(40861.629821331211/8.0), REAL_CONST(40880.587835366234/8.0), REAL_CONST(40899.548047559321/8.0), REAL_CONST(40918.510457400931/8.0), REAL_CONST(40937.475064381761/8.0), REAL_CONST(40956.441867992849/8.0), REAL_CONST(40975.410867725499/8.0), REAL_CONST(40994.382063071331/8.0), REAL_CONST(41013.355453522236/8.0), REAL_CONST(41032.331038570417/8.0), REAL_CONST(41051.308817708363/8.0), REAL_CONST(41070.288790428858/8.0), REAL_CONST(41089.270956224987/8.0), REAL_CONST(41108.255314590111/8.0), REAL_CONST(41127.241865017888/8.0), REAL_CONST(41146.23060700229/8.0), REAL_CONST(41165.221540037543/8.0), REAL_CONST(41184.214663618193/8.0), REAL_CONST(41203.209977239079/8.0), REAL_CONST(41222.207480395307/8.0), REAL_CONST(41241.207172582297/8.0), REAL_CONST(41260.209053295752/8.0), REAL_CONST(41279.213122031659/8.0), REAL_CONST(41298.219378286303/8.0), REAL_CONST(41317.227821556255/8.0), REAL_CONST(41336.23845133838/8.0), REAL_CONST(41355.251267129832/8.0), REAL_CONST(41374.266268428037/8.0), REAL_CONST(41393.283454730743/8.0), REAL_CONST(41412.302825535953/8.0), REAL_CONST(41431.324380341983/8.0), REAL_CONST(41450.348118647416/8.0), REAL_CONST(41469.374039951144/8.0), REAL_CONST(41488.402143752326/8.0), REAL_CONST(41507.432429550427/8.0), REAL_CONST(41526.464896845187/8.0), REAL_CONST(41545.499545136627/8.0), REAL_CONST(41564.536373925075/8.0), REAL_CONST(41583.575382711126/8.0), REAL_CONST(41602.616570995662/8.0), REAL_CONST(41621.659938279874/8.0), REAL_CONST(41640.705484065205/8.0), REAL_CONST(41659.753207853406/8.0), REAL_CONST(41678.803109146495/8.0), REAL_CONST(41697.855187446803/8.0), REAL_CONST(41716.909442256911/8.0), REAL_CONST(41735.965873079709/8.0), REAL_CONST(41755.02447941836/8.0), REAL_CONST(41774.085260776315/8.0), REAL_CONST(41793.148216657297/8.0), REAL_CONST(41812.213346565331/8.0), REAL_CONST(41831.280650004708/8.0), REAL_CONST(41850.350126480014/8.0), REAL_CONST(41869.421775496106/8.0), REAL_CONST(41888.495596558132/8.0), REAL_CONST(41907.571589171515/8.0), REAL_CONST(41926.649752841957/8.0), REAL_CONST(41945.730087075463/8.0), REAL_CONST(41964.812591378286/8.0), REAL_CONST(41983.897265256979/8.0), REAL_CONST(42002.984108218378/8.0), REAL_CONST(42022.073119769593/8.0), REAL_CONST(42041.164299418015/8.0), REAL_CONST(42060.257646671307/8.0), REAL_CONST(42079.353161037419/8.0), REAL_CONST(42098.450842024591/8.0), REAL_CONST(42117.550689141324/8.0), REAL_CONST(42136.652701896404/8.0), REAL_CONST(42155.756879798893/8.0), REAL_CONST(42174.863222358137/8.0), REAL_CONST(42193.971729083758/8.0), REAL_CONST(42213.082399485655/8.0), REAL_CONST(42232.195233074002/8.0), REAL_CONST(42251.310229359246/8.0), REAL_CONST(42270.427387852127/8.0), REAL_CONST(42289.546708063644/8.0), REAL_CONST(42308.668189505079/8.0), REAL_CONST(42327.791831687995/8.0), REAL_CONST(42346.917634124227/8.0), REAL_CONST(42366.045596325886/8.0), REAL_CONST(42385.175717805352/8.0), REAL_CONST(42404.307998075295/8.0), REAL_CONST(42423.442436648642/8.0), REAL_CONST(42442.579033038608/8.0), REAL_CONST(42461.717786758672/8.0), REAL_CONST(42480.858697322597/8.0), REAL_CONST(42500.001764244422/8.0), REAL_CONST(42519.146987038446/8.0), REAL_CONST(42538.294365219248/8.0), REAL_CONST(42557.443898301688/8.0), REAL_CONST(42576.595585800882/8.0), REAL_CONST(42595.749427232236/8.0), REAL_CONST(42614.90542211142/8.0), REAL_CONST(42634.063569954378/8.0), REAL_CONST(42653.223870277317/8.0), REAL_CONST(42672.386322596729/8.0), REAL_CONST(42691.55092642938/8.0), REAL_CONST(42710.717681292292/8.0), REAL_CONST(42729.886586702756/8.0), REAL_CONST(42749.057642178363/8.0), REAL_CONST(42768.23084723694/8.0), REAL_CONST(42787.406201396603/8.0), REAL_CONST(42806.58370417574/8.0), REAL_CONST(42825.76335509299/8.0), REAL_CONST(42844.945153667286/8.0), REAL_CONST(42864.129099417805/8.0), REAL_CONST(42883.315191864014/8.0), REAL_CONST(42902.503430525649/8.0), REAL_CONST(42921.693814922692/8.0), REAL_CONST(42940.88634457541/8.0), REAL_CONST(42960.081019004348/8.0), REAL_CONST(42979.277837730297/8.0), REAL_CONST(42998.476800274322/8.0), REAL_CONST(43017.677906157769/8.0), REAL_CONST(43036.881154902228/8.0), REAL_CONST(43056.086546029583/8.0), REAL_CONST(43075.294079061961/8.0), REAL_CONST(43094.503753521763/8.0), REAL_CONST(43113.715568931671/8.0), REAL_CONST(43132.929524814601/8.0), REAL_CONST(43152.145620693766/8.0), REAL_CONST(43171.363856092619/8.0), REAL_CONST(43190.584230534907/8.0), REAL_CONST(43209.806743544621/8.0), REAL_CONST(43229.031394646016/8.0), REAL_CONST(43248.258183363621/8.0), REAL_CONST(43267.487109222224/8.0), REAL_CONST(43286.718171746885/8.0), REAL_CONST(43305.951370462906/8.0), REAL_CONST(43325.186704895881/8.0), REAL_CONST(43344.42417457165/8.0), REAL_CONST(43363.663779016322/8.0), REAL_CONST(43382.905517756262/8.0), REAL_CONST(43402.149390318104/8.0), REAL_CONST(43421.395396228749/8.0), REAL_CONST(43440.643535015348/8.0), REAL_CONST(43459.89380620532/8.0), REAL_CONST(43479.146209326354/8.0), REAL_CONST(43498.400743906379/8.0), REAL_CONST(43517.657409473606/8.0), REAL_CONST(43536.916205556496/8.0), REAL_CONST(43556.177131683784/8.0), REAL_CONST(43575.44018738444/8.0), REAL_CONST(43594.705372187724/8.0), REAL_CONST(43613.972685623135/8.0), REAL_CONST(43633.242127220445/8.0), REAL_CONST(43652.513696509668/8.0), REAL_CONST(43671.787393021099/8.0), REAL_CONST(43691.063216285271/8.0), REAL_CONST(43710.341165833001/8.0), REAL_CONST(43729.621241195346/8.0), REAL_CONST(43748.903441903625/8.0), REAL_CONST(43768.187767489413/8.0), REAL_CONST(43787.474217484552/8.0), REAL_CONST(43806.762791421126/8.0), REAL_CONST(43826.053488831501/8.0), REAL_CONST(43845.346309248278/8.0), REAL_CONST(43864.641252204325/8.0), REAL_CONST(43883.938317232765/8.0), REAL_CONST(43903.237503866971/8.0), REAL_CONST(43922.538811640596/8.0), REAL_CONST(43941.842240087513/8.0), REAL_CONST(43961.147788741881/8.0), REAL_CONST(43980.455457138101/8.0), REAL_CONST(43999.765244810835/8.0), REAL_CONST(44019.077151295001/8.0), REAL_CONST(44038.391176125755/8.0), REAL_CONST(44057.70731883854/8.0), REAL_CONST(44077.02557896902/8.0), REAL_CONST(44096.345956053141/8.0), REAL_CONST(44115.668449627083/8.0), REAL_CONST(44134.993059227287/8.0), REAL_CONST(44154.319784390456/8.0), REAL_CONST(44173.648624653535/8.0), REAL_CONST(44192.979579553728/8.0), REAL_CONST(44212.312648628489/8.0), REAL_CONST(44231.647831415532/8.0), REAL_CONST(44250.985127452805/8.0), REAL_CONST(44270.324536278538/8.0), REAL_CONST(44289.666057431183/8.0), REAL_CONST(44309.009690449464/8.0), REAL_CONST(44328.355434872348/8.0), REAL_CONST(44347.703290239064/8.0), REAL_CONST(44367.053256089079/8.0), REAL_CONST(44386.405331962109/8.0), REAL_CONST(44405.759517398139/8.0), REAL_CONST(44425.115811937387/8.0), REAL_CONST(44444.474215120332/8.0), REAL_CONST(44463.834726487694/8.0), REAL_CONST(44483.197345580462/8.0), REAL_CONST(44502.562071939843/8.0), REAL_CONST(44521.928905107328/8.0), REAL_CONST(44541.297844624634/8.0), REAL_CONST(44560.668890033732/8.0), REAL_CONST(44580.042040876848/8.0), REAL_CONST(44599.417296696454/8.0), REAL_CONST(44618.794657035272/8.0), REAL_CONST(44638.174121436256/8.0), REAL_CONST(44657.555689442641/8.0), REAL_CONST(44676.939360597877/8.0), REAL_CONST(44696.325134445673/8.0), REAL_CONST(44715.713010530002/8.0), REAL_CONST(44735.102988395054/8.0), REAL_CONST(44754.495067585296/8.0), REAL_CONST(44773.88924764542/8.0), REAL_CONST(44793.285528120374/8.0), REAL_CONST(44812.683908555344/8.0), REAL_CONST(44832.084388495779/8.0), REAL_CONST(44851.486967487363/8.0), REAL_CONST(44870.891645076015/8.0), REAL_CONST(44890.298420807922/8.0), REAL_CONST(44909.707294229491/8.0), REAL_CONST(44929.118264887409/8.0), REAL_CONST(44948.531332328566/8.0), REAL_CONST(44967.946496100136/8.0), REAL_CONST(44987.363755749502/8.0), REAL_CONST(45006.783110824319/8.0), REAL_CONST(45026.204560872473/8.0), REAL_CONST(45045.628105442098/8.0), REAL_CONST(45065.053744081561/8.0), REAL_CONST(45084.48147633949/8.0), REAL_CONST(45103.911301764747/8.0), REAL_CONST(45123.343219906426/8.0), REAL_CONST(45142.777230313885/8.0), REAL_CONST(45162.21333253671/8.0), REAL_CONST(45181.651526124733/8.0), REAL_CONST(45201.091810628037/8.0), REAL_CONST(45220.534185596924/8.0), REAL_CONST(45239.978650581965/8.0), REAL_CONST(45259.425205133957/8.0), REAL_CONST(45278.873848803938/8.0), REAL_CONST(45298.324581143192/8.0), REAL_CONST(45317.777401703235/8.0), REAL_CONST(45337.232310035848/8.0), REAL_CONST(45356.68930569302/8.0), REAL_CONST(45376.148388226997/8.0), REAL_CONST(45395.60955719027/8.0), REAL_CONST(45415.072812135557/8.0), REAL_CONST(45434.538152615823/8.0), REAL_CONST(45454.005578184282/8.0), REAL_CONST(45473.475088394356/8.0), REAL_CONST(45492.946682799746/8.0), REAL_CONST(45512.420360954362/8.0), REAL_CONST(45531.896122412363/8.0), REAL_CONST(45551.373966728155/8.0), REAL_CONST(45570.853893456362/8.0), REAL_CONST(45590.33590215187/8.0), REAL_CONST(45609.819992369776/8.0), REAL_CONST(45629.306163665438/8.0), REAL_CONST(45648.794415594442/8.0), REAL_CONST(45668.284747712612/8.0), REAL_CONST(45687.777159576006/8.0), REAL_CONST(45707.27165074092/8.0), REAL_CONST(45726.768220763894/8.0), REAL_CONST(45746.266869201696/8.0), REAL_CONST(45765.767595611323/8.0), REAL_CONST(45785.270399550034/8.0), REAL_CONST(45804.775280575297/8.0), REAL_CONST(45824.282238244828/8.0), REAL_CONST(45843.79127211657/8.0), REAL_CONST(45863.302381748719/8.0), REAL_CONST(45882.815566699683/8.0), REAL_CONST(45902.33082652813/8.0), REAL_CONST(45921.848160792935/8.0), REAL_CONST(45941.367569053225/8.0), REAL_CONST(45960.889050868354/8.0), REAL_CONST(45980.41260579793/8.0), REAL_CONST(45999.938233401757/8.0), REAL_CONST(46019.465933239902/8.0), REAL_CONST(46038.995704872657/8.0), REAL_CONST(46058.527547860547/8.0), REAL_CONST(46078.06146176433/8.0), REAL_CONST(46097.597446144995/8.0), REAL_CONST(46117.135500563774/8.0), REAL_CONST(46136.675624582109/8.0), REAL_CONST(46156.217817761702/8.0), REAL_CONST(46175.762079664462/8.0), REAL_CONST(46195.308409852543/8.0), REAL_CONST(46214.856807888333/8.0), REAL_CONST(46234.407273334444/8.0), REAL_CONST(46253.959805753715/8.0), REAL_CONST(46273.51440470924/8.0), REAL_CONST(46293.071069764315/8.0), REAL_CONST(46312.629800482478/8.0), REAL_CONST(46332.190596427499/8.0), REAL_CONST(46351.753457163381/8.0), REAL_CONST(46371.318382254351/8.0), REAL_CONST(46390.885371264863/8.0), REAL_CONST(46410.45442375962/8.0), REAL_CONST(46430.025539303526/8.0), REAL_CONST(46449.598717461733/8.0), REAL_CONST(46469.17395779962/8.0), REAL_CONST(46488.751259882782/8.0), REAL_CONST(46508.33062327707/8.0), REAL_CONST(46527.912047548532/8.0), REAL_CONST(46547.495532263471/8.0), REAL_CONST(46567.081076988397/8.0), REAL_CONST(46586.668681290059/8.0), REAL_CONST(46606.258344735434/8.0), REAL_CONST(46625.850066891719/8.0), REAL_CONST(46645.443847326351/8.0), REAL_CONST(46665.039685606986/8.0), REAL_CONST(46684.637581301497/8.0), REAL_CONST(46704.237533978005/8.0), REAL_CONST(46723.839543204842/8.0), REAL_CONST(46743.443608550573/8.0), REAL_CONST(46763.049729583989/8.0), REAL_CONST(46782.657905874104/8.0), REAL_CONST(46802.268136990162/8.0), REAL_CONST(46821.880422501628/8.0), REAL_CONST(46841.494761978196/8.0), REAL_CONST(46861.111154989776/8.0), REAL_CONST(46880.729601106526/8.0), REAL_CONST(46900.350099898795/8.0), REAL_CONST(46919.97265093719/8.0), REAL_CONST(46939.597253792526/8.0), REAL_CONST(46959.223908035841/8.0), REAL_CONST(46978.852613238392/8.0), REAL_CONST(46998.483368971691/8.0), REAL_CONST(47018.11617480743/8.0), REAL_CONST(47037.751030317551/8.0), REAL_CONST(47057.387935074221/8.0), REAL_CONST(47077.026888649809/8.0), REAL_CONST(47096.66789061694/8.0), REAL_CONST(47116.310940548428/8.0), REAL_CONST(47135.956038017328/8.0), REAL_CONST(47155.603182596918/8.0), REAL_CONST(47175.252373860698/8.0), REAL_CONST(47194.903611382375/8.0), REAL_CONST(47214.556894735892/8.0), REAL_CONST(47234.212223495422/8.0), REAL_CONST(47253.869597235338/8.0), REAL_CONST(47273.52901553025/8.0), REAL_CONST(47293.19047795498/8.0), REAL_CONST(47312.853984084577/8.0), REAL_CONST(47332.519533494306/8.0), REAL_CONST(47352.187125759658/8.0), REAL_CONST(47371.856760456343/8.0), REAL_CONST(47391.528437160297/8.0), REAL_CONST(47411.202155447652/8.0), REAL_CONST(47430.877914894787/8.0), REAL_CONST(47450.555715078299/8.0), REAL_CONST(47470.235555574982/8.0), REAL_CONST(47489.917435961863/8.0), REAL_CONST(47509.601355816201/8.0), REAL_CONST(47529.287314715453/8.0), REAL_CONST(47548.975312237308/8.0), REAL_CONST(47568.665347959672/8.0), REAL_CONST(47588.357421460656/8.0), REAL_CONST(47608.051532318605/8.0), REAL_CONST(47627.747680112072/8.0), REAL_CONST(47647.445864419846/8.0), REAL_CONST(47667.14608482091/8.0), REAL_CONST(47686.848340894474/8.0), REAL_CONST(47706.552632219973/8.0), REAL_CONST(47726.258958377046/8.0), REAL_CONST(47745.967318945557/8.0), REAL_CONST(47765.677713505589/8.0), REAL_CONST(47785.390141637428/8.0), REAL_CONST(47805.104602921601/8.0), REAL_CONST(47824.821096938824/8.0), REAL_CONST(47844.539623270044/8.0), REAL_CONST(47864.260181496429/8.0), REAL_CONST(47883.982771199349/8.0), REAL_CONST(47903.707391960394/8.0), REAL_CONST(47923.434043361369/8.0), REAL_CONST(47943.162724984308/8.0), REAL_CONST(47962.893436411439/8.0), REAL_CONST(47982.626177225218/8.0), REAL_CONST(48002.36094700831/8.0), REAL_CONST(48022.097745343599/8.0), REAL_CONST(48041.836571814172/8.0), REAL_CONST(48061.57742600335/8.0), REAL_CONST(48081.32030749465/8.0), REAL_CONST(48101.065215871815/8.0), REAL_CONST(48120.81215071879/8.0), REAL_CONST(48140.56111161974/8.0), REAL_CONST(48160.312098159047/8.0), REAL_CONST(48180.065109921306/8.0), REAL_CONST(48199.820146491307/8.0), REAL_CONST(48219.577207454073/8.0), REAL_CONST(48239.336292394844/8.0), REAL_CONST(48259.097400899045/8.0), REAL_CONST(48278.860532552339/8.0), REAL_CONST(48298.625686940592/8.0), REAL_CONST(48318.392863649875/8.0), REAL_CONST(48338.162062266485/8.0), REAL_CONST(48357.933282376915/8.0), REAL_CONST(48377.706523567889/8.0), REAL_CONST(48397.481785426316/8.0), REAL_CONST(48417.259067539344/8.0), REAL_CONST(48437.038369494308/8.0), REAL_CONST(48456.819690878765/8.0), REAL_CONST(48476.603031280487/8.0), REAL_CONST(48496.388390287451/8.0), REAL_CONST(48516.175767487839/8.0), REAL_CONST(48535.965162470042/8.0), REAL_CONST(48555.756574822684/8.0), REAL_CONST(48575.550004134566/8.0), REAL_CONST(48595.345449994718/8.0), REAL_CONST(48615.142911992378/8.0), REAL_CONST(48634.942389716991/8.0), REAL_CONST(48654.743882758201/8.0), REAL_CONST(48674.547390705877/8.0), REAL_CONST(48694.352913150084/8.0), REAL_CONST(48714.160449681112/8.0), REAL_CONST(48733.969999889443/8.0), REAL_CONST(48753.781563365759/8.0), REAL_CONST(48773.595139700978/8.0), REAL_CONST(48793.410728486211/8.0), REAL_CONST(48813.228329312769/8.0), REAL_CONST(48833.047941772187/8.0), REAL_CONST(48852.869565456189/8.0), REAL_CONST(48872.693199956717/8.0), REAL_CONST(48892.518844865925/8.0), REAL_CONST(48912.346499776155/8.0), REAL_CONST(48932.176164279976/8.0), REAL_CONST(48952.007837970152/8.0), REAL_CONST(48971.841520439666/8.0), REAL_CONST(48991.677211281676/8.0), REAL_CONST(49011.514910089587/8.0), REAL_CONST(49031.354616456978/8.0), REAL_CONST(49051.196329977654/8.0), REAL_CONST(49071.04005024561/8.0), REAL_CONST(49090.885776855059/8.0), REAL_CONST(49110.733509400408/8.0), REAL_CONST(49130.583247476279/8.0), REAL_CONST(49150.434990677488/8.0), REAL_CONST(49170.288738599062/8.0), REAL_CONST(49190.144490836232/8.0), REAL_CONST(49210.002246984441/8.0), REAL_CONST(49229.86200663932/8.0), REAL_CONST(49249.723769396718/8.0), REAL_CONST(49269.587534852675/8.0), REAL_CONST(49289.453302603448/8.0), REAL_CONST(49309.32107224549/8.0), REAL_CONST(49329.190843375451/8.0), REAL_CONST(49349.062615590192/8.0), REAL_CONST(49368.936388486785/8.0), REAL_CONST(49388.812161662492/8.0), REAL_CONST(49408.689934714785/8.0), REAL_CONST(49428.569707241324/8.0), REAL_CONST(49448.45147883999/8.0), REAL_CONST(49468.335249108866/8.0), REAL_CONST(49488.22101764621/8.0), REAL_CONST(49508.108784050521/8.0), REAL_CONST(49527.99854792047/8.0), REAL_CONST(49547.890308854934/8.0), REAL_CONST(49567.784066453009/8.0), REAL_CONST(49587.679820313977/8.0), REAL_CONST(49607.57757003732/8.0), REAL_CONST(49627.477315222721/8.0), REAL_CONST(49647.379055470075/8.0), REAL_CONST(49667.28279037946/8.0), REAL_CONST(49687.188519551179/8.0), REAL_CONST(49707.096242585707/8.0), REAL_CONST(49727.005959083741/8.0), REAL_CONST(49746.917668646165/8.0), REAL_CONST(49766.831370874068/8.0), REAL_CONST(49786.747065368734/8.0), REAL_CONST(49806.66475173166/8.0), REAL_CONST(49826.584429564515/8.0), REAL_CONST(49846.506098469203/8.0), REAL_CONST(49866.429758047794/8.0), REAL_CONST(49886.355407902578/8.0), REAL_CONST(49906.283047636032/8.0), REAL_CONST(49926.212676850846/8.0), REAL_CONST(49946.144295149883/8.0), REAL_CONST(49966.077902136225/8.0), REAL_CONST(49986.013497413151/8.0), REAL_CONST(50005.951080584135/8.0), REAL_CONST(50025.890651252834/8.0), REAL_CONST(50045.832209023123/8.0), REAL_CONST(50065.775753499074/8.0), REAL_CONST(50085.721284284933/8.0), REAL_CONST(50105.668800985164/8.0), REAL_CONST(50125.618303204428/8.0), REAL_CONST(50145.569790547575/8.0), REAL_CONST(50165.523262619652/8.0), REAL_CONST(50185.478719025901/8.0), REAL_CONST(50205.436159371769/8.0), REAL_CONST(50225.395583262893/8.0), REAL_CONST(50245.356990305103/8.0), REAL_CONST(50265.320380104429/8.0), REAL_CONST(50285.285752267104/8.0), REAL_CONST(50305.253106399534/8.0), REAL_CONST(50325.222442108337/8.0), REAL_CONST(50345.193759000336/8.0), REAL_CONST(50365.16705668252/8.0), REAL_CONST(50385.142334762102/8.0), REAL_CONST(50405.119592846473/8.0), REAL_CONST(50425.098830543218/8.0), REAL_CONST(50445.080047460127/8.0), REAL_CONST(50465.063243205179/8.0), REAL_CONST(50485.048417386541/8.0), REAL_CONST(50505.035569612577/8.0), REAL_CONST(50525.024699491856/8.0), REAL_CONST(50545.015806633128/8.0), REAL_CONST(50565.008890645338/8.0), REAL_CONST(50585.003951137631/8.0), REAL_CONST(50605.00098771933/8.0), REAL_CONST(50624.999999999971/8.0), REAL_CONST(50645.000987589265/8.0), REAL_CONST(50665.003950097132/8.0), REAL_CONST(50685.008887133677/8.0), REAL_CONST(50705.015798309192/8.0), REAL_CONST(50725.024683234165/8.0), REAL_CONST(50745.035541519283/8.0), REAL_CONST(50765.048372775411/8.0), REAL_CONST(50785.063176613621/8.0), REAL_CONST(50805.079952645159/8.0), REAL_CONST(50825.098700481489/8.0), REAL_CONST(50845.119419734241/8.0), REAL_CONST(50865.142110015244/8.0), REAL_CONST(50885.166770936521/8.0), REAL_CONST(50905.193402110279/8.0), REAL_CONST(50925.222003148934/8.0), REAL_CONST(50945.252573665071/8.0), REAL_CONST(50965.285113271471/8.0), REAL_CONST(50985.319621581119/8.0), REAL_CONST(51005.356098207172/8.0), REAL_CONST(51025.394542762981/8.0), REAL_CONST(51045.434954862096/8.0), REAL_CONST(51065.477334118244/8.0), REAL_CONST(51085.521680145357/8.0), REAL_CONST(51105.567992557546/8.0), REAL_CONST(51125.616270969113/8.0), REAL_CONST(51145.66651499454/8.0), REAL_CONST(51165.718724248516/8.0), REAL_CONST(51185.772898345916/8.0), REAL_CONST(51205.829036901778/8.0), REAL_CONST(51225.887139531362/8.0), REAL_CONST(51245.947205850105/8.0), REAL_CONST(51266.009235473619/8.0), REAL_CONST(51286.073228017718/8.0), REAL_CONST(51306.139183098399/8.0), REAL_CONST(51326.207100331856/8.0), REAL_CONST(51346.276979334456/8.0), REAL_CONST(51366.348819722756/8.0), REAL_CONST(51386.42262111351/8.0), REAL_CONST(51406.498383123653/8.0), REAL_CONST(51426.57610537031/8.0), REAL_CONST(51446.655787470787/8.0), REAL_CONST(51466.737429042587/8.0), REAL_CONST(51486.82102970338/8.0), REAL_CONST(51506.906589071048/8.0), REAL_CONST(51526.994106763632/8.0), REAL_CONST(51547.083582399391/8.0), REAL_CONST(51567.175015596738/8.0), REAL_CONST(51587.268405974297/8.0), REAL_CONST(51607.363753150858/8.0), REAL_CONST(51627.461056745415/8.0), REAL_CONST(51647.56031637713/8.0), REAL_CONST(51667.661531665362/8.0), REAL_CONST(51687.764702229651/8.0), REAL_CONST(51707.869827689727/8.0), REAL_CONST(51727.976907665499/8.0), REAL_CONST(51748.085941777055/8.0), REAL_CONST(51768.196929644677/8.0), REAL_CONST(51788.309870888836/8.0), REAL_CONST(51808.42476513017/8.0), REAL_CONST(51828.541611989524/8.0), REAL_CONST(51848.660411087905/8.0), REAL_CONST(51868.781162046515/8.0), REAL_CONST(51888.90386448674/8.0), REAL_CONST(51909.028518030143/8.0), REAL_CONST(51929.155122298485/8.0), REAL_CONST(51949.283676913685/8.0), REAL_CONST(51969.414181497872/8.0), REAL_CONST(51989.546635673345/8.0), REAL_CONST(52009.681039062583/8.0), REAL_CONST(52029.817391288263/8.0), REAL_CONST(52049.955691973213/8.0), REAL_CONST(52070.095940740481/8.0), REAL_CONST(52090.238137213273/8.0), REAL_CONST(52110.382281014987/8.0), REAL_CONST(52130.5283717692/8.0), REAL_CONST(52150.676409099666/8.0), REAL_CONST(52170.826392630333/8.0), REAL_CONST(52190.97832198532/8.0), REAL_CONST(52211.132196788931/8.0), REAL_CONST(52231.288016665654/8.0), REAL_CONST(52251.445781240145/8.0), REAL_CONST(52271.60549013727/8.0), REAL_CONST(52291.76714298204/8.0), REAL_CONST(52311.930739399664/8.0), REAL_CONST(52332.096279015546/8.0), REAL_CONST(52352.263761455244/8.0), REAL_CONST(52372.433186344519/8.0), REAL_CONST(52392.604553309284/8.0), REAL_CONST(52412.777861975665/8.0), REAL_CONST(52432.953111969946/8.0), REAL_CONST(52453.130302918595/8.0), REAL_CONST(52473.309434448267/8.0), REAL_CONST(52493.490506185793/8.0), REAL_CONST(52513.67351775818/8.0), REAL_CONST(52533.858468792605/8.0), REAL_CONST(52554.045358916446/8.0), REAL_CONST(52574.234187757254/8.0), REAL_CONST(52594.42495494274/8.0), REAL_CONST(52614.617660100812/8.0), REAL_CONST(52634.812302859558/8.0), REAL_CONST(52655.008882847229/8.0), REAL_CONST(52675.20739969227/8.0), REAL_CONST(52695.407853023295/8.0), REAL_CONST(52715.610242469098/8.0), REAL_CONST(52735.814567658657/8.0), REAL_CONST(52756.02082822111/8.0), REAL_CONST(52776.229023785803/8.0), REAL_CONST(52796.439153982225/8.0), REAL_CONST(52816.651218440056/8.0), REAL_CONST(52836.865216789171/8.0), REAL_CONST(52857.081148659599/8.0), REAL_CONST(52877.29901368155/8.0), REAL_CONST(52897.518811485425/8.0), REAL_CONST(52917.740541701773/8.0), REAL_CONST(52937.964203961354/8.0), REAL_CONST(52958.18979789508/8.0), REAL_CONST(52978.417323134046/8.0), REAL_CONST(52998.646779309529/8.0), REAL_CONST(53018.878166052978/8.0), REAL_CONST(53039.111482996006/8.0), REAL_CONST(53059.346729770419/8.0), REAL_CONST(53079.583906008193/8.0), REAL_CONST(53099.823011341483/8.0), REAL_CONST(53120.0640454026/8.0), REAL_CONST(53140.307007824063/8.0), REAL_CONST(53160.551898238533/8.0), REAL_CONST(53180.79871627887/8.0), REAL_CONST(53201.047461578091/8.0), REAL_CONST(53221.2981337694/8.0), REAL_CONST(53241.550732486176/8.0), REAL_CONST(53261.805257361964/8.0), REAL_CONST(53282.061708030487/8.0), REAL_CONST(53302.32008412564/8.0), REAL_CONST(53322.580385281493/8.0), REAL_CONST(53342.842611132299/8.0), REAL_CONST(53363.106761312469/8.0), REAL_CONST(53383.372835456597/8.0), REAL_CONST(53403.640833199453/8.0), REAL_CONST(53423.910754175973/8.0), REAL_CONST(53444.18259802126/8.0), REAL_CONST(53464.456364370613/8.0), REAL_CONST(53484.732052859479/8.0), REAL_CONST(53505.009663123499/8.0), REAL_CONST(53525.289194798468/8.0), REAL_CONST(53545.570647520362/8.0), REAL_CONST(53565.854020925333/8.0), REAL_CONST(53586.139314649699/8.0), REAL_CONST(53606.426528329954/8.0), REAL_CONST(53626.715661602764/8.0), REAL_CONST(53647.006714104959/8.0), REAL_CONST(53667.299685473547/8.0), REAL_CONST(53687.59457534572/8.0), REAL_CONST(53707.891383358816/8.0), REAL_CONST(53728.190109150361/8.0), REAL_CONST(53748.490752358055/8.0), REAL_CONST(53768.793312619753/8.0), REAL_CONST(53789.09778957349/8.0), REAL_CONST(53809.404182857485/8.0), REAL_CONST(53829.712492110106/8.0), REAL_CONST(53850.022716969899/8.0), REAL_CONST(53870.334857075584/8.0), REAL_CONST(53890.648912066055/8.0), REAL_CONST(53910.964881580367/8.0), REAL_CONST(53931.28276525774/8.0), REAL_CONST(53951.602562737586/8.0), REAL_CONST(53971.924273659461/8.0), REAL_CONST(53992.24789766311/8.0), REAL_CONST(54012.57343438844/8.0), REAL_CONST(54032.90088347553/8.0), REAL_CONST(54053.23024456462/8.0), REAL_CONST(54073.561517296133/8.0), REAL_CONST(54093.894701310644/8.0), REAL_CONST(54114.22979624891/8.0), REAL_CONST(54134.566801751855/8.0), REAL_CONST(54154.90571746057/8.0), REAL_CONST(54175.246543016314/8.0), REAL_CONST(54195.589278060506/8.0), REAL_CONST(54215.933922234755/8.0), REAL_CONST(54236.280475180814/8.0), REAL_CONST(54256.628936540626/8.0), REAL_CONST(54276.97930595628/8.0), REAL_CONST(54297.331583070045/8.0), REAL_CONST(54317.685767524359/8.0), REAL_CONST(54338.041858961828/8.0), REAL_CONST(54358.399857025215/8.0), REAL_CONST(54378.759761357462/8.0), REAL_CONST(54399.121571601667/8.0), REAL_CONST(54419.485287401105/8.0), REAL_CONST(54439.850908399218/8.0), REAL_CONST(54460.218434239614/8.0), REAL_CONST(54480.587864566056/8.0), REAL_CONST(54500.95919902248/8.0), REAL_CONST(54521.332437252997/8.0), REAL_CONST(54541.707578901878/8.0), REAL_CONST(54562.084623613555/8.0), REAL_CONST(54582.46357103264/8.0), REAL_CONST(54602.844420803893/8.0), REAL_CONST(54623.227172572246/8.0), REAL_CONST(54643.611825982807/8.0), REAL_CONST(54663.998380680838/8.0), REAL_CONST(54684.386836311773/8.0), REAL_CONST(54704.777192521207/8.0), REAL_CONST(54725.169448954897/8.0), REAL_CONST(54745.563605258772/8.0), REAL_CONST(54765.959661078923/8.0), REAL_CONST(54786.357616061614/8.0), REAL_CONST(54806.757469853255/8.0), REAL_CONST(54827.159222100439/8.0), REAL_CONST(54847.562872449904/8.0), REAL_CONST(54867.968420548583/8.0), REAL_CONST(54888.375866043534/8.0), REAL_CONST(54908.785208582012/8.0), REAL_CONST(54929.196447811417/8.0), REAL_CONST(54949.609583379322/8.0), REAL_CONST(54970.024614933463/8.0), REAL_CONST(54990.441542121727/8.0), REAL_CONST(55010.86036459219/8.0), REAL_CONST(55031.28108199306/8.0), REAL_CONST(55051.703693972733/8.0), REAL_CONST(55072.128200179759/8.0), REAL_CONST(55092.554600262847/8.0), REAL_CONST(55112.982893870874/8.0), REAL_CONST(55133.413080652877/8.0), REAL_CONST(55153.845160258061/8.0), REAL_CONST(55174.279132335789/8.0), REAL_CONST(55194.714996535586/8.0), REAL_CONST(55215.152752507143/8.0), REAL_CONST(55235.592399900306/8.0), REAL_CONST(55256.033938365079/8.0), REAL_CONST(55276.477367551655/8.0), REAL_CONST(55296.92268711036/8.0), REAL_CONST(55317.369896691685/8.0), REAL_CONST(55337.818995946305/8.0), REAL_CONST(55358.269984525024/8.0), REAL_CONST(55378.72286207883/8.0), REAL_CONST(55399.177628258869/8.0), REAL_CONST(55419.634282716441/8.0), REAL_CONST(55440.092825103013/8.0), REAL_CONST(55460.553255070205/8.0), REAL_CONST(55481.015572269804/8.0), REAL_CONST(55501.479776353764/8.0), REAL_CONST(55521.945866974187/8.0), REAL_CONST(55542.413843783339/8.0), REAL_CONST(55562.883706433655/8.0), REAL_CONST(55583.355454577715/8.0), REAL_CONST(55603.82908786826/8.0), REAL_CONST(55624.304605958219/8.0), REAL_CONST(55644.782008500639/8.0), REAL_CONST(55665.261295148754/8.0), REAL_CONST(55685.742465555952/8.0), REAL_CONST(55706.225519375774/8.0), REAL_CONST(55726.710456261928/8.0), REAL_CONST(55747.197275868275/8.0), REAL_CONST(55767.685977848843/8.0), REAL_CONST(55788.176561857814/8.0), REAL_CONST(55808.669027549528/8.0), REAL_CONST(55829.163374578478/8.0), REAL_CONST(55849.659602599328/8.0), REAL_CONST(55870.157711266889/8.0), REAL_CONST(55890.657700236145/8.0), REAL_CONST(55911.159569162221/8.0), REAL_CONST(55931.663317700411/8.0), REAL_CONST(55952.168945506164/8.0), REAL_CONST(55972.676452235086/8.0), REAL_CONST(55993.185837542944/8.0), REAL_CONST(56013.697101085651/8.0), REAL_CONST(56034.210242519301/8.0), REAL_CONST(56054.72526150012/8.0), REAL_CONST(56075.242157684508/8.0), REAL_CONST(56095.760930729011/8.0), REAL_CONST(56116.281580290342/8.0), REAL_CONST(56136.804106025367/8.0), REAL_CONST(56157.328507591104/8.0), REAL_CONST(56177.85478464474/8.0), REAL_CONST(56198.382936843598/8.0), REAL_CONST(56218.912963845185/8.0), REAL_CONST(56239.444865307138/8.0), REAL_CONST(56259.978640887268/8.0), REAL_CONST(56280.514290243525/8.0), REAL_CONST(56301.051813034042/8.0), REAL_CONST(56321.591208917082/8.0), REAL_CONST(56342.13247755108/8.0), REAL_CONST(56362.675618594607/8.0), REAL_CONST(56383.220631706419/8.0), REAL_CONST(56403.767516545398/8.0), REAL_CONST(56424.316272770608/8.0), REAL_CONST(56444.866900041241/8.0), REAL_CONST(56465.419398016667/8.0), REAL_CONST(56485.973766356394/8.0), REAL_CONST(56506.530004720102/8.0), REAL_CONST(56527.088112767611/8.0), REAL_CONST(56547.648090158902/8.0), REAL_CONST(56568.209936554107/8.0), REAL_CONST(56588.773651613519/8.0), REAL_CONST(56609.339234997584/8.0), REAL_CONST(56629.9066863669/8.0), REAL_CONST(56650.47600538221/8.0), REAL_CONST(56671.04719170442/8.0), REAL_CONST(56691.620244994599/8.0), REAL_CONST(56712.195164913959/8.0), REAL_CONST(56732.771951123868/8.0), REAL_CONST(56753.350603285835/8.0), REAL_CONST(56773.931121061541/8.0), REAL_CONST(56794.513504112823/8.0), REAL_CONST(56815.097752101647/8.0), REAL_CONST(56835.683864690152/8.0), REAL_CONST(56856.271841540627/8.0), REAL_CONST(56876.86168231551/8.0), REAL_CONST(56897.453386677393/8.0), REAL_CONST(56918.046954289028/8.0), REAL_CONST(56938.642384813298/8.0), REAL_CONST(56959.239677913261/8.0), REAL_CONST(56979.838833252121/8.0), REAL_CONST(57000.439850493225/8.0), REAL_CONST(57021.04272930009/8.0), REAL_CONST(57041.647469336371/8.0), REAL_CONST(57062.254070265873/8.0), REAL_CONST(57082.862531752558/8.0), REAL_CONST(57103.472853460553/8.0), REAL_CONST(57124.085035054108/8.0), REAL_CONST(57144.699076197649/8.0), REAL_CONST(57165.314976555739/8.0), REAL_CONST(57185.932735793103/8.0), REAL_CONST(57206.552353574611/8.0), REAL_CONST(57227.173829565276/8.0), REAL_CONST(57247.797163430281/8.0), REAL_CONST(57268.42235483494/8.0), REAL_CONST(57289.049403444733/8.0), REAL_CONST(57309.678308925286/8.0), REAL_CONST(57330.30907094237/8.0), REAL_CONST(57350.941689161911/8.0), REAL_CONST(57371.576163249985/8.0), REAL_CONST(57392.212492872815/8.0), REAL_CONST(57412.850677696784/8.0), REAL_CONST(57433.490717388406/8.0), REAL_CONST(57454.132611614368/8.0), REAL_CONST(57474.776360041491/8.0), REAL_CONST(57495.421962336746/8.0), REAL_CONST(57516.069418167266/8.0), REAL_CONST(57536.718727200314/8.0), REAL_CONST(57557.36988910332/8.0), REAL_CONST(57578.022903543861/8.0), REAL_CONST(57598.677770189643/8.0), REAL_CONST(57619.334488708548/8.0), REAL_CONST(57639.993058768589/8.0), REAL_CONST(57660.653480037938/8.0), REAL_CONST(57681.315752184906/8.0), REAL_CONST(57701.979874877965/8.0), REAL_CONST(57722.64584778573/8.0), REAL_CONST(57743.31367057695/8.0), REAL_CONST(57763.983342920546/8.0), REAL_CONST(57784.654864485572/8.0), REAL_CONST(57805.328234941233/8.0), REAL_CONST(57826.003453956881/8.0), REAL_CONST(57846.680521202026/8.0), REAL_CONST(57867.359436346305/8.0), REAL_CONST(57888.040199059527/8.0), REAL_CONST(57908.722809011633/8.0), REAL_CONST(57929.407265872709/8.0), REAL_CONST(57950.093569313001/8.0), REAL_CONST(57970.781719002895/8.0), REAL_CONST(57991.471714612911/8.0), REAL_CONST(58012.16355581375/8.0), REAL_CONST(58032.857242276223/8.0), REAL_CONST(58053.552773671312/8.0), REAL_CONST(58074.25014967013/8.0), REAL_CONST(58094.949369943948/8.0), REAL_CONST(58115.650434164185/8.0), REAL_CONST(58136.353342002389/8.0), REAL_CONST(58157.058093130276/8.0), REAL_CONST(58177.764687219693/8.0), REAL_CONST(58198.47312394264/8.0), REAL_CONST(58219.183402971255/8.0), REAL_CONST(58239.895523977837/8.0), REAL_CONST(58260.609486634821/8.0), REAL_CONST(58281.325290614775/8.0), REAL_CONST(58302.042935590434/8.0), REAL_CONST(58322.762421234678/8.0), REAL_CONST(58343.483747220511/8.0), REAL_CONST(58364.206913221096/8.0), REAL_CONST(58384.931918909751/8.0), REAL_CONST(58405.658763959924/8.0), REAL_CONST(58426.3874480452/8.0), REAL_CONST(58447.117970839339/8.0), REAL_CONST(58467.85033201622/8.0), REAL_CONST(58488.584531249864/8.0), REAL_CONST(58509.320568214462/8.0), REAL_CONST(58530.058442584334/8.0), REAL_CONST(58550.798154033931/8.0), REAL_CONST(58571.539702237875/8.0), REAL_CONST(58592.283086870906/8.0), REAL_CONST(58613.028307607929/8.0), REAL_CONST(58633.775364123983/8.0), REAL_CONST(58654.52425609425/8.0), REAL_CONST(58675.274983194053/8.0), REAL_CONST(58696.027545098877/8.0), REAL_CONST(58716.781941484325/8.0), REAL_CONST(58737.538172026158/8.0), REAL_CONST(58758.296236400274/8.0), REAL_CONST(58779.056134282728/8.0), REAL_CONST(58799.817865349694/8.0), REAL_CONST(58820.581429277503/8.0), REAL_CONST(58841.346825742643/8.0), REAL_CONST(58862.114054421712/8.0), REAL_CONST(58882.883114991484/8.0), REAL_CONST(58903.654007128847/8.0), REAL_CONST(58924.426730510851/8.0), REAL_CONST(58945.201284814684/8.0), REAL_CONST(58965.977669717664/8.0), REAL_CONST(58986.755884897269/8.0), REAL_CONST(59007.535930031117/8.0), REAL_CONST(59028.317804796949/8.0), REAL_CONST(59049.101508872664/8.0), REAL_CONST(59069.887041936301/8.0), REAL_CONST(59090.674403666046/8.0), REAL_CONST(59111.463593740213/8.0), REAL_CONST(59132.254611837263/8.0), REAL_CONST(59153.047457635803/8.0), REAL_CONST(59173.84213081457/8.0), REAL_CONST(59194.638631052461/8.0), REAL_CONST(59215.436958028506/8.0), REAL_CONST(59236.237111421855/8.0), REAL_CONST(59257.039090911829/8.0), REAL_CONST(59277.842896177877/8.0), REAL_CONST(59298.648526899589/8.0), REAL_CONST(59319.455982756685/8.0), REAL_CONST(59340.26526342905/8.0), REAL_CONST(59361.076368596696/8.0), REAL_CONST(59381.889297939757/8.0), REAL_CONST(59402.704051138542/8.0), REAL_CONST(59423.520627873484/8.0), REAL_CONST(59444.339027825139/8.0), REAL_CONST(59465.159250674224/8.0), REAL_CONST(59485.9812961016/8.0), REAL_CONST(59506.805163788253/8.0), REAL_CONST(59527.630853415307/8.0), REAL_CONST(59548.458364664046/8.0), REAL_CONST(59569.287697215863/8.0), REAL_CONST(59590.118850752311/8.0), REAL_CONST(59610.951824955089/8.0), REAL_CONST(59631.786619506012/8.0), REAL_CONST(59652.623234087048/8.0), REAL_CONST(59673.461668380311/8.0), REAL_CONST(59694.301922068029/8.0), REAL_CONST(59715.143994832593/8.0), REAL_CONST(59735.987886356525/8.0), REAL_CONST(59756.833596322482/8.0), REAL_CONST(59777.681124413255/8.0), REAL_CONST(59798.530470311794/8.0), REAL_CONST(59819.381633701159/8.0), REAL_CONST(59840.234614264569/8.0), REAL_CONST(59861.089411685381/8.0), REAL_CONST(59881.94602564707/8.0), REAL_CONST(59902.804455833269/8.0), REAL_CONST(59923.664701927737/8.0), REAL_CONST(59944.526763614384/8.0), REAL_CONST(59965.390640577243/8.0), REAL_CONST(59986.256332500488/8.0), REAL_CONST(60007.123839068438/8.0), REAL_CONST(60027.993159965539/8.0), REAL_CONST(60048.864294876381/8.0), REAL_CONST(60069.737243485688/8.0), REAL_CONST(60090.612005478324/8.0), REAL_CONST(60111.488580539284/8.0), REAL_CONST(60132.366968353708/8.0), REAL_CONST(60153.247168606867/8.0), REAL_CONST(60174.129180984164/8.0), REAL_CONST(60195.013005171153/8.0), REAL_CONST(60215.898640853513/8.0), REAL_CONST(60236.786087717061/8.0), REAL_CONST(60257.675345447751/8.0), REAL_CONST(60278.566413731671/8.0), REAL_CONST(60299.459292255044/8.0), REAL_CONST(60320.353980704247/8.0), REAL_CONST(60341.25047876576/8.0), REAL_CONST(60362.148786126229/8.0), REAL_CONST(60383.048902472423/8.0), REAL_CONST(60403.950827491237/8.0), REAL_CONST(60424.854560869717/8.0), REAL_CONST(60445.76010229504/8.0), REAL_CONST(60466.667451454516/8.0), REAL_CONST(60487.57660803559/8.0), REAL_CONST(60508.487571725847/8.0), REAL_CONST(60529.400342212997/8.0), REAL_CONST(60550.314919184893/8.0), REAL_CONST(60571.231302329521/8.0), REAL_CONST(60592.149491335003/8.0), REAL_CONST(60613.069485889588/8.0), REAL_CONST(60633.991285681674/8.0), REAL_CONST(60654.914890399785/8.0), REAL_CONST(60675.840299732568/8.0), REAL_CONST(60696.767513368832/8.0), REAL_CONST(60717.696530997484/8.0), REAL_CONST(60738.627352307602/8.0), REAL_CONST(60759.55997698837/8.0), REAL_CONST(60780.494404729128/8.0), REAL_CONST(60801.430635219323/8.0), REAL_CONST(60822.368668148556/8.0), REAL_CONST(60843.308503206565/8.0), REAL_CONST(60864.250140083204/8.0), REAL_CONST(60885.193578468468/8.0), REAL_CONST(60906.138818052495/8.0), REAL_CONST(60927.085858525541/8.0), REAL_CONST(60948.034699578006/8.0), REAL_CONST(60968.985340900421/8.0), REAL_CONST(60989.937782183442/8.0), REAL_CONST(61010.892023117864/8.0), REAL_CONST(61031.848063394616/8.0), REAL_CONST(61052.805902704764/8.0), REAL_CONST(61073.765540739492/8.0), REAL_CONST(61094.726977190134/8.0), REAL_CONST(61115.690211748137/8.0), REAL_CONST(61136.655244105103/8.0), REAL_CONST(61157.622073952742/8.0), REAL_CONST(61178.590700982917/8.0), REAL_CONST(61199.561124887616/8.0), REAL_CONST(61220.533345358948/8.0), REAL_CONST(61241.507362089171/8.0), REAL_CONST(61262.483174770663/8.0), REAL_CONST(61283.460783095943/8.0), REAL_CONST(61304.440186757645/8.0), REAL_CONST(61325.421385448557/8.0), REAL_CONST(61346.404378861582/8.0), REAL_CONST(61367.389166689762/8.0), REAL_CONST(61388.375748626262/8.0), REAL_CONST(61409.364124364387/8.0), REAL_CONST(61430.354293597571/8.0), REAL_CONST(61451.346256019373/8.0), REAL_CONST(61472.340011323497/8.0), REAL_CONST(61493.335559203762/8.0), REAL_CONST(61514.332899354122/8.0), REAL_CONST(61535.332031468672/8.0), REAL_CONST(61556.332955241618/8.0), REAL_CONST(61577.335670367313/8.0), REAL_CONST(61598.340176540238/8.0), REAL_CONST(61619.346473454993/8.0), REAL_CONST(61640.354560806329/8.0), REAL_CONST(61661.3644382891/8.0), REAL_CONST(61682.376105598312/8.0), REAL_CONST(61703.389562429089/8.0), REAL_CONST(61724.404808476691/8.0), REAL_CONST(61745.42184343651/8.0), REAL_CONST(61766.440667004063/8.0), REAL_CONST(61787.461278874987/8.0), REAL_CONST(61808.483678745069/8.0), REAL_CONST(61829.507866310203/8.0), REAL_CONST(61850.533841266435/8.0), REAL_CONST(61871.561603309929/8.0), REAL_CONST(61892.591152136971/8.0), REAL_CONST(61913.622487443987/8.0), REAL_CONST(61934.655608927525/8.0), REAL_CONST(61955.690516284267/8.0), REAL_CONST(61976.727209211022/8.0), REAL_CONST(61997.765687404724/8.0), REAL_CONST(62018.805950562448/8.0), REAL_CONST(62039.847998381381/8.0), REAL_CONST(62060.891830558845/8.0), REAL_CONST(62081.93744679229/8.0), REAL_CONST(62102.984846779298/8.0), REAL_CONST(62124.034030217575/8.0), REAL_CONST(62145.084996804966/8.0), REAL_CONST(62166.137746239416/8.0), REAL_CONST(62187.19227821903/8.0), REAL_CONST(62208.248592442025/8.0), REAL_CONST(62229.306688606739/8.0), REAL_CONST(62250.366566411656/8.0), REAL_CONST(62271.428225555377/8.0), REAL_CONST(62292.491665736627/8.0), REAL_CONST(62313.556886654267/8.0), REAL_CONST(62334.623888007271/8.0), REAL_CONST(62355.692669494762/8.0), REAL_CONST(62376.763230815974/8.0), REAL_CONST(62397.835571670272/8.0), REAL_CONST(62418.909691757144/8.0), REAL_CONST(62439.98559077621/8.0), REAL_CONST(62461.063268427228/8.0), REAL_CONST(62482.142724410049/8.0), REAL_CONST(62503.223958424685/8.0), REAL_CONST(62524.306970171267/8.0), REAL_CONST(62545.39175935003/8.0), REAL_CONST(62566.478325661366/8.0), REAL_CONST(62587.566668805768/8.0), REAL_CONST(62608.656788483881/8.0), REAL_CONST(62629.748684396451/8.0), REAL_CONST(62650.842356244357/8.0), REAL_CONST(62671.937803728622/8.0), REAL_CONST(62693.035026550366/8.0), REAL_CONST(62714.134024410858/8.0), REAL_CONST(62735.234797011479/8.0), REAL_CONST(62756.337344053733/8.0), REAL_CONST(62777.441665239276/8.0), REAL_CONST(62798.547760269852/8.0), REAL_CONST(62819.655628847358/8.0), REAL_CONST(62840.765270673801/8.0), REAL_CONST(62861.876685451323/8.0), REAL_CONST(62882.989872882186/8.0), REAL_CONST(62904.104832668774/8.0), REAL_CONST(62925.221564513602/8.0), REAL_CONST(62946.340068119309/8.0), REAL_CONST(62967.460343188657/8.0), REAL_CONST(62988.582389424526/8.0), REAL_CONST(63009.70620652994/8.0), REAL_CONST(63030.831794208025/8.0), REAL_CONST(63051.959152162039/8.0), REAL_CONST(63073.08828009537/8.0), REAL_CONST(63094.219177711529/8.0), REAL_CONST(63115.351844714154/8.0), REAL_CONST(63136.486280806988/8.0), REAL_CONST(63157.622485693922/8.0), REAL_CONST(63178.760459078956/8.0), REAL_CONST(63199.900200666219/8.0), REAL_CONST(63221.041710159967/8.0), REAL_CONST(63242.184987264569/8.0), REAL_CONST(63263.330031684534/8.0), REAL_CONST(63284.476843124474/8.0), REAL_CONST(63305.625421289144/8.0), REAL_CONST(63326.775765883409/8.0), REAL_CONST(63347.927876612259/8.0), REAL_CONST(63369.081753180813/8.0), REAL_CONST(63390.237395294316/8.0), REAL_CONST(63411.39480265812/8.0), REAL_CONST(63432.553974977716/8.0), REAL_CONST(63453.714911958712/8.0), REAL_CONST(63474.877613306839/8.0), REAL_CONST(63496.042078727944/8.0), REAL_CONST(63517.208307927998/8.0), REAL_CONST(63538.376300613119/8.0), REAL_CONST(63559.546056489504/8.0), REAL_CONST(63580.717575263516/8.0), REAL_CONST(63601.890856641607/8.0), REAL_CONST(63623.065900330374/8.0), REAL_CONST(63644.242706036515/8.0), REAL_CONST(63665.421273466869/8.0), REAL_CONST(63686.601602328381/8.0), REAL_CONST(63707.783692328136/8.0), REAL_CONST(63728.967543173334/8.0), REAL_CONST(63750.153154571279/8.0), REAL_CONST(63771.340526229418/8.0), REAL_CONST(63792.529657855317/8.0), REAL_CONST(63813.720549156649/8.0), REAL_CONST(63834.913199841227/8.0), REAL_CONST(63856.107609616978/8.0), REAL_CONST(63877.303778191941/8.0), REAL_CONST(63898.501705274284/8.0), REAL_CONST(63919.7013905723/8.0), REAL_CONST(63940.902833794404/8.0), REAL_CONST(63962.106034649114/8.0), REAL_CONST(63983.310992845094/8.0), REAL_CONST(64004.517708091109/8.0), REAL_CONST(64025.726180096048/8.0), REAL_CONST(64046.936408568938/8.0), REAL_CONST(64068.1483932189/8.0), REAL_CONST(64089.362133755196/8.0), REAL_CONST(64110.577629887193/8.0), REAL_CONST(64131.794881324393/8.0), REAL_CONST(64153.013887776404/8.0), REAL_CONST(64174.234648952966/8.0), REAL_CONST(64195.457164563937/8.0), REAL_CONST(64216.681434319289/8.0), REAL_CONST(64237.907457929112/8.0), REAL_CONST(64259.135235103626/8.0), REAL_CONST(64280.36476555316/8.0), REAL_CONST(64301.596048988169/8.0), REAL_CONST(64322.829085119236/8.0), REAL_CONST(64344.06387365704/8.0), REAL_CONST(64365.300414312398/8.0), REAL_CONST(64386.538706796251/8.0), REAL_CONST(64407.778750819634/8.0), REAL_CONST(64429.020546093721/8.0), REAL_CONST(64450.26409232981/8.0), REAL_CONST(64471.509389239291/8.0), REAL_CONST(64492.756436533709/8.0), REAL_CONST(64514.005233924705/8.0), REAL_CONST(64535.255781124033/8.0), REAL_CONST(64556.50807784358/8.0), REAL_CONST(64577.762123795357/8.0), REAL_CONST(64599.017918691468/8.0), REAL_CONST(64620.275462244172/8.0), REAL_CONST(64641.534754165805/8.0), REAL_CONST(64662.795794168844/8.0), REAL_CONST(64684.058581965895/8.0), REAL_CONST(64705.323117269661/8.0), REAL_CONST(64726.589399792974/8.0), REAL_CONST(64747.857429248776/8.0), REAL_CONST(64769.127205350138/8.0), REAL_CONST(64790.398727810236/8.0), REAL_CONST(64811.671996342375/8.0), REAL_CONST(64832.947010659969/8.0), REAL_CONST(64854.223770476558/8.0), REAL_CONST(64875.502275505794/8.0), REAL_CONST(64896.782525461451/8.0), REAL_CONST(64918.064520057414/8.0), REAL_CONST(64939.348259007682/8.0), REAL_CONST(64960.633742026388/8.0), REAL_CONST(64981.920968827762/8.0), REAL_CONST(65003.209939126165/8.0), REAL_CONST(65024.500652636067/8.0), REAL_CONST(65045.793109072067/8.0), REAL_CONST(65067.087308148861/8.0), REAL_CONST(65088.383249581282/8.0), REAL_CONST(65109.680933084259/8.0), REAL_CONST(65130.980358372864/8.0), REAL_CONST(65152.28152516226/8.0), REAL_CONST(65173.584433167736/8.0), REAL_CONST(65194.889082104703/8.0), REAL_CONST(65216.195471688683/8.0), REAL_CONST(65237.503601635319/8.0), REAL_CONST(65258.813471660353/8.0), REAL_CONST(65280.125081479666/8.0), REAL_CONST(65301.438430809241/8.0), REAL_CONST(65322.753519365178/8.0), REAL_CONST(65344.070346863708/8.0), REAL_CONST(65365.388913021146/8.0), REAL_CONST(65386.709217553958/8.0), REAL_CONST(65408.031260178701/8.0), REAL_CONST(65429.355040612056/8.0), REAL_CONST(65450.680558570821/8.0), REAL_CONST(65472.00781377191/8.0), REAL_CONST(65493.336805932355/8.0), REAL_CONST(65514.66753476928/8.0), REAL_CONST(65535.999999999956/8.0), REAL_CONST(65557.334201341757/8.0), REAL_CONST(65578.670138512171/8.0), REAL_CONST(65600.007811228788/8.0), REAL_CONST(65621.347219209332/8.0), REAL_CONST(65642.688362171626/8.0), REAL_CONST(65664.031239833639/8.0), REAL_CONST(65685.375851913413/8.0), REAL_CONST(65706.722198129137/8.0), REAL_CONST(65728.070278199084/8.0), REAL_CONST(65749.420091841661/8.0), REAL_CONST(65770.771638775404/8.0), REAL_CONST(65792.124918718939/8.0), REAL_CONST(65813.479931391004/8.0), REAL_CONST(65834.836676510458/8.0), REAL_CONST(65856.195153796303/8.0), REAL_CONST(65877.5553629676/8.0), REAL_CONST(65898.917303743554/8.0), REAL_CONST(65920.280975843489/8.0), REAL_CONST(65941.646378986843/8.0), REAL_CONST(65963.013512893158/8.0), REAL_CONST(65984.382377282076/8.0), REAL_CONST(66005.752971873386/8.0), REAL_CONST(66027.125296386963/8.0), REAL_CONST(66048.499350542799/8.0), REAL_CONST(66069.875134061018/8.0), REAL_CONST(66091.252646661844/8.0), REAL_CONST(66112.631888065618/8.0), REAL_CONST(66134.01285799277/8.0), REAL_CONST(66155.395556163887/8.0), REAL_CONST(66176.779982299631/8.0), REAL_CONST(66198.166136120795/8.0), REAL_CONST(66219.554017348273/8.0), REAL_CONST(66240.943625703105/8.0), REAL_CONST(66262.334960906388/8.0), REAL_CONST(66283.728022679396/8.0), REAL_CONST(66305.122810743444/8.0), REAL_CONST(66326.519324820023/8.0), REAL_CONST(66347.917564630698/8.0), REAL_CONST(66369.317529897162/8.0), REAL_CONST(66390.719220341227/8.0), REAL_CONST(66412.122635684791/8.0), REAL_CONST(66433.527775649884/8.0), REAL_CONST(66454.934639958636/8.0), REAL_CONST(66476.343228333324/8.0), REAL_CONST(66497.753540496284/8.0), REAL_CONST(66519.165576169995/8.0), REAL_CONST(66540.57933507704/8.0), REAL_CONST(66561.994816940118/8.0), REAL_CONST(66583.412021482043/8.0), REAL_CONST(66604.830948425733/8.0), REAL_CONST(66626.251597494222/8.0), REAL_CONST(66647.673968410629/8.0), REAL_CONST(66669.098060898235/8.0), REAL_CONST(66690.523874680381/8.0), REAL_CONST(66711.951409480564/8.0), REAL_CONST(66733.380665022371/8.0), REAL_CONST(66754.811641029475/8.0), REAL_CONST(66776.244337225711/8.0), REAL_CONST(66797.678753334985/8.0), REAL_CONST(66819.11488908132/8.0), REAL_CONST(66840.552744188884/8.0), REAL_CONST(66861.992318381905/8.0), REAL_CONST(66883.433611384738/8.0), REAL_CONST(66904.876622921889/8.0), REAL_CONST(66926.321352717903/8.0), REAL_CONST(66947.767800497502/8.0), REAL_CONST(66969.215965985466/8.0), REAL_CONST(66990.665848906734/8.0), REAL_CONST(67012.117448986304/8.0), REAL_CONST(67033.570765949335/8.0), REAL_CONST(67055.025799521056/8.0), REAL_CONST(67076.482549426815/8.0), REAL_CONST(67097.941015392076/8.0), REAL_CONST(67119.401197142433/8.0), REAL_CONST(67140.863094403554/8.0), REAL_CONST(67162.326706901222/8.0), REAL_CONST(67183.792034361351/8.0), REAL_CONST(67205.259076509959/8.0), REAL_CONST(67226.72783307315/8.0), REAL_CONST(67248.198303777172/8.0), REAL_CONST(67269.670488348347/8.0), REAL_CONST(67291.144386513144/8.0), REAL_CONST(67312.619997998088/8.0), REAL_CONST(67334.09732252988/8.0), REAL_CONST(67355.576359835293/8.0), REAL_CONST(67377.057109641188/8.0), REAL_CONST(67398.53957167457/8.0), REAL_CONST(67420.023745662547/8.0), REAL_CONST(67441.50963133233/8.0), REAL_CONST(67462.99722841123/8.0), REAL_CONST(67484.486536626689/8.0), REAL_CONST(67505.977555706224/8.0), REAL_CONST(67527.470285377494/8.0), REAL_CONST(67548.964725368263/8.0), REAL_CONST(67570.460875406367/8.0), REAL_CONST(67591.9587352198/8.0), REAL_CONST(67613.458304536631/8.0), REAL_CONST(67634.95958308503/8.0), REAL_CONST(67656.462570593329/8.0), REAL_CONST(67677.967266789899/8.0), REAL_CONST(67699.473671403248/8.0), REAL_CONST(67720.981784162024/8.0), REAL_CONST(67742.491604794923/8.0), REAL_CONST(67764.003133030797/8.0), REAL_CONST(67785.516368598575/8.0), REAL_CONST(67807.031311227314/8.0), REAL_CONST(67828.547960646174/8.0), REAL_CONST(67850.066316584402/8.0), REAL_CONST(67871.58637877139/8.0), REAL_CONST(67893.108146936589/8.0), REAL_CONST(67914.63162080961/8.0), REAL_CONST(67936.156800120138/8.0), REAL_CONST(67957.683684597971/8.0), REAL_CONST(67979.212273973011/8.0), REAL_CONST(68000.742567975263/8.0), REAL_CONST(68022.274566334876/8.0), REAL_CONST(68043.808268782057/8.0), REAL_CONST(68065.343675047145/8.0), REAL_CONST(68086.880784860579/8.0), REAL_CONST(68108.419597952918/8.0), REAL_CONST(68129.960114054789/8.0), REAL_CONST(68151.502332896969/8.0), REAL_CONST(68173.04625421032/8.0), REAL_CONST(68194.591877725834/8.0), REAL_CONST(68216.139203174564/8.0), REAL_CONST(68237.688230287706/8.0), REAL_CONST(68259.238958796544/8.0), REAL_CONST(68280.791388432481/8.0), REAL_CONST(68302.345518927032/8.0), REAL_CONST(68323.901350011787/8.0), REAL_CONST(68345.458881418483/8.0), REAL_CONST(68367.018112878912/8.0), REAL_CONST(68388.579044125028/8.0), REAL_CONST(68410.141674888844/8.0), REAL_CONST(68431.706004902502/8.0), REAL_CONST(68453.272033898262/8.0), REAL_CONST(68474.839761608455/8.0), REAL_CONST(68496.409187765545/8.0), REAL_CONST(68517.980312102081/8.0), REAL_CONST(68539.553134350732/8.0), REAL_CONST(68561.127654244279/8.0), REAL_CONST(68582.70387151558/8.0), REAL_CONST(68604.281785897634/8.0), REAL_CONST(68625.861397123503/8.0), REAL_CONST(68647.44270492639/8.0), REAL_CONST(68669.025709039604/8.0), REAL_CONST(68690.610409196524/8.0), REAL_CONST(68712.196805130661/8.0), REAL_CONST(68733.784896575627/8.0), REAL_CONST(68755.374683265123/8.0), REAL_CONST(68776.966164932994/8.0), REAL_CONST(68798.559341313128/8.0), REAL_CONST(68820.154212139591/8.0), REAL_CONST(68841.750777146473/8.0), REAL_CONST(68863.349036068044/8.0), REAL_CONST(68884.948988638629/8.0), REAL_CONST(68906.550634592684/8.0), REAL_CONST(68928.153973664739/8.0), REAL_CONST(68949.75900558944/8.0), REAL_CONST(68971.365730101577/8.0), REAL_CONST(68992.974146935987/8.0), REAL_CONST(69014.584255827634/8.0), REAL_CONST(69036.196056511588/8.0), REAL_CONST(69057.809548723017/8.0), REAL_CONST(69079.424732197207/8.0), REAL_CONST(69101.041606669532/8.0), REAL_CONST(69122.660171875468/8.0), REAL_CONST(69144.280427550606/8.0), REAL_CONST(69165.902373430625/8.0), REAL_CONST(69187.526009251334/8.0), REAL_CONST(69209.151334748618/8.0), REAL_CONST(69230.778349658474/8.0), REAL_CONST(69252.40705371699/8.0), REAL_CONST(69274.037446660412/8.0), REAL_CONST(69295.669528225/8.0), REAL_CONST(69317.303298147192/8.0), REAL_CONST(69338.938756163494/8.0), REAL_CONST(69360.575902010532/8.0), REAL_CONST(69382.214735425005/8.0), REAL_CONST(69403.855256143754/8.0), REAL_CONST(69425.497463903681/8.0), REAL_CONST(69447.141358441833/8.0), REAL_CONST(69468.78693949533/8.0), REAL_CONST(69490.434206801394/8.0), REAL_CONST(69512.083160097391/8.0), REAL_CONST(69533.733799120717/8.0), REAL_CONST(69555.386123608929/8.0), REAL_CONST(69577.04013329967/8.0), REAL_CONST(69598.695827930685/8.0), REAL_CONST(69620.353207239794/8.0), REAL_CONST(69642.012270964973/8.0), REAL_CONST(69663.67301884426/8.0), REAL_CONST(69685.335450615792/8.0), REAL_CONST(69706.999566017839/8.0), REAL_CONST(69728.665364788743/8.0), REAL_CONST(69750.332846666963/8.0), REAL_CONST(69772.002011391058/8.0), REAL_CONST(69793.672858699691/8.0), REAL_CONST(69815.345388331611/8.0), REAL_CONST(69837.019600025669/8.0), REAL_CONST(69858.695493520849/8.0), REAL_CONST(69880.373068556204/8.0), REAL_CONST(69902.052324870907/8.0), REAL_CONST(69923.733262204216/8.0), REAL_CONST(69945.415880295492/8.0), REAL_CONST(69967.100178884211/8.0), REAL_CONST(69988.786157709939/8.0), REAL_CONST(70010.473816512356/8.0), REAL_CONST(70032.163155031216/8.0), REAL_CONST(70053.854173006403/8.0), REAL_CONST(70075.546870177874/8.0), REAL_CONST(70097.241246285717/8.0), REAL_CONST(70118.937301070109/8.0), REAL_CONST(70140.635034271298/8.0), REAL_CONST(70162.334445629691/8.0), REAL_CONST(70184.035534885741/8.0), REAL_CONST(70205.738301780017/8.0), REAL_CONST(70227.442746053217/8.0), REAL_CONST(70249.1488674461/8.0), REAL_CONST(70270.856665699539/8.0), REAL_CONST(70292.566140554511/8.0), REAL_CONST(70314.277291752107/8.0), REAL_CONST(70335.990119033493/8.0), REAL_CONST(70357.704622139936/8.0), REAL_CONST(70379.420800812819/8.0), REAL_CONST(70401.138654793613/8.0), REAL_CONST(70422.85818382389/8.0), REAL_CONST(70444.579387645339/8.0), REAL_CONST(70466.302265999722/8.0), REAL_CONST(70488.026818628918/8.0), REAL_CONST(70509.753045274876/8.0), REAL_CONST(70531.480945679708/8.0), REAL_CONST(70553.210519585555/8.0), REAL_CONST(70574.941766734701/8.0), REAL_CONST(70596.674686869505/8.0), REAL_CONST(70618.409279732456/8.0), REAL_CONST(70640.145545066101/8.0), REAL_CONST(70661.883482613106/8.0), REAL_CONST(70683.623092116264/8.0), REAL_CONST(70705.364373318414/8.0), REAL_CONST(70727.107325962526/8.0), REAL_CONST(70748.851949791671/8.0), REAL_CONST(70770.598244549008/8.0), REAL_CONST(70792.346209977783/8.0), REAL_CONST(70814.095845821372/8.0), REAL_CONST(70835.847151823225/8.0), REAL_CONST(70857.600127726895/8.0), REAL_CONST(70879.354773276034/8.0), REAL_CONST(70901.111088214413/8.0), REAL_CONST(70922.869072285859/8.0), REAL_CONST(70944.628725234332/8.0), REAL_CONST(70966.390046803877/8.0), REAL_CONST(70988.153036738629/8.0), REAL_CONST(71009.917694782853/8.0), REAL_CONST(71031.684020680885/8.0), REAL_CONST(71053.45201417715/8.0), REAL_CONST(71075.221675016204/8.0), REAL_CONST(71096.993002942661/8.0), REAL_CONST(71118.765997701266/8.0), REAL_CONST(71140.540659036851/8.0), REAL_CONST(71162.316986694335/8.0), REAL_CONST(71184.09498041874/8.0), REAL_CONST(71205.874639955218/8.0), REAL_CONST(71227.655965048951/8.0), REAL_CONST(71249.438955445294/8.0), REAL_CONST(71271.223610889632/8.0), REAL_CONST(71293.009931127483/8.0), REAL_CONST(71314.797915904477/8.0), REAL_CONST(71336.587564966307/8.0), REAL_CONST(71358.378878058764/8.0), REAL_CONST(71380.171854927772/8.0), REAL_CONST(71401.966495319313/8.0), REAL_CONST(71423.762798979486/8.0), REAL_CONST(71445.560765654489/8.0), REAL_CONST(71467.360395090596/8.0), REAL_CONST(71489.161687034211/8.0), REAL_CONST(71510.964641231811/8.0), REAL_CONST(71532.769257429973/8.0), REAL_CONST(71554.575535375348/8.0), REAL_CONST(71576.383474814749/8.0), REAL_CONST(71598.19307549503/8.0), REAL_CONST(71620.004337163133/8.0), REAL_CONST(71641.817259566145/8.0), REAL_CONST(71663.631842451214/8.0), REAL_CONST(71685.4480855656/8.0), REAL_CONST(71707.26598865664/8.0), REAL_CONST(71729.085551471784/8.0), REAL_CONST(71750.906773758586/8.0), REAL_CONST(71772.729655264673/8.0), REAL_CONST(71794.554195737772/8.0), REAL_CONST(71816.380394925713/8.0), REAL_CONST(71838.208252576442/8.0), REAL_CONST(71860.037768437964/8.0), REAL_CONST(71881.868942258385/8.0), REAL_CONST(71903.701773785942/8.0), REAL_CONST(71925.536262768932/8.0), REAL_CONST(71947.372408955751/8.0), REAL_CONST(71969.210212094898/8.0), REAL_CONST(71991.049671934976/8.0), REAL_CONST(72012.890788224686/8.0), REAL_CONST(72034.73356071279/8.0), REAL_CONST(72056.577989148165/8.0), REAL_CONST(72078.424073279821/8.0), REAL_CONST(72100.271812856794/8.0), REAL_CONST(72122.121207628254/8.0), REAL_CONST(72143.97225734347/8.0), REAL_CONST(72165.824961751801/8.0), REAL_CONST(72187.679320602692/8.0), REAL_CONST(72209.53533364569/8.0), REAL_CONST(72231.393000630429/8.0), REAL_CONST(72253.252321306645/8.0), REAL_CONST(72275.113295424177/8.0), REAL_CONST(72296.975922732949/8.0), REAL_CONST(72318.840202982959/8.0), REAL_CONST(72340.706135924338/8.0), REAL_CONST(72362.573721307272/8.0), REAL_CONST(72384.442958882093/8.0), REAL_CONST(72406.313848399179/8.0), REAL_CONST(72428.186389609036/8.0), REAL_CONST(72450.060582262216/8.0), REAL_CONST(72471.936426109431/8.0), REAL_CONST(72493.813920901433/8.0), REAL_CONST(72515.693066389096/8.0), REAL_CONST(72537.573862323392/8.0), REAL_CONST(72559.456308455352/8.0), REAL_CONST(72581.340404536139/8.0), REAL_CONST(72603.226150316987/8.0), REAL_CONST(72625.113545549248/8.0), REAL_CONST(72647.002589984331/8.0), REAL_CONST(72668.893283373764/8.0), REAL_CONST(72690.785625469172/8.0), REAL_CONST(72712.679616022273/8.0), REAL_CONST(72734.575254784853/8.0), REAL_CONST(72756.472541508803/8.0), REAL_CONST(72778.371475946144/8.0), REAL_CONST(72800.272057848939/8.0), REAL_CONST(72822.174286969355/8.0), REAL_CONST(72844.07816305969/8.0), REAL_CONST(72865.983685872285/8.0), REAL_CONST(72887.890855159596/8.0), REAL_CONST(72909.799670674183/8.0), REAL_CONST(72931.710132168693/8.0), REAL_CONST(72953.622239395845/8.0), REAL_CONST(72975.535992108475/8.0), REAL_CONST(72997.451390059519/8.0), REAL_CONST(73019.368433001961/8.0), REAL_CONST(73041.287120688925/8.0), REAL_CONST(73063.207452873612/8.0), REAL_CONST(73085.129429309294/8.0), REAL_CONST(73107.053049749389/8.0), REAL_CONST(73128.978313947344/8.0), REAL_CONST(73150.905221656736/8.0), REAL_CONST(73172.833772631217/8.0), REAL_CONST(73194.763966624567/8.0), REAL_CONST(73216.695803390612/8.0), REAL_CONST(73238.62928268328/8.0), REAL_CONST(73260.564404256627/8.0), REAL_CONST(73282.501167864757/8.0), REAL_CONST(73304.439573261901/8.0), REAL_CONST(73326.379620202337/8.0), REAL_CONST(73348.321308440485/8.0), REAL_CONST(73370.264637730841/8.0), REAL_CONST(73392.209607827957/8.0), REAL_CONST(73414.156218486532/8.0), REAL_CONST(73436.104469461323/8.0), REAL_CONST(73458.054360507173/8.0), REAL_CONST(73480.005891379056/8.0), REAL_CONST(73501.959061831993/8.0), REAL_CONST(73523.913871621116/8.0), REAL_CONST(73545.870320501665/8.0), REAL_CONST(73567.828408228932/8.0), REAL_CONST(73589.78813455833/8.0), REAL_CONST(73611.749499245358/8.0), REAL_CONST(73633.712502045615/8.0), REAL_CONST(73655.677142714747/8.0), REAL_CONST(73677.643421008557/8.0), REAL_CONST(73699.611336682879/8.0), REAL_CONST(73721.580889493693/8.0), REAL_CONST(73743.552079197019/8.0), REAL_CONST(73765.524905548999/8.0), REAL_CONST(73787.499368305856/8.0), REAL_CONST(73809.475467223907/8.0), REAL_CONST(73831.453202059551/8.0), REAL_CONST(73853.432572569291/8.0), REAL_CONST(73875.413578509717/8.0), REAL_CONST(73897.396219637507/8.0), REAL_CONST(73919.380495709411/8.0), REAL_CONST(73941.36640648231/8.0), REAL_CONST(73963.353951713143/8.0), REAL_CONST(73985.343131158952/8.0), REAL_CONST(74007.333944576865/8.0), REAL_CONST(74029.326391724098/8.0), REAL_CONST(74051.320472357969/8.0), REAL_CONST(74073.316186235883/8.0), REAL_CONST(74095.313533115303/8.0), REAL_CONST(74117.312512753837/8.0), REAL_CONST(74139.313124909138/8.0), REAL_CONST(74161.315369338976/8.0), REAL_CONST(74183.319245801191/8.0), REAL_CONST(74205.324754053727/8.0), REAL_CONST(74227.331893854629/8.0), REAL_CONST(74249.340664961986/8.0), REAL_CONST(74271.351067134034/8.0), REAL_CONST(74293.363100129049/8.0), REAL_CONST(74315.376763705441/8.0), REAL_CONST(74337.392057621662/8.0), REAL_CONST(74359.408981636298/8.0), REAL_CONST(74381.427535508003/8.0), REAL_CONST(74403.447718995507/8.0), REAL_CONST(74425.469531857671/8.0), REAL_CONST(74447.492973853383/8.0), REAL_CONST(74469.518044741693/8.0), REAL_CONST(74491.54474428168/8.0), REAL_CONST(74513.573072232539/8.0), REAL_CONST(74535.603028353551/8.0), REAL_CONST(74557.634612404087/8.0), REAL_CONST(74579.667824143602/8.0), REAL_CONST(74601.702663331642/8.0), REAL_CONST(74623.739129727837/8.0), REAL_CONST(74645.777223091936/8.0), REAL_CONST(74667.816943183716/8.0), REAL_CONST(74689.858289763113/8.0), REAL_CONST(74711.901262590094/8.0), REAL_CONST(74733.945861424741/8.0), REAL_CONST(74755.992086027225/8.0), REAL_CONST(74778.039936157802/8.0), REAL_CONST(74800.089411576817/8.0), REAL_CONST(74822.140512044702/8.0), REAL_CONST(74844.193237321961/8.0), REAL_CONST(74866.24758716923/8.0), REAL_CONST(74888.303561347187/8.0), REAL_CONST(74910.36115961663/8.0), REAL_CONST(74932.420381738411/8.0), REAL_CONST(74954.481227473516/8.0), REAL_CONST(74976.543696582972/8.0), REAL_CONST(74998.607788827925/8.0), REAL_CONST(75020.673503969607/8.0), REAL_CONST(75042.740841769322/8.0), REAL_CONST(75064.809801988464/8.0), REAL_CONST(75086.88038438854/8.0), REAL_CONST(75108.952588731103/8.0), REAL_CONST(75131.026414777836/8.0), REAL_CONST(75153.101862290467/8.0), REAL_CONST(75175.178931030852/8.0), REAL_CONST(75197.257620760924/8.0), REAL_CONST(75219.33793124267/8.0), REAL_CONST(75241.419862238225/8.0), REAL_CONST(75263.503413509738/8.0), REAL_CONST(75285.588584819503/8.0), REAL_CONST(75307.675375929874/8.0), REAL_CONST(75329.763786603318/8.0), REAL_CONST(75351.853816602365/8.0), REAL_CONST(75373.945465689612/8.0), REAL_CONST(75396.038733627807/8.0), REAL_CONST(75418.133620179724/8.0), REAL_CONST(75440.230125108254/8.0), REAL_CONST(75462.32824817636/8.0), REAL_CONST(75484.427989147109/8.0), REAL_CONST(75506.529347783653/8.0), REAL_CONST(75528.63232384919/8.0), REAL_CONST(75550.736917107075/8.0), REAL_CONST(75572.843127320695/8.0), REAL_CONST(75594.950954253538/8.0), REAL_CONST(75617.060397669193/8.0), REAL_CONST(75639.171457331307/8.0), REAL_CONST(75661.284133003646/8.0), REAL_CONST(75683.398424450032/8.0), REAL_CONST(75705.514331434402/8.0), REAL_CONST(75727.631853720741/8.0), REAL_CONST(75749.750991073175/8.0), REAL_CONST(75771.871743255862/8.0), REAL_CONST(75793.994110033076/8.0), REAL_CONST(75816.118091169177/8.0), REAL_CONST(75838.243686428585/8.0), REAL_CONST(75860.370895575848/8.0), REAL_CONST(75882.499718375562/8.0), REAL_CONST(75904.630154592422/8.0), REAL_CONST(75926.762203991224/8.0), REAL_CONST(75948.895866336825/8.0), REAL_CONST(75971.031141394182/8.0), REAL_CONST(75993.168028928325/8.0), REAL_CONST(76015.306528704401/8.0), REAL_CONST(76037.4466404876/8.0), REAL_CONST(76059.588364043215/8.0), REAL_CONST(76081.731699136653/8.0), REAL_CONST(76103.876645533353/8.0), REAL_CONST(76126.023202998884/8.0), REAL_CONST(76148.171371298871/8.0), REAL_CONST(76170.321150199044/8.0), REAL_CONST(76192.472539465205/8.0), REAL_CONST(76214.625538863256/8.0), REAL_CONST(76236.780148159174/8.0), REAL_CONST(76258.936367119008/8.0), REAL_CONST(76281.094195508922/8.0), REAL_CONST(76303.253633095141/8.0), REAL_CONST(76325.414679643975/8.0), REAL_CONST(76347.577334921851/8.0), REAL_CONST(76369.741598695226/8.0), REAL_CONST(76391.907470730686/8.0), REAL_CONST(76414.074950794879/8.0), REAL_CONST(76436.244038654564/8.0), REAL_CONST(76458.414734076548/8.0), REAL_CONST(76480.587036827754/8.0), REAL_CONST(76502.760946675175/8.0), REAL_CONST(76524.936463385893/8.0), REAL_CONST(76547.11358672705/8.0), REAL_CONST(76569.292316465915/8.0), REAL_CONST(76591.472652369819/8.0), REAL_CONST(76613.654594206164/8.0), REAL_CONST(76635.838141742468/8.0), REAL_CONST(76658.023294746308/8.0), REAL_CONST(76680.210052985349/8.0), REAL_CONST(76702.398416227341/8.0), REAL_CONST(76724.588384240138/8.0), REAL_CONST(76746.779956791637/8.0), REAL_CONST(76768.973133649866/8.0), REAL_CONST(76791.167914582897/8.0), REAL_CONST(76813.364299358902/8.0), REAL_CONST(76835.562287746157/8.0), REAL_CONST(76857.761879512967/8.0), REAL_CONST(76879.963074427797/8.0), REAL_CONST(76902.165872259109/8.0), REAL_CONST(76924.37027277553/8.0), REAL_CONST(76946.576275745727/8.0), REAL_CONST(76968.783880938441/8.0), REAL_CONST(76990.993088122515/8.0), REAL_CONST(77013.203897066895/8.0), REAL_CONST(77035.416307540567/8.0), REAL_CONST(77057.630319312622/8.0), REAL_CONST(77079.845932152239/8.0), REAL_CONST(77102.063145828695/8.0), REAL_CONST(77124.281960111301/8.0), REAL_CONST(77146.50237476948/8.0), REAL_CONST(77168.724389572759/8.0), REAL_CONST(77190.948004290723/8.0), REAL_CONST(77213.173218693031/8.0), REAL_CONST(77235.400032549442/8.0), REAL_CONST(77257.628445629802/8.0), REAL_CONST(77279.858457704031/8.0), REAL_CONST(77302.090068542122/8.0), REAL_CONST(77324.323277914169/8.0), REAL_CONST(77346.558085590339/8.0), REAL_CONST(77368.794491340886/8.0), REAL_CONST(77391.032494936138/8.0), REAL_CONST(77413.272096146524/8.0), REAL_CONST(77435.51329474253/8.0), REAL_CONST(77457.756090494731/8.0), REAL_CONST(77480.000483173804/8.0), REAL_CONST(77502.246472550498/8.0), REAL_CONST(77524.494058395634/8.0), REAL_CONST(77546.743240480107/8.0), REAL_CONST(77568.994018574944/8.0), REAL_CONST(77591.246392451198/8.0), REAL_CONST(77613.500361880026/8.0), REAL_CONST(77635.755926632657/8.0), REAL_CONST(77658.013086480438/8.0), REAL_CONST(77680.271841194757/8.0), REAL_CONST(77702.532190547092/8.0), REAL_CONST(77724.794134309021/8.0), REAL_CONST(77747.057672252195/8.0), REAL_CONST(77769.322804148323/8.0), REAL_CONST(77791.589529769248/8.0), REAL_CONST(77813.857848886837/8.0), REAL_CONST(77836.127761273063/8.0), REAL_CONST(77858.399266699998/8.0), REAL_CONST(77880.67236493979/8.0), REAL_CONST(77902.947055764627/8.0), REAL_CONST(77925.223338946831/8.0), REAL_CONST(77947.50121425878/8.0), REAL_CONST(77969.780681472927/8.0), REAL_CONST(77992.061740361838/8.0), REAL_CONST(78014.344390698127/8.0), REAL_CONST(78036.628632254491/8.0), REAL_CONST(78058.914464803747/8.0), REAL_CONST(78081.201888118725/8.0), REAL_CONST(78103.490901972415/8.0), REAL_CONST(78125.781506137821/8.0), REAL_CONST(78148.073700388064/8.0), REAL_CONST(78170.367484496339/8.0), REAL_CONST(78192.662858235926/8.0), REAL_CONST(78214.959821380166/8.0), REAL_CONST(78237.258373702498/8.0), REAL_CONST(78259.558514976452/8.0), REAL_CONST(78281.860244975614/8.0), REAL_CONST(78304.163563473659/8.0), REAL_CONST(78326.468470244363/8.0), REAL_CONST(78348.77496506153/8.0), REAL_CONST(78371.083047699125/8.0), REAL_CONST(78393.392717931114/8.0), REAL_CONST(78415.703975531578/8.0), REAL_CONST(78438.016820274701/8.0), REAL_CONST(78460.331251934695/8.0), REAL_CONST(78482.647270285903/8.0), REAL_CONST(78504.964875102727/8.0), REAL_CONST(78527.284066159627/8.0), REAL_CONST(78549.604843231195/8.0), REAL_CONST(78571.927206092048/8.0), REAL_CONST(78594.251154516911/8.0), REAL_CONST(78616.576688280606/8.0), REAL_CONST(78638.903807157985/8.0), REAL_CONST(78661.232510924034/8.0), REAL_CONST(78683.562799353778/8.0), REAL_CONST(78705.894672222363/8.0), REAL_CONST(78728.228129304945/8.0), REAL_CONST(78750.563170376859/8.0), REAL_CONST(78772.899795213423/8.0), REAL_CONST(78795.238003590101/8.0), REAL_CONST(78817.577795282399/8.0), REAL_CONST(78839.919170065928/8.0), REAL_CONST(78862.262127716356/8.0), REAL_CONST(78884.606668009452/8.0), REAL_CONST(78906.952790721043/8.0), REAL_CONST(78929.300495627045/8.0), REAL_CONST(78951.64978250346/8.0), REAL_CONST(78974.000651126378/8.0), REAL_CONST(78996.353101271932/8.0), REAL_CONST(79018.707132716358/8.0), REAL_CONST(79041.062745235977/8.0), REAL_CONST(79063.41993860717/8.0), REAL_CONST(79085.778712606436/8.0), REAL_CONST(79108.139067010285/8.0), REAL_CONST(79130.501001595389/8.0), REAL_CONST(79152.864516138419/8.0), REAL_CONST(79175.22961041618/8.0), REAL_CONST(79197.596284205531/8.0), REAL_CONST(79219.96453728342/8.0), REAL_CONST(79242.33436942687/8.0), REAL_CONST(79264.705780412987/8.0), REAL_CONST(79287.078770018954/8.0), REAL_CONST(79309.453338022009/8.0), REAL_CONST(79331.829484199508/8.0), REAL_CONST(79354.207208328866/8.0), REAL_CONST(79376.586510187582/8.0), REAL_CONST(79398.967389553218/8.0), REAL_CONST(79421.349846203433/8.0), REAL_CONST(79443.733879915948/8.0), REAL_CONST(79466.119490468584/8.0), REAL_CONST(79488.50667763922/8.0), REAL_CONST(79510.895441205823/8.0), REAL_CONST(79533.285780946433/8.0), REAL_CONST(79555.677696639163/8.0), REAL_CONST(79578.071188062226/8.0), REAL_CONST(79600.466254993895/8.0), REAL_CONST(79622.862897212515/8.0), REAL_CONST(79645.261114496549/8.0), REAL_CONST(79667.660906624471/8.0), REAL_CONST(79690.062273374875/8.0), REAL_CONST(79712.465214526455/8.0), REAL_CONST(79734.869729857935/8.0), REAL_CONST(79757.275819148126/8.0), REAL_CONST(79779.683482175955/8.0), REAL_CONST(79802.092718720378/8.0), REAL_CONST(79824.503528560454/8.0), REAL_CONST(79846.915911475327/8.0), REAL_CONST(79869.329867244203/8.0), REAL_CONST(79891.745395646343/8.0), REAL_CONST(79914.162496461155/8.0), REAL_CONST(79936.581169468045/8.0), REAL_CONST(79959.001414446553/8.0), REAL_CONST(79981.423231176261/8.0), REAL_CONST(80003.846619436852/8.0), REAL_CONST(80026.271579008084/8.0), REAL_CONST(80048.698109669771/8.0), REAL_CONST(80071.12621120183/8.0), REAL_CONST(80093.555883384237/8.0), REAL_CONST(80115.987125997053/8.0), REAL_CONST(80138.419938820414/8.0), REAL_CONST(80160.854321634528/8.0), REAL_CONST(80183.290274219689/8.0), REAL_CONST(80205.727796356281/8.0), REAL_CONST(80228.166887824715/8.0), REAL_CONST(80250.607548405547/8.0), REAL_CONST(80273.049777879336/8.0), REAL_CONST(80295.493576026798/8.0), REAL_CONST(80317.938942628651/8.0), REAL_CONST(80340.385877465727/8.0), REAL_CONST(80362.834380318949/8.0), REAL_CONST(80385.28445096928/8.0), REAL_CONST(80407.736089197788/8.0), REAL_CONST(80430.189294785596/8.0), REAL_CONST(80452.644067513917/8.0), REAL_CONST(80475.100407164035/8.0), REAL_CONST(80497.558313517322/8.0), REAL_CONST(80520.017786355209/8.0), REAL_CONST(80542.478825459213/8.0), REAL_CONST(80564.941430610925/8.0), REAL_CONST(80587.405601592007/8.0), REAL_CONST(80609.871338184195/8.0), REAL_CONST(80632.338640169342/8.0), REAL_CONST(80654.8075073293/8.0), REAL_CONST(80677.277939446067/8.0), REAL_CONST(80699.749936301683/8.0), REAL_CONST(80722.223497678278/8.0), REAL_CONST(80744.698623358039/8.0), REAL_CONST(80767.17531312324/8.0), REAL_CONST(80789.653566756242/8.0), REAL_CONST(80812.133384039465/8.0), REAL_CONST(80834.614764755403/8.0), REAL_CONST(80857.097708686648/8.0), REAL_CONST(80879.582215615854/8.0), REAL_CONST(80902.068285325731/8.0), REAL_CONST(80924.555917599093/8.0), REAL_CONST(80947.045112218824/8.0), REAL_CONST(80969.535868967869/8.0), REAL_CONST(80992.028187629272/8.0), REAL_CONST(81014.522067986123/8.0), REAL_CONST(81037.017509821613/8.0), REAL_CONST(81059.514512919006/8.0), REAL_CONST(81082.013077061609/8.0), REAL_CONST(81104.513202032831/8.0), REAL_CONST(81127.014887616184/8.0), REAL_CONST(81149.518133595193/8.0), REAL_CONST(81172.022939753486/8.0), REAL_CONST(81194.529305874807/8.0), REAL_CONST(81217.037231742899/8.0), REAL_CONST(81239.546717141639/8.0), REAL_CONST(81262.057761854958/8.0), REAL_CONST(81284.570365666848/8.0), REAL_CONST(81307.084528361403/8.0), REAL_CONST(81329.600249722775/8.0), REAL_CONST(81352.117529535186/8.0), REAL_CONST(81374.636367582949/8.0), REAL_CONST(81397.156763650448/8.0), REAL_CONST(81419.678717522125/8.0), REAL_CONST(81442.202228982511/8.0), REAL_CONST(81464.727297816222/8.0), REAL_CONST(81487.253923807933/8.0), REAL_CONST(81509.782106742379/8.0), REAL_CONST(81532.311846404409/8.0), REAL_CONST(81554.843142578902/8.0), REAL_CONST(81577.375995050839/8.0), REAL_CONST(81599.910403605274/8.0), REAL_CONST(81622.446368027333/8.0), REAL_CONST(81644.983888102215/8.0), REAL_CONST(81667.522963615178/8.0), REAL_CONST(81690.063594351581/8.0), REAL_CONST(81712.605780096841/8.0), REAL_CONST(81735.149520636449/8.0), REAL_CONST(81757.694815755967/8.0), REAL_CONST(81780.241665241047/8.0), REAL_CONST(81802.79006887741/8.0), REAL_CONST(81825.340026450824/8.0), REAL_CONST(81847.891537747171/8.0), REAL_CONST(81870.444602552379/8.0), REAL_CONST(81892.999220652477/8.0), REAL_CONST(81915.555391833506/8.0), REAL_CONST(81938.113115881672/8.0), REAL_CONST(81960.672392583176/8.0), REAL_CONST(81983.233221724338/8.0), REAL_CONST(82005.795603091537/8.0), REAL_CONST(82028.359536471224/8.0), REAL_CONST(82050.925021649906/8.0), REAL_CONST(82073.492058414209/8.0), REAL_CONST(82096.060646550788/8.0), REAL_CONST(82118.630785846399/8.0), REAL_CONST(82141.202476087841/8.0), REAL_CONST(82163.775717062032/8.0), REAL_CONST(82186.35050855593/8.0), REAL_CONST(82208.926850356569/8.0), REAL_CONST(82231.504742251054/8.0), REAL_CONST(82254.084184026578/8.0), REAL_CONST(82276.665175470393/8.0), REAL_CONST(82299.24771636985/8.0), REAL_CONST(82321.831806512317/8.0), REAL_CONST(82344.417445685307/8.0), REAL_CONST(82367.004633676348/8.0), REAL_CONST(82389.593370273054/8.0), REAL_CONST(82412.183655263143/8.0), REAL_CONST(82434.775488434374/8.0), REAL_CONST(82457.368869574595/8.0), REAL_CONST(82479.963798471697/8.0), REAL_CONST(82502.560274913689/8.0), REAL_CONST(82525.158298688606/8.0), REAL_CONST(82547.757869584602/8.0), REAL_CONST(82570.35898738986/8.0), REAL_CONST(82592.961651892678/8.0), REAL_CONST(82615.565862881398/8.0), REAL_CONST(82638.171620144421/8.0), REAL_CONST(82660.778923470265/8.0), REAL_CONST(82683.387772647475/8.0), REAL_CONST(82705.998167464713/8.0), REAL_CONST(82728.610107710658/8.0), REAL_CONST(82751.223593174116/8.0), REAL_CONST(82773.83862364394/8.0), REAL_CONST(82796.45519890904/8.0), REAL_CONST(82819.073318758441/8.0), REAL_CONST(82841.692982981185/8.0), REAL_CONST(82864.314191366429/8.0), REAL_CONST(82886.936943703375/8.0), REAL_CONST(82909.561239781324/8.0), REAL_CONST(82932.187079389638/8.0), REAL_CONST(82954.814462317736/8.0), REAL_CONST(82977.443388355125/8.0), REAL_CONST(83000.073857291369/8.0), REAL_CONST(83022.70586891612/8.0), REAL_CONST(83045.339423019104/8.0), REAL_CONST(83067.974519390089/8.0), REAL_CONST(83090.611157818959/8.0), REAL_CONST(83113.249338095629/8.0), REAL_CONST(83135.8890600101/8.0), REAL_CONST(83158.530323352461/8.0), REAL_CONST(83181.173127912858/8.0), REAL_CONST(83203.817473481497/8.0), REAL_CONST(83226.463359848669/8.0), REAL_CONST(83249.11078680474/8.0), REAL_CONST(83271.759754140134/8.0), REAL_CONST(83294.410261645375/8.0), REAL_CONST(83317.062309111003/8.0), REAL_CONST(83339.715896327703/8.0), REAL_CONST(83362.371023086147/8.0), REAL_CONST(83385.027689177165/8.0), REAL_CONST(83407.685894391587/8.0), REAL_CONST(83430.345638520361/8.0), REAL_CONST(83453.006921354478/8.0), REAL_CONST(83475.669742685001/8.0), REAL_CONST(83498.334102303095/8.0), REAL_CONST(83520.999999999942/8.0), REAL_CONST(83543.667435566866/8.0), REAL_CONST(83566.336408795192/8.0), REAL_CONST(83589.006919476349/8.0), REAL_CONST(83611.678967401851/8.0), REAL_CONST(83634.352552363242/8.0), REAL_CONST(83657.027674152167/8.0), REAL_CONST(83679.704332560359/8.0), REAL_CONST(83702.382527379552/8.0), REAL_CONST(83725.062258401638/8.0), REAL_CONST(83747.743525418511/8.0), REAL_CONST(83770.42632822218/8.0), REAL_CONST(83793.110666604684/8.0), REAL_CONST(83815.796540358162/8.0), REAL_CONST(83838.483949274829/8.0), REAL_CONST(83861.172893146941/8.0), REAL_CONST(83883.863371766842/8.0), REAL_CONST(83906.555384926964/8.0), REAL_CONST(83929.248932419752/8.0), REAL_CONST(83951.944014037799/8.0), REAL_CONST(83974.640629573696/8.0), REAL_CONST(83997.338778820151/8.0), REAL_CONST(84020.038461569929/8.0), REAL_CONST(84042.739677615857/8.0), REAL_CONST(84065.442426750829/8.0), REAL_CONST(84088.146708767847/8.0), REAL_CONST(84110.852523459922/8.0), REAL_CONST(84133.559870620171/8.0), REAL_CONST(84156.268750041796/8.0), REAL_CONST(84178.979161518029/8.0), REAL_CONST(84201.691104842204/8.0), REAL_CONST(84224.404579807713/8.0), REAL_CONST(84247.119586208006/8.0), REAL_CONST(84269.83612383662/8.0), REAL_CONST(84292.55419248715/8.0), REAL_CONST(84315.273791953281/8.0), REAL_CONST(84337.994922028738/8.0), REAL_CONST(84360.717582507335/8.0), REAL_CONST(84383.441773182945/8.0), REAL_CONST(84406.167493849513/8.0), REAL_CONST(84428.894744301069/8.0), REAL_CONST(84451.623524331691/8.0), REAL_CONST(84474.353833735542/8.0), REAL_CONST(84497.085672306828/8.0), REAL_CONST(84519.819039839858/8.0), REAL_CONST(84542.553936128999/8.0), REAL_CONST(84565.290360968676/8.0), REAL_CONST(84588.028314153402/8.0), REAL_CONST(84610.767795477717/8.0), REAL_CONST(84633.508804736295/8.0), REAL_CONST(84656.251341723822/8.0), REAL_CONST(84678.995406235073/8.0), REAL_CONST(84701.740998064924/8.0), REAL_CONST(84724.488117008252/8.0), REAL_CONST(84747.236762860062/8.0), REAL_CONST(84769.986935415407/8.0), REAL_CONST(84792.73863446941/8.0), REAL_CONST(84815.491859817252/8.0), REAL_CONST(84838.246611254188/8.0), REAL_CONST(84861.002888575575/8.0), REAL_CONST(84883.760691576768/8.0), REAL_CONST(84906.520020053256/8.0), REAL_CONST(84929.28087380057/8.0), REAL_CONST(84952.043252614312/8.0), REAL_CONST(84974.807156290146/8.0), REAL_CONST(84997.572584623806/8.0), REAL_CONST(85020.339537411113/8.0), REAL_CONST(85043.108014447949/8.0), REAL_CONST(85065.878015530237/8.0), REAL_CONST(85088.649540453989/8.0), REAL_CONST(85111.422589015303/8.0), REAL_CONST(85134.197161010321/8.0), REAL_CONST(85156.973256235244/8.0), REAL_CONST(85179.750874486374/8.0), REAL_CONST(85202.530015560071/8.0), REAL_CONST(85225.310679252725/8.0), REAL_CONST(85248.092865360857/8.0), REAL_CONST(85270.876573681016/8.0), REAL_CONST(85293.661804009811/8.0), REAL_CONST(85316.448556143951/8.0), REAL_CONST(85339.236829880188/8.0), REAL_CONST(85362.026625015351/8.0), REAL_CONST(85384.817941346351/8.0), REAL_CONST(85407.610778670132/8.0), REAL_CONST(85430.405136783724/8.0), REAL_CONST(85453.201015484257/8.0), REAL_CONST(85475.998414568865/8.0), REAL_CONST(85498.797333834795/8.0), REAL_CONST(85521.597773079353/8.0), REAL_CONST(85544.399732099904/8.0), REAL_CONST(85567.203210693886/8.0), REAL_CONST(85590.008208658808/8.0), REAL_CONST(85612.814725792239/8.0), REAL_CONST(85635.62276189182/8.0), REAL_CONST(85658.432316755265/8.0), REAL_CONST(85681.243390180331/8.0), REAL_CONST(85704.055981964877/8.0), REAL_CONST(85726.870091906807/8.0), REAL_CONST(85749.685719804082/8.0), REAL_CONST(85772.502865454764/8.0), REAL_CONST(85795.321528656961/8.0), REAL_CONST(85818.141709208852/8.0), REAL_CONST(85840.963406908675/8.0), REAL_CONST(85863.78662155474/8.0), REAL_CONST(85886.611352945445/8.0), REAL_CONST(85909.437600879217/8.0), REAL_CONST(85932.26536515457/8.0), REAL_CONST(85955.094645570091/8.0), REAL_CONST(85977.92544192441/8.0), REAL_CONST(86000.757754016275/8.0), REAL_CONST(86023.591581644432/8.0), REAL_CONST(86046.426924607746/8.0), REAL_CONST(86069.263782705122/8.0), REAL_CONST(86092.102155735556/8.0), REAL_CONST(86114.942043498071/8.0), REAL_CONST(86137.783445791807/8.0), REAL_CONST(86160.626362415918/8.0), REAL_CONST(86183.470793169676/8.0), REAL_CONST(86206.316737852379/8.0), REAL_CONST(86229.164196263402/8.0), REAL_CONST(86252.013168202204/8.0), REAL_CONST(86274.863653468303/8.0), REAL_CONST(86297.715651861261/8.0), REAL_CONST(86320.569163180728/8.0), REAL_CONST(86343.424187226425/8.0), REAL_CONST(86366.280723798132/8.0), REAL_CONST(86389.138772695675/8.0), REAL_CONST(86411.998333718977/8.0), REAL_CONST(86434.859406668009/8.0), REAL_CONST(86457.721991342827/8.0), REAL_CONST(86480.586087543532/8.0), REAL_CONST(86503.451695070296/8.0), REAL_CONST(86526.318813723352/8.0), REAL_CONST(86549.187443303032/8.0), REAL_CONST(86572.057583609683/8.0), REAL_CONST(86594.929234443756/8.0), REAL_CONST(86617.802395605773/8.0), REAL_CONST(86640.677066896271/8.0), REAL_CONST(86663.553248115903/8.0), REAL_CONST(86686.43093906538/8.0), REAL_CONST(86709.310139545443/8.0), REAL_CONST(86732.190849356964/8.0), REAL_CONST(86755.073068300815/8.0), REAL_CONST(86777.956796177954/8.0), REAL_CONST(86800.842032789442/8.0), REAL_CONST(86823.728777936354/8.0), REAL_CONST(86846.617031419853/8.0), REAL_CONST(86869.506793041175/8.0), REAL_CONST(86892.398062601613/8.0), REAL_CONST(86915.290839902518/8.0), REAL_CONST(86938.185124745316/8.0), REAL_CONST(86961.080916931489/8.0), REAL_CONST(86983.978216262592/8.0), REAL_CONST(87006.87702254027/8.0), REAL_CONST(87029.777335566177/8.0), REAL_CONST(87052.67915514209/8.0), REAL_CONST(87075.582481069796/8.0), REAL_CONST(87098.487313151185/8.0), REAL_CONST(87121.39365118822/8.0), REAL_CONST(87144.301494982894/8.0), REAL_CONST(87167.210844337285/8.0), REAL_CONST(87190.121699053532/8.0), REAL_CONST(87213.034058933845/8.0), REAL_CONST(87235.947923780506/8.0), REAL_CONST(87258.863293395829/8.0), REAL_CONST(87281.780167582241/8.0), REAL_CONST(87304.698546142172/8.0), REAL_CONST(87327.618428878181/8.0), REAL_CONST(87350.539815592856/8.0), REAL_CONST(87373.462706088845/8.0), REAL_CONST(87396.387100168897/8.0), REAL_CONST(87419.312997635774/8.0), REAL_CONST(87442.240398292357/8.0), REAL_CONST(87465.16930194154/8.0), REAL_CONST(87488.099708386319/8.0), REAL_CONST(87511.031617429733/8.0), REAL_CONST(87533.965028874911/8.0), REAL_CONST(87556.899942525008/8.0), REAL_CONST(87579.836358183282/8.0), REAL_CONST(87602.774275653021/8.0), REAL_CONST(87625.713694737613/8.0), REAL_CONST(87648.654615240492/8.0), REAL_CONST(87671.597036965148/8.0), REAL_CONST(87694.540959715145/8.0), REAL_CONST(87717.486383294105/8.0), REAL_CONST(87740.433307505737/8.0), REAL_CONST(87763.381732153779/8.0), REAL_CONST(87786.331657042057/8.0), REAL_CONST(87809.283081974456/8.0), REAL_CONST(87832.236006754916/8.0), REAL_CONST(87855.190431187453/8.0), REAL_CONST(87878.146355076155/8.0), REAL_CONST(87901.103778225151/8.0), REAL_CONST(87924.062700438633/8.0), REAL_CONST(87947.023121520891/8.0), REAL_CONST(87969.985041276246/8.0), REAL_CONST(87992.948459509105/8.0), REAL_CONST(88015.913376023906/8.0), REAL_CONST(88038.879790625171/8.0), REAL_CONST(88061.847703117513/8.0), REAL_CONST(88084.817113305573/8.0), REAL_CONST(88107.788020994049/8.0), REAL_CONST(88130.760425987726/8.0), REAL_CONST(88153.734328091465/8.0), REAL_CONST(88176.709727110137/8.0), REAL_CONST(88199.686622848749/8.0), REAL_CONST(88222.665015112303/8.0), REAL_CONST(88245.644903705906/8.0), REAL_CONST(88268.626288434709/8.0), REAL_CONST(88291.609169103947/8.0), REAL_CONST(88314.593545518903/8.0), REAL_CONST(88337.579417484914/8.0), REAL_CONST(88360.566784807408/8.0), REAL_CONST(88383.555647291854/8.0), REAL_CONST(88406.546004743795/8.0), REAL_CONST(88429.537856968818/8.0), REAL_CONST(88452.531203772611/8.0), REAL_CONST(88475.52604496089/8.0), REAL_CONST(88498.522380339447/8.0), REAL_CONST(88521.52020971413/8.0), REAL_CONST(88544.519532890874/8.0), REAL_CONST(88567.520349675644/8.0), REAL_CONST(88590.522659874507/8.0), REAL_CONST(88613.526463293543/8.0), REAL_CONST(88636.531759738922/8.0), REAL_CONST(88659.538549016899/8.0), REAL_CONST(88682.546830933745/8.0), REAL_CONST(88705.556605295846/8.0), REAL_CONST(88728.567871909589/8.0), REAL_CONST(88751.580630581491/8.0), REAL_CONST(88774.594881118086/8.0), REAL_CONST(88797.610623325963/8.0), REAL_CONST(88820.62785701183/8.0), REAL_CONST(88843.646581982393/8.0), REAL_CONST(88866.666798044462/8.0), REAL_CONST(88889.688505004888/8.0), REAL_CONST(88912.711702670611/8.0), REAL_CONST(88935.7363908486/8.0), REAL_CONST(88958.762569345898/8.0), REAL_CONST(88981.790237969632/8.0), REAL_CONST(89004.81939652696/8.0), REAL_CONST(89027.850044825114/8.0), REAL_CONST(89050.882182671412/8.0), REAL_CONST(89073.9158098732/8.0), REAL_CONST(89096.950926237885/8.0), REAL_CONST(89119.987531572973/8.0), REAL_CONST(89143.025625686001/8.0), REAL_CONST(89166.065208384563/8.0), REAL_CONST(89189.106279476357/8.0), REAL_CONST(89212.148838769106/8.0), REAL_CONST(89235.192886070581/8.0), REAL_CONST(89258.238421188667/8.0), REAL_CONST(89281.285443931265/8.0), REAL_CONST(89304.333954106376/8.0), REAL_CONST(89327.383951522017/8.0), REAL_CONST(89350.435435986306/8.0), REAL_CONST(89373.488407307406/8.0), REAL_CONST(89396.542865293537/8.0), REAL_CONST(89419.598809753006/8.0), REAL_CONST(89442.656240494165/8.0), REAL_CONST(89465.715157325409/8.0), REAL_CONST(89488.775560055219/8.0), REAL_CONST(89511.837448492137/8.0), REAL_CONST(89534.900822444746/8.0), REAL_CONST(89557.965681721733/8.0), REAL_CONST(89581.032026131812/8.0), REAL_CONST(89604.099855483742/8.0), REAL_CONST(89627.169169586399/8.0), REAL_CONST(89650.239968248672/8.0), REAL_CONST(89673.312251279538/8.0), REAL_CONST(89696.386018488018/8.0), REAL_CONST(89719.461269683205/8.0), REAL_CONST(89742.53800467425/8.0), REAL_CONST(89765.616223270365/8.0), REAL_CONST(89788.69592528083/8.0), REAL_CONST(89811.777110514988/8.0), REAL_CONST(89834.859778782207/8.0), REAL_CONST(89857.943929891975/8.0), REAL_CONST(89881.029563653807/8.0), REAL_CONST(89904.116679877261/8.0), REAL_CONST(89927.205278372014/8.0), REAL_CONST(89950.29535894774/8.0), REAL_CONST(89973.386921414218/8.0), REAL_CONST(89996.479965581268/8.0), REAL_CONST(90019.574491258769/8.0), REAL_CONST(90042.670498256688/8.0), REAL_CONST(90065.767986385021/8.0), REAL_CONST(90088.866955453836/8.0), REAL_CONST(90111.967405273259/8.0), REAL_CONST(90135.069335653476/8.0), REAL_CONST(90158.172746404758/8.0), REAL_CONST(90181.277637337407/8.0), REAL_CONST(90204.384008261797/8.0), REAL_CONST(90227.49185898836/8.0), REAL_CONST(90250.601189327586/8.0), REAL_CONST(90273.711999090039/8.0), REAL_CONST(90296.824288086325/8.0), REAL_CONST(90319.938056127125/8.0), REAL_CONST(90343.053303023189/8.0), REAL_CONST(90366.170028585286/8.0), REAL_CONST(90389.288232624298/8.0), REAL_CONST(90412.407914951138/8.0), REAL_CONST(90435.529075376777/8.0), REAL_CONST(90458.651713712257/8.0), REAL_CONST(90481.775829768681/8.0), REAL_CONST(90504.901423357209/8.0), REAL_CONST(90528.028494289058/8.0), REAL_CONST(90551.157042375504/8.0), REAL_CONST(90574.287067427911/8.0), REAL_CONST(90597.418569257643/8.0), REAL_CONST(90620.551547676194/8.0), REAL_CONST(90643.686002495073/8.0), REAL_CONST(90666.821933525847/8.0), REAL_CONST(90689.959340580186/8.0), REAL_CONST(90713.098223469773/8.0), REAL_CONST(90736.238582006365/8.0), REAL_CONST(90759.380416001804/8.0), REAL_CONST(90782.523725267951/8.0), REAL_CONST(90805.668509616764/8.0), REAL_CONST(90828.814768860233/8.0), REAL_CONST(90851.962502810435/8.0), REAL_CONST(90875.11171127946/8.0), REAL_CONST(90898.262394079517/8.0), REAL_CONST(90921.414551022855/8.0), REAL_CONST(90944.568181921743/8.0), REAL_CONST(90967.72328658856/8.0), REAL_CONST(90990.879864835719/8.0), REAL_CONST(91014.037916475718/8.0), REAL_CONST(91037.19744132107/8.0), REAL_CONST(91060.358439184391/8.0), REAL_CONST(91083.520909878338/8.0), REAL_CONST(91106.684853215629/8.0), REAL_CONST(91129.850269009039/8.0), REAL_CONST(91153.017157071401/8.0), REAL_CONST(91176.185517215621/8.0), REAL_CONST(91199.355349254649/8.0), REAL_CONST(91222.526653001492/8.0), REAL_CONST(91245.699428269247/8.0), REAL_CONST(91268.873674871036/8.0), REAL_CONST(91292.049392620058/8.0), REAL_CONST(91315.226581329553/8.0), REAL_CONST(91338.405240812834/8.0), REAL_CONST(91361.585370883287/8.0), REAL_CONST(91384.766971354344/8.0), REAL_CONST(91407.950042039476/8.0), REAL_CONST(91431.134582752245/8.0), REAL_CONST(91454.320593306256/8.0), REAL_CONST(91477.508073515171/8.0), REAL_CONST(91500.697023192712/8.0), REAL_CONST(91523.887442152685/8.0), REAL_CONST(91547.07933020893/8.0), REAL_CONST(91570.272687175326/8.0), REAL_CONST(91593.467512865856/8.0), REAL_CONST(91616.663807094534/8.0), REAL_CONST(91639.861569675442/8.0), REAL_CONST(91663.060800422725/8.0), REAL_CONST(91686.261499150554/8.0), REAL_CONST(91709.463665673218/8.0), REAL_CONST(91732.66729980502/8.0), REAL_CONST(91755.872401360321/8.0), REAL_CONST(91779.078970153569/8.0), REAL_CONST(91802.287005999257/8.0), REAL_CONST(91825.49650871192/8.0), REAL_CONST(91848.707478106167/8.0), REAL_CONST(91871.91991399668/8.0), REAL_CONST(91895.133816198169/8.0), REAL_CONST(91918.349184525418/8.0), REAL_CONST(91941.566018793281/8.0), REAL_CONST(91964.784318816659/8.0), REAL_CONST(91988.004084410495/8.0), REAL_CONST(92011.22531538982/8.0), REAL_CONST(92034.448011569708/8.0), REAL_CONST(92057.672172765277/8.0), REAL_CONST(92080.897798791746/8.0), REAL_CONST(92104.124889464365/8.0), REAL_CONST(92127.353444598411/8.0), REAL_CONST(92150.58346400928/8.0), REAL_CONST(92173.814947512379/8.0), REAL_CONST(92197.04789492322/8.0), REAL_CONST(92220.282306057314/8.0), REAL_CONST(92243.518180730272/8.0), REAL_CONST(92266.755518757753/8.0), REAL_CONST(92289.994319955469/8.0), REAL_CONST(92313.234584139194/8.0), REAL_CONST(92336.476311124774/8.0), REAL_CONST(92359.719500728082/8.0), REAL_CONST(92382.964152765067/8.0), REAL_CONST(92406.210267051734/8.0), REAL_CONST(92429.457843404161/8.0), REAL_CONST(92452.706881638471/8.0), REAL_CONST(92475.957381570814/8.0), REAL_CONST(92499.209343017443/8.0), REAL_CONST(92522.462765794655/8.0), REAL_CONST(92545.717649718805/8.0), REAL_CONST(92568.973994606305/8.0), REAL_CONST(92592.231800273614/8.0), REAL_CONST(92615.491066537259/8.0), REAL_CONST(92638.751793213814/8.0), REAL_CONST(92662.01398011994/8.0), REAL_CONST(92685.277627072326/8.0), REAL_CONST(92708.54273388772/8.0), REAL_CONST(92731.809300382942/8.0), REAL_CONST(92755.077326374871/8.0), REAL_CONST(92778.346811680414/8.0), REAL_CONST(92801.617756116568/8.0), REAL_CONST(92824.890159500384/8.0), REAL_CONST(92848.164021648947/8.0), REAL_CONST(92871.439342379424/8.0), REAL_CONST(92894.716121509016/8.0), REAL_CONST(92917.994358855023/8.0), REAL_CONST(92941.274054234746/8.0), REAL_CONST(92964.555207465572/8.0), REAL_CONST(92987.837818364962/8.0), REAL_CONST(93011.121886750407/8.0), REAL_CONST(93034.407412439468/8.0), REAL_CONST(93057.694395249753/8.0), REAL_CONST(93080.982834998955/8.0), REAL_CONST(93104.272731504767/8.0), REAL_CONST(93127.564084584999/8.0), REAL_CONST(93150.856894057491/8.0), REAL_CONST(93174.15115974014/8.0), REAL_CONST(93197.446881450916/8.0), REAL_CONST(93220.744059007804/8.0), REAL_CONST(93244.04269222889/8.0), REAL_CONST(93267.342780932304/8.0), REAL_CONST(93290.644324936235/8.0), REAL_CONST(93313.947324058914/8.0), REAL_CONST(93337.251778118633/8.0), REAL_CONST(93360.557686933767/8.0), REAL_CONST(93383.865050322696/8.0), REAL_CONST(93407.173868103928/8.0), REAL_CONST(93430.484140095941/8.0), REAL_CONST(93453.795866117362/8.0), REAL_CONST(93477.109045986799/8.0), REAL_CONST(93500.423679522952/8.0), REAL_CONST(93523.739766544561/8.0), REAL_CONST(93547.057306870454/8.0), REAL_CONST(93570.376300319491/8.0), REAL_CONST(93593.696746710571/8.0), REAL_CONST(93617.018645862699/8.0), REAL_CONST(93640.341997594893/8.0), REAL_CONST(93663.666801726242/8.0), REAL_CONST(93686.993058075881/8.0), REAL_CONST(93710.320766463032/8.0), REAL_CONST(93733.64992670693/8.0), REAL_CONST(93756.980538626914/8.0), REAL_CONST(93780.312602042337/8.0), REAL_CONST(93803.646116772637/8.0), REAL_CONST(93826.981082637285/8.0), REAL_CONST(93850.317499455836/8.0), REAL_CONST(93873.655367047861/8.0), REAL_CONST(93896.994685233032/8.0), REAL_CONST(93920.335453831038/8.0), REAL_CONST(93943.677672661666/8.0), REAL_CONST(93967.021341544707/8.0), REAL_CONST(93990.366460300051/8.0), REAL_CONST(94013.713028747632/8.0), REAL_CONST(94037.061046707429/8.0), REAL_CONST(94060.410513999494/8.0), REAL_CONST(94083.761430443905/8.0), REAL_CONST(94107.113795860845/8.0), REAL_CONST(94130.467610070496/8.0), REAL_CONST(94153.822872893157/8.0), REAL_CONST(94177.179584149111/8.0), REAL_CONST(94200.537743658759/8.0), REAL_CONST(94223.897351242529/8.0), REAL_CONST(94247.25840672091/8.0), REAL_CONST(94270.620909914433/8.0), REAL_CONST(94293.98486064373/8.0), REAL_CONST(94317.350258729421/8.0), REAL_CONST(94340.71710399224/8.0), REAL_CONST(94364.085396252936/8.0), REAL_CONST(94387.455135332348/8.0), REAL_CONST(94410.82632105134/8.0), REAL_CONST(94434.198953230851/8.0), REAL_CONST(94457.573031691878/8.0), REAL_CONST(94480.948556255447/8.0), REAL_CONST(94504.325526742658/8.0), REAL_CONST(94527.70394297468/8.0), REAL_CONST(94551.083804772716/8.0), REAL_CONST(94574.465111958023/8.0), REAL_CONST(94597.847864351934/8.0), REAL_CONST(94621.232061775823/8.0), REAL_CONST(94644.617704051096/8.0), REAL_CONST(94668.004790999272/8.0), REAL_CONST(94691.393322441872/8.0), REAL_CONST(94714.783298200506/8.0), REAL_CONST(94738.174718096794/8.0), REAL_CONST(94761.567581952477/8.0), REAL_CONST(94784.961889589307/8.0), REAL_CONST(94808.357640829097/8.0), REAL_CONST(94831.754835493703/8.0), REAL_CONST(94855.153473405066/8.0), REAL_CONST(94878.553554385173/8.0), REAL_CONST(94901.955078256055/8.0), REAL_CONST(94925.358044839784/8.0), REAL_CONST(94948.762453958523/8.0), REAL_CONST(94972.168305434476/8.0), REAL_CONST(94995.575599089891/8.0), REAL_CONST(95018.984334747074/8.0), REAL_CONST(95042.394512228391/8.0), REAL_CONST(95065.806131356265/8.0), REAL_CONST(95089.219191953176/8.0), REAL_CONST(95112.633693841635/8.0), REAL_CONST(95136.04963684424/8.0), REAL_CONST(95159.467020783617/8.0), REAL_CONST(95182.885845482466/8.0), REAL_CONST(95206.306110763529/8.0), REAL_CONST(95229.727816449609/8.0), REAL_CONST(95253.150962363579/8.0), REAL_CONST(95276.575548328314/8.0), REAL_CONST(95300.001574166803/8.0), REAL_CONST(95323.429039702052/8.0), REAL_CONST(95346.857944757154/8.0), REAL_CONST(95370.288289155214/8.0), REAL_CONST(95393.720072719429/8.0), REAL_CONST(95417.153295273019/8.0), REAL_CONST(95440.587956639298/8.0), REAL_CONST(95464.024056641589/8.0), REAL_CONST(95487.461595103305/8.0), REAL_CONST(95510.900571847902/8.0), REAL_CONST(95534.340986698866/8.0), REAL_CONST(95557.782839479783/8.0), REAL_CONST(95581.226130014256/8.0), REAL_CONST(95604.670858125959/8.0), REAL_CONST(95628.117023638595/8.0), REAL_CONST(95651.564626375985/8.0), REAL_CONST(95675.013666161918/8.0), REAL_CONST(95698.464142820303/8.0), REAL_CONST(95721.916056175076/8.0), REAL_CONST(95745.369406050231/8.0), REAL_CONST(95768.824192269807/8.0), REAL_CONST(95792.280414657915/8.0), REAL_CONST(95815.738073038709/8.0), REAL_CONST(95839.197167236387/8.0), REAL_CONST(95862.657697075221/8.0), REAL_CONST(95886.11966237954/8.0), REAL_CONST(95909.583062973688/8.0), REAL_CONST(95933.047898682111/8.0), REAL_CONST(95956.514169329268/8.0), REAL_CONST(95979.981874739708/8.0), REAL_CONST(96003.451014738006/8.0), REAL_CONST(96026.921589148798/8.0), REAL_CONST(96050.393597796792/8.0), REAL_CONST(96073.867040506724/8.0), REAL_CONST(96097.341917103375/8.0), REAL_CONST(96120.818227411626/8.0), REAL_CONST(96144.295971256375/8.0), REAL_CONST(96167.775148462577/8.0), REAL_CONST(96191.255758855244/8.0), REAL_CONST(96214.737802259449/8.0), REAL_CONST(96238.221278500292/8.0), REAL_CONST(96261.70618740299/8.0), REAL_CONST(96285.192528792715/8.0), REAL_CONST(96308.680302494788/8.0), REAL_CONST(96332.169508334526/8.0), REAL_CONST(96355.660146137321/8.0), REAL_CONST(96379.152215728609/8.0), REAL_CONST(96402.645716933868/8.0), REAL_CONST(96426.14064957868/8.0), REAL_CONST(96449.637013488609/8.0), REAL_CONST(96473.134808489311/8.0), REAL_CONST(96496.63403440651/8.0), REAL_CONST(96520.134691065963/8.0), REAL_CONST(96543.636778293469/8.0), REAL_CONST(96567.140295914898/8.0), REAL_CONST(96590.645243756153/8.0), REAL_CONST(96614.151621643221/8.0), REAL_CONST(96637.659429402134/8.0), REAL_CONST(96661.168666858954/8.0), REAL_CONST(96684.679333839798/8.0), REAL_CONST(96708.191430170875/8.0), REAL_CONST(96731.70495567839/8.0), REAL_CONST(96755.219910188665/8.0), REAL_CONST(96778.736293528011/8.0), REAL_CONST(96802.254105522836/8.0), REAL_CONST(96825.77334599958/8.0), REAL_CONST(96849.29401478474/8.0), REAL_CONST(96872.816111704873/8.0), REAL_CONST(96896.339636586577/8.0), REAL_CONST(96919.864589256511/8.0), REAL_CONST(96943.390969541389/8.0), REAL_CONST(96966.918777267958/8.0), REAL_CONST(96990.448012263048/8.0), REAL_CONST(97013.978674353522/8.0), REAL_CONST(97037.510763366285/8.0), REAL_CONST(97061.044279128328/8.0), REAL_CONST(97084.579221466673/8.0), REAL_CONST(97108.115590208385/8.0), REAL_CONST(97131.653385180587/8.0), REAL_CONST(97155.19260621049/8.0), REAL_CONST(97178.733253125291/8.0), REAL_CONST(97202.2753257523/8.0), REAL_CONST(97225.81882391886/8.0), REAL_CONST(97249.363747452342/8.0), REAL_CONST(97272.910096180189/8.0), REAL_CONST(97296.457869929916/8.0), REAL_CONST(97320.007068529041/8.0), REAL_CONST(97343.557691805196/8.0), REAL_CONST(97367.109739586012/8.0), REAL_CONST(97390.663211699197/8.0), REAL_CONST(97414.218107972498/8.0), REAL_CONST(97437.774428233737/8.0), REAL_CONST(97461.332172310766/8.0), REAL_CONST(97484.891340031507/8.0), REAL_CONST(97508.451931223899/8.0), REAL_CONST(97532.013945715982/8.0), REAL_CONST(97555.577383335811/8.0), REAL_CONST(97579.142243911512/8.0), REAL_CONST(97602.708527271257/8.0), REAL_CONST(97626.276233243261/8.0), REAL_CONST(97649.845361655811/8.0), REAL_CONST(97673.415912337223/8.0), REAL_CONST(97696.987885115886/8.0), REAL_CONST(97720.561279820206/8.0), REAL_CONST(97744.1360962787/8.0), REAL_CONST(97767.712334319876/8.0), REAL_CONST(97791.289993772341/8.0), REAL_CONST(97814.869074464703/8.0), REAL_CONST(97838.449576225685/8.0), REAL_CONST(97862.031498883996/8.0), REAL_CONST(97885.614842268449/8.0), REAL_CONST(97909.199606207883/8.0), REAL_CONST(97932.785790531183/8.0), REAL_CONST(97956.37339506732/8.0), REAL_CONST(97979.962419645264/8.0), REAL_CONST(98003.552864094076/8.0), REAL_CONST(98027.144728242856/8.0), REAL_CONST(98050.738011920766/8.0), REAL_CONST(98074.332714956996/8.0), REAL_CONST(98097.928837180807/8.0), REAL_CONST(98121.526378421506/8.0), REAL_CONST(98145.125338508456/8.0), REAL_CONST(98168.725717271067/8.0), REAL_CONST(98192.327514538789/8.0), REAL_CONST(98215.930730141132/8.0), REAL_CONST(98239.535363907664/8.0), REAL_CONST(98263.141415668011/8.0), REAL_CONST(98286.748885251814/8.0), REAL_CONST(98310.357772488816/8.0), REAL_CONST(98333.968077208759/8.0), REAL_CONST(98357.579799241488/8.0), REAL_CONST(98381.192938416847/8.0), REAL_CONST(98404.807494564782/8.0), REAL_CONST(98428.42346751524/8.0), REAL_CONST(98452.040857098269/8.0), REAL_CONST(98475.659663143917/8.0), REAL_CONST(98499.27988548232/8.0), REAL_CONST(98522.901523943656/8.0), REAL_CONST(98546.524578358163/8.0), REAL_CONST(98570.149048556093/8.0), REAL_CONST(98593.774934367786/8.0), REAL_CONST(98617.402235623624/8.0), REAL_CONST(98641.030952154048/8.0), REAL_CONST(98664.661083789513/8.0), REAL_CONST(98688.292630360564/8.0), REAL_CONST(98711.925591697771/8.0), REAL_CONST(98735.559967631794/8.0), REAL_CONST(98759.195757993293/8.0), REAL_CONST(98782.832962613014/8.0), REAL_CONST(98806.471581321734/8.0), REAL_CONST(98830.111613950285/8.0), REAL_CONST(98853.753060329575/8.0), REAL_CONST(98877.39592029051/8.0), REAL_CONST(98901.040193664099/8.0), REAL_CONST(98924.68588028138/8.0), REAL_CONST(98948.33297997342/8.0), REAL_CONST(98971.981492571387/8.0), REAL_CONST(98995.63141790645/8.0), REAL_CONST(99019.282755809851/8.0), REAL_CONST(99042.935506112874/8.0), REAL_CONST(99066.589668646877/8.0), REAL_CONST(99090.245243243233/8.0), REAL_CONST(99113.902229733401/8.0), REAL_CONST(99137.560627948857/8.0), REAL_CONST(99161.220437721131/8.0), REAL_CONST(99184.881658881859/8.0), REAL_CONST(99208.544291262631/8.0), REAL_CONST(99232.208334695169/8.0), REAL_CONST(99255.87378901121/8.0), REAL_CONST(99279.540654042547/8.0), REAL_CONST(99303.208929621018/8.0), REAL_CONST(99326.878615578535/8.0), REAL_CONST(99350.549711746993/8.0), REAL_CONST(99374.222217958435/8.0), REAL_CONST(99397.896134044888/8.0), REAL_CONST(99421.571459838422/8.0), REAL_CONST(99445.248195171211/8.0), REAL_CONST(99468.926339875441/8.0), REAL_CONST(99492.605893783344/8.0), REAL_CONST(99516.286856727209/8.0), REAL_CONST(99539.969228539398/8.0), REAL_CONST(99563.653009052287/8.0), REAL_CONST(99587.338198098325/8.0), REAL_CONST(99611.024795510006/8.0), REAL_CONST(99634.712801119866/8.0), REAL_CONST(99658.402214760499/8.0), REAL_CONST(99682.093036264545/8.0), REAL_CONST(99705.785265464699/8.0), REAL_CONST(99729.478902193689/8.0), REAL_CONST(99753.173946284325/8.0), REAL_CONST(99776.870397569437/8.0), REAL_CONST(99800.56825588191/8.0), REAL_CONST(99824.267521054688/8.0), REAL_CONST(99847.968192920773/8.0), REAL_CONST(99871.670271313182/8.0), REAL_CONST(99895.373756065004/8.0), REAL_CONST(99919.078647009388/8.0), REAL_CONST(99942.78494397951/8.0), REAL_CONST(99966.492646808634/8.0), REAL_CONST(99990.20175533001/8.0), REAL_CONST(100013.91226937699/8.0), REAL_CONST(100037.62418878295/8.0), REAL_CONST(100061.33751338134/8.0), REAL_CONST(100085.05224300563/8.0), REAL_CONST(100108.76837748935/8.0), REAL_CONST(100132.4859166661/8.0), REAL_CONST(100156.2048603695/8.0), REAL_CONST(100179.92520843323/8.0), REAL_CONST(100203.64696069101/8.0), REAL_CONST(100227.37011697664/8.0), REAL_CONST(100251.09467712394/8.0), REAL_CONST(100274.82064096678/8.0), REAL_CONST(100298.54800833909/8.0), REAL_CONST(100322.27677907483/8.0), REAL_CONST(100346.00695300807/8.0), REAL_CONST(100369.73852997283/8.0), REAL_CONST(100393.47150980328/8.0), REAL_CONST(100417.20589233354/8.0), REAL_CONST(100440.94167739789/8.0), REAL_CONST(100464.67886483055/8.0), REAL_CONST(100488.41745446586/8.0), REAL_CONST(100512.1574461382/8.0), REAL_CONST(100535.89883968196/8.0), REAL_CONST(100559.64163493161/8.0), REAL_CONST(100583.38583172169/8.0), REAL_CONST(100607.13142988674/8.0), REAL_CONST(100630.87842926137/8.0), REAL_CONST(100654.62682968024/8.0), REAL_CONST(100678.37663097809/8.0), REAL_CONST(100702.12783298964/8.0), REAL_CONST(100725.88043554971/8.0), REAL_CONST(100749.63443849317/8.0), REAL_CONST(100773.38984165489/8.0), REAL_CONST(100797.14664486986/8.0), REAL_CONST(100820.90484797307/8.0), REAL_CONST(100844.66445079957/8.0), REAL_CONST(100868.42545318443/8.0), REAL_CONST(100892.18785496285/8.0), REAL_CONST(100915.95165596998/8.0), REAL_CONST(100939.71685604109/8.0), REAL_CONST(100963.48345501146/8.0), REAL_CONST(100987.25145271645/8.0), REAL_CONST(101011.02084899142/8.0), REAL_CONST(101034.79164367182/8.0), REAL_CONST(101058.56383659317/8.0), REAL_CONST(101082.33742759094/8.0), REAL_CONST(101106.11241650078/8.0), REAL_CONST(101129.88880315828/8.0), REAL_CONST(101153.66658739912/8.0), REAL_CONST(101177.44576905905/8.0), REAL_CONST(101201.22634797383/8.0), REAL_CONST(101225.00832397929/8.0), REAL_CONST(101248.7916969113/8.0), REAL_CONST(101272.57646660579/8.0), REAL_CONST(101296.36263289873/8.0), REAL_CONST(101320.15019562612/8.0), REAL_CONST(101343.93915462404/8.0), REAL_CONST(101367.7295097286/8.0), REAL_CONST(101391.52126077596/8.0), REAL_CONST(101415.31440760233/8.0), REAL_CONST(101439.10895004397/8.0), REAL_CONST(101462.9048879372/8.0), REAL_CONST(101486.70222111834/8.0), REAL_CONST(101510.50094942382/8.0), REAL_CONST(101534.30107269008/8.0), REAL_CONST(101558.10259075361/8.0), REAL_CONST(101581.90550345098/8.0), REAL_CONST(101605.70981061876/8.0), REAL_CONST(101629.5155120936/8.0), REAL_CONST(101653.32260771218/8.0), REAL_CONST(101677.13109731126/8.0), REAL_CONST(101700.9409807276/8.0), REAL_CONST(101724.75225779804/8.0), REAL_CONST(101748.56492835947/8.0), REAL_CONST(101772.37899224881/8.0), REAL_CONST(101796.19444930303/8.0), REAL_CONST(101820.01129935916/8.0), REAL_CONST(101843.82954225427/8.0), REAL_CONST(101867.64917782549/8.0), REAL_CONST(101891.47020590997/8.0), REAL_CONST(101915.29262634492/8.0), REAL_CONST(101939.11643896763/8.0), REAL_CONST(101962.94164361537/8.0), REAL_CONST(101986.76824012553/8.0), REAL_CONST(102010.59622833549/8.0), REAL_CONST(102034.42560808272/8.0), REAL_CONST(102058.25637920471/8.0), REAL_CONST(102082.08854153901/8.0), REAL_CONST(102105.9220949232/8.0), REAL_CONST(102129.75703919494/8.0), REAL_CONST(102153.59337419191/8.0), REAL_CONST(102177.43109975185/8.0), REAL_CONST(102201.27021571253/8.0), REAL_CONST(102225.1107219118/8.0), REAL_CONST(102248.95261818753/8.0), REAL_CONST(102272.79590437764/8.0), REAL_CONST(102296.64058032009/8.0), REAL_CONST(102320.48664585294/8.0), REAL_CONST(102344.33410081422/8.0), REAL_CONST(102368.18294504205/8.0), REAL_CONST(102392.03317837461/8.0), REAL_CONST(102415.88480065008/8.0), REAL_CONST(102439.73781170673/8.0), REAL_CONST(102463.59221138287/8.0), REAL_CONST(102487.44799951684/8.0), REAL_CONST(102511.30517594704/8.0), REAL_CONST(102535.1637405119/8.0), REAL_CONST(102559.02369304992/8.0), REAL_CONST(102582.88503339965/8.0), REAL_CONST(102606.74776139967/8.0), REAL_CONST(102630.61187688859/8.0), REAL_CONST(102654.4773797051/8.0), REAL_CONST(102678.34426968795/8.0), REAL_CONST(102702.21254667587/8.0), REAL_CONST(102726.08221050771/8.0), REAL_CONST(102749.95326102231/8.0), REAL_CONST(102773.8256980586/8.0), REAL_CONST(102797.69952145554/8.0), REAL_CONST(102821.57473105213/8.0), REAL_CONST(102845.45132668741/8.0), REAL_CONST(102869.32930820051/8.0), REAL_CONST(102893.20867543056/8.0), REAL_CONST(102917.08942821674/8.0), REAL_CONST(102940.97156639832/8.0), REAL_CONST(102964.85508981455/8.0), REAL_CONST(102988.73999830478/8.0), REAL_CONST(103012.6262917084/8.0), REAL_CONST(103036.51396986481/8.0), REAL_CONST(103060.40303261351/8.0), REAL_CONST(103084.293479794/8.0), REAL_CONST(103108.18531124585/8.0), REAL_CONST(103132.07852680866/8.0), REAL_CONST(103155.97312632212/8.0), REAL_CONST(103179.8691096259/8.0), REAL_CONST(103203.76647655977/8.0), REAL_CONST(103227.66522696352/8.0), REAL_CONST(103251.56536067701/8.0), REAL_CONST(103275.46687754011/8.0), REAL_CONST(103299.36977739276/8.0), REAL_CONST(103323.27406007495/8.0), REAL_CONST(103347.1797254267/8.0), REAL_CONST(103371.0867732881/8.0), REAL_CONST(103394.99520349925/8.0), REAL_CONST(103418.90501590034/8.0), REAL_CONST(103442.81621033157/8.0), REAL_CONST(103466.72878663319/8.0), REAL_CONST(103490.64274464553/8.0), REAL_CONST(103514.55808420894/8.0), REAL_CONST(103538.4748051638/8.0), REAL_CONST(103562.39290735057/8.0), REAL_CONST(103586.31239060973/8.0), REAL_CONST(103610.23325478184/8.0), REAL_CONST(103634.15549970744/8.0), REAL_CONST(103658.07912522719/8.0), REAL_CONST(103682.00413118176/8.0), REAL_CONST(103705.93051741188/8.0), REAL_CONST(103729.85828375829/8.0), REAL_CONST(103753.78743006183/8.0), REAL_CONST(103777.71795616332/8.0), REAL_CONST(103801.64986190372/8.0), REAL_CONST(103825.58314712394/8.0), REAL_CONST(103849.51781166498/8.0), REAL_CONST(103873.4538553679/8.0), REAL_CONST(103897.39127807376/8.0), REAL_CONST(103921.33007962372/8.0), REAL_CONST(103945.27025985894/8.0), REAL_CONST(103969.21181862066/8.0), REAL_CONST(103993.15475575015/8.0), REAL_CONST(104017.0990710887/8.0), REAL_CONST(104041.0447644777/8.0), REAL_CONST(104064.99183575854/8.0), REAL_CONST(104088.94028477269/8.0), REAL_CONST(104112.89011136163/8.0), REAL_CONST(104136.84131536692/8.0), REAL_CONST(104160.79389663014/8.0), REAL_CONST(104184.74785499295/8.0), REAL_CONST(104208.70319029699/8.0), REAL_CONST(104232.65990238401/8.0), REAL_CONST(104256.61799109577/8.0), REAL_CONST(104280.57745627411/8.0), REAL_CONST(104304.53829776087/8.0), REAL_CONST(104328.50051539797/8.0), REAL_CONST(104352.46410902737/8.0), REAL_CONST(104376.42907849104/8.0), REAL_CONST(104400.39542363105/8.0), REAL_CONST(104424.36314428948/8.0), REAL_CONST(104448.33224030846/8.0), REAL_CONST(104472.3027115302/8.0), REAL_CONST(104496.27455779689/8.0), REAL_CONST(104520.24777895081/8.0), REAL_CONST(104544.22237483428/8.0), REAL_CONST(104568.19834528965/8.0), REAL_CONST(104592.17569015936/8.0), REAL_CONST(104616.15440928582/8.0), REAL_CONST(104640.13450251156/8.0), REAL_CONST(104664.1159696791/8.0), REAL_CONST(104688.09881063103/8.0), REAL_CONST(104712.08302520998/8.0), REAL_CONST(104736.06861325864/8.0), REAL_CONST(104760.05557461972/8.0), REAL_CONST(104784.043909136/8.0), REAL_CONST(104808.03361665027/8.0), REAL_CONST(104832.0246970054/8.0), REAL_CONST(104856.01715004431/8.0), REAL_CONST(104880.01097560991/8.0), REAL_CONST(104904.00617354522/8.0), REAL_CONST(104928.00274369326/8.0), REAL_CONST(104952.00068589712/8.0), REAL_CONST(104975.99999999993/8.0), REAL_CONST(105000.00068584486/8.0), REAL_CONST(105024.00274327511/8.0), REAL_CONST(105048.00617213396/8.0), REAL_CONST(105072.0109722647/8.0), REAL_CONST(105096.0171435107/8.0), REAL_CONST(105120.02468571534/8.0), REAL_CONST(105144.03359872208/8.0), REAL_CONST(105168.04388237436/8.0), REAL_CONST(105192.05553651576/8.0), REAL_CONST(105216.06856098982/8.0), REAL_CONST(105240.08295564017/8.0), REAL_CONST(105264.09872031047/8.0), REAL_CONST(105288.11585484444/8.0), REAL_CONST(105312.13435908582/8.0), REAL_CONST(105336.1542328784/8.0), REAL_CONST(105360.17547606604/8.0), REAL_CONST(105384.19808849262/8.0), REAL_CONST(105408.22207000206/8.0), REAL_CONST(105432.24742043833/8.0), REAL_CONST(105456.27413964548/8.0), REAL_CONST(105480.30222746753/8.0), REAL_CONST(105504.33168374863/8.0), REAL_CONST(105528.36250833291/8.0), REAL_CONST(105552.39470106458/8.0), REAL_CONST(105576.42826178786/8.0), REAL_CONST(105600.46319034706/8.0), REAL_CONST(105624.49948658649/8.0), REAL_CONST(105648.53715035053/8.0), REAL_CONST(105672.5761814836/8.0), REAL_CONST(105696.61657983017/8.0), REAL_CONST(105720.65834523473/8.0), REAL_CONST(105744.70147754184/8.0), REAL_CONST(105768.7459765961/8.0), REAL_CONST(105792.79184224214/8.0), REAL_CONST(105816.83907432464/8.0), REAL_CONST(105840.88767268835/8.0), REAL_CONST(105864.93763717801/8.0), REAL_CONST(105888.98896763846/8.0), REAL_CONST(105913.04166391456/8.0), REAL_CONST(105937.09572585119/8.0), REAL_CONST(105961.15115329332/8.0), REAL_CONST(105985.20794608595/8.0), REAL_CONST(106009.26610407409/8.0), REAL_CONST(106033.32562710284/8.0), REAL_CONST(106057.38651501729/8.0), REAL_CONST(106081.44876766266/8.0), REAL_CONST(106105.51238488412/8.0), REAL_CONST(106129.57736652695/8.0), REAL_CONST(106153.64371243643/8.0), REAL_CONST(106177.71142245791/8.0), REAL_CONST(106201.78049643678/8.0), REAL_CONST(106225.85093421848/8.0), REAL_CONST(106249.92273564848/8.0), REAL_CONST(106273.99590057228/8.0), REAL_CONST(106298.07042883546/8.0), REAL_CONST(106322.14632028362/8.0), REAL_CONST(106346.22357476239/8.0), REAL_CONST(106370.30219211751/8.0), REAL_CONST(106394.38217219469/8.0), REAL_CONST(106418.46351483969/8.0), REAL_CONST(106442.54621989837/8.0), REAL_CONST(106466.63028721658/8.0), REAL_CONST(106490.71571664025/8.0), REAL_CONST(106514.80250801529/8.0), REAL_CONST(106538.89066118775/8.0), REAL_CONST(106562.98017600364/8.0), REAL_CONST(106587.07105230905/8.0), REAL_CONST(106611.16328995011/8.0), REAL_CONST(106635.25688877302/8.0), REAL_CONST(106659.35184862395/8.0), REAL_CONST(106683.44816934918/8.0), REAL_CONST(106707.54585079502/8.0), REAL_CONST(106731.64489280782/8.0), REAL_CONST(106755.74529523395/8.0), REAL_CONST(106779.84705791986/8.0), REAL_CONST(106803.95018071201/8.0), REAL_CONST(106828.05466345693/8.0), REAL_CONST(106852.16050600118/8.0), REAL_CONST(106876.26770819137/8.0), REAL_CONST(106900.37626987413/8.0), REAL_CONST(106924.48619089619/8.0), REAL_CONST(106948.59747110425/8.0), REAL_CONST(106972.71011034511/8.0), REAL_CONST(106996.82410846559/8.0), REAL_CONST(107020.93946531253/8.0), REAL_CONST(107045.05618073288/8.0), REAL_CONST(107069.17425457356/8.0), REAL_CONST(107093.29368668159/8.0), REAL_CONST(107117.41447690397/8.0), REAL_CONST(107141.53662508781/8.0), REAL_CONST(107165.66013108024/8.0), REAL_CONST(107189.7849947284/8.0), REAL_CONST(107213.91121587952/8.0), REAL_CONST(107238.03879438085/8.0), REAL_CONST(107262.16773007967/8.0), REAL_CONST(107286.29802282334/8.0), REAL_CONST(107310.42967245923/8.0), REAL_CONST(107334.56267883476/8.0), REAL_CONST(107358.69704179741/8.0), REAL_CONST(107382.83276119467/8.0), REAL_CONST(107406.96983687414/8.0), REAL_CONST(107431.10826868335/8.0), REAL_CONST(107455.24805646999/8.0), REAL_CONST(107479.38920008171/8.0), REAL_CONST(107503.53169936626/8.0), REAL_CONST(107527.67555417139/8.0), REAL_CONST(107551.82076434491/8.0), REAL_CONST(107575.96732973469/8.0), REAL_CONST(107600.11525018861/8.0), REAL_CONST(107624.26452555459/8.0), REAL_CONST(107648.41515568066/8.0), REAL_CONST(107672.56714041479/8.0), REAL_CONST(107696.72047960508/8.0), REAL_CONST(107720.87517309963/8.0), REAL_CONST(107745.03122074658/8.0), REAL_CONST(107769.18862239413/8.0), REAL_CONST(107793.34737789053/8.0), REAL_CONST(107817.50748708403/8.0), REAL_CONST(107841.66894982298/8.0), REAL_CONST(107865.83176595572/8.0), REAL_CONST(107889.99593533068/8.0), REAL_CONST(107914.16145779629/8.0), REAL_CONST(107938.32833320105/8.0), REAL_CONST(107962.49656139348/8.0), REAL_CONST(107986.66614222217/8.0), REAL_CONST(108010.83707553572/8.0), REAL_CONST(108035.00936118282/8.0), REAL_CONST(108059.18299901215/8.0), REAL_CONST(108083.35798887245/8.0), REAL_CONST(108107.53433061253/8.0), REAL_CONST(108131.71202408121/8.0), REAL_CONST(108155.89106912735/8.0), REAL_CONST(108180.07146559987/8.0), REAL_CONST(108204.25321334775/8.0), REAL_CONST(108228.43631221994/8.0), REAL_CONST(108252.62076206553/8.0), REAL_CONST(108276.80656273357/8.0), REAL_CONST(108300.99371407321/8.0), REAL_CONST(108325.18221593359/8.0), REAL_CONST(108349.37206816394/8.0), REAL_CONST(108373.56327061349/8.0), REAL_CONST(108397.75582313156/8.0), REAL_CONST(108421.94972556747/8.0), REAL_CONST(108446.1449777706/8.0), REAL_CONST(108470.34157959036/8.0), REAL_CONST(108494.53953087622/8.0), REAL_CONST(108518.73883147769/8.0), REAL_CONST(108542.93948124432/8.0), REAL_CONST(108567.14148002568/8.0), REAL_CONST(108591.34482767139/8.0), REAL_CONST(108615.54952403114/8.0), REAL_CONST(108639.75556895464/8.0), REAL_CONST(108663.96296229165/8.0), REAL_CONST(108688.17170389196/8.0), REAL_CONST(108712.38179360541/8.0), REAL_CONST(108736.59323128188/8.0), REAL_CONST(108760.80601677128/8.0), REAL_CONST(108785.02014992358/8.0), REAL_CONST(108809.23563058881/8.0), REAL_CONST(108833.45245861699/8.0), REAL_CONST(108857.67063385822/8.0), REAL_CONST(108881.89015616261/8.0), REAL_CONST(108906.11102538036/8.0), REAL_CONST(108930.33324136167/8.0), REAL_CONST(108954.55680395682/8.0), REAL_CONST(108978.78171301607/8.0), REAL_CONST(109003.00796838976/8.0), REAL_CONST(109027.23556992831/8.0), REAL_CONST(109051.46451748211/8.0), REAL_CONST(109075.69481090162/8.0), REAL_CONST(109099.92645003737/8.0), REAL_CONST(109124.15943473989/8.0), REAL_CONST(109148.39376485976/8.0), REAL_CONST(109172.62944024763/8.0), REAL_CONST(109196.86646075416/8.0), REAL_CONST(109221.10482623006/8.0), REAL_CONST(109245.34453652608/8.0), REAL_CONST(109269.58559149304/8.0), REAL_CONST(109293.82799098175/8.0), REAL_CONST(109318.07173484311/8.0), REAL_CONST(109342.31682292801/8.0), REAL_CONST(109366.56325508743/8.0), REAL_CONST(109390.81103117237/8.0), REAL_CONST(109415.06015103387/8.0), REAL_CONST(109439.31061452301/8.0), REAL_CONST(109463.56242149093/8.0), REAL_CONST(109487.8155717888/8.0), REAL_CONST(109512.07006526781/8.0), REAL_CONST(109536.3259017792/8.0), REAL_CONST(109560.58308117429/8.0), REAL_CONST(109584.8416033044/8.0), REAL_CONST(109609.1014680209/8.0), REAL_CONST(109633.36267517522/8.0), REAL_CONST(109657.62522461878/8.0), REAL_CONST(109681.88911620311/8.0), REAL_CONST(109706.15434977971/8.0), REAL_CONST(109730.4209252002/8.0), REAL_CONST(109754.68884231619/8.0), REAL_CONST(109778.95810097932/8.0), REAL_CONST(109803.22870104131/8.0), REAL_CONST(109827.50064235389/8.0), REAL_CONST(109851.77392476884/8.0), REAL_CONST(109876.04854813802/8.0), REAL_CONST(109900.32451231324/8.0), REAL_CONST(109924.60181714644/8.0), REAL_CONST(109948.88046248957/8.0), REAL_CONST(109973.1604481946/8.0), REAL_CONST(109997.44177411357/8.0), REAL_CONST(110021.72444009855/8.0), REAL_CONST(110046.00844600165/8.0), REAL_CONST(110070.29379167501/8.0), REAL_CONST(110094.58047697082/8.0), REAL_CONST(110118.86850174134/8.0), REAL_CONST(110143.15786583882/8.0), REAL_CONST(110167.44856911557/8.0), REAL_CONST(110191.74061142397/8.0), REAL_CONST(110216.03399261639/8.0), REAL_CONST(110240.32871254528/8.0), REAL_CONST(110264.62477106311/8.0), REAL_CONST(110288.9221680224/8.0), REAL_CONST(110313.22090327571/8.0), REAL_CONST(110337.52097667565/8.0), REAL_CONST(110361.82238807483/8.0), REAL_CONST(110386.12513732594/8.0), REAL_CONST(110410.42922428172/8.0), REAL_CONST(110434.73464879491/8.0), REAL_CONST(110459.04141071832/8.0), REAL_CONST(110483.34950990479/8.0), REAL_CONST(110507.6589462072/8.0), REAL_CONST(110531.96971947847/8.0), REAL_CONST(110556.28182957157/8.0), REAL_CONST(110580.5952763395/8.0), REAL_CONST(110604.91005963532/8.0), REAL_CONST(110629.22617931209/8.0), REAL_CONST(110653.54363522294/8.0), REAL_CONST(110677.86242722106/8.0), REAL_CONST(110702.18255515963/8.0), REAL_CONST(110726.50401889188/8.0), REAL_CONST(110750.82681827113/8.0), REAL_CONST(110775.1509531507/8.0), REAL_CONST(110799.47642338395/8.0), REAL_CONST(110823.80322882428/8.0), REAL_CONST(110848.13136932514/8.0), REAL_CONST(110872.46084474004/8.0), REAL_CONST(110896.79165492248/8.0), REAL_CONST(110921.12379972603/8.0), REAL_CONST(110945.4572790043/8.0), REAL_CONST(110969.79209261097/8.0), REAL_CONST(110994.12824039967/8.0), REAL_CONST(111018.46572222417/8.0), REAL_CONST(111042.80453793822/8.0), REAL_CONST(111067.14468739564/8.0), REAL_CONST(111091.48617045028/8.0), REAL_CONST(111115.82898695602/8.0), REAL_CONST(111140.1731367668/8.0), REAL_CONST(111164.51861973655/8.0), REAL_CONST(111188.86543571933/8.0), REAL_CONST(111213.21358456917/8.0), REAL_CONST(111237.56306614014/8.0), REAL_CONST(111261.91388028639/8.0), REAL_CONST(111286.26602686207/8.0), REAL_CONST(111310.61950572141/8.0), REAL_CONST(111334.97431671864/8.0), REAL_CONST(111359.33045970804/8.0), REAL_CONST(111383.68793454397/8.0), REAL_CONST(111408.04674108078/8.0), REAL_CONST(111432.40687917286/8.0), REAL_CONST(111456.76834867468/8.0), REAL_CONST(111481.13114944073/8.0), REAL_CONST(111505.49528132551/8.0), REAL_CONST(111529.86074418361/8.0), REAL_CONST(111554.22753786964/8.0), REAL_CONST(111578.59566223821/8.0), REAL_CONST(111602.96511714405/8.0), REAL_CONST(111627.33590244185/8.0), REAL_CONST(111651.7080179864/8.0), REAL_CONST(111676.08146363248/8.0), REAL_CONST(111700.45623923496/8.0), REAL_CONST(111724.8323446487/8.0), REAL_CONST(111749.20977972864/8.0), REAL_CONST(111773.58854432974/8.0), REAL_CONST(111797.96863830699/8.0), REAL_CONST(111822.35006151545/8.0), REAL_CONST(111846.73281381019/8.0), REAL_CONST(111871.11689504632/8.0), REAL_CONST(111895.50230507903/8.0), REAL_CONST(111919.8890437635/8.0), REAL_CONST(111944.27711095495/8.0), REAL_CONST(111968.6665065087/8.0), REAL_CONST(111993.05723028004/8.0), REAL_CONST(112017.44928212435/8.0), REAL_CONST(112041.842661897/8.0), REAL_CONST(112066.23736945343/8.0), REAL_CONST(112090.63340464912/8.0), REAL_CONST(112115.03076733962/8.0), REAL_CONST(112139.42945738042/8.0), REAL_CONST(112163.82947462716/8.0), REAL_CONST(112188.23081893545/8.0), REAL_CONST(112212.63349016097/8.0), REAL_CONST(112237.03748815943/8.0), REAL_CONST(112261.44281278658/8.0), REAL_CONST(112285.84946389822/8.0), REAL_CONST(112310.25744135017/8.0), REAL_CONST(112334.66674499828/8.0), REAL_CONST(112359.07737469849/8.0), REAL_CONST(112383.48933030672/8.0), REAL_CONST(112407.90261167898/8.0), REAL_CONST(112432.31721867126/8.0), REAL_CONST(112456.73315113965/8.0), REAL_CONST(112481.15040894024/8.0), REAL_CONST(112505.56899192919/8.0), REAL_CONST(112529.98889996267/8.0), REAL_CONST(112554.41013289688/8.0), REAL_CONST(112578.8326905881/8.0), REAL_CONST(112603.25657289263/8.0), REAL_CONST(112627.68177966679/8.0), REAL_CONST(112652.10831076698/8.0), REAL_CONST(112676.53616604958/8.0), REAL_CONST(112700.96534537108/8.0), REAL_CONST(112725.39584858794/8.0), REAL_CONST(112749.82767555672/8.0), REAL_CONST(112774.26082613398/8.0), REAL_CONST(112798.6953001763/8.0), REAL_CONST(112823.13109754038/8.0), REAL_CONST(112847.56821808286/8.0), REAL_CONST(112872.00666166049/8.0), REAL_CONST(112896.44642813003/8.0), REAL_CONST(112920.88751734827/8.0), REAL_CONST(112945.32992917208/8.0), REAL_CONST(112969.77366345831/8.0), REAL_CONST(112994.21872006389/8.0), REAL_CONST(113018.66509884578/8.0), REAL_CONST(113043.11279966099/8.0), REAL_CONST(113067.56182236652/8.0), REAL_CONST(113092.01216681948/8.0), REAL_CONST(113116.46383287695/8.0), REAL_CONST(113140.9168203961/8.0), REAL_CONST(113165.37112923413/8.0), REAL_CONST(113189.82675924824/8.0), REAL_CONST(113214.28371029573/8.0), REAL_CONST(113238.74198223387/8.0), REAL_CONST(113263.20157492002/8.0), REAL_CONST(113287.66248821157/8.0), REAL_CONST(113312.12472196593/8.0), REAL_CONST(113336.58827604055/8.0), REAL_CONST(113361.05315029295/8.0), REAL_CONST(113385.51934458067/8.0), REAL_CONST(113409.98685876124/8.0), REAL_CONST(113434.45569269233/8.0), REAL_CONST(113458.92584623155/8.0), REAL_CONST(113483.39731923661/8.0), REAL_CONST(113507.87011156522/8.0), REAL_CONST(113532.34422307517/8.0), REAL_CONST(113556.81965362425/8.0), REAL_CONST(113581.2964030703/8.0), REAL_CONST(113605.77447127122/8.0), REAL_CONST(113630.25385808491/8.0), REAL_CONST(113654.73456336933/8.0), REAL_CONST(113679.2165869825/8.0), REAL_CONST(113703.69992878241/8.0), REAL_CONST(113728.18458862718/8.0), REAL_CONST(113752.67056637487/8.0), REAL_CONST(113777.15786188368/8.0), REAL_CONST(113801.64647501177/8.0), REAL_CONST(113826.13640561736/8.0), REAL_CONST(113850.62765355874/8.0), REAL_CONST(113875.12021869418/8.0), REAL_CONST(113899.61410088204/8.0), REAL_CONST(113924.1092999807/8.0), REAL_CONST(113948.60581584855/8.0), REAL_CONST(113973.10364834407/8.0), REAL_CONST(113997.60279732574/8.0), REAL_CONST(114022.1032626521/8.0), REAL_CONST(114046.60504418171/8.0), REAL_CONST(114071.10814177318/8.0), REAL_CONST(114095.61255528514/8.0), REAL_CONST(114120.11828457628/8.0), REAL_CONST(114144.62532950533/8.0), REAL_CONST(114169.13368993104/8.0), REAL_CONST(114193.6433657122/8.0), REAL_CONST(114218.15435670764/8.0), REAL_CONST(114242.66666277625/8.0), REAL_CONST(114267.18028377694/8.0), REAL_CONST(114291.69521956862/8.0), REAL_CONST(114316.21147001031/8.0), REAL_CONST(114340.72903496103/8.0), REAL_CONST(114365.24791427983/8.0), REAL_CONST(114389.7681078258/8.0), REAL_CONST(114414.2896154581/8.0), REAL_CONST(114438.81243703589/8.0), REAL_CONST(114463.33657241837/8.0), REAL_CONST(114487.8620214648/8.0), REAL_CONST(114512.38878403447/8.0), REAL_CONST(114536.91685998671/8.0), REAL_CONST(114561.44624918087/8.0), REAL_CONST(114585.97695147636/8.0), REAL_CONST(114610.5089667326/8.0), REAL_CONST(114635.04229480909/8.0), REAL_CONST(114659.57693556532/8.0), REAL_CONST(114684.11288886084/8.0), REAL_CONST(114708.65015455526/8.0), REAL_CONST(114733.18873250818/8.0), REAL_CONST(114757.72862257928/8.0), REAL_CONST(114782.26982462825/8.0), REAL_CONST(114806.81233851484/8.0), REAL_CONST(114831.35616409882/8.0), REAL_CONST(114855.90130123998/8.0), REAL_CONST(114880.44774979822/8.0), REAL_CONST(114904.99550963337/8.0), REAL_CONST(114929.5445806054/8.0), REAL_CONST(114954.09496257425/8.0), REAL_CONST(114978.64665539992/8.0), REAL_CONST(115003.19965894247/8.0), REAL_CONST(115027.75397306195/8.0), REAL_CONST(115052.30959761847/8.0), REAL_CONST(115076.86653247218/8.0), REAL_CONST(115101.42477748329/8.0), REAL_CONST(115125.984332512/8.0), REAL_CONST(115150.54519741859/8.0), REAL_CONST(115175.10737206334/8.0), REAL_CONST(115199.67085630659/8.0), REAL_CONST(115224.23565000873/8.0), REAL_CONST(115248.80175303014/8.0), REAL_CONST(115273.3691652313/8.0), REAL_CONST(115297.93788647266/8.0), REAL_CONST(115322.50791661476/8.0), REAL_CONST(115347.07925551817/8.0), REAL_CONST(115371.65190304347/8.0), REAL_CONST(115396.22585905129/8.0), REAL_CONST(115420.80112340231/8.0), REAL_CONST(115445.37769595724/8.0), REAL_CONST(115469.95557657682/8.0), REAL_CONST(115494.53476512182/8.0), REAL_CONST(115519.11526145306/8.0), REAL_CONST(115543.69706543141/8.0), REAL_CONST(115568.28017691776/8.0), REAL_CONST(115592.86459577303/8.0), REAL_CONST(115617.4503218582/8.0), REAL_CONST(115642.03735503425/8.0), REAL_CONST(115666.62569516223/8.0), REAL_CONST(115691.21534210323/8.0), REAL_CONST(115715.80629571836/8.0), REAL_CONST(115740.39855586876/8.0), REAL_CONST(115764.99212241563/8.0), REAL_CONST(115789.58699522018/8.0), REAL_CONST(115814.18317414368/8.0), REAL_CONST(115838.78065904744/8.0), REAL_CONST(115863.37944979276/8.0), REAL_CONST(115887.97954624105/8.0), REAL_CONST(115912.5809482537/8.0), REAL_CONST(115937.18365569216/8.0), REAL_CONST(115961.78766841792/8.0), REAL_CONST(115986.39298629249/8.0), REAL_CONST(116010.99960917742/8.0), REAL_CONST(116035.60753693432/8.0), REAL_CONST(116060.21676942479/8.0), REAL_CONST(116084.82730651053/8.0), REAL_CONST(116109.43914805322/8.0), REAL_CONST(116134.0522939146/8.0), REAL_CONST(116158.66674395646/8.0), REAL_CONST(116183.2824980406/8.0), REAL_CONST(116207.89955602887/8.0), REAL_CONST(116232.51791778316/8.0), REAL_CONST(116257.13758316539/8.0), REAL_CONST(116281.75855203751/8.0), REAL_CONST(116306.38082426153/8.0), REAL_CONST(116331.00439969949/8.0), REAL_CONST(116355.62927821343/8.0), REAL_CONST(116380.25545966547/8.0), REAL_CONST(116404.88294391775/8.0), REAL_CONST(116429.51173083246/8.0), REAL_CONST(116454.14182027178/8.0), REAL_CONST(116478.77321209799/8.0), REAL_CONST(116503.40590617337/8.0), REAL_CONST(116528.03990236025/8.0), REAL_CONST(116552.67520052097/8.0), REAL_CONST(116577.31180051794/8.0), REAL_CONST(116601.94970221359/8.0), REAL_CONST(116626.5889054704/8.0), REAL_CONST(116651.22941015086/8.0), REAL_CONST(116675.87121611751/8.0), REAL_CONST(116700.51432323294/8.0), REAL_CONST(116725.15873135976/8.0), REAL_CONST(116749.8044403606/8.0), REAL_CONST(116774.45145009817/8.0), REAL_CONST(116799.0997604352/8.0), REAL_CONST(116823.74937123443/8.0), REAL_CONST(116848.40028235866/8.0), REAL_CONST(116873.05249367072/8.0), REAL_CONST(116897.70600503348/8.0), REAL_CONST(116922.36081630984/8.0), REAL_CONST(116947.01692736275/8.0), REAL_CONST(116971.67433805518/8.0), REAL_CONST(116996.33304825013/8.0), REAL_CONST(117020.99305781067/8.0), REAL_CONST(117045.65436659988/8.0), REAL_CONST(117070.31697448085/8.0), REAL_CONST(117094.98088131678/8.0), REAL_CONST(117119.64608697082/8.0), REAL_CONST(117144.31259130624/8.0), REAL_CONST(117168.98039418629/8.0), REAL_CONST(117193.64949547425/8.0), REAL_CONST(117218.31989503348/8.0), REAL_CONST(117242.99159272734/8.0), REAL_CONST(117267.66458841923/8.0), REAL_CONST(117292.33888197262/8.0), REAL_CONST(117317.01447325097/8.0), REAL_CONST(117341.6913621178/8.0), REAL_CONST(117366.36954843666/8.0), REAL_CONST(117391.04903207115/8.0), REAL_CONST(117415.72981288488/8.0), REAL_CONST(117440.41189074152/8.0), REAL_CONST(117465.09526550474/8.0), REAL_CONST(117489.77993703831/8.0), REAL_CONST(117514.46590520597/8.0), REAL_CONST(117539.15316987153/8.0), REAL_CONST(117563.84173089883/8.0), REAL_CONST(117588.53158815173/8.0), REAL_CONST(117613.22274149416/8.0), REAL_CONST(117637.91519079007/8.0), REAL_CONST(117662.60893590341/8.0), REAL_CONST(117687.30397669821/8.0), REAL_CONST(117712.00031303853/8.0), REAL_CONST(117736.69794478847/8.0), REAL_CONST(117761.39687181212/8.0), REAL_CONST(117786.09709397367/8.0), REAL_CONST(117810.7986111373/8.0), REAL_CONST(117835.50142316725/8.0), REAL_CONST(117860.20552992777/8.0), REAL_CONST(117884.91093128319/8.0), REAL_CONST(117909.6176270978/8.0), REAL_CONST(117934.32561723603/8.0), REAL_CONST(117959.03490156225/8.0), REAL_CONST(117983.74547994092/8.0), REAL_CONST(118008.45735223651/8.0), REAL_CONST(118033.17051831353/8.0), REAL_CONST(118057.88497803656/8.0), REAL_CONST(118082.60073127014/8.0), REAL_CONST(118107.31777787894/8.0), REAL_CONST(118132.03611772758/8.0), REAL_CONST(118156.75575068076/8.0), REAL_CONST(118181.47667660323/8.0), REAL_CONST(118206.19889535972/8.0), REAL_CONST(118230.92240681504/8.0), REAL_CONST(118255.64721083404/8.0), REAL_CONST(118280.37330728157/8.0), REAL_CONST(118305.10069602253/8.0), REAL_CONST(118329.82937692189/8.0), REAL_CONST(118354.55934984458/8.0), REAL_CONST(118379.29061465565/8.0), REAL_CONST(118404.02317122012/8.0), REAL_CONST(118428.75701940308/8.0), REAL_CONST(118453.49215906965/8.0), REAL_CONST(118478.22859008498/8.0), REAL_CONST(118502.96631231424/8.0), REAL_CONST(118527.70532562268/8.0), REAL_CONST(118552.44562987552/8.0), REAL_CONST(118577.18722493808/8.0), REAL_CONST(118601.93011067568/8.0), REAL_CONST(118626.67428695368/8.0), REAL_CONST(118651.41975363747/8.0), REAL_CONST(118676.16651059251/8.0), REAL_CONST(118700.91455768423/8.0), REAL_CONST(118725.66389477813/8.0), REAL_CONST(118750.41452173979/8.0), REAL_CONST(118775.16643843475/8.0), REAL_CONST(118799.91964472862/8.0), REAL_CONST(118824.67414048707/8.0), REAL_CONST(118849.42992557574/8.0), REAL_CONST(118874.18699986035/8.0), REAL_CONST(118898.94536320666/8.0), REAL_CONST(118923.70501548045/8.0), REAL_CONST(118948.46595654752/8.0), REAL_CONST(118973.22818627374/8.0), REAL_CONST(118997.99170452499/8.0), REAL_CONST(119022.7565111672/8.0), REAL_CONST(119047.52260606633/8.0), REAL_CONST(119072.28998908834/8.0), REAL_CONST(119097.0586600993/8.0), REAL_CONST(119121.82861896523/8.0), REAL_CONST(119146.59986555226/8.0), REAL_CONST(119171.3723997265/8.0), REAL_CONST(119196.14622135412/8.0), REAL_CONST(119220.92133030134/8.0), REAL_CONST(119245.69772643436/8.0), REAL_CONST(119270.47540961947/8.0), REAL_CONST(119295.25437972297/8.0), REAL_CONST(119320.03463661121/8.0), REAL_CONST(119344.81618015055/8.0), REAL_CONST(119369.5990102074/8.0), REAL_CONST(119394.38312664822/8.0), REAL_CONST(119419.16852933947/8.0), REAL_CONST(119443.95521814766/8.0), REAL_CONST(119468.74319293935/8.0), REAL_CONST(119493.53245358112/8.0), REAL_CONST(119518.32299993958/8.0), REAL_CONST(119543.11483188139/8.0), REAL_CONST(119567.90794927324/8.0), REAL_CONST(119592.70235198183/8.0), REAL_CONST(119617.49803987393/8.0), REAL_CONST(119642.29501281632/8.0), REAL_CONST(119667.09327067583/8.0), REAL_CONST(119691.89281331931/8.0), REAL_CONST(119716.69364061367/8.0), REAL_CONST(119741.49575242582/8.0), REAL_CONST(119766.29914862274/8.0), REAL_CONST(119791.10382907141/8.0), REAL_CONST(119815.90979363887/8.0), REAL_CONST(119840.71704219218/8.0), REAL_CONST(119865.52557459843/8.0), REAL_CONST(119890.33539072477/8.0), REAL_CONST(119915.14649043836/8.0), REAL_CONST(119939.95887360642/8.0), REAL_CONST(119964.77254009615/8.0), REAL_CONST(119989.58748977486/8.0), REAL_CONST(120014.40372250983/8.0), REAL_CONST(120039.22123816841/8.0), REAL_CONST(120064.04003661797/8.0), REAL_CONST(120088.86011772591/8.0), REAL_CONST(120113.6814813597/8.0), REAL_CONST(120138.5041273868/8.0), REAL_CONST(120163.3280556747/8.0), REAL_CONST(120188.15326609099/8.0), REAL_CONST(120212.97975850321/8.0), REAL_CONST(120237.807532779/8.0), REAL_CONST(120262.63658878599/8.0), REAL_CONST(120287.46692639188/8.0), REAL_CONST(120312.29854546436/8.0), REAL_CONST(120337.13144587121/8.0), REAL_CONST(120361.9656274802/8.0), REAL_CONST(120386.80109015915/8.0), REAL_CONST(120411.63783377589/8.0), REAL_CONST(120436.47585819835/8.0), REAL_CONST(120461.31516329442/8.0), REAL_CONST(120486.15574893207/8.0), REAL_CONST(120510.99761497928/8.0), REAL_CONST(120535.84076130406/8.0), REAL_CONST(120560.68518777451/8.0), REAL_CONST(120585.53089425867/8.0), REAL_CONST(120610.3778806247/8.0), REAL_CONST(120635.22614674074/8.0), REAL_CONST(120660.07569247499/8.0), REAL_CONST(120684.92651769568/8.0), REAL_CONST(120709.77862227106/8.0), REAL_CONST(120734.63200606944/8.0), REAL_CONST(120759.48666895913/8.0), REAL_CONST(120784.3426108085/8.0), REAL_CONST(120809.19983148595/8.0), REAL_CONST(120834.05833085992/8.0), REAL_CONST(120858.91810879884/8.0), REAL_CONST(120883.77916517125/8.0), REAL_CONST(120908.64149984565/8.0), REAL_CONST(120933.5051126906/8.0), REAL_CONST(120958.37000357473/8.0), REAL_CONST(120983.23617236665/8.0), REAL_CONST(121008.10361893504/8.0), REAL_CONST(121032.97234314861/8.0), REAL_CONST(121057.84234487606/8.0), REAL_CONST(121082.71362398617/8.0), REAL_CONST(121107.58618034775/8.0), REAL_CONST(121132.46001382964/8.0), REAL_CONST(121157.33512430069/8.0), REAL_CONST(121182.21151162982/8.0), REAL_CONST(121207.08917568595/8.0), REAL_CONST(121231.96811633807/8.0), REAL_CONST(121256.84833345517/8.0), REAL_CONST(121281.72982690629/8.0), REAL_CONST(121306.61259656049/8.0), REAL_CONST(121331.49664228689/8.0), REAL_CONST(121356.38196395461/8.0), REAL_CONST(121381.26856143285/8.0), REAL_CONST(121406.15643459078/8.0), REAL_CONST(121431.04558329767/8.0), REAL_CONST(121455.93600742276/8.0), REAL_CONST(121480.82770683538/8.0), REAL_CONST(121505.72068140487/8.0), REAL_CONST(121530.61493100057/8.0), REAL_CONST(121555.51045549192/8.0), REAL_CONST(121580.40725474835/8.0), REAL_CONST(121605.30532863933/8.0), REAL_CONST(121630.20467703436/8.0), REAL_CONST(121655.10529980299/8.0), REAL_CONST(121680.00719681478/8.0), REAL_CONST(121704.91036793934/8.0), REAL_CONST(121729.81481304632/8.0), REAL_CONST(121754.72053200539/8.0), REAL_CONST(121779.62752468624/8.0), REAL_CONST(121804.53579095862/8.0), REAL_CONST(121829.44533069231/8.0), REAL_CONST(121854.3561437571/8.0), REAL_CONST(121879.26823002285/8.0), REAL_CONST(121904.1815893594/8.0), REAL_CONST(121929.09622163669/8.0), REAL_CONST(121954.01212672464/8.0), REAL_CONST(121978.92930449323/8.0), REAL_CONST(122003.84775481246/8.0), REAL_CONST(122028.76747755238/8.0), REAL_CONST(122053.68847258303/8.0), REAL_CONST(122078.61073977455/8.0), REAL_CONST(122103.53427899707/8.0), REAL_CONST(122128.45909012076/8.0), REAL_CONST(122153.38517301581/8.0), REAL_CONST(122178.31252755247/8.0), REAL_CONST(122203.24115360099/8.0), REAL_CONST(122228.17105103172/8.0), REAL_CONST(122253.10221971494/8.0), REAL_CONST(122278.03465952107/8.0), REAL_CONST(122302.96837032049/8.0), REAL_CONST(122327.90335198362/8.0), REAL_CONST(122352.83960438096/8.0), REAL_CONST(122377.777127383/8.0), REAL_CONST(122402.71592086025/8.0), REAL_CONST(122427.65598468333/8.0), REAL_CONST(122452.59731872278/8.0), REAL_CONST(122477.53992284928/8.0), REAL_CONST(122502.48379693348/8.0), REAL_CONST(122527.42894084606/8.0), REAL_CONST(122552.37535445779/8.0), REAL_CONST(122577.32303763942/8.0), REAL_CONST(122602.27199026172/8.0), REAL_CONST(122627.22221219557/8.0), REAL_CONST(122652.17370331181/8.0), REAL_CONST(122677.12646348133/8.0), REAL_CONST(122702.08049257506/8.0), REAL_CONST(122727.03579046397/8.0), REAL_CONST(122751.99235701906/8.0), REAL_CONST(122776.95019211136/8.0), REAL_CONST(122801.9092956119/8.0), REAL_CONST(122826.8696673918/8.0), REAL_CONST(122851.83130732219/8.0), REAL_CONST(122876.79421527422/8.0), REAL_CONST(122901.75839111909/8.0), REAL_CONST(122926.72383472799/8.0), REAL_CONST(122951.69054597223/8.0), REAL_CONST(122976.65852472307/8.0), REAL_CONST(123001.62777085182/8.0), REAL_CONST(123026.59828422987/8.0), REAL_CONST(123051.57006472857/8.0), REAL_CONST(123076.54311221937/8.0), REAL_CONST(123101.5174265737/8.0), REAL_CONST(123126.49300766307/8.0), REAL_CONST(123151.46985535898/8.0), REAL_CONST(123176.44796953299/8.0), REAL_CONST(123201.42735005668/8.0), REAL_CONST(123226.40799680166/8.0), REAL_CONST(123251.38990963959/8.0), REAL_CONST(123276.37308844214/8.0), REAL_CONST(123301.35753308103/8.0), REAL_CONST(123326.343243428/8.0), REAL_CONST(123351.33021935483/8.0), REAL_CONST(123376.31846073334/8.0), REAL_CONST(123401.30796743535/8.0), REAL_CONST(123426.29873933276/8.0), REAL_CONST(123451.29077629748/8.0), REAL_CONST(123476.28407820144/8.0), REAL_CONST(123501.2786449166/8.0), REAL_CONST(123526.27447631498/8.0), REAL_CONST(123551.27157226863/8.0), REAL_CONST(123576.26993264959/8.0), REAL_CONST(123601.26955732999/8.0), REAL_CONST(123626.27044618195/8.0), REAL_CONST(123651.27259907764/8.0), REAL_CONST(123676.27601588926/8.0), REAL_CONST(123701.28069648903/8.0), REAL_CONST(123726.28664074924/8.0), REAL_CONST(123751.29384854218/8.0), REAL_CONST(123776.30231974016/8.0), REAL_CONST(123801.31205421555/8.0), REAL_CONST(123826.32305184075/8.0), REAL_CONST(123851.33531248817/8.0), REAL_CONST(123876.34883603029/8.0), REAL_CONST(123901.36362233957/8.0), REAL_CONST(123926.37967128855/8.0), REAL_CONST(123951.39698274979/8.0), REAL_CONST(123976.41555659588/8.0), REAL_CONST(124001.43539269941/8.0), REAL_CONST(124026.45649093305/8.0), REAL_CONST(124051.47885116948/8.0), REAL_CONST(124076.50247328142/8.0), REAL_CONST(124101.5273571416/8.0), REAL_CONST(124126.55350262282/8.0), REAL_CONST(124151.58090959788/8.0), REAL_CONST(124176.60957793961/8.0), REAL_CONST(124201.63950752091/8.0), REAL_CONST(124226.67069821467/8.0), REAL_CONST(124251.70314989384/8.0), REAL_CONST(124276.73686243138/8.0), REAL_CONST(124301.7718357003/8.0), REAL_CONST(124326.80806957364/8.0), REAL_CONST(124351.84556392446/8.0), REAL_CONST(124376.88431862585/8.0), REAL_CONST(124401.92433355095/8.0), REAL_CONST(124426.96560857294/8.0), REAL_CONST(124452.00814356498/8.0), REAL_CONST(124477.05193840031/8.0), REAL_CONST(124502.0969929522/8.0), REAL_CONST(124527.14330709392/8.0), REAL_CONST(124552.19088069882/8.0), REAL_CONST(124577.23971364023/8.0), REAL_CONST(124602.28980579154/8.0), REAL_CONST(124627.34115702618/8.0), REAL_CONST(124652.3937672176/8.0), REAL_CONST(124677.44763623926/8.0), REAL_CONST(124702.50276396469/8.0), REAL_CONST(124727.55915026742/8.0), REAL_CONST(124752.61679502104/8.0), REAL_CONST(124777.67569809916/8.0), REAL_CONST(124802.73585937542/8.0), REAL_CONST(124827.79727872348/8.0), REAL_CONST(124852.85995601704/8.0), REAL_CONST(124877.92389112986/8.0), REAL_CONST(124902.98908393568/8.0), REAL_CONST(124928.05553430831/8.0), REAL_CONST(124953.1232421216/8.0), REAL_CONST(124978.19220724938/8.0), REAL_CONST(125003.26242956554/8.0), REAL_CONST(125028.33390894404/8.0), REAL_CONST(125053.40664525882/8.0), REAL_CONST(125078.48063838384/8.0), REAL_CONST(125103.55588819318/8.0), REAL_CONST(125128.63239456083/8.0), REAL_CONST(125153.71015736091/8.0), REAL_CONST(125178.78917646752/8.0), REAL_CONST(125203.86945175481/8.0), REAL_CONST(125228.95098309696/8.0), REAL_CONST(125254.03377036817/8.0), REAL_CONST(125279.1178134427/8.0), REAL_CONST(125304.20311219479/8.0), REAL_CONST(125329.28966649878/8.0), REAL_CONST(125354.37747622898/8.0), REAL_CONST(125379.46654125977/8.0), REAL_CONST(125404.55686146552/8.0), REAL_CONST(125429.6484367207/8.0), REAL_CONST(125454.74126689974/8.0), REAL_CONST(125479.83535187715/8.0), REAL_CONST(125504.93069152744/8.0), REAL_CONST(125530.02728572517/8.0), REAL_CONST(125555.12513434493/8.0), REAL_CONST(125580.22423726133/8.0), REAL_CONST(125605.32459434902/8.0), REAL_CONST(125630.4262054827/8.0), REAL_CONST(125655.52907053704/8.0), REAL_CONST(125680.63318938682/8.0), REAL_CONST(125705.73856190679/8.0), REAL_CONST(125730.84518797178/8.0), REAL_CONST(125755.9530674566/8.0), REAL_CONST(125781.06220023613/8.0), REAL_CONST(125806.17258618528/8.0), REAL_CONST(125831.28422517896/8.0), REAL_CONST(125856.39711709213/8.0), REAL_CONST(125881.51126179981/8.0), REAL_CONST(125906.62665917698/8.0), REAL_CONST(125931.74330909875/8.0), REAL_CONST(125956.86121144016/8.0), REAL_CONST(125981.98036607634/8.0), REAL_CONST(126007.10077288245/8.0), REAL_CONST(126032.22243173365/8.0), REAL_CONST(126057.34534250517/8.0), REAL_CONST(126082.46950507225/8.0), REAL_CONST(126107.59491931014/8.0), REAL_CONST(126132.72158509417/8.0), REAL_CONST(126157.84950229966/8.0), REAL_CONST(126182.97867080198/8.0), REAL_CONST(126208.10909047653/8.0), REAL_CONST(126233.24076119871/8.0), REAL_CONST(126258.37368284403/8.0), REAL_CONST(126283.50785528794/8.0), REAL_CONST(126308.64327840599/8.0), REAL_CONST(126333.77995207369/8.0), REAL_CONST(126358.91787616667/8.0), REAL_CONST(126384.0570505605/8.0), REAL_CONST(126409.19747513086/8.0), REAL_CONST(126434.3391497534/8.0), REAL_CONST(126459.48207430386/8.0), REAL_CONST(126484.62624865794/8.0), REAL_CONST(126509.77167269142/8.0), REAL_CONST(126534.9183462801/8.0), REAL_CONST(126560.06626929982/8.0), REAL_CONST(126585.21544162642/8.0), REAL_CONST(126610.36586313581/8.0), REAL_CONST(126635.51753370393/8.0), REAL_CONST(126660.67045320668/8.0), REAL_CONST(126685.82462152008/8.0), REAL_CONST(126710.98003852014/8.0), REAL_CONST(126736.13670408291/8.0), REAL_CONST(126761.29461808444/8.0), REAL_CONST(126786.45378040087/8.0), REAL_CONST(126811.61419090834/8.0), REAL_CONST(126836.77584948298/8.0), REAL_CONST(126861.93875600102/8.0), REAL_CONST(126887.10291033868/8.0), REAL_CONST(126912.26831237224/8.0), REAL_CONST(126937.43496197795/8.0), REAL_CONST(126962.60285903217/8.0), REAL_CONST(126987.77200341123/8.0), REAL_CONST(127012.94239499152/8.0), REAL_CONST(127038.11403364947/8.0), REAL_CONST(127063.2869192615/8.0), REAL_CONST(127088.46105170409/8.0), REAL_CONST(127113.63643085376/8.0), REAL_CONST(127138.81305658702/8.0), REAL_CONST(127163.99092878048/8.0), REAL_CONST(127189.17004731069/8.0), REAL_CONST(127214.35041205429/8.0), REAL_CONST(127239.53202288797/8.0), REAL_CONST(127264.71487968838/8.0), REAL_CONST(127289.89898233226/8.0), REAL_CONST(127315.08433069635/8.0), REAL_CONST(127340.27092465744/8.0), REAL_CONST(127365.45876409234/8.0), REAL_CONST(127390.64784887788/8.0), REAL_CONST(127415.83817889093/8.0), REAL_CONST(127441.02975400841/8.0), REAL_CONST(127466.22257410725/8.0), REAL_CONST(127491.41663906439/8.0), REAL_CONST(127516.61194875685/8.0), REAL_CONST(127541.80850306165/8.0), REAL_CONST(127567.00630185583/8.0), REAL_CONST(127592.20534501647/8.0), REAL_CONST(127617.4056324207/8.0), REAL_CONST(127642.60716394568/8.0), REAL_CONST(127667.80993946856/8.0), REAL_CONST(127693.01395886653/8.0), REAL_CONST(127718.21922201688/8.0), REAL_CONST(127743.42572879682/8.0), REAL_CONST(127768.63347908368/8.0), REAL_CONST(127793.84247275478/8.0), REAL_CONST(127819.05270968749/8.0), REAL_CONST(127844.26418975917/8.0), REAL_CONST(127869.47691284724/8.0), REAL_CONST(127894.69087882918/8.0), REAL_CONST(127919.90608758242/8.0), REAL_CONST(127945.12253898452/8.0), REAL_CONST(127970.34023291297/8.0), REAL_CONST(127995.55916924537/8.0), REAL_CONST(128020.77934785932/8.0), REAL_CONST(128046.00076863244/8.0), REAL_CONST(128071.22343144237/8.0), REAL_CONST(128096.44733616684/8.0), REAL_CONST(128121.67248268353/8.0), REAL_CONST(128146.89887087021/8.0), REAL_CONST(128172.12650060465/8.0), REAL_CONST(128197.35537176467/8.0), REAL_CONST(128222.5854842281/8.0), REAL_CONST(128247.81683787282/8.0), REAL_CONST(128273.04943257671/8.0), REAL_CONST(128298.28326821771/8.0), REAL_CONST(128323.51834467379/8.0), REAL_CONST(128348.75466182294/8.0), REAL_CONST(128373.99221954317/8.0), REAL_CONST(128399.23101771252/8.0), REAL_CONST(128424.47105620909/8.0), REAL_CONST(128449.71233491098/8.0), REAL_CONST(128474.95485369631/8.0), REAL_CONST(128500.19861244329/8.0), REAL_CONST(128525.44361103009/8.0), REAL_CONST(128550.68984933494/8.0), REAL_CONST(128575.93732723613/8.0), REAL_CONST(128601.18604461191/8.0), REAL_CONST(128626.43600134061/8.0), REAL_CONST(128651.68719730059/8.0), REAL_CONST(128676.93963237021/8.0), REAL_CONST(128702.1933064279/8.0), REAL_CONST(128727.44821935208/8.0), REAL_CONST(128752.70437102125/8.0), REAL_CONST(128777.96176131385/8.0), REAL_CONST(128803.22039010846/8.0), REAL_CONST(128828.48025728362/8.0), REAL_CONST(128853.74136271792/8.0), REAL_CONST(128879.00370628996/8.0), REAL_CONST(128904.26728787841/8.0), REAL_CONST(128929.53210736193/8.0), REAL_CONST(128954.79816461923/8.0), REAL_CONST(128980.06545952905/8.0), REAL_CONST(129005.33399197015/8.0), REAL_CONST(129030.60376182134/8.0), REAL_CONST(129055.87476896142/8.0), REAL_CONST(129081.14701326926/8.0), REAL_CONST(129106.42049462376/8.0), REAL_CONST(129131.6952129038/8.0), REAL_CONST(129156.97116798835/8.0), REAL_CONST(129182.24835975636/8.0), REAL_CONST(129207.52678808685/8.0), REAL_CONST(129232.80645285884/8.0), REAL_CONST(129258.08735395141/8.0), REAL_CONST(129283.36949124365/8.0), REAL_CONST(129308.65286461466/8.0), REAL_CONST(129333.9374739436/8.0), REAL_CONST(129359.22331910966/8.0), REAL_CONST(129384.51039999202/8.0), REAL_CONST(129409.79871646997/8.0), REAL_CONST(129435.08826842274/8.0), REAL_CONST(129460.37905572963/8.0), REAL_CONST(129485.67107826998/8.0), REAL_CONST(129510.96433592314/8.0), REAL_CONST(129536.25882856851/8.0), REAL_CONST(129561.55455608548/8.0), REAL_CONST(129586.85151835352/8.0), REAL_CONST(129612.14971525209/8.0), REAL_CONST(129637.4491466607/8.0), REAL_CONST(129662.74981245887/8.0), REAL_CONST(129688.0517125262/8.0), REAL_CONST(129713.35484674224/8.0), REAL_CONST(129738.65921498663/8.0), REAL_CONST(129763.96481713903/8.0), REAL_CONST(129789.27165307909/8.0), REAL_CONST(129814.57972268655/8.0), REAL_CONST(129839.88902584116/8.0), REAL_CONST(129865.19956242264/8.0), REAL_CONST(129890.51133231082/8.0), REAL_CONST(129915.82433538554/8.0), REAL_CONST(129941.13857152662/8.0), REAL_CONST(129966.45404061397/8.0), REAL_CONST(129991.7707425275/8.0), REAL_CONST(130017.08867714716/8.0), REAL_CONST(130042.4078443529/8.0), REAL_CONST(130067.72824402474/8.0), REAL_CONST(130093.04987604271/8.0), REAL_CONST(130118.37274028687/8.0), REAL_CONST(130143.69683663732/8.0), REAL_CONST(130169.02216497416/8.0), REAL_CONST(130194.34872517755/8.0), REAL_CONST(130219.67651712766/8.0), REAL_CONST(130245.0055407047/8.0), REAL_CONST(130270.33579578891/8.0), REAL_CONST(130295.66728226055/8.0), REAL_CONST(130320.99999999991/8.0), REAL_CONST(130346.33394888733/8.0), REAL_CONST(130371.66912880314/8.0), REAL_CONST(130397.00553962773/8.0), REAL_CONST(130422.34318124152/8.0), REAL_CONST(130447.68205352494/8.0), REAL_CONST(130473.02215635845/8.0), REAL_CONST(130498.36348962256/8.0), REAL_CONST(130523.70605319779/8.0), REAL_CONST(130549.0498469647/8.0), REAL_CONST(130574.39487080388/8.0), REAL_CONST(130599.74112459592/8.0), REAL_CONST(130625.08860822149/8.0), REAL_CONST(130650.43732156123/8.0), REAL_CONST(130675.78726449587/8.0), REAL_CONST(130701.13843690613/8.0), REAL_CONST(130726.49083867275/8.0), REAL_CONST(130751.84446967654/8.0), REAL_CONST(130777.19932979831/8.0), REAL_CONST(130802.5554189189/8.0), REAL_CONST(130827.91273691918/8.0), REAL_CONST(130853.27128368006/8.0), REAL_CONST(130878.63105908247/8.0), REAL_CONST(130903.99206300738/8.0), REAL_CONST(130929.35429533575/8.0), REAL_CONST(130954.71775594862/8.0), REAL_CONST(130980.08244472703/8.0), REAL_CONST(131005.44836155206/8.0), REAL_CONST(131030.81550630482/8.0), REAL_CONST(131056.18387886642/8.0), REAL_CONST(131081.55347911804/8.0), REAL_CONST(131106.92430694087/8.0), REAL_CONST(131132.29636221612/8.0), REAL_CONST(131157.66964482504/8.0), REAL_CONST(131183.0441546489/8.0), REAL_CONST(131208.41989156904/8.0), REAL_CONST(131233.79685546676/8.0), REAL_CONST(131259.17504622342/8.0), REAL_CONST(131284.55446372041/8.0), REAL_CONST(131309.93510783918/8.0), REAL_CONST(131335.31697846117/8.0), REAL_CONST(131360.70007546784/8.0), REAL_CONST(131386.0843987407/8.0), REAL_CONST(131411.46994816128/8.0), REAL_CONST(131436.85672361116/8.0), REAL_CONST(131462.24472497194/8.0), REAL_CONST(131487.63395212521/8.0), REAL_CONST(131513.02440495262/8.0), REAL_CONST(131538.41608333588/8.0), REAL_CONST(131563.80898715663/8.0), REAL_CONST(131589.2031162967/8.0), REAL_CONST(131614.59847063778/8.0), REAL_CONST(131639.9950500617/8.0), REAL_CONST(131665.39285445024/8.0), REAL_CONST(131690.79188368531/8.0), REAL_CONST(131716.19213764873/8.0), REAL_CONST(131741.59361622241/8.0), REAL_CONST(131766.99631928833/8.0), REAL_CONST(131792.40024672839/8.0), REAL_CONST(131817.80539842462/8.0), REAL_CONST(131843.21177425905/8.0), REAL_CONST(131868.61937411371/8.0), REAL_CONST(131894.02819787065/8.0), REAL_CONST(131919.43824541202/8.0), REAL_CONST(131944.84951661993/8.0), REAL_CONST(131970.26201137656/8.0), REAL_CONST(131995.67572956407/8.0), REAL_CONST(132021.09067106468/8.0), REAL_CONST(132046.50683576067/8.0), REAL_CONST(132071.9242235343/8.0), REAL_CONST(132097.34283426782/8.0), REAL_CONST(132122.76266784366/8.0), REAL_CONST(132148.1837241441/8.0), REAL_CONST(132173.60600305157/8.0), REAL_CONST(132199.02950444847/8.0), REAL_CONST(132224.45422821722/8.0), REAL_CONST(132249.88017424036/8.0), REAL_CONST(132275.30734240031/8.0), REAL_CONST(132300.73573257966/8.0), REAL_CONST(132326.16534466096/8.0), REAL_CONST(132351.59617852676/8.0), REAL_CONST(132377.02823405969/8.0), REAL_CONST(132402.46151114244/8.0), REAL_CONST(132427.89600965759/8.0), REAL_CONST(132453.33172948789/8.0), REAL_CONST(132478.76867051609/8.0), REAL_CONST(132504.20683262491/8.0), REAL_CONST(132529.64621569714/8.0), REAL_CONST(132555.08681961559/8.0), REAL_CONST(132580.5286442631/8.0), REAL_CONST(132605.97168952253/8.0), REAL_CONST(132631.41595527678/8.0), REAL_CONST(132656.86144140881/8.0), REAL_CONST(132682.30814780149/8.0), REAL_CONST(132707.75607433787/8.0), REAL_CONST(132733.20522090094/8.0), REAL_CONST(132758.65558737374/8.0), REAL_CONST(132784.10717363929/8.0), REAL_CONST(132809.55997958075/8.0), REAL_CONST(132835.01400508118/8.0), REAL_CONST(132860.46925002377/8.0), REAL_CONST(132885.92571429166/8.0), REAL_CONST(132911.38339776811/8.0), REAL_CONST(132936.84230033628/8.0), REAL_CONST(132962.30242187946/8.0), REAL_CONST(132987.76376228096/8.0), REAL_CONST(133013.22632142407/8.0), REAL_CONST(133038.69009919214/8.0), REAL_CONST(133064.15509546854/8.0), REAL_CONST(133089.62131013666/8.0), REAL_CONST(133115.08874307995/8.0), REAL_CONST(133140.55739418184/8.0), REAL_CONST(133166.02726332581/8.0), REAL_CONST(133191.49835039541/8.0), REAL_CONST(133216.97065527414/8.0), REAL_CONST(133242.44417784561/8.0), REAL_CONST(133267.91891799335/8.0), REAL_CONST(133293.39487560102/8.0), REAL_CONST(133318.87205055228/8.0), REAL_CONST(133344.35044273079/8.0), REAL_CONST(133369.83005202023/8.0), REAL_CONST(133395.31087830439/8.0), REAL_CONST(133420.79292146701/8.0), REAL_CONST(133446.27618139185/8.0), REAL_CONST(133471.76065796276/8.0), REAL_CONST(133497.24635106357/8.0), REAL_CONST(133522.73326057816/8.0), REAL_CONST(133548.22138639039/8.0), REAL_CONST(133573.71072838426/8.0), REAL_CONST(133599.20128644365/8.0), REAL_CONST(133624.69306045261/8.0), REAL_CONST(133650.1860502951/8.0), REAL_CONST(133675.68025585517/8.0), REAL_CONST(133701.1756770169/8.0), REAL_CONST(133726.67231366437/8.0), REAL_CONST(133752.17016568172/8.0), REAL_CONST(133777.66923295305/8.0), REAL_CONST(133803.16951536259/8.0), REAL_CONST(133828.67101279454/8.0), REAL_CONST(133854.17372513309/8.0), REAL_CONST(133879.67765226253/8.0), REAL_CONST(133905.18279406714/8.0), REAL_CONST(133930.68915043125/8.0), REAL_CONST(133956.19672123916/8.0), REAL_CONST(133981.70550637526/8.0), REAL_CONST(134007.21550572399/8.0), REAL_CONST(134032.7267191697/8.0), REAL_CONST(134058.23914659687/8.0), REAL_CONST(134083.75278789/8.0), REAL_CONST(134109.26764293358/8.0), REAL_CONST(134134.78371161217/8.0), REAL_CONST(134160.30099381026/8.0), REAL_CONST(134185.8194894125/8.0), REAL_CONST(134211.33919830353/8.0), REAL_CONST(134236.8601203679/8.0), REAL_CONST(134262.38225549037/8.0), REAL_CONST(134287.90560355558/8.0), REAL_CONST(134313.43016444831/8.0), REAL_CONST(134338.95593805326/8.0), REAL_CONST(134364.48292425525/8.0), REAL_CONST(134390.01112293909/8.0), REAL_CONST(134415.54053398955/8.0), REAL_CONST(134441.07115729159/8.0), REAL_CONST(134466.60299273001/8.0), REAL_CONST(134492.1360401898/8.0), REAL_CONST(134517.67029955584/8.0), REAL_CONST(134543.20577071316/8.0), REAL_CONST(134568.74245354676/8.0), REAL_CONST(134594.28034794159/8.0), REAL_CONST(134619.81945378278/8.0), REAL_CONST(134645.35977095537/8.0), REAL_CONST(134670.90129934452/8.0), REAL_CONST(134696.4440388353/8.0), REAL_CONST(134721.98798931291/8.0), REAL_CONST(134747.53315066252/8.0), REAL_CONST(134773.07952276937/8.0), REAL_CONST(134798.62710551871/8.0), REAL_CONST(134824.17589879577/8.0), REAL_CONST(134849.72590248589/8.0), REAL_CONST(134875.27711647438/8.0), REAL_CONST(134900.82954064661/8.0), REAL_CONST(134926.38317488792/8.0), REAL_CONST(134951.93801908373/8.0), REAL_CONST(134977.49407311951/8.0), REAL_CONST(135003.05133688069/8.0), REAL_CONST(135028.60981025276/8.0), REAL_CONST(135054.16949312127/8.0), REAL_CONST(135079.73038537172/8.0), REAL_CONST(135105.29248688967/8.0), REAL_CONST(135130.85579756077/8.0), REAL_CONST(135156.42031727062/8.0), REAL_CONST(135181.98604590484/8.0), REAL_CONST(135207.55298334916/8.0), REAL_CONST(135233.12112948924/8.0), REAL_CONST(135258.69048421088/8.0), REAL_CONST(135284.26104739975/8.0), REAL_CONST(135309.83281894168/8.0), REAL_CONST(135335.4057987225/8.0), REAL_CONST(135360.97998662802/8.0), REAL_CONST(135386.55538254412/8.0), REAL_CONST(135412.13198635669/8.0), REAL_CONST(135437.70979795168/8.0), REAL_CONST(135463.28881721498/8.0), REAL_CONST(135488.86904403262/8.0), REAL_CONST(135514.45047829056/8.0), REAL_CONST(135540.03311987486/8.0), REAL_CONST(135565.61696867159/8.0), REAL_CONST(135591.20202456677/8.0), REAL_CONST(135616.78828744654/8.0), REAL_CONST(135642.37575719706/8.0), REAL_CONST(135667.96443370447/8.0), REAL_CONST(135693.55431685498/8.0), REAL_CONST(135719.14540653475/8.0), REAL_CONST(135744.73770263011/8.0), REAL_CONST(135770.33120502727/8.0), REAL_CONST(135795.92591361253/8.0), REAL_CONST(135821.52182827223/8.0), REAL_CONST(135847.11894889272/8.0), REAL_CONST(135872.7172753604/8.0), REAL_CONST(135898.31680756161/8.0), REAL_CONST(135923.91754538284/8.0), REAL_CONST(135949.51948871053/8.0), REAL_CONST(135975.12263743114/8.0), REAL_CONST(136000.72699143123/8.0), REAL_CONST(136026.33255059729/8.0), REAL_CONST(136051.93931481591/8.0), REAL_CONST(136077.54728397369/8.0), REAL_CONST(136103.15645795723/8.0), REAL_CONST(136128.76683665317/8.0), REAL_CONST(136154.37841994822/8.0), REAL_CONST(136179.99120772901/8.0), REAL_CONST(136205.60519988232/8.0), REAL_CONST(136231.2203962949/8.0), REAL_CONST(136256.83679685349/8.0), REAL_CONST(136282.45440144493/8.0), REAL_CONST(136308.07320995603/8.0), REAL_CONST(136333.69322227367/8.0), REAL_CONST(136359.31443828469/8.0), REAL_CONST(136384.93685787608/8.0), REAL_CONST(136410.56048093468/8.0), REAL_CONST(136436.18530734754/8.0), REAL_CONST(136461.81133700156/8.0), REAL_CONST(136487.43856978384/8.0), REAL_CONST(136513.06700558143/8.0), REAL_CONST(136538.6966442813/8.0), REAL_CONST(136564.32748577066/8.0), REAL_CONST(136589.95952993655/8.0), REAL_CONST(136615.59277666616/8.0), REAL_CONST(136641.22722584667/8.0), REAL_CONST(136666.86287736523/8.0), REAL_CONST(136692.49973110916/8.0), REAL_CONST(136718.13778696564/8.0), REAL_CONST(136743.77704482197/8.0), REAL_CONST(136769.41750456547/8.0), REAL_CONST(136795.05916608346/8.0), REAL_CONST(136820.70202926331/8.0), REAL_CONST(136846.34609399244/8.0), REAL_CONST(136871.99136015819/8.0), REAL_CONST(136897.63782764805/8.0), REAL_CONST(136923.28549634948/8.0), REAL_CONST(136948.93436614997/8.0), REAL_CONST(136974.58443693706/8.0), REAL_CONST(137000.23570859825/8.0), REAL_CONST(137025.88818102115/8.0), REAL_CONST(137051.54185409332/8.0), REAL_CONST(137077.19672770242/8.0), REAL_CONST(137102.85280173609/8.0), REAL_CONST(137128.51007608202/8.0), REAL_CONST(137154.16855062786/8.0), REAL_CONST(137179.82822526142/8.0), REAL_CONST(137205.48909987041/8.0), REAL_CONST(137231.15117434258/8.0), REAL_CONST(137256.8144485658/8.0), REAL_CONST(137282.47892242789/8.0), REAL_CONST(137308.14459581667/8.0), REAL_CONST(137333.81146862009/8.0), REAL_CONST(137359.47954072602/8.0), REAL_CONST(137385.14881202241/8.0), REAL_CONST(137410.81928239719/8.0), REAL_CONST(137436.49095173844/8.0), REAL_CONST(137462.16381993407/8.0), REAL_CONST(137487.83788687221/8.0), REAL_CONST(137513.51315244089/8.0), REAL_CONST(137539.18961652822/8.0), REAL_CONST(137564.86727902229/8.0), REAL_CONST(137590.54613981131/8.0), REAL_CONST(137616.22619878338/8.0), REAL_CONST(137641.90745582676/8.0), REAL_CONST(137667.58991082967/8.0), REAL_CONST(137693.27356368033/8.0), REAL_CONST(137718.95841426702/8.0), REAL_CONST(137744.64446247809/8.0), REAL_CONST(137770.33170820182/8.0), REAL_CONST(137796.02015132661/8.0), REAL_CONST(137821.70979174081/8.0), REAL_CONST(137847.40062933284/8.0), REAL_CONST(137873.09266399115/8.0), REAL_CONST(137898.78589560417/8.0), REAL_CONST(137924.48032406042/8.0), REAL_CONST(137950.17594924837/8.0), REAL_CONST(137975.8727710566/8.0), REAL_CONST(138001.57078937365/8.0), REAL_CONST(138027.27000408815/8.0), REAL_CONST(138052.97041508864/8.0), REAL_CONST(138078.67202226384/8.0), REAL_CONST(138104.3748255024/8.0), REAL_CONST(138130.07882469296/8.0), REAL_CONST(138155.78401972432/8.0), REAL_CONST(138181.49041048516/8.0), REAL_CONST(138207.1979968643/8.0), REAL_CONST(138232.9067787505/8.0), REAL_CONST(138258.61675603263/8.0), REAL_CONST(138284.32792859949/8.0), REAL_CONST(138310.04029633995/8.0), REAL_CONST(138335.75385914298/8.0), REAL_CONST(138361.46861689744/8.0), REAL_CONST(138387.18456949232/8.0), REAL_CONST(138412.90171681659/8.0), REAL_CONST(138438.62005875923/8.0), REAL_CONST(138464.33959520931/8.0), REAL_CONST(138490.06032605586/8.0), REAL_CONST(138515.78225118798/8.0), REAL_CONST(138541.50537049473/8.0), REAL_CONST(138567.2296838653/8.0), REAL_CONST(138592.95519118884/8.0), REAL_CONST(138618.68189235451/8.0), REAL_CONST(138644.40978725153/8.0), REAL_CONST(138670.13887576913/8.0), REAL_CONST(138695.86915779658/8.0), REAL_CONST(138721.60063322316/8.0), REAL_CONST(138747.33330193823/8.0), REAL_CONST(138773.06716383106/8.0), REAL_CONST(138798.80221879104/8.0), REAL_CONST(138824.53846670757/8.0), REAL_CONST(138850.27590747006/8.0), REAL_CONST(138876.01454096794/8.0), REAL_CONST(138901.7543670907/8.0), REAL_CONST(138927.49538572782/8.0), REAL_CONST(138953.2375967688/8.0), REAL_CONST(138978.9810001032/8.0), REAL_CONST(139004.72559562061/8.0), REAL_CONST(139030.47138321059/8.0), REAL_CONST(139056.2183627628/8.0), REAL_CONST(139081.96653416683/8.0), REAL_CONST(139107.71589731239/8.0), REAL_CONST(139133.46645208917/8.0), REAL_CONST(139159.21819838689/8.0), REAL_CONST(139184.97113609532/8.0), REAL_CONST(139210.72526510421/8.0), REAL_CONST(139236.48058530336/8.0), REAL_CONST(139262.23709658257/8.0), REAL_CONST(139287.99479883176/8.0), REAL_CONST(139313.75369194071/8.0), REAL_CONST(139339.51377579942/8.0), REAL_CONST(139365.27505029776/8.0), REAL_CONST(139391.03751532568/8.0), REAL_CONST(139416.80117077316/8.0), REAL_CONST(139442.56601653024/8.0), REAL_CONST(139468.33205248689/8.0), REAL_CONST(139494.09927853322/8.0), REAL_CONST(139519.86769455927/8.0), REAL_CONST(139545.63730045516/8.0), REAL_CONST(139571.408096111/8.0), REAL_CONST(139597.18008141697/8.0), REAL_CONST(139622.95325626322/8.0), REAL_CONST(139648.72762054001/8.0), REAL_CONST(139674.5031741375/8.0), REAL_CONST(139700.27991694602/8.0), REAL_CONST(139726.05784885579/8.0), REAL_CONST(139751.83696975713/8.0), REAL_CONST(139777.61727954043/8.0), REAL_CONST(139803.39877809596/8.0), REAL_CONST(139829.18146531415/8.0), REAL_CONST(139854.96534108539/8.0), REAL_CONST(139880.75040530015/8.0), REAL_CONST(139906.53665784886/8.0), REAL_CONST(139932.32409862199/8.0), REAL_CONST(139958.11272751007/8.0), REAL_CONST(139983.90254440365/8.0), REAL_CONST(140009.69354919327/8.0), REAL_CONST(140035.48574176949/8.0), REAL_CONST(140061.27912202294/8.0), REAL_CONST(140087.07368984428/8.0), REAL_CONST(140112.86944512415/8.0), REAL_CONST(140138.66638775321/8.0), REAL_CONST(140164.4645176222/8.0), REAL_CONST(140190.26383462184/8.0), REAL_CONST(140216.06433864293/8.0), REAL_CONST(140241.86602957622/8.0), REAL_CONST(140267.66890731253/8.0), REAL_CONST(140293.47297174268/8.0), REAL_CONST(140319.27822275754/8.0), REAL_CONST(140345.08466024802/8.0), REAL_CONST(140370.89228410498/8.0), REAL_CONST(140396.70109421943/8.0), REAL_CONST(140422.51109048226/8.0), REAL_CONST(140448.32227278448/8.0), REAL_CONST(140474.13464101712/8.0), REAL_CONST(140499.94819507122/8.0), REAL_CONST(140525.76293483781/8.0), REAL_CONST(140551.57886020801/8.0), REAL_CONST(140577.3959710729/8.0), REAL_CONST(140603.21426732364/8.0), REAL_CONST(140629.03374885136/8.0), REAL_CONST(140654.85441554731/8.0), REAL_CONST(140680.67626730262/8.0), REAL_CONST(140706.49930400858/8.0), REAL_CONST(140732.32352555645/8.0), REAL_CONST(140758.1489318375/8.0), REAL_CONST(140783.97552274304/8.0), REAL_CONST(140809.80329816442/8.0), REAL_CONST(140835.63225799298/8.0), REAL_CONST(140861.46240212015/8.0), REAL_CONST(140887.29373043729/8.0), REAL_CONST(140913.12624283586/8.0), REAL_CONST(140938.95993920733/8.0), REAL_CONST(140964.79481944317/8.0), REAL_CONST(140990.63088343487/8.0), REAL_CONST(141016.46813107401/8.0), REAL_CONST(141042.30656225214/8.0), REAL_CONST(141068.14617686081/8.0), REAL_CONST(141093.98697479168/8.0), REAL_CONST(141119.82895593636/8.0), REAL_CONST(141145.6721201865/8.0), REAL_CONST(141171.51646743377/8.0), REAL_CONST(141197.36199756994/8.0), REAL_CONST(141223.20871048668/8.0), REAL_CONST(141249.05660607578/8.0), REAL_CONST(141274.90568422904/8.0), REAL_CONST(141300.75594483822/8.0), REAL_CONST(141326.6073877952/8.0), REAL_CONST(141352.4600129918/8.0), REAL_CONST(141378.31382031992/8.0), REAL_CONST(141404.16880967148/8.0), REAL_CONST(141430.02498093838/8.0), REAL_CONST(141455.8823340126/8.0), REAL_CONST(141481.74086878612/8.0), REAL_CONST(141507.60058515094/8.0), REAL_CONST(141533.46148299909/8.0), REAL_CONST(141559.32356222265/8.0), REAL_CONST(141585.18682271364/8.0), REAL_CONST(141611.05126436421/8.0), REAL_CONST(141636.9168870665/8.0), REAL_CONST(141662.78369071262/8.0), REAL_CONST(141688.65167519479/8.0), REAL_CONST(141714.5208404052/8.0), REAL_CONST(141740.39118623605/8.0), REAL_CONST(141766.26271257963/8.0), REAL_CONST(141792.1354193282/8.0), REAL_CONST(141818.00930637406/8.0), REAL_CONST(141843.88437360956/8.0), REAL_CONST(141869.760620927/8.0), REAL_CONST(141895.6380482188/8.0), REAL_CONST(141921.51665537735/8.0), REAL_CONST(141947.39644229505/8.0), REAL_CONST(141973.27740886438/8.0), REAL_CONST(141999.15955497778/8.0), REAL_CONST(142025.04288052776/8.0), REAL_CONST(142050.92738540689/8.0), REAL_CONST(142076.81306950765/8.0), REAL_CONST(142102.69993272264/8.0), REAL_CONST(142128.58797494444/8.0), REAL_CONST(142154.47719606571/8.0), REAL_CONST(142180.36759597904/8.0), REAL_CONST(142206.25917457714/8.0), REAL_CONST(142232.15193175265/8.0), REAL_CONST(142258.04586739838/8.0), REAL_CONST(142283.94098140698/8.0), REAL_CONST(142309.83727367126/8.0), REAL_CONST(142335.73474408401/8.0), REAL_CONST(142361.63339253806/8.0), REAL_CONST(142387.5332189262/8.0), REAL_CONST(142413.43422314132/8.0), REAL_CONST(142439.33640507635/8.0), REAL_CONST(142465.23976462413/8.0), REAL_CONST(142491.14430167765/8.0), REAL_CONST(142517.05001612983/8.0), REAL_CONST(142542.95690787368/8.0), REAL_CONST(142568.86497680223/8.0), REAL_CONST(142594.77422280848/8.0), REAL_CONST(142620.68464578551/8.0), REAL_CONST(142646.5962456264/8.0), REAL_CONST(142672.50902222423/8.0), REAL_CONST(142698.42297547215/8.0), REAL_CONST(142724.33810526333/8.0), REAL_CONST(142750.25441149093/8.0), REAL_CONST(142776.17189404817/8.0), REAL_CONST(142802.09055282827/8.0), REAL_CONST(142828.01038772447/8.0), REAL_CONST(142853.93139863008/8.0), REAL_CONST(142879.85358543837/8.0), REAL_CONST(142905.77694804268/8.0), REAL_CONST(142931.70148633636/8.0), REAL_CONST(142957.62720021277/8.0), REAL_CONST(142983.55408956532/8.0), REAL_CONST(143009.48215428743/8.0), REAL_CONST(143035.41139427255/8.0), REAL_CONST(143061.34180941415/8.0), REAL_CONST(143087.27339960571/8.0), REAL_CONST(143113.20616474075/8.0), REAL_CONST(143139.14010471283/8.0), REAL_CONST(143165.07521941551/8.0), REAL_CONST(143191.01150874238/8.0), REAL_CONST(143216.94897258704/8.0), REAL_CONST(143242.88761084314/8.0), REAL_CONST(143268.82742340435/8.0), REAL_CONST(143294.76841016437/8.0), REAL_CONST(143320.71057101688/8.0), REAL_CONST(143346.65390585564/8.0), REAL_CONST(143372.59841457437/8.0), REAL_CONST(143398.54409706692/8.0), REAL_CONST(143424.49095322701/8.0), REAL_CONST(143450.43898294857/8.0), REAL_CONST(143476.38818612538/8.0), REAL_CONST(143502.33856265133/8.0), REAL_CONST(143528.29011242036/8.0), REAL_CONST(143554.24283532638/8.0), REAL_CONST(143580.19673126334/8.0), REAL_CONST(143606.1518001252/8.0), REAL_CONST(143632.10804180597/8.0), REAL_CONST(143658.06545619969/8.0), REAL_CONST(143684.02404320039/8.0), REAL_CONST(143709.98380270213/8.0), REAL_CONST(143735.944734599/8.0), REAL_CONST(143761.90683878519/8.0), REAL_CONST(143787.87011515474/8.0), REAL_CONST(143813.83456360188/8.0), REAL_CONST(143839.8001840208/8.0), REAL_CONST(143865.76697630569/8.0), REAL_CONST(143891.73494035081/8.0), REAL_CONST(143917.7040760504/8.0), REAL_CONST(143943.67438329876/8.0), REAL_CONST(143969.6458619902/8.0), REAL_CONST(143995.61851201905/8.0), REAL_CONST(144021.59233327967/8.0), REAL_CONST(144047.56732566646/8.0), REAL_CONST(144073.54348907378/8.0), REAL_CONST(144099.52082339607/8.0), REAL_CONST(144125.49932852783/8.0), REAL_CONST(144151.4790043635/8.0), REAL_CONST(144177.45985079758/8.0), REAL_CONST(144203.44186772458/8.0), REAL_CONST(144229.42505503909/8.0), REAL_CONST(144255.40941263564/8.0), REAL_CONST(144281.39494040885/8.0), REAL_CONST(144307.38163825331/8.0), REAL_CONST(144333.36950606373/8.0), REAL_CONST(144359.35854373468/8.0), REAL_CONST(144385.34875116093/8.0), REAL_CONST(144411.34012823718/8.0), REAL_CONST(144437.33267485813/8.0), REAL_CONST(144463.32639091855/8.0), REAL_CONST(144489.32127631325/8.0), REAL_CONST(144515.31733093705/8.0), REAL_CONST(144541.31455468474/8.0), REAL_CONST(144567.3129474512/8.0), REAL_CONST(144593.3125091313/8.0), REAL_CONST(144619.31323961995/8.0), REAL_CONST(144645.31513881206/8.0), REAL_CONST(144671.31820660262/8.0), REAL_CONST(144697.32244288657/8.0), REAL_CONST(144723.32784755889/8.0), REAL_CONST(144749.33442051467/8.0), REAL_CONST(144775.34216164888/8.0), REAL_CONST(144801.35107085665/8.0), REAL_CONST(144827.36114803303/8.0), REAL_CONST(144853.37239307314/8.0), REAL_CONST(144879.38480587213/8.0), REAL_CONST(144905.39838632516/8.0), REAL_CONST(144931.41313432742/8.0), REAL_CONST(144957.4290497741/8.0), REAL_CONST(144983.44613256046/8.0), REAL_CONST(145009.46438258173/8.0), REAL_CONST(145035.48379973322/8.0), REAL_CONST(145061.50438391021/8.0), REAL_CONST(145087.52613500805/8.0), REAL_CONST(145113.54905292206/8.0), REAL_CONST(145139.57313754765/8.0), REAL_CONST(145165.59838878017/8.0), REAL_CONST(145191.62480651509/8.0), REAL_CONST(145217.65239064783/8.0), REAL_CONST(145243.68114107384/8.0), REAL_CONST(145269.71105768863/8.0), REAL_CONST(145295.74214038774/8.0), REAL_CONST(145321.77438906668/8.0), REAL_CONST(145347.80780362099/8.0), REAL_CONST(145373.84238394629/8.0), REAL_CONST(145399.87812993818/8.0), REAL_CONST(145425.91504149229/8.0), REAL_CONST(145451.95311850426/8.0), REAL_CONST(145477.9923608698/8.0), REAL_CONST(145504.03276848458/8.0), REAL_CONST(145530.07434124436/8.0), REAL_CONST(145556.11707904484/8.0), REAL_CONST(145582.16098178181/8.0), REAL_CONST(145608.20604935108/8.0), REAL_CONST(145634.25228164849/8.0), REAL_CONST(145660.29967856981/8.0), REAL_CONST(145686.34824001096/8.0), REAL_CONST(145712.39796586783/8.0), REAL_CONST(145738.4488560363/8.0), REAL_CONST(145764.50091041232/8.0), REAL_CONST(145790.55412889185/8.0), REAL_CONST(145816.60851137087/8.0), REAL_CONST(145842.66405774537/8.0), REAL_CONST(145868.72076791141/8.0), REAL_CONST(145894.77864176501/8.0), REAL_CONST(145920.83767920226/8.0), REAL_CONST(145946.89788011924/8.0), REAL_CONST(145972.95924441208/8.0), REAL_CONST(145999.02177197693/8.0), REAL_CONST(146025.08546270995/8.0), REAL_CONST(146051.15031650732/8.0), REAL_CONST(146077.21633326527/8.0), REAL_CONST(146103.28351288004/8.0), REAL_CONST(146129.35185524789/8.0), REAL_CONST(146155.42136026506/8.0), REAL_CONST(146181.49202782792/8.0), REAL_CONST(146207.56385783272/8.0), REAL_CONST(146233.63685017588/8.0), REAL_CONST(146259.71100475377/8.0), REAL_CONST(146285.78632146274/8.0), REAL_CONST(146311.86280019928/8.0), REAL_CONST(146337.94044085976/8.0), REAL_CONST(146364.01924334071/8.0), REAL_CONST(146390.09920753856/8.0), REAL_CONST(146416.18033334985/8.0), REAL_CONST(146442.26262067116/8.0), REAL_CONST(146468.34606939898/8.0), REAL_CONST(146494.43067942993/8.0), REAL_CONST(146520.51645066062/8.0), REAL_CONST(146546.60338298764/8.0), REAL_CONST(146572.69147630769/8.0), REAL_CONST(146598.78073051744/8.0), REAL_CONST(146624.87114551352/8.0), REAL_CONST(146650.96272119274/8.0), REAL_CONST(146677.05545745179/8.0), REAL_CONST(146703.14935418745/8.0), REAL_CONST(146729.2444112965/8.0), REAL_CONST(146755.34062867577/8.0), REAL_CONST(146781.43800622207/8.0), REAL_CONST(146807.53654383228/8.0), REAL_CONST(146833.63624140329/8.0), REAL_CONST(146859.73709883197/8.0), REAL_CONST(146885.83911601527/8.0), REAL_CONST(146911.94229285014/8.0), REAL_CONST(146938.04662923355/8.0), REAL_CONST(146964.15212506248/8.0), REAL_CONST(146990.25878023397/8.0), REAL_CONST(147016.36659464505/8.0), REAL_CONST(147042.47556819281/8.0), REAL_CONST(147068.58570077427/8.0), REAL_CONST(147094.6969922866/8.0), REAL_CONST(147120.80944262692/8.0), REAL_CONST(147146.92305169237/8.0), REAL_CONST(147173.03781938017/8.0), REAL_CONST(147199.15374558745/8.0), REAL_CONST(147225.27083021149/8.0), REAL_CONST(147251.38907314953/8.0), REAL_CONST(147277.50847429881/8.0), REAL_CONST(147303.62903355664/8.0), REAL_CONST(147329.75075082036/8.0), REAL_CONST(147355.87362598727/8.0), REAL_CONST(147381.99765895473/8.0), REAL_CONST(147408.12284962015/8.0), REAL_CONST(147434.24919788091/8.0), REAL_CONST(147460.37670363448/8.0), REAL_CONST(147486.50536677826/8.0), REAL_CONST(147512.63518720976/8.0), REAL_CONST(147538.76616482646/8.0), REAL_CONST(147564.89829952587/8.0), REAL_CONST(147591.03159120557/8.0), REAL_CONST(147617.16603976308/8.0), REAL_CONST(147643.30164509601/8.0), REAL_CONST(147669.43840710199/8.0), REAL_CONST(147695.57632567859/8.0), REAL_CONST(147721.71540072354/8.0), REAL_CONST(147747.85563213445/8.0), REAL_CONST(147773.99701980909/8.0), REAL_CONST(147800.13956364512/8.0), REAL_CONST(147826.28326354033/8.0), REAL_CONST(147852.42811939248/8.0), REAL_CONST(147878.57413109933/8.0), REAL_CONST(147904.72129855872/8.0), REAL_CONST(147930.86962166851/8.0), REAL_CONST(147957.01910032652/8.0), REAL_CONST(147983.16973443062/8.0), REAL_CONST(148009.32152387875/8.0), REAL_CONST(148035.47446856883/8.0), REAL_CONST(148061.62856839882/8.0), REAL_CONST(148087.78382326665/8.0), REAL_CONST(148113.94023307035/8.0), REAL_CONST(148140.09779770792/8.0), REAL_CONST(148166.25651707739/8.0), REAL_CONST(148192.41639107687/8.0), REAL_CONST(148218.57741960438/8.0), REAL_CONST(148244.73960255808/8.0), REAL_CONST(148270.90293983606/8.0), REAL_CONST(148297.0674313365/8.0), REAL_CONST(148323.23307695755/8.0), REAL_CONST(148349.39987659742/8.0), REAL_CONST(148375.56783015432/8.0), REAL_CONST(148401.73693752653/8.0), REAL_CONST(148427.90719861226/8.0), REAL_CONST(148454.07861330983/8.0), REAL_CONST(148480.25118151752/8.0), REAL_CONST(148506.42490313368/8.0), REAL_CONST(148532.59977805667/8.0), REAL_CONST(148558.77580618486/8.0), REAL_CONST(148584.95298741665/8.0), REAL_CONST(148611.13132165043/8.0), REAL_CONST(148637.31080878471/8.0), REAL_CONST(148663.49144871789/8.0), REAL_CONST(148689.6732413485/8.0), REAL_CONST(148715.85618657502/8.0), REAL_CONST(148742.040284296/8.0), REAL_CONST(148768.22553440998/8.0), REAL_CONST(148794.41193681557/8.0), REAL_CONST(148820.59949141133/8.0), REAL_CONST(148846.78819809589/8.0), REAL_CONST(148872.97805676793/8.0), REAL_CONST(148899.16906732606/8.0), REAL_CONST(148925.36122966901/8.0), REAL_CONST(148951.55454369547/8.0), REAL_CONST(148977.74900930419/8.0), REAL_CONST(149003.9446263939/8.0), REAL_CONST(149030.1413948634/8.0), REAL_CONST(149056.33931461151/8.0), REAL_CONST(149082.53838553699/8.0), REAL_CONST(149108.73860753875/8.0), REAL_CONST(149134.9399805156/8.0), REAL_CONST(149161.14250436646/8.0), REAL_CONST(149187.34617899026/8.0), REAL_CONST(149213.5510042859/8.0), REAL_CONST(149239.75698015234/8.0), REAL_CONST(149265.96410648854/8.0), REAL_CONST(149292.17238319354/8.0), REAL_CONST(149318.38181016635/8.0), REAL_CONST(149344.59238730598/8.0), REAL_CONST(149370.80411451156/8.0), REAL_CONST(149397.01699168212/8.0), REAL_CONST(149423.23101871679/8.0), REAL_CONST(149449.44619551473/8.0), REAL_CONST(149475.66252197503/8.0), REAL_CONST(149501.87999799693/8.0), REAL_CONST(149528.0986234796/8.0), REAL_CONST(149554.31839832227/8.0), REAL_CONST(149580.53932242419/8.0), REAL_CONST(149606.76139568459/8.0), REAL_CONST(149632.98461800278/8.0), REAL_CONST(149659.20898927809/8.0), REAL_CONST(149685.43450940982/8.0), REAL_CONST(149711.66117829733/8.0), REAL_CONST(149737.88899584001/8.0), REAL_CONST(149764.11796193724/8.0), REAL_CONST(149790.34807648844/8.0), REAL_CONST(149816.57933939309/8.0), REAL_CONST(149842.81175055061/8.0), REAL_CONST(149869.04530986046/8.0), REAL_CONST(149895.28001722222/8.0), REAL_CONST(149921.51587253538/8.0), REAL_CONST(149947.75287569952/8.0), REAL_CONST(149973.99102661415/8.0), REAL_CONST(150000.23032517891/8.0), REAL_CONST(150026.47077129342/8.0), REAL_CONST(150052.71236485732/8.0), REAL_CONST(150078.95510577026/8.0), REAL_CONST(150105.1989939319/8.0), REAL_CONST(150131.444029242/8.0), REAL_CONST(150157.69021160025/8.0), REAL_CONST(150183.93754090639/8.0), REAL_CONST(150210.18601706024/8.0), REAL_CONST(150236.43563996154/8.0), REAL_CONST(150262.68640951012/8.0), REAL_CONST(150288.93832560582/8.0), REAL_CONST(150315.19138814852/8.0), REAL_CONST(150341.44559703805/8.0), REAL_CONST(150367.70095217437/8.0), REAL_CONST(150393.95745345735/8.0), REAL_CONST(150420.21510078697/8.0), REAL_CONST(150446.47389406321/8.0), REAL_CONST(150472.73383318601/8.0), REAL_CONST(150498.99491805542/8.0), REAL_CONST(150525.25714857146/8.0), REAL_CONST(150551.52052463419/8.0), REAL_CONST(150577.78504614369/8.0), REAL_CONST(150604.05071300003/8.0), REAL_CONST(150630.31752510337/8.0), REAL_CONST(150656.58548235384/8.0), REAL_CONST(150682.85458465159/8.0), REAL_CONST(150709.1248318968/8.0), REAL_CONST(150735.39622398972/8.0), REAL_CONST(150761.66876083051/8.0), REAL_CONST(150787.9424423195/8.0), REAL_CONST(150814.21726835691/8.0), REAL_CONST(150840.49323884305/8.0), REAL_CONST(150866.77035367821/8.0), REAL_CONST(150893.04861276277/8.0), REAL_CONST(150919.32801599705/8.0), REAL_CONST(150945.60856328148/8.0), REAL_CONST(150971.89025451642/8.0), REAL_CONST(150998.17308960229/8.0), REAL_CONST(151024.45706843957/8.0), REAL_CONST(151050.74219092872/8.0), REAL_CONST(151077.02845697021/8.0), REAL_CONST(151103.31586646455/8.0), REAL_CONST(151129.60441931229/8.0), REAL_CONST(151155.894115414/8.0), REAL_CONST(151182.1849546702/8.0), REAL_CONST(151208.47693698155/8.0), REAL_CONST(151234.77006224863/8.0), REAL_CONST(151261.06433037209/8.0), REAL_CONST(151287.35974125259/8.0), REAL_CONST(151313.65629479082/8.0), REAL_CONST(151339.95399088747/8.0), REAL_CONST(151366.25282944329/8.0), REAL_CONST(151392.55281035902/8.0), REAL_CONST(151418.85393353543/8.0), REAL_CONST(151445.1561988733/8.0), REAL_CONST(151471.45960627345/8.0), REAL_CONST(151497.76415563675/8.0), REAL_CONST(151524.06984686397/8.0), REAL_CONST(151550.37667985607/8.0), REAL_CONST(151576.68465451393/8.0), REAL_CONST(151602.99377073845/8.0), REAL_CONST(151629.30402843058/8.0), REAL_CONST(151655.61542749128/8.0), REAL_CONST(151681.92796782157/8.0), REAL_CONST(151708.24164932242/8.0), REAL_CONST(151734.55647189484/8.0), REAL_CONST(151760.87243543993/8.0), REAL_CONST(151787.18953985872/8.0), REAL_CONST(151813.50778505235/8.0), REAL_CONST(151839.82717092187/8.0), REAL_CONST(151866.14769736846/8.0), REAL_CONST(151892.46936429327/8.0), REAL_CONST(151918.79217159748/8.0), REAL_CONST(151945.11611918229/8.0), REAL_CONST(151971.44120694889/8.0), REAL_CONST(151997.76743479856/8.0), REAL_CONST(152024.09480263255/8.0), REAL_CONST(152050.42331035214/8.0), REAL_CONST(152076.75295785864/8.0), REAL_CONST(152103.08374505339/8.0), REAL_CONST(152129.41567183775/8.0), REAL_CONST(152155.74873811303/8.0), REAL_CONST(152182.08294378067/8.0), REAL_CONST(152208.41828874208/8.0), REAL_CONST(152234.75477289871/8.0), REAL_CONST(152261.09239615197/8.0), REAL_CONST(152287.43115840337/8.0), REAL_CONST(152313.77105955439/8.0), REAL_CONST(152340.11209950657/8.0), REAL_CONST(152366.45427816146/8.0), REAL_CONST(152392.79759542056/8.0), REAL_CONST(152419.14205118554/8.0), REAL_CONST(152445.48764535793/8.0), REAL_CONST(152471.8343778394/8.0), REAL_CONST(152498.18224853161/8.0), REAL_CONST(152524.53125733617/8.0), REAL_CONST(152550.88140415482/8.0), REAL_CONST(152577.23268888926/8.0), REAL_CONST(152603.58511144121/8.0), REAL_CONST(152629.93867171241/8.0), REAL_CONST(152656.29336960468/8.0), REAL_CONST(152682.64920501978/8.0), REAL_CONST(152709.00617785956/8.0), REAL_CONST(152735.36428802583/8.0), REAL_CONST(152761.72353542043/8.0), REAL_CONST(152788.08391994529/8.0), REAL_CONST(152814.44544150229/8.0), REAL_CONST(152840.80809999333/8.0), REAL_CONST(152867.17189532038/8.0), REAL_CONST(152893.53682738543/8.0), REAL_CONST(152919.90289609041/8.0), REAL_CONST(152946.27010133737/8.0), REAL_CONST(152972.63844302832/8.0), REAL_CONST(152999.00792106529/8.0), REAL_CONST(153025.37853535041/8.0), REAL_CONST(153051.7502857857/8.0), REAL_CONST(153078.12317227334/8.0), REAL_CONST(153104.4971947154/8.0), REAL_CONST(153130.8723530141/8.0), REAL_CONST(153157.24864707157/8.0), REAL_CONST(153183.62607679001/8.0), REAL_CONST(153210.00464207167/8.0), REAL_CONST(153236.38434281875/8.0), REAL_CONST(153262.76517893354/8.0), REAL_CONST(153289.14715031831/8.0), REAL_CONST(153315.53025687535/8.0), REAL_CONST(153341.91449850702/8.0), REAL_CONST(153368.2998751156/8.0), REAL_CONST(153394.68638660354/8.0), REAL_CONST(153421.07403287315/8.0), REAL_CONST(153447.46281382689/8.0), REAL_CONST(153473.85272936718/8.0), REAL_CONST(153500.24377939643/8.0), REAL_CONST(153526.63596381716/8.0), REAL_CONST(153553.02928253182/8.0), REAL_CONST(153579.42373544298/8.0), REAL_CONST(153605.81932245308/8.0), REAL_CONST(153632.21604346478/8.0), REAL_CONST(153658.61389838057/8.0), REAL_CONST(153685.0128871031/8.0), REAL_CONST(153711.41300953497/8.0), REAL_CONST(153737.81426557881/8.0), REAL_CONST(153764.21665513728/8.0), REAL_CONST(153790.62017811305/8.0), REAL_CONST(153817.02483440886/8.0), REAL_CONST(153843.43062392739/8.0), REAL_CONST(153869.83754657139/8.0), REAL_CONST(153896.24560224367/8.0), REAL_CONST(153922.65479084692/8.0), REAL_CONST(153949.06511228404/8.0), REAL_CONST(153975.4765664578/8.0), REAL_CONST(154001.88915327107/8.0), REAL_CONST(154028.30287262669/8.0), REAL_CONST(154054.71772442761/8.0), REAL_CONST(154081.13370857667/8.0), REAL_CONST(154107.55082497682/8.0), REAL_CONST(154133.96907353101/8.0), REAL_CONST(154160.38845414223/8.0), REAL_CONST(154186.80896671346/8.0), REAL_CONST(154213.23061114774/8.0), REAL_CONST(154239.65338734805/8.0), REAL_CONST(154266.07729521746/8.0), REAL_CONST(154292.50233465908/8.0), REAL_CONST(154318.92850557598/8.0), REAL_CONST(154345.35580787127/8.0), REAL_CONST(154371.7842414481/8.0), REAL_CONST(154398.21380620965/8.0), REAL_CONST(154424.64450205903/8.0), REAL_CONST(154451.07632889951/8.0), REAL_CONST(154477.50928663427/8.0), REAL_CONST(154503.94337516659/8.0), REAL_CONST(154530.37859439969/8.0), REAL_CONST(154556.81494423689/8.0), REAL_CONST(154583.25242458144/8.0), REAL_CONST(154609.69103533673/8.0), REAL_CONST(154636.13077640603/8.0), REAL_CONST(154662.57164769279/8.0), REAL_CONST(154689.01364910032/8.0), REAL_CONST(154715.45678053208/8.0), REAL_CONST(154741.90104189145/8.0), REAL_CONST(154768.34643308193/8.0), REAL_CONST(154794.79295400696/8.0), REAL_CONST(154821.24060457002/8.0), REAL_CONST(154847.68938467462/8.0), REAL_CONST(154874.13929422433/8.0), REAL_CONST(154900.59033312264/8.0), REAL_CONST(154927.04250127316/8.0), REAL_CONST(154953.49579857948/8.0), REAL_CONST(154979.95022494521/8.0), REAL_CONST(155006.40578027396/8.0), REAL_CONST(155032.86246446942/8.0), REAL_CONST(155059.32027743524/8.0), REAL_CONST(155085.77921907514/8.0), REAL_CONST(155112.2392892928/8.0), REAL_CONST(155138.70048799197/8.0), REAL_CONST(155165.16281507642/8.0), REAL_CONST(155191.62627044989/8.0), REAL_CONST(155218.09085401625/8.0), REAL_CONST(155244.55656567923/8.0), REAL_CONST(155271.02340534274/8.0), REAL_CONST(155297.49137291059/8.0), REAL_CONST(155323.96046828668/8.0), REAL_CONST(155350.4306913749/8.0), REAL_CONST(155376.90204207919/8.0), REAL_CONST(155403.37452030348/8.0), REAL_CONST(155429.84812595171/8.0), REAL_CONST(155456.32285892789/8.0), REAL_CONST(155482.79871913602/8.0), REAL_CONST(155509.27570648011/8.0), REAL_CONST(155535.75382086422/8.0), REAL_CONST(155562.23306219239/8.0), REAL_CONST(155588.71343036872/8.0), REAL_CONST(155615.19492529731/8.0), REAL_CONST(155641.67754688227/8.0), REAL_CONST(155668.16129502779/8.0), REAL_CONST(155694.64616963797/8.0), REAL_CONST(155721.13217061706/8.0), REAL_CONST(155747.61929786921/8.0), REAL_CONST(155774.10755129869/8.0), REAL_CONST(155800.59693080973/8.0), REAL_CONST(155827.08743630661/8.0), REAL_CONST(155853.57906769359/8.0), REAL_CONST(155880.07182487496/8.0), REAL_CONST(155906.56570775513/8.0), REAL_CONST(155933.06071623837/8.0), REAL_CONST(155959.55685022907/8.0), REAL_CONST(155986.05410963166/8.0), REAL_CONST(156012.5524943505/8.0), REAL_CONST(156039.05200429002/8.0), REAL_CONST(156065.55263935472/8.0), REAL_CONST(156092.054399449/8.0), REAL_CONST(156118.5572844774/8.0), REAL_CONST(156145.06129434443/8.0), REAL_CONST(156171.5664289546/8.0), REAL_CONST(156198.07268821247/8.0), REAL_CONST(156224.5800720226/8.0), REAL_CONST(156251.08858028959/8.0), REAL_CONST(156277.59821291809/8.0), REAL_CONST(156304.10896981266/8.0), REAL_CONST(156330.62085087801/8.0), REAL_CONST(156357.1338560188/8.0), REAL_CONST(156383.64798513969/8.0), REAL_CONST(156410.16323814544/8.0), REAL_CONST(156436.67961494075/8.0), REAL_CONST(156463.1971154304/8.0), REAL_CONST(156489.71573951913/8.0), REAL_CONST(156516.23548711176/8.0), REAL_CONST(156542.75635811311/8.0), REAL_CONST(156569.27835242799/8.0), REAL_CONST(156595.80146996127/8.0), REAL_CONST(156622.32571061782/8.0), REAL_CONST(156648.85107430254/8.0), REAL_CONST(156675.37756092031/8.0), REAL_CONST(156701.90517037612/8.0), REAL_CONST(156728.43390257491/8.0), REAL_CONST(156754.96375742162/8.0), REAL_CONST(156781.49473482129/8.0), REAL_CONST(156808.02683467892/8.0), REAL_CONST(156834.5600568995/8.0), REAL_CONST(156861.09440138817/8.0), REAL_CONST(156887.62986804993/8.0), REAL_CONST(156914.16645678994/8.0), REAL_CONST(156940.70416751326/8.0), REAL_CONST(156967.24300012505/8.0), REAL_CONST(156993.78295453047/8.0), REAL_CONST(157020.32403063469/8.0), REAL_CONST(157046.8662283429/8.0), REAL_CONST(157073.40954756032/8.0), REAL_CONST(157099.9539881922/8.0), REAL_CONST(157126.49955014378/8.0), REAL_CONST(157153.04623332032/8.0), REAL_CONST(157179.59403762716/8.0), REAL_CONST(157206.14296296958/8.0), REAL_CONST(157232.69300925292/8.0), REAL_CONST(157259.24417638258/8.0), REAL_CONST(157285.79646426387/8.0), REAL_CONST(157312.34987280221/8.0), REAL_CONST(157338.90440190304/8.0), REAL_CONST(157365.46005147175/8.0), REAL_CONST(157392.01682141385/8.0), REAL_CONST(157418.57471163478/8.0), REAL_CONST(157445.13372204005/8.0), REAL_CONST(157471.69385253513/8.0), REAL_CONST(157498.25510302564/8.0), REAL_CONST(157524.81747341706/8.0), REAL_CONST(157551.38096361503/8.0), REAL_CONST(157577.9455735251/8.0), REAL_CONST(157604.51130305286/8.0), REAL_CONST(157631.07815210402/8.0), REAL_CONST(157657.64612058419/8.0), REAL_CONST(157684.21520839902/8.0), REAL_CONST(157710.78541545427/8.0), REAL_CONST(157737.35674165559/8.0), REAL_CONST(157763.92918690876/8.0), REAL_CONST(157790.50275111952/8.0), REAL_CONST(157817.07743419363/8.0), REAL_CONST(157843.65323603692/8.0), REAL_CONST(157870.23015655516/8.0), REAL_CONST(157896.80819565422/8.0), REAL_CONST(157923.3873532399/8.0), REAL_CONST(157949.96762921812/8.0), REAL_CONST(157976.54902349479/8.0), REAL_CONST(158003.13153597576/8.0), REAL_CONST(158029.71516656701/8.0), REAL_CONST(158056.29991517449/8.0), REAL_CONST(158082.88578170416/8.0), REAL_CONST(158109.47276606198/8.0), REAL_CONST(158136.06086815402/8.0), REAL_CONST(158162.65008788629/8.0), REAL_CONST(158189.24042516484/8.0), REAL_CONST(158215.83187989573/8.0), REAL_CONST(158242.42445198505/8.0), REAL_CONST(158269.01814133892/8.0), REAL_CONST(158295.61294786347/8.0), REAL_CONST(158322.20887146486/8.0), REAL_CONST(158348.80591204923/8.0), REAL_CONST(158375.4040695228/8.0), REAL_CONST(158402.00334379176/8.0), REAL_CONST(158428.60373476235/8.0), REAL_CONST(158455.2052423408/8.0), REAL_CONST(158481.80786643337/8.0), REAL_CONST(158508.41160694641/8.0), REAL_CONST(158535.01646378616/8.0), REAL_CONST(158561.62243685898/8.0), REAL_CONST(158588.2295260712/8.0), REAL_CONST(158614.8377313292/8.0), REAL_CONST(158641.44705253936/8.0), REAL_CONST(158668.05748960807/8.0), REAL_CONST(158694.66904244179/8.0), REAL_CONST(158721.28171094693/8.0), REAL_CONST(158747.89549502998/8.0), REAL_CONST(158774.5103945974/8.0), REAL_CONST(158801.12640955573/8.0), REAL_CONST(158827.74353981143/8.0), REAL_CONST(158854.36178527112/8.0), REAL_CONST(158880.9811458413/8.0), REAL_CONST(158907.60162142856/8.0), REAL_CONST(158934.22321193956/8.0), REAL_CONST(158960.84591728085/8.0), REAL_CONST(158987.46973735912/8.0), REAL_CONST(159014.09467208097/8.0), REAL_CONST(159040.72072135314/8.0), REAL_CONST(159067.3478850823/8.0), REAL_CONST(159093.97616317519/8.0), REAL_CONST(159120.60555553852/8.0), REAL_CONST(159147.23606207906/8.0), REAL_CONST(159173.8676827036/8.0), REAL_CONST(159200.50041731889/8.0), REAL_CONST(159227.13426583182/8.0), REAL_CONST(159253.76922814918/8.0), REAL_CONST(159280.40530417781/8.0), REAL_CONST(159307.04249382461/8.0), REAL_CONST(159333.68079699649/8.0), REAL_CONST(159360.32021360032/8.0), REAL_CONST(159386.96074354305/8.0), REAL_CONST(159413.60238673165/8.0), REAL_CONST(159440.24514307309/8.0), REAL_CONST(159466.88901247433/8.0), REAL_CONST(159493.53399484244/8.0), REAL_CONST(159520.18009008438/8.0), REAL_CONST(159546.82729810724/8.0), REAL_CONST(159573.47561881805/8.0), REAL_CONST(159600.12505212394/8.0), REAL_CONST(159626.77559793202/8.0), REAL_CONST(159653.42725614941/8.0), REAL_CONST(159680.08002668325/8.0), REAL_CONST(159706.73390944069/8.0), REAL_CONST(159733.38890432892/8.0), REAL_CONST(159760.04501125516/8.0), REAL_CONST(159786.70223012666/8.0), REAL_CONST(159813.36056085059/8.0), REAL_CONST(159840.02000333427/8.0), REAL_CONST(159866.68055748497/8.0), REAL_CONST(159893.34222320997/8.0), REAL_CONST(159920.00500041663/8.0), REAL_CONST(159946.66888901225/8.0), REAL_CONST(159973.33388890422/8.0), REAL_CONST(159999.99999999988/8.0), REAL_CONST(160026.66722220668/8.0), REAL_CONST(160053.33555543202/8.0), REAL_CONST(160080.0049995833/8.0), REAL_CONST(160106.67555456801/8.0), REAL_CONST(160133.3472202936/8.0), REAL_CONST(160160.0199966676/8.0), REAL_CONST(160186.6938835975/8.0), REAL_CONST(160213.36888099083/8.0), REAL_CONST(160240.04498875517/8.0), REAL_CONST(160266.72220679806/8.0), REAL_CONST(160293.40053502709/8.0), REAL_CONST(160320.07997334987/8.0), REAL_CONST(160346.76052167406/8.0), REAL_CONST(160373.44217990729/8.0), REAL_CONST(160400.1249479572/8.0), REAL_CONST(160426.80882573154/8.0), REAL_CONST(160453.49381313793/8.0), REAL_CONST(160480.17991008417/8.0), REAL_CONST(160506.86711647795/8.0), REAL_CONST(160533.55543222709/8.0), REAL_CONST(160560.24485723933/8.0), REAL_CONST(160586.93539142248/8.0), REAL_CONST(160613.62703468435/8.0), REAL_CONST(160640.31978693281/8.0), REAL_CONST(160667.01364807569/8.0), REAL_CONST(160693.70861802087/8.0), REAL_CONST(160720.40469667627/8.0), REAL_CONST(160747.1018839498/8.0), REAL_CONST(160773.80017974938/8.0), REAL_CONST(160800.49958398298/8.0), REAL_CONST(160827.20009655855/8.0), REAL_CONST(160853.90171738411/8.0), REAL_CONST(160880.60444636765/8.0), REAL_CONST(160907.30828341722/8.0), REAL_CONST(160934.01322844089/8.0), REAL_CONST(160960.71928134665/8.0), REAL_CONST(160987.42644204266/8.0), REAL_CONST(161014.13471043704/8.0), REAL_CONST(161040.84408643784/8.0), REAL_CONST(161067.55456995327/8.0), REAL_CONST(161094.26616089148/8.0), REAL_CONST(161120.97885916062/8.0), REAL_CONST(161147.69266466892/8.0), REAL_CONST(161174.40757732463/8.0), REAL_CONST(161201.12359703594/8.0), REAL_CONST(161227.84072371112/8.0), REAL_CONST(161254.55895725847/8.0), REAL_CONST(161281.27829758628/8.0), REAL_CONST(161307.99874460287/8.0), REAL_CONST(161334.72029821656/8.0), REAL_CONST(161361.44295833571/8.0), REAL_CONST(161388.1667248687/8.0), REAL_CONST(161414.89159772391/8.0), REAL_CONST(161441.61757680977/8.0), REAL_CONST(161468.34466203468/8.0), REAL_CONST(161495.07285330712/8.0), REAL_CONST(161521.80215053557/8.0), REAL_CONST(161548.53255362847/8.0), REAL_CONST(161575.26406249436/8.0), REAL_CONST(161601.99667704175/8.0), REAL_CONST(161628.7303971792/8.0), REAL_CONST(161655.46522281526/8.0), REAL_CONST(161682.20115385848/8.0), REAL_CONST(161708.93819021754/8.0), REAL_CONST(161735.67633180099/8.0), REAL_CONST(161762.41557851751/8.0), REAL_CONST(161789.15593027571/8.0), REAL_CONST(161815.89738698432/8.0), REAL_CONST(161842.63994855201/8.0), REAL_CONST(161869.38361488748/8.0), REAL_CONST(161896.1283858995/8.0), REAL_CONST(161922.87426149679/8.0), REAL_CONST(161949.62124158812/8.0), REAL_CONST(161976.36932608229/8.0), REAL_CONST(162003.1185148881/8.0), REAL_CONST(162029.8688079144/8.0), REAL_CONST(162056.62020507001/8.0), REAL_CONST(162083.37270626382/8.0), REAL_CONST(162110.12631140469/8.0), REAL_CONST(162136.88102040152/8.0), REAL_CONST(162163.63683316324/8.0), REAL_CONST(162190.39374959879/8.0), REAL_CONST(162217.15176961714/8.0), REAL_CONST(162243.91089312723/8.0), REAL_CONST(162270.67112003808/8.0), REAL_CONST(162297.43245025873/8.0), REAL_CONST(162324.19488369819/8.0), REAL_CONST(162350.9584202655/8.0), REAL_CONST(162377.72305986975/8.0), REAL_CONST(162404.48880242003/8.0), REAL_CONST(162431.25564782543/8.0), REAL_CONST(162458.02359599507/8.0), REAL_CONST(162484.79264683815/8.0), REAL_CONST(162511.56280026378/8.0), REAL_CONST(162538.33405618116/8.0), REAL_CONST(162565.10641449949/8.0), REAL_CONST(162591.87987512801/8.0), REAL_CONST(162618.65443797593/8.0), REAL_CONST(162645.43010295252/8.0), REAL_CONST(162672.20686996708/8.0), REAL_CONST(162698.98473892888/8.0), REAL_CONST(162725.76370974723/8.0), REAL_CONST(162752.54378233149/8.0), REAL_CONST(162779.32495659095/8.0), REAL_CONST(162806.10723243505/8.0), REAL_CONST(162832.89060977317/8.0), REAL_CONST(162859.67508851466/8.0), REAL_CONST(162886.46066856899/8.0), REAL_CONST(162913.24734984562/8.0), REAL_CONST(162940.03513225398/8.0), REAL_CONST(162966.82401570358/8.0), REAL_CONST(162993.6140001039/8.0), REAL_CONST(163020.40508536444/8.0), REAL_CONST(163047.19727139481/8.0), REAL_CONST(163073.99055810447/8.0), REAL_CONST(163100.78494540305/8.0), REAL_CONST(163127.58043320014/8.0), REAL_CONST(163154.37702140535/8.0), REAL_CONST(163181.17470992831/8.0), REAL_CONST(163207.97349867865/8.0), REAL_CONST(163234.77338756606/8.0), REAL_CONST(163261.57437650024/8.0), REAL_CONST(163288.37646539087/8.0), REAL_CONST(163315.17965414765/8.0), REAL_CONST(163341.98394268038/8.0), REAL_CONST(163368.78933089875/8.0), REAL_CONST(163395.59581871261/8.0), REAL_CONST(163422.40340603172/8.0), REAL_CONST(163449.2120927659/8.0), REAL_CONST(163476.02187882498/8.0), REAL_CONST(163502.83276411882/8.0), REAL_CONST(163529.6447485573/8.0), REAL_CONST(163556.45783205028/8.0), REAL_CONST(163583.2720145077/8.0), REAL_CONST(163610.08729583945/8.0), REAL_CONST(163636.90367595552/8.0), REAL_CONST(163663.72115476584/8.0), REAL_CONST(163690.53973218042/8.0), REAL_CONST(163717.35940810922/8.0), REAL_CONST(163744.18018246227/8.0), REAL_CONST(163771.00205514964/8.0), REAL_CONST(163797.82502608138/8.0), REAL_CONST(163824.64909516752/8.0), REAL_CONST(163851.4742623182/8.0), REAL_CONST(163878.3005274435/8.0), REAL_CONST(163905.12789045356/8.0), REAL_CONST(163931.95635125853/8.0), REAL_CONST(163958.78590976857/8.0), REAL_CONST(163985.61656589387/8.0), REAL_CONST(164012.44831954464/8.0), REAL_CONST(164039.28117063109/8.0), REAL_CONST(164066.11511906344/8.0), REAL_CONST(164092.95016475199/8.0), REAL_CONST(164119.78630760699/8.0), REAL_CONST(164146.62354753874/8.0), REAL_CONST(164173.46188445756/8.0), REAL_CONST(164200.30131827376/8.0), REAL_CONST(164227.14184889771/8.0), REAL_CONST(164253.98347623978/8.0), REAL_CONST(164280.82620021031/8.0), REAL_CONST(164307.67002071979/8.0), REAL_CONST(164334.51493767856/8.0), REAL_CONST(164361.3609509971/8.0), REAL_CONST(164388.20806058586/8.0), REAL_CONST(164415.05626635533/8.0), REAL_CONST(164441.905568216/8.0), REAL_CONST(164468.75596607837/8.0), REAL_CONST(164495.607459853/8.0), REAL_CONST(164522.4600494504/8.0), REAL_CONST(164549.31373478117/8.0), REAL_CONST(164576.16851575591/8.0), REAL_CONST(164603.02439228518/8.0), REAL_CONST(164629.88136427966/8.0), REAL_CONST(164656.73943164994/8.0), REAL_CONST(164683.59859430668/8.0), REAL_CONST(164710.45885216061/8.0), REAL_CONST(164737.32020512238/8.0), REAL_CONST(164764.1826531027/8.0), REAL_CONST(164791.04619601235/8.0), REAL_CONST(164817.91083376206/8.0), REAL_CONST(164844.77656626256/8.0), REAL_CONST(164871.64339342469/8.0), REAL_CONST(164898.51131515924/8.0), REAL_CONST(164925.38033137703/8.0), REAL_CONST(164952.25044198887/8.0), REAL_CONST(164979.1216469057/8.0), REAL_CONST(165005.9939460383/8.0), REAL_CONST(165032.86733929763/8.0), REAL_CONST(165059.7418265946/8.0), REAL_CONST(165086.61740784015/8.0), REAL_CONST(165113.4940829452/8.0) #endif }; #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/is.c000066400000000000000000000075651357201522000177420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: is.c,v 1.28 2007/11/01 12:33:31 menno Exp $ **/ #include "common.h" #include "structs.h" #include "syntax.h" #include "is.h" #ifdef FIXED_POINT static real_t pow05_table[] = { COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */ COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */ COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */ COEF_CONST(1.0), /* 0.5^( 0/4) */ COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */ COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */ COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */ }; #endif void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, uint16_t frame_len) { uint8_t g, sfb, b; uint16_t i; #ifndef FIXED_POINT real_t scale; #else int32_t exp, frac; #endif uint16_t nshort = frame_len/8; uint8_t group = 0; for (g = 0; g < icsr->num_window_groups; g++) { /* Do intensity stereo decoding */ for (b = 0; b < icsr->window_group_length[g]; b++) { for (sfb = 0; sfb < icsr->max_sfb; sfb++) { if (is_intensity(icsr, g, sfb)) { #ifdef MAIN_DEC /* For scalefactor bands coded in intensity stereo the corresponding predictors in the right channel are switched to "off". */ ics->pred.prediction_used[sfb] = 0; icsr->pred.prediction_used[sfb] = 0; #endif #ifndef FIXED_POINT scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb])); #else exp = icsr->scale_factors[g][sfb] >> 2; frac = icsr->scale_factors[g][sfb] & 3; #endif /* Scale from left to right channel, do not touch left channel */ for (i = icsr->swb_offset[sfb]; i < min(icsr->swb_offset[sfb+1], ics->swb_offset_max); i++) { #ifndef FIXED_POINT r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale); #else if (exp < 0) r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp; else r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp; r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]); #endif if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i]; } } } group++; } } } welle.io-2.1/src/libs/faad2/libfaad/is.h000066400000000000000000000036741357201522000177440ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: is.h,v 1.20 2007/11/01 12:33:31 menno Exp $ **/ #ifndef __IS_H__ #define __IS_H__ #ifdef __cplusplus extern "C" { #endif #include "syntax.h" void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, uint16_t frame_len); static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) { switch (ics->sfb_cb[group][sfb]) { case INTENSITY_HCB: return 1; case INTENSITY_HCB2: return -1; default: return 0; } } static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) { if (ics->ms_mask_present == 1) return (1-2*ics->ms_used[group][sfb]); return 1; } #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/kbd_win.h000066400000000000000000002352061357201522000207440ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: kbd_win.h,v 1.21 2007/11/01 12:33:31 menno Exp $ **/ #ifndef __KBD_WIN_H__ #define __KBD_WIN_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t kbd_long_1024[] = { FRAC_CONST(0.00029256153896361), FRAC_CONST(0.00042998567353047), FRAC_CONST(0.00054674074589540), FRAC_CONST(0.00065482304299792), FRAC_CONST(0.00075870195068747), FRAC_CONST(0.00086059331713336), FRAC_CONST(0.00096177541439010), FRAC_CONST(0.0010630609410878), FRAC_CONST(0.0011650036308132), FRAC_CONST(0.0012680012194148), FRAC_CONST(0.0013723517232956), FRAC_CONST(0.0014782864109136), FRAC_CONST(0.0015859901976719), FRAC_CONST(0.0016956148252373), FRAC_CONST(0.0018072876903517), FRAC_CONST(0.0019211179405514), FRAC_CONST(0.0020372007924215), FRAC_CONST(0.0021556206591754), FRAC_CONST(0.0022764534599614), FRAC_CONST(0.0023997683540995), FRAC_CONST(0.0025256290631156), FRAC_CONST(0.0026540948920831), FRAC_CONST(0.0027852215281403), FRAC_CONST(0.0029190616715331), FRAC_CONST(0.0030556655443223), FRAC_CONST(0.0031950812943391), FRAC_CONST(0.0033373553240392), FRAC_CONST(0.0034825325586930), FRAC_CONST(0.0036306566699199), FRAC_CONST(0.0037817702604646), FRAC_CONST(0.0039359150179719), FRAC_CONST(0.0040931318437260), FRAC_CONST(0.0042534609610026), FRAC_CONST(0.0044169420066964), FRAC_CONST(0.0045836141091341), FRAC_CONST(0.0047535159544086), FRAC_CONST(0.0049266858431214), FRAC_CONST(0.0051031617390698), FRAC_CONST(0.0052829813111335), FRAC_CONST(0.0054661819693975), FRAC_CONST(0.0056528008963682), FRAC_CONST(0.0058428750739943), FRAC_CONST(0.0060364413070882), FRAC_CONST(0.0062335362436492), FRAC_CONST(0.0064341963925079), FRAC_CONST(0.0066384581386503), FRAC_CONST(0.0068463577565218), FRAC_CONST(0.0070579314215715), FRAC_CONST(0.0072732152202559), FRAC_CONST(0.0074922451586909), FRAC_CONST(0.0077150571701162), FRAC_CONST(0.0079416871213115), FRAC_CONST(0.0081721708180857), FRAC_CONST(0.0084065440099458), FRAC_CONST(0.0086448423940363), FRAC_CONST(0.0088871016184291), FRAC_CONST(0.0091333572848345), FRAC_CONST(0.0093836449507939), FRAC_CONST(0.0096380001314086), FRAC_CONST(0.0098964583006517), FRAC_CONST(0.010159054892306), FRAC_CONST(0.010425825300561), FRAC_CONST(0.010696804880310), FRAC_CONST(0.010972028947167), FRAC_CONST(0.011251532777236), FRAC_CONST(0.011535351606646), FRAC_CONST(0.011823520630897), FRAC_CONST(0.012116075003993), FRAC_CONST(0.012413049837429), FRAC_CONST(0.012714480198999), FRAC_CONST(0.013020401111478), FRAC_CONST(0.013330847551161), FRAC_CONST(0.013645854446288), FRAC_CONST(0.013965456675352), FRAC_CONST(0.014289689065314), FRAC_CONST(0.014618586389712), FRAC_CONST(0.014952183366697), FRAC_CONST(0.015290514656976), FRAC_CONST(0.015633614861688), FRAC_CONST(0.015981518520214), FRAC_CONST(0.016334260107915), FRAC_CONST(0.016691874033817), FRAC_CONST(0.017054394638241), FRAC_CONST(0.017421856190380), FRAC_CONST(0.017794292885832), FRAC_CONST(0.018171738844085), FRAC_CONST(0.018554228105962), FRAC_CONST(0.018941794631032), FRAC_CONST(0.019334472294980), FRAC_CONST(0.019732294886947), FRAC_CONST(0.020135296106839), FRAC_CONST(0.020543509562604), FRAC_CONST(0.020956968767488), FRAC_CONST(0.021375707137257), FRAC_CONST(0.021799757987407), FRAC_CONST(0.022229154530343), FRAC_CONST(0.022663929872540), FRAC_CONST(0.023104117011689), FRAC_CONST(0.023549748833816), FRAC_CONST(0.024000858110398), FRAC_CONST(0.024457477495451), FRAC_CONST(0.024919639522613), FRAC_CONST(0.025387376602207), FRAC_CONST(0.025860721018295), FRAC_CONST(0.026339704925726), FRAC_CONST(0.026824360347160), FRAC_CONST(0.027314719170100), FRAC_CONST(0.027810813143900), FRAC_CONST(0.028312673876775), FRAC_CONST(0.028820332832801), FRAC_CONST(0.029333821328905), FRAC_CONST(0.029853170531859), FRAC_CONST(0.030378411455255), FRAC_CONST(0.030909574956490), FRAC_CONST(0.031446691733739), FRAC_CONST(0.031989792322926), FRAC_CONST(0.032538907094693), FRAC_CONST(0.033094066251369), FRAC_CONST(0.033655299823935), FRAC_CONST(0.034222637668991), FRAC_CONST(0.034796109465717), FRAC_CONST(0.035375744712844), FRAC_CONST(0.035961572725616), FRAC_CONST(0.036553622632758), FRAC_CONST(0.037151923373446), FRAC_CONST(0.037756503694277), FRAC_CONST(0.038367392146243), FRAC_CONST(0.038984617081711), FRAC_CONST(0.039608206651398), FRAC_CONST(0.040238188801359), FRAC_CONST(0.040874591269976), FRAC_CONST(0.041517441584950), FRAC_CONST(0.042166767060301), FRAC_CONST(0.042822594793376), FRAC_CONST(0.043484951661852), FRAC_CONST(0.044153864320760), FRAC_CONST(0.044829359199509), FRAC_CONST(0.045511462498913), FRAC_CONST(0.046200200188234), FRAC_CONST(0.046895598002228), FRAC_CONST(0.047597681438201), FRAC_CONST(0.048306475753074), FRAC_CONST(0.049022005960455), FRAC_CONST(0.049744296827725), FRAC_CONST(0.050473372873129), FRAC_CONST(0.051209258362879), FRAC_CONST(0.051951977308273), FRAC_CONST(0.052701553462813), FRAC_CONST(0.053458010319350), FRAC_CONST(0.054221371107223), FRAC_CONST(0.054991658789428), FRAC_CONST(0.055768896059787), FRAC_CONST(0.056553105340134), FRAC_CONST(0.057344308777513), FRAC_CONST(0.058142528241393), FRAC_CONST(0.058947785320893), FRAC_CONST(0.059760101322019), FRAC_CONST(0.060579497264926), FRAC_CONST(0.061405993881180), FRAC_CONST(0.062239611611049), FRAC_CONST(0.063080370600799), FRAC_CONST(0.063928290700012), FRAC_CONST(0.064783391458919), FRAC_CONST(0.065645692125747), FRAC_CONST(0.066515211644086), FRAC_CONST(0.067391968650269), FRAC_CONST(0.068275981470777), FRAC_CONST(0.069167268119652), FRAC_CONST(0.070065846295935), FRAC_CONST(0.070971733381121), FRAC_CONST(0.071884946436630), FRAC_CONST(0.072805502201299), FRAC_CONST(0.073733417088896), FRAC_CONST(0.074668707185649), FRAC_CONST(0.075611388247794), FRAC_CONST(0.076561475699152), FRAC_CONST(0.077518984628715), FRAC_CONST(0.078483929788261), FRAC_CONST(0.079456325589986), FRAC_CONST(0.080436186104162), FRAC_CONST(0.081423525056808), FRAC_CONST(0.082418355827392), FRAC_CONST(0.083420691446553), FRAC_CONST(0.084430544593841), FRAC_CONST(0.085447927595483), FRAC_CONST(0.086472852422178), FRAC_CONST(0.087505330686900), FRAC_CONST(0.088545373642744), FRAC_CONST(0.089592992180780), FRAC_CONST(0.090648196827937), FRAC_CONST(0.091710997744919), FRAC_CONST(0.092781404724131), FRAC_CONST(0.093859427187640), FRAC_CONST(0.094945074185163), FRAC_CONST(0.096038354392069), FRAC_CONST(0.097139276107423), FRAC_CONST(0.098247847252041), FRAC_CONST(0.099364075366580), FRAC_CONST(0.10048796760965), FRAC_CONST(0.10161953075597), FRAC_CONST(0.10275877119451), FRAC_CONST(0.10390569492671), FRAC_CONST(0.10506030756469), FRAC_CONST(0.10622261432949), FRAC_CONST(0.10739262004941), FRAC_CONST(0.10857032915821), FRAC_CONST(0.10975574569357), FRAC_CONST(0.11094887329534), FRAC_CONST(0.11214971520402), FRAC_CONST(0.11335827425914), FRAC_CONST(0.11457455289772), FRAC_CONST(0.11579855315274), FRAC_CONST(0.11703027665170), FRAC_CONST(0.11826972461510), FRAC_CONST(0.11951689785504), FRAC_CONST(0.12077179677383), FRAC_CONST(0.12203442136263), FRAC_CONST(0.12330477120008), FRAC_CONST(0.12458284545102), FRAC_CONST(0.12586864286523), FRAC_CONST(0.12716216177615), FRAC_CONST(0.12846340009971), FRAC_CONST(0.12977235533312), FRAC_CONST(0.13108902455375), FRAC_CONST(0.13241340441801), FRAC_CONST(0.13374549116025), FRAC_CONST(0.13508528059173), FRAC_CONST(0.13643276809961), FRAC_CONST(0.13778794864595), FRAC_CONST(0.13915081676677), FRAC_CONST(0.14052136657114), FRAC_CONST(0.14189959174027), FRAC_CONST(0.14328548552671), FRAC_CONST(0.14467904075349), FRAC_CONST(0.14608024981336), FRAC_CONST(0.14748910466804), FRAC_CONST(0.14890559684750), FRAC_CONST(0.15032971744929), FRAC_CONST(0.15176145713790), FRAC_CONST(0.15320080614414), FRAC_CONST(0.15464775426459), FRAC_CONST(0.15610229086100), FRAC_CONST(0.15756440485987), FRAC_CONST(0.15903408475193), FRAC_CONST(0.16051131859170), FRAC_CONST(0.16199609399712), FRAC_CONST(0.16348839814917), FRAC_CONST(0.16498821779156), FRAC_CONST(0.16649553923042), FRAC_CONST(0.16801034833404), FRAC_CONST(0.16953263053270), FRAC_CONST(0.17106237081842), FRAC_CONST(0.17259955374484), FRAC_CONST(0.17414416342714), FRAC_CONST(0.17569618354193), FRAC_CONST(0.17725559732720), FRAC_CONST(0.17882238758238), FRAC_CONST(0.18039653666830), FRAC_CONST(0.18197802650733), FRAC_CONST(0.18356683858343), FRAC_CONST(0.18516295394233), FRAC_CONST(0.18676635319174), FRAC_CONST(0.18837701650148), FRAC_CONST(0.18999492360384), FRAC_CONST(0.19162005379380), FRAC_CONST(0.19325238592940), FRAC_CONST(0.19489189843209), FRAC_CONST(0.19653856928714), FRAC_CONST(0.19819237604409), FRAC_CONST(0.19985329581721), FRAC_CONST(0.20152130528605), FRAC_CONST(0.20319638069594), FRAC_CONST(0.20487849785865), FRAC_CONST(0.20656763215298), FRAC_CONST(0.20826375852540), FRAC_CONST(0.20996685149083), FRAC_CONST(0.21167688513330), FRAC_CONST(0.21339383310678), FRAC_CONST(0.21511766863598), FRAC_CONST(0.21684836451719), FRAC_CONST(0.21858589311922), FRAC_CONST(0.22033022638425), FRAC_CONST(0.22208133582887), FRAC_CONST(0.22383919254503), FRAC_CONST(0.22560376720111), FRAC_CONST(0.22737503004300), FRAC_CONST(0.22915295089517), FRAC_CONST(0.23093749916189), FRAC_CONST(0.23272864382838), FRAC_CONST(0.23452635346201), FRAC_CONST(0.23633059621364), FRAC_CONST(0.23814133981883), FRAC_CONST(0.23995855159925), FRAC_CONST(0.24178219846403), FRAC_CONST(0.24361224691114), FRAC_CONST(0.24544866302890), FRAC_CONST(0.24729141249740), FRAC_CONST(0.24914046059007), FRAC_CONST(0.25099577217522), FRAC_CONST(0.25285731171763), FRAC_CONST(0.25472504328019), FRAC_CONST(0.25659893052556), FRAC_CONST(0.25847893671788), FRAC_CONST(0.26036502472451), FRAC_CONST(0.26225715701781), FRAC_CONST(0.26415529567692), FRAC_CONST(0.26605940238966), FRAC_CONST(0.26796943845439), FRAC_CONST(0.26988536478190), FRAC_CONST(0.27180714189742), FRAC_CONST(0.27373472994256), FRAC_CONST(0.27566808867736), FRAC_CONST(0.27760717748238), FRAC_CONST(0.27955195536071), FRAC_CONST(0.28150238094021), FRAC_CONST(0.28345841247557), FRAC_CONST(0.28542000785059), FRAC_CONST(0.28738712458038), FRAC_CONST(0.28935971981364), FRAC_CONST(0.29133775033492), FRAC_CONST(0.29332117256704), FRAC_CONST(0.29530994257338), FRAC_CONST(0.29730401606034), FRAC_CONST(0.29930334837974), FRAC_CONST(0.30130789453132), FRAC_CONST(0.30331760916521), FRAC_CONST(0.30533244658452), FRAC_CONST(0.30735236074785), FRAC_CONST(0.30937730527195), FRAC_CONST(0.31140723343430), FRAC_CONST(0.31344209817583), FRAC_CONST(0.31548185210356), FRAC_CONST(0.31752644749341), FRAC_CONST(0.31957583629288), FRAC_CONST(0.32162997012390), FRAC_CONST(0.32368880028565), FRAC_CONST(0.32575227775738), FRAC_CONST(0.32782035320134), FRAC_CONST(0.32989297696566), FRAC_CONST(0.33197009908736), FRAC_CONST(0.33405166929523), FRAC_CONST(0.33613763701295), FRAC_CONST(0.33822795136203), FRAC_CONST(0.34032256116495), FRAC_CONST(0.34242141494820), FRAC_CONST(0.34452446094547), FRAC_CONST(0.34663164710072), FRAC_CONST(0.34874292107143), FRAC_CONST(0.35085823023181), FRAC_CONST(0.35297752167598), FRAC_CONST(0.35510074222129), FRAC_CONST(0.35722783841160), FRAC_CONST(0.35935875652060), FRAC_CONST(0.36149344255514), FRAC_CONST(0.36363184225864), FRAC_CONST(0.36577390111444), FRAC_CONST(0.36791956434930), FRAC_CONST(0.37006877693676), FRAC_CONST(0.37222148360070), FRAC_CONST(0.37437762881878), FRAC_CONST(0.37653715682603), FRAC_CONST(0.37870001161834), FRAC_CONST(0.38086613695607), FRAC_CONST(0.38303547636766), FRAC_CONST(0.38520797315322), FRAC_CONST(0.38738357038821), FRAC_CONST(0.38956221092708), FRAC_CONST(0.39174383740701), FRAC_CONST(0.39392839225157), FRAC_CONST(0.39611581767449), FRAC_CONST(0.39830605568342), FRAC_CONST(0.40049904808370), FRAC_CONST(0.40269473648218), FRAC_CONST(0.40489306229101), FRAC_CONST(0.40709396673153), FRAC_CONST(0.40929739083810), FRAC_CONST(0.41150327546197), FRAC_CONST(0.41371156127524), FRAC_CONST(0.41592218877472), FRAC_CONST(0.41813509828594), FRAC_CONST(0.42035022996702), FRAC_CONST(0.42256752381274), FRAC_CONST(0.42478691965848), FRAC_CONST(0.42700835718423), FRAC_CONST(0.42923177591866), FRAC_CONST(0.43145711524314), FRAC_CONST(0.43368431439580), FRAC_CONST(0.43591331247564), FRAC_CONST(0.43814404844658), FRAC_CONST(0.44037646114161), FRAC_CONST(0.44261048926688), FRAC_CONST(0.44484607140589), FRAC_CONST(0.44708314602359), FRAC_CONST(0.44932165147057), FRAC_CONST(0.45156152598727), FRAC_CONST(0.45380270770813), FRAC_CONST(0.45604513466581), FRAC_CONST(0.45828874479543), FRAC_CONST(0.46053347593880), FRAC_CONST(0.46277926584861), FRAC_CONST(0.46502605219277), FRAC_CONST(0.46727377255861), FRAC_CONST(0.46952236445718), FRAC_CONST(0.47177176532752), FRAC_CONST(0.47402191254100), FRAC_CONST(0.47627274340557), FRAC_CONST(0.47852419517009), FRAC_CONST(0.48077620502869), FRAC_CONST(0.48302871012505), FRAC_CONST(0.48528164755674), FRAC_CONST(0.48753495437962), FRAC_CONST(0.48978856761212), FRAC_CONST(0.49204242423966), FRAC_CONST(0.49429646121898), FRAC_CONST(0.49655061548250), FRAC_CONST(0.49880482394273), FRAC_CONST(0.50105902349665), FRAC_CONST(0.50331315103004), FRAC_CONST(0.50556714342194), FRAC_CONST(0.50782093754901), FRAC_CONST(0.51007447028990), FRAC_CONST(0.51232767852971), FRAC_CONST(0.51458049916433), FRAC_CONST(0.51683286910489), FRAC_CONST(0.51908472528213), FRAC_CONST(0.52133600465083), FRAC_CONST(0.52358664419420), FRAC_CONST(0.52583658092832), FRAC_CONST(0.52808575190648), FRAC_CONST(0.53033409422367), FRAC_CONST(0.53258154502092), FRAC_CONST(0.53482804148974), FRAC_CONST(0.53707352087652), FRAC_CONST(0.53931792048690), FRAC_CONST(0.54156117769021), FRAC_CONST(0.54380322992385), FRAC_CONST(0.54604401469766), FRAC_CONST(0.54828346959835), FRAC_CONST(0.55052153229384), FRAC_CONST(0.55275814053768), FRAC_CONST(0.55499323217338), FRAC_CONST(0.55722674513883), FRAC_CONST(0.55945861747062), FRAC_CONST(0.56168878730842), FRAC_CONST(0.56391719289930), FRAC_CONST(0.56614377260214), FRAC_CONST(0.56836846489188), FRAC_CONST(0.57059120836390), FRAC_CONST(0.57281194173835), FRAC_CONST(0.57503060386439), FRAC_CONST(0.57724713372458), FRAC_CONST(0.57946147043912), FRAC_CONST(0.58167355327012), FRAC_CONST(0.58388332162591), FRAC_CONST(0.58609071506528), FRAC_CONST(0.58829567330173), FRAC_CONST(0.59049813620770), FRAC_CONST(0.59269804381879), FRAC_CONST(0.59489533633802), FRAC_CONST(0.59708995413996), FRAC_CONST(0.59928183777495), FRAC_CONST(0.60147092797329), FRAC_CONST(0.60365716564937), FRAC_CONST(0.60584049190582), FRAC_CONST(0.60802084803764), FRAC_CONST(0.61019817553632), FRAC_CONST(0.61237241609393), FRAC_CONST(0.61454351160718), FRAC_CONST(0.61671140418155), FRAC_CONST(0.61887603613527), FRAC_CONST(0.62103735000336), FRAC_CONST(0.62319528854167), FRAC_CONST(0.62534979473088), FRAC_CONST(0.62750081178042), FRAC_CONST(0.62964828313250), FRAC_CONST(0.63179215246597), FRAC_CONST(0.63393236370030), FRAC_CONST(0.63606886099946), FRAC_CONST(0.63820158877577), FRAC_CONST(0.64033049169379), FRAC_CONST(0.64245551467413), FRAC_CONST(0.64457660289729), FRAC_CONST(0.64669370180740), FRAC_CONST(0.64880675711607), FRAC_CONST(0.65091571480603), FRAC_CONST(0.65302052113494), FRAC_CONST(0.65512112263906), FRAC_CONST(0.65721746613689), FRAC_CONST(0.65930949873289), FRAC_CONST(0.66139716782102), FRAC_CONST(0.66348042108842), FRAC_CONST(0.66555920651892), FRAC_CONST(0.66763347239664), FRAC_CONST(0.66970316730947), FRAC_CONST(0.67176824015260), FRAC_CONST(0.67382864013196), FRAC_CONST(0.67588431676768), FRAC_CONST(0.67793521989751), FRAC_CONST(0.67998129968017), FRAC_CONST(0.68202250659876), FRAC_CONST(0.68405879146403), FRAC_CONST(0.68609010541774), FRAC_CONST(0.68811639993588), FRAC_CONST(0.69013762683195), FRAC_CONST(0.69215373826012), FRAC_CONST(0.69416468671849), FRAC_CONST(0.69617042505214), FRAC_CONST(0.69817090645634), FRAC_CONST(0.70016608447958), FRAC_CONST(0.70215591302664), FRAC_CONST(0.70414034636163), FRAC_CONST(0.70611933911096), FRAC_CONST(0.70809284626630), FRAC_CONST(0.71006082318751), FRAC_CONST(0.71202322560554), FRAC_CONST(0.71398000962530), FRAC_CONST(0.71593113172842), FRAC_CONST(0.71787654877613), FRAC_CONST(0.71981621801195), FRAC_CONST(0.72175009706445), FRAC_CONST(0.72367814394990), FRAC_CONST(0.72560031707496), FRAC_CONST(0.72751657523927), FRAC_CONST(0.72942687763803), FRAC_CONST(0.73133118386457), FRAC_CONST(0.73322945391280), FRAC_CONST(0.73512164817975), FRAC_CONST(0.73700772746796), FRAC_CONST(0.73888765298787), FRAC_CONST(0.74076138636020), FRAC_CONST(0.74262888961827), FRAC_CONST(0.74449012521027), FRAC_CONST(0.74634505600152), FRAC_CONST(0.74819364527663), FRAC_CONST(0.75003585674175), FRAC_CONST(0.75187165452661), FRAC_CONST(0.75370100318668), FRAC_CONST(0.75552386770515), FRAC_CONST(0.75734021349500), FRAC_CONST(0.75915000640095), FRAC_CONST(0.76095321270137), FRAC_CONST(0.76274979911019), FRAC_CONST(0.76453973277875), FRAC_CONST(0.76632298129757), FRAC_CONST(0.76809951269819), FRAC_CONST(0.76986929545481), FRAC_CONST(0.77163229848604), FRAC_CONST(0.77338849115651), FRAC_CONST(0.77513784327849), FRAC_CONST(0.77688032511340), FRAC_CONST(0.77861590737340), FRAC_CONST(0.78034456122283), FRAC_CONST(0.78206625827961), FRAC_CONST(0.78378097061667), FRAC_CONST(0.78548867076330), FRAC_CONST(0.78718933170643), FRAC_CONST(0.78888292689189), FRAC_CONST(0.79056943022564), FRAC_CONST(0.79224881607494), FRAC_CONST(0.79392105926949), FRAC_CONST(0.79558613510249), FRAC_CONST(0.79724401933170), FRAC_CONST(0.79889468818046), FRAC_CONST(0.80053811833858), FRAC_CONST(0.80217428696334), FRAC_CONST(0.80380317168028), FRAC_CONST(0.80542475058405), FRAC_CONST(0.80703900223920), FRAC_CONST(0.80864590568089), FRAC_CONST(0.81024544041560), FRAC_CONST(0.81183758642175), FRAC_CONST(0.81342232415032), FRAC_CONST(0.81499963452540), FRAC_CONST(0.81656949894467), FRAC_CONST(0.81813189927991), FRAC_CONST(0.81968681787738), FRAC_CONST(0.82123423755821), FRAC_CONST(0.82277414161874), FRAC_CONST(0.82430651383076), FRAC_CONST(0.82583133844180), FRAC_CONST(0.82734860017528), FRAC_CONST(0.82885828423070), FRAC_CONST(0.83036037628369), FRAC_CONST(0.83185486248609), FRAC_CONST(0.83334172946597), FRAC_CONST(0.83482096432759), FRAC_CONST(0.83629255465130), FRAC_CONST(0.83775648849344), FRAC_CONST(0.83921275438615), FRAC_CONST(0.84066134133716), FRAC_CONST(0.84210223882952), FRAC_CONST(0.84353543682130), FRAC_CONST(0.84496092574524), FRAC_CONST(0.84637869650833), FRAC_CONST(0.84778874049138), FRAC_CONST(0.84919104954855), FRAC_CONST(0.85058561600677), FRAC_CONST(0.85197243266520), FRAC_CONST(0.85335149279457), FRAC_CONST(0.85472279013653), FRAC_CONST(0.85608631890295), FRAC_CONST(0.85744207377513), FRAC_CONST(0.85879004990298), FRAC_CONST(0.86013024290422), FRAC_CONST(0.86146264886346), FRAC_CONST(0.86278726433124), FRAC_CONST(0.86410408632306), FRAC_CONST(0.86541311231838), FRAC_CONST(0.86671434025950), FRAC_CONST(0.86800776855046), FRAC_CONST(0.86929339605590), FRAC_CONST(0.87057122209981), FRAC_CONST(0.87184124646433), FRAC_CONST(0.87310346938840), FRAC_CONST(0.87435789156650), FRAC_CONST(0.87560451414719), FRAC_CONST(0.87684333873173), FRAC_CONST(0.87807436737261), FRAC_CONST(0.87929760257204), FRAC_CONST(0.88051304728038), FRAC_CONST(0.88172070489456), FRAC_CONST(0.88292057925645), FRAC_CONST(0.88411267465117), FRAC_CONST(0.88529699580537), FRAC_CONST(0.88647354788545), FRAC_CONST(0.88764233649580), FRAC_CONST(0.88880336767692), FRAC_CONST(0.88995664790351), FRAC_CONST(0.89110218408260), FRAC_CONST(0.89223998355154), FRAC_CONST(0.89337005407600), FRAC_CONST(0.89449240384793), FRAC_CONST(0.89560704148345), FRAC_CONST(0.89671397602074), FRAC_CONST(0.89781321691786), FRAC_CONST(0.89890477405053), FRAC_CONST(0.89998865770993), FRAC_CONST(0.90106487860034), FRAC_CONST(0.90213344783689), FRAC_CONST(0.90319437694315), FRAC_CONST(0.90424767784873), FRAC_CONST(0.90529336288690), FRAC_CONST(0.90633144479201), FRAC_CONST(0.90736193669708), FRAC_CONST(0.90838485213119), FRAC_CONST(0.90940020501694), FRAC_CONST(0.91040800966776), FRAC_CONST(0.91140828078533), FRAC_CONST(0.91240103345685), FRAC_CONST(0.91338628315231), FRAC_CONST(0.91436404572173), FRAC_CONST(0.91533433739238), FRAC_CONST(0.91629717476594), FRAC_CONST(0.91725257481564), FRAC_CONST(0.91820055488334), FRAC_CONST(0.91914113267664), FRAC_CONST(0.92007432626589), FRAC_CONST(0.92100015408120), FRAC_CONST(0.92191863490944), FRAC_CONST(0.92282978789113), FRAC_CONST(0.92373363251740), FRAC_CONST(0.92463018862687), FRAC_CONST(0.92551947640245), FRAC_CONST(0.92640151636824), FRAC_CONST(0.92727632938624), FRAC_CONST(0.92814393665320), FRAC_CONST(0.92900435969727), FRAC_CONST(0.92985762037477), FRAC_CONST(0.93070374086684), FRAC_CONST(0.93154274367610), FRAC_CONST(0.93237465162328), FRAC_CONST(0.93319948784382), FRAC_CONST(0.93401727578443), FRAC_CONST(0.93482803919967), FRAC_CONST(0.93563180214841), FRAC_CONST(0.93642858899043), FRAC_CONST(0.93721842438279), FRAC_CONST(0.93800133327637), FRAC_CONST(0.93877734091223), FRAC_CONST(0.93954647281807), FRAC_CONST(0.94030875480458), FRAC_CONST(0.94106421296182), FRAC_CONST(0.94181287365556), FRAC_CONST(0.94255476352362), FRAC_CONST(0.94328990947213), FRAC_CONST(0.94401833867184), FRAC_CONST(0.94474007855439), FRAC_CONST(0.94545515680855), FRAC_CONST(0.94616360137644), FRAC_CONST(0.94686544044975), FRAC_CONST(0.94756070246592), FRAC_CONST(0.94824941610434), FRAC_CONST(0.94893161028248), FRAC_CONST(0.94960731415209), FRAC_CONST(0.95027655709525), FRAC_CONST(0.95093936872056), FRAC_CONST(0.95159577885924), FRAC_CONST(0.95224581756115), FRAC_CONST(0.95288951509097), FRAC_CONST(0.95352690192417), FRAC_CONST(0.95415800874314), FRAC_CONST(0.95478286643320), FRAC_CONST(0.95540150607863), FRAC_CONST(0.95601395895871), FRAC_CONST(0.95662025654373), FRAC_CONST(0.95722043049100), FRAC_CONST(0.95781451264084), FRAC_CONST(0.95840253501260), FRAC_CONST(0.95898452980058), FRAC_CONST(0.95956052937008), FRAC_CONST(0.96013056625336), FRAC_CONST(0.96069467314557), FRAC_CONST(0.96125288290073), FRAC_CONST(0.96180522852773), FRAC_CONST(0.96235174318622), FRAC_CONST(0.96289246018262), FRAC_CONST(0.96342741296604), FRAC_CONST(0.96395663512424), FRAC_CONST(0.96448016037959), FRAC_CONST(0.96499802258499), FRAC_CONST(0.96551025571985), FRAC_CONST(0.96601689388602), FRAC_CONST(0.96651797130376), FRAC_CONST(0.96701352230768), FRAC_CONST(0.96750358134269), FRAC_CONST(0.96798818295998), FRAC_CONST(0.96846736181297), FRAC_CONST(0.96894115265327), FRAC_CONST(0.96940959032667), FRAC_CONST(0.96987270976912), FRAC_CONST(0.97033054600270), FRAC_CONST(0.97078313413161), FRAC_CONST(0.97123050933818), FRAC_CONST(0.97167270687887), FRAC_CONST(0.97210976208030), FRAC_CONST(0.97254171033525), FRAC_CONST(0.97296858709871), FRAC_CONST(0.97339042788392), FRAC_CONST(0.97380726825843), FRAC_CONST(0.97421914384017), FRAC_CONST(0.97462609029350), FRAC_CONST(0.97502814332534), FRAC_CONST(0.97542533868127), FRAC_CONST(0.97581771214160), FRAC_CONST(0.97620529951759), FRAC_CONST(0.97658813664749), FRAC_CONST(0.97696625939282), FRAC_CONST(0.97733970363445), FRAC_CONST(0.97770850526884), FRAC_CONST(0.97807270020427), FRAC_CONST(0.97843232435704), FRAC_CONST(0.97878741364771), FRAC_CONST(0.97913800399743), FRAC_CONST(0.97948413132414), FRAC_CONST(0.97982583153895), FRAC_CONST(0.98016314054243), FRAC_CONST(0.98049609422096), FRAC_CONST(0.98082472844313), FRAC_CONST(0.98114907905608), FRAC_CONST(0.98146918188197), FRAC_CONST(0.98178507271438), FRAC_CONST(0.98209678731477), FRAC_CONST(0.98240436140902), FRAC_CONST(0.98270783068385), FRAC_CONST(0.98300723078342), FRAC_CONST(0.98330259730589), FRAC_CONST(0.98359396579995), FRAC_CONST(0.98388137176152), FRAC_CONST(0.98416485063031), FRAC_CONST(0.98444443778651), FRAC_CONST(0.98472016854752), FRAC_CONST(0.98499207816463), FRAC_CONST(0.98526020181980), FRAC_CONST(0.98552457462240), FRAC_CONST(0.98578523160609), FRAC_CONST(0.98604220772560), FRAC_CONST(0.98629553785362), FRAC_CONST(0.98654525677772), FRAC_CONST(0.98679139919726), FRAC_CONST(0.98703399972035), FRAC_CONST(0.98727309286089), FRAC_CONST(0.98750871303556), FRAC_CONST(0.98774089456089), FRAC_CONST(0.98796967165036), FRAC_CONST(0.98819507841154), FRAC_CONST(0.98841714884323), FRAC_CONST(0.98863591683269), FRAC_CONST(0.98885141615285), FRAC_CONST(0.98906368045957), FRAC_CONST(0.98927274328896), FRAC_CONST(0.98947863805473), FRAC_CONST(0.98968139804554), FRAC_CONST(0.98988105642241), FRAC_CONST(0.99007764621618), FRAC_CONST(0.99027120032501), FRAC_CONST(0.99046175151186), FRAC_CONST(0.99064933240208), FRAC_CONST(0.99083397548099), FRAC_CONST(0.99101571309153), FRAC_CONST(0.99119457743191), FRAC_CONST(0.99137060055337), FRAC_CONST(0.99154381435784), FRAC_CONST(0.99171425059582), FRAC_CONST(0.99188194086414), FRAC_CONST(0.99204691660388), FRAC_CONST(0.99220920909823), FRAC_CONST(0.99236884947045), FRAC_CONST(0.99252586868186), FRAC_CONST(0.99268029752989), FRAC_CONST(0.99283216664606), FRAC_CONST(0.99298150649419), FRAC_CONST(0.99312834736847), FRAC_CONST(0.99327271939167), FRAC_CONST(0.99341465251338), FRAC_CONST(0.99355417650825), FRAC_CONST(0.99369132097430), FRAC_CONST(0.99382611533130), FRAC_CONST(0.99395858881910), FRAC_CONST(0.99408877049612), FRAC_CONST(0.99421668923778), FRAC_CONST(0.99434237373503), FRAC_CONST(0.99446585249289), FRAC_CONST(0.99458715382906), FRAC_CONST(0.99470630587254), FRAC_CONST(0.99482333656229), FRAC_CONST(0.99493827364600), FRAC_CONST(0.99505114467878), FRAC_CONST(0.99516197702200), FRAC_CONST(0.99527079784214), FRAC_CONST(0.99537763410962), FRAC_CONST(0.99548251259777), FRAC_CONST(0.99558545988178), FRAC_CONST(0.99568650233767), FRAC_CONST(0.99578566614138), FRAC_CONST(0.99588297726783), FRAC_CONST(0.99597846149005), FRAC_CONST(0.99607214437834), FRAC_CONST(0.99616405129947), FRAC_CONST(0.99625420741595), FRAC_CONST(0.99634263768527), FRAC_CONST(0.99642936685928), FRAC_CONST(0.99651441948352), FRAC_CONST(0.99659781989663), FRAC_CONST(0.99667959222978), FRAC_CONST(0.99675976040620), FRAC_CONST(0.99683834814063), FRAC_CONST(0.99691537893895), FRAC_CONST(0.99699087609774), FRAC_CONST(0.99706486270391), FRAC_CONST(0.99713736163442), FRAC_CONST(0.99720839555593), FRAC_CONST(0.99727798692461), FRAC_CONST(0.99734615798589), FRAC_CONST(0.99741293077431), FRAC_CONST(0.99747832711337), FRAC_CONST(0.99754236861541), FRAC_CONST(0.99760507668158), FRAC_CONST(0.99766647250181), FRAC_CONST(0.99772657705478), FRAC_CONST(0.99778541110799), FRAC_CONST(0.99784299521785), FRAC_CONST(0.99789934972976), FRAC_CONST(0.99795449477828), FRAC_CONST(0.99800845028730), FRAC_CONST(0.99806123597027), FRAC_CONST(0.99811287133042), FRAC_CONST(0.99816337566108), FRAC_CONST(0.99821276804596), FRAC_CONST(0.99826106735952), FRAC_CONST(0.99830829226732), FRAC_CONST(0.99835446122649), FRAC_CONST(0.99839959248609), FRAC_CONST(0.99844370408765), FRAC_CONST(0.99848681386566), FRAC_CONST(0.99852893944805), FRAC_CONST(0.99857009825685), FRAC_CONST(0.99861030750869), FRAC_CONST(0.99864958421549), FRAC_CONST(0.99868794518504), FRAC_CONST(0.99872540702178), FRAC_CONST(0.99876198612738), FRAC_CONST(0.99879769870160), FRAC_CONST(0.99883256074295), FRAC_CONST(0.99886658804953), FRAC_CONST(0.99889979621983), FRAC_CONST(0.99893220065356), FRAC_CONST(0.99896381655254), FRAC_CONST(0.99899465892154), FRAC_CONST(0.99902474256924), FRAC_CONST(0.99905408210916), FRAC_CONST(0.99908269196056), FRAC_CONST(0.99911058634952), FRAC_CONST(0.99913777930986), FRAC_CONST(0.99916428468421), FRAC_CONST(0.99919011612505), FRAC_CONST(0.99921528709576), FRAC_CONST(0.99923981087174), FRAC_CONST(0.99926370054150), FRAC_CONST(0.99928696900779), FRAC_CONST(0.99930962898876), FRAC_CONST(0.99933169301910), FRAC_CONST(0.99935317345126), FRAC_CONST(0.99937408245662), FRAC_CONST(0.99939443202674), FRAC_CONST(0.99941423397457), FRAC_CONST(0.99943349993572), FRAC_CONST(0.99945224136972), FRAC_CONST(0.99947046956130), FRAC_CONST(0.99948819562171), FRAC_CONST(0.99950543049000), FRAC_CONST(0.99952218493439), FRAC_CONST(0.99953846955355), FRAC_CONST(0.99955429477803), FRAC_CONST(0.99956967087154), FRAC_CONST(0.99958460793242), FRAC_CONST(0.99959911589494), FRAC_CONST(0.99961320453077), FRAC_CONST(0.99962688345035), FRAC_CONST(0.99964016210433), FRAC_CONST(0.99965304978499), FRAC_CONST(0.99966555562769), FRAC_CONST(0.99967768861231), FRAC_CONST(0.99968945756473), FRAC_CONST(0.99970087115825), FRAC_CONST(0.99971193791510), FRAC_CONST(0.99972266620792), FRAC_CONST(0.99973306426121), FRAC_CONST(0.99974314015288), FRAC_CONST(0.99975290181568), FRAC_CONST(0.99976235703876), FRAC_CONST(0.99977151346914), FRAC_CONST(0.99978037861326), FRAC_CONST(0.99978895983845), FRAC_CONST(0.99979726437448), FRAC_CONST(0.99980529931507), FRAC_CONST(0.99981307161943), FRAC_CONST(0.99982058811377), FRAC_CONST(0.99982785549283), FRAC_CONST(0.99983488032144), FRAC_CONST(0.99984166903600), FRAC_CONST(0.99984822794606), FRAC_CONST(0.99985456323584), FRAC_CONST(0.99986068096572), FRAC_CONST(0.99986658707386), FRAC_CONST(0.99987228737764), FRAC_CONST(0.99987778757524), FRAC_CONST(0.99988309324717), FRAC_CONST(0.99988820985777), FRAC_CONST(0.99989314275675), FRAC_CONST(0.99989789718072), FRAC_CONST(0.99990247825468), FRAC_CONST(0.99990689099357), FRAC_CONST(0.99991114030376), FRAC_CONST(0.99991523098456), FRAC_CONST(0.99991916772971), FRAC_CONST(0.99992295512891), FRAC_CONST(0.99992659766930), FRAC_CONST(0.99993009973692), FRAC_CONST(0.99993346561824), FRAC_CONST(0.99993669950161), FRAC_CONST(0.99993980547870), FRAC_CONST(0.99994278754604), FRAC_CONST(0.99994564960642), FRAC_CONST(0.99994839547033), FRAC_CONST(0.99995102885747), FRAC_CONST(0.99995355339809), FRAC_CONST(0.99995597263451), FRAC_CONST(0.99995829002249), FRAC_CONST(0.99996050893264), FRAC_CONST(0.99996263265183), FRAC_CONST(0.99996466438460), FRAC_CONST(0.99996660725452), FRAC_CONST(0.99996846430558), FRAC_CONST(0.99997023850356), FRAC_CONST(0.99997193273736), FRAC_CONST(0.99997354982037), FRAC_CONST(0.99997509249183), FRAC_CONST(0.99997656341810), FRAC_CONST(0.99997796519400), FRAC_CONST(0.99997930034415), FRAC_CONST(0.99998057132421), FRAC_CONST(0.99998178052220), FRAC_CONST(0.99998293025975), FRAC_CONST(0.99998402279338), FRAC_CONST(0.99998506031574), FRAC_CONST(0.99998604495686), FRAC_CONST(0.99998697878536), FRAC_CONST(0.99998786380966), FRAC_CONST(0.99998870197921), FRAC_CONST(0.99998949518567), FRAC_CONST(0.99999024526408), FRAC_CONST(0.99999095399401), FRAC_CONST(0.99999162310077), FRAC_CONST(0.99999225425649), FRAC_CONST(0.99999284908128), FRAC_CONST(0.99999340914435), FRAC_CONST(0.99999393596510), FRAC_CONST(0.99999443101421), FRAC_CONST(0.99999489571473), FRAC_CONST(0.99999533144314), FRAC_CONST(0.99999573953040), FRAC_CONST(0.99999612126300), FRAC_CONST(0.99999647788395), FRAC_CONST(0.99999681059383), FRAC_CONST(0.99999712055178), FRAC_CONST(0.99999740887647), FRAC_CONST(0.99999767664709), FRAC_CONST(0.99999792490431), FRAC_CONST(0.99999815465123), FRAC_CONST(0.99999836685427), FRAC_CONST(0.99999856244415), FRAC_CONST(0.99999874231676), FRAC_CONST(0.99999890733405), FRAC_CONST(0.99999905832493), FRAC_CONST(0.99999919608613), FRAC_CONST(0.99999932138304), FRAC_CONST(0.99999943495056), FRAC_CONST(0.99999953749392), FRAC_CONST(0.99999962968950), FRAC_CONST(0.99999971218563), FRAC_CONST(0.99999978560337), FRAC_CONST(0.99999985053727), FRAC_CONST(0.99999990755616), FRAC_CONST(0.99999995720387) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t kbd_long_960[] = { FRAC_CONST(0.0003021562530949), FRAC_CONST(0.0004452267024786), FRAC_CONST(0.0005674947527496), FRAC_CONST(0.0006812465553466), FRAC_CONST(0.0007910496776387), FRAC_CONST(0.0008991655033895), FRAC_CONST(0.0010068978259384), FRAC_CONST(0.0011150758515751), FRAC_CONST(0.0012242653193642), FRAC_CONST(0.0013348735658205), FRAC_CONST(0.0014472068670273), FRAC_CONST(0.0015615039850448), FRAC_CONST(0.0016779568885263), FRAC_CONST(0.0017967241232412), FRAC_CONST(0.0019179397560955), FRAC_CONST(0.0020417195415393), FRAC_CONST(0.0021681652836642), FRAC_CONST(0.0022973679910599), FRAC_CONST(0.0024294102029937), FRAC_CONST(0.0025643677339078), FRAC_CONST(0.0027023110014772), FRAC_CONST(0.0028433060512612), FRAC_CONST(0.0029874153568025), FRAC_CONST(0.0031346984511728), FRAC_CONST(0.0032852124303662), FRAC_CONST(0.0034390123581190), FRAC_CONST(0.0035961515940931), FRAC_CONST(0.0037566820618961), FRAC_CONST(0.0039206544694386), FRAC_CONST(0.0040881184912194), FRAC_CONST(0.0042591229199617), FRAC_CONST(0.0044337157933972), FRAC_CONST(0.0046119445007641), FRAC_CONST(0.0047938558726415), FRAC_CONST(0.0049794962570131), FRAC_CONST(0.0051689115838900), FRAC_CONST(0.0053621474203763), FRAC_CONST(0.0055592490177131), FRAC_CONST(0.0057602613515573), FRAC_CONST(0.0059652291565289), FRAC_CONST(0.0061741969558843), FRAC_CONST(0.0063872090870253), FRAC_CONST(0.0066043097234387), FRAC_CONST(0.0068255428935640), FRAC_CONST(0.0070509524970088), FRAC_CONST(0.0072805823184660), FRAC_CONST(0.0075144760396340), FRAC_CONST(0.0077526772493942), FRAC_CONST(0.0079952294524673), FRAC_CONST(0.0082421760767325), FRAC_CONST(0.0084935604793733), FRAC_CONST(0.0087494259519870), FRAC_CONST(0.0090098157247792), FRAC_CONST(0.0092747729699467), FRAC_CONST(0.0095443408043399), FRAC_CONST(0.0098185622914832), FRAC_CONST(0.0100974804430226), FRAC_CONST(0.0103811382196612), FRAC_CONST(0.0106695785316351), FRAC_CONST(0.0109628442387771), FRAC_CONST(0.0112609781502091), FRAC_CONST(0.0115640230236993), FRAC_CONST(0.0118720215647169), FRAC_CONST(0.0121850164252137), FRAC_CONST(0.0125030502021561), FRAC_CONST(0.0128261654358321), FRAC_CONST(0.0131544046079532), FRAC_CONST(0.0134878101395681), FRAC_CONST(0.0138264243888068), FRAC_CONST(0.0141702896484671), FRAC_CONST(0.0145194481434592), FRAC_CONST(0.0148739420281182), FRAC_CONST(0.0152338133833959), FRAC_CONST(0.0155991042139432), FRAC_CONST(0.0159698564450882), FRAC_CONST(0.0163461119197227), FRAC_CONST(0.0167279123950996), FRAC_CONST(0.0171152995395520), FRAC_CONST(0.0175083149291368), FRAC_CONST(0.0179070000442104), FRAC_CONST(0.0183113962659409), FRAC_CONST(0.0187215448727609), FRAC_CONST(0.0191374870367659), FRAC_CONST(0.0195592638200623), FRAC_CONST(0.0199869161710679), FRAC_CONST(0.0204204849207691), FRAC_CONST(0.0208600107789370), FRAC_CONST(0.0213055343303066), FRAC_CONST(0.0217570960307201), FRAC_CONST(0.0222147362032386), FRAC_CONST(0.0226784950342228), FRAC_CONST(0.0231484125693867), FRAC_CONST(0.0236245287098244), FRAC_CONST(0.0241068832080138), FRAC_CONST(0.0245955156637973), FRAC_CONST(0.0250904655203431), FRAC_CONST(0.0255917720600868), FRAC_CONST(0.0260994744006559), FRAC_CONST(0.0266136114907790), FRAC_CONST(0.0271342221061795), FRAC_CONST(0.0276613448454576), FRAC_CONST(0.0281950181259587), FRAC_CONST(0.0287352801796329), FRAC_CONST(0.0292821690488833), FRAC_CONST(0.0298357225824074), FRAC_CONST(0.0303959784310299), FRAC_CONST(0.0309629740435296), FRAC_CONST(0.0315367466624615), FRAC_CONST(0.0321173333199732), FRAC_CONST(0.0327047708336193), FRAC_CONST(0.0332990958021720), FRAC_CONST(0.0339003446014307), FRAC_CONST(0.0345085533800302), FRAC_CONST(0.0351237580552491), FRAC_CONST(0.0357459943088193), FRAC_CONST(0.0363752975827358), FRAC_CONST(0.0370117030750704), FRAC_CONST(0.0376552457357870), FRAC_CONST(0.0383059602625614), FRAC_CONST(0.0389638810966056), FRAC_CONST(0.0396290424184964), FRAC_CONST(0.0403014781440112), FRAC_CONST(0.0409812219199691), FRAC_CONST(0.0416683071200799), FRAC_CONST(0.0423627668408009), FRAC_CONST(0.0430646338972016), FRAC_CONST(0.0437739408188385), FRAC_CONST(0.0444907198456388), FRAC_CONST(0.0452150029237951), FRAC_CONST(0.0459468217016708), FRAC_CONST(0.0466862075257170), FRAC_CONST(0.0474331914364021), FRAC_CONST(0.0481878041641539), FRAC_CONST(0.0489500761253148), FRAC_CONST(0.0497200374181119), FRAC_CONST(0.0504977178186404), FRAC_CONST(0.0512831467768636), FRAC_CONST(0.0520763534126273), FRAC_CONST(0.0528773665116913), FRAC_CONST(0.0536862145217772), FRAC_CONST(0.0545029255486345), FRAC_CONST(0.0553275273521232), FRAC_CONST(0.0561600473423164), FRAC_CONST(0.0570005125756209), FRAC_CONST(0.0578489497509179), FRAC_CONST(0.0587053852057233), FRAC_CONST(0.0595698449123695), FRAC_CONST(0.0604423544742077), FRAC_CONST(0.0613229391218317), FRAC_CONST(0.0622116237093247), FRAC_CONST(0.0631084327105284), FRAC_CONST(0.0640133902153352), FRAC_CONST(0.0649265199260043), FRAC_CONST(0.0658478451535027), FRAC_CONST(0.0667773888138695), FRAC_CONST(0.0677151734246072), FRAC_CONST(0.0686612211010977), FRAC_CONST(0.0696155535530446), FRAC_CONST(0.0705781920809429), FRAC_CONST(0.0715491575725758), FRAC_CONST(0.0725284704995383), FRAC_CONST(0.0735161509137906), FRAC_CONST(0.0745122184442388), FRAC_CONST(0.0755166922933461), FRAC_CONST(0.0765295912337720), FRAC_CONST(0.0775509336050437), FRAC_CONST(0.0785807373102561), FRAC_CONST(0.0796190198128044), FRAC_CONST(0.0806657981331473), FRAC_CONST(0.0817210888456026), FRAC_CONST(0.0827849080751753), FRAC_CONST(0.0838572714944183), FRAC_CONST(0.0849381943203265), FRAC_CONST(0.0860276913112652), FRAC_CONST(0.0871257767639319), FRAC_CONST(0.0882324645103534), FRAC_CONST(0.0893477679149177), FRAC_CONST(0.0904716998714418), FRAC_CONST(0.0916042728002747), FRAC_CONST(0.0927454986454381), FRAC_CONST(0.0938953888718020), FRAC_CONST(0.0950539544622996), FRAC_CONST(0.0962212059151784), FRAC_CONST(0.0973971532412897), FRAC_CONST(0.0985818059614169), FRAC_CONST(0.0997751731036425), FRAC_CONST(0.1009772632007537), FRAC_CONST(0.1021880842876888), FRAC_CONST(0.1034076438990227), FRAC_CONST(0.1046359490664932), FRAC_CONST(0.1058730063165681), FRAC_CONST(0.1071188216680533), FRAC_CONST(0.1083734006297428), FRAC_CONST(0.1096367481981100), FRAC_CONST(0.1109088688550422), FRAC_CONST(0.1121897665656167), FRAC_CONST(0.1134794447759207), FRAC_CONST(0.1147779064109143), FRAC_CONST(0.1160851538723372), FRAC_CONST(0.1174011890366591), FRAC_CONST(0.1187260132530751), FRAC_CONST(0.1200596273415457), FRAC_CONST(0.1214020315908810), FRAC_CONST(0.1227532257568719), FRAC_CONST(0.1241132090604651), FRAC_CONST(0.1254819801859856), FRAC_CONST(0.1268595372794049), FRAC_CONST(0.1282458779466558), FRAC_CONST(0.1296409992519942), FRAC_CONST(0.1310448977164081), FRAC_CONST(0.1324575693160745), FRAC_CONST(0.1338790094808633), FRAC_CONST(0.1353092130928902), FRAC_CONST(0.1367481744851168), FRAC_CONST(0.1381958874400010), FRAC_CONST(0.1396523451881945), FRAC_CONST(0.1411175404072910), FRAC_CONST(0.1425914652206223), FRAC_CONST(0.1440741111961058), FRAC_CONST(0.1455654693451402), FRAC_CONST(0.1470655301215526), FRAC_CONST(0.1485742834205956), FRAC_CONST(0.1500917185779945), FRAC_CONST(0.1516178243690463), FRAC_CONST(0.1531525890077689), FRAC_CONST(0.1546960001461024), FRAC_CONST(0.1562480448731608), FRAC_CONST(0.1578087097145364), FRAC_CONST(0.1593779806316558), FRAC_CONST(0.1609558430211876), FRAC_CONST(0.1625422817145027), FRAC_CONST(0.1641372809771871), FRAC_CONST(0.1657408245086070), FRAC_CONST(0.1673528954415270), FRAC_CONST(0.1689734763417811), FRAC_CONST(0.1706025492079969), FRAC_CONST(0.1722400954713725), FRAC_CONST(0.1738860959955082), FRAC_CONST(0.1755405310762898), FRAC_CONST(0.1772033804418275), FRAC_CONST(0.1788746232524467), FRAC_CONST(0.1805542381007349), FRAC_CONST(0.1822422030116404), FRAC_CONST(0.1839384954426268), FRAC_CONST(0.1856430922838810), FRAC_CONST(0.1873559698585756), FRAC_CONST(0.1890771039231862), FRAC_CONST(0.1908064696678625), FRAC_CONST(0.1925440417168546), FRAC_CONST(0.1942897941289937), FRAC_CONST(0.1960437003982277), FRAC_CONST(0.1978057334542116), FRAC_CONST(0.1995758656629525), FRAC_CONST(0.2013540688275098), FRAC_CONST(0.2031403141887507), FRAC_CONST(0.2049345724261595), FRAC_CONST(0.2067368136587033), FRAC_CONST(0.2085470074457521), FRAC_CONST(0.2103651227880538), FRAC_CONST(0.2121911281287646), FRAC_CONST(0.2140249913545346), FRAC_CONST(0.2158666797966480), FRAC_CONST(0.2177161602322188), FRAC_CONST(0.2195733988854414), FRAC_CONST(0.2214383614288963), FRAC_CONST(0.2233110129849106), FRAC_CONST(0.2251913181269740), FRAC_CONST(0.2270792408812093), FRAC_CONST(0.2289747447278976), FRAC_CONST(0.2308777926030592), FRAC_CONST(0.2327883469000885), FRAC_CONST(0.2347063694714437), FRAC_CONST(0.2366318216303919), FRAC_CONST(0.2385646641528076), FRAC_CONST(0.2405048572790267), FRAC_CONST(0.2424523607157545), FRAC_CONST(0.2444071336380283), FRAC_CONST(0.2463691346912334), FRAC_CONST(0.2483383219931741), FRAC_CONST(0.2503146531361985), FRAC_CONST(0.2522980851893767), FRAC_CONST(0.2542885747007335), FRAC_CONST(0.2562860776995335), FRAC_CONST(0.2582905496986215), FRAC_CONST(0.2603019456968142), FRAC_CONST(0.2623202201813464), FRAC_CONST(0.2643453271303700), FRAC_CONST(0.2663772200155053), FRAC_CONST(0.2684158518044454), FRAC_CONST(0.2704611749636135), FRAC_CONST(0.2725131414608710), FRAC_CONST(0.2745717027682799), FRAC_CONST(0.2766368098649151), FRAC_CONST(0.2787084132397296), FRAC_CONST(0.2807864628944707), FRAC_CONST(0.2828709083466482), FRAC_CONST(0.2849616986325523), FRAC_CONST(0.2870587823103237), FRAC_CONST(0.2891621074630737), FRAC_CONST(0.2912716217020546), FRAC_CONST(0.2933872721698803), FRAC_CONST(0.2955090055437973), FRAC_CONST(0.2976367680390041), FRAC_CONST(0.2997705054120213), FRAC_CONST(0.3019101629641097), FRAC_CONST(0.3040556855447379), FRAC_CONST(0.3062070175550981), FRAC_CONST(0.3083641029516701), FRAC_CONST(0.3105268852498334), FRAC_CONST(0.3126953075275265), FRAC_CONST(0.3148693124289546), FRAC_CONST(0.3170488421683428), FRAC_CONST(0.3192338385337370), FRAC_CONST(0.3214242428908514), FRAC_CONST(0.3236199961869606), FRAC_CONST(0.3258210389548392), FRAC_CONST(0.3280273113167459), FRAC_CONST(0.3302387529884521), FRAC_CONST(0.3324553032833160), FRAC_CONST(0.3346769011164010), FRAC_CONST(0.3369034850086373), FRAC_CONST(0.3391349930910280), FRAC_CONST(0.3413713631088974), FRAC_CONST(0.3436125324261830), FRAC_CONST(0.3458584380297697), FRAC_CONST(0.3481090165338656), FRAC_CONST(0.3503642041844199), FRAC_CONST(0.3526239368635820), FRAC_CONST(0.3548881500942010), FRAC_CONST(0.3571567790443668), FRAC_CONST(0.3594297585319891), FRAC_CONST(0.3617070230294185), FRAC_CONST(0.3639885066681048), FRAC_CONST(0.3662741432432950), FRAC_CONST(0.3685638662187693), FRAC_CONST(0.3708576087316147), FRAC_CONST(0.3731553035970366), FRAC_CONST(0.3754568833132069), FRAC_CONST(0.3777622800661488), FRAC_CONST(0.3800714257346570), FRAC_CONST(0.3823842518952546), FRAC_CONST(0.3847006898271841), FRAC_CONST(0.3870206705174334), FRAC_CONST(0.3893441246657958), FRAC_CONST(0.3916709826899639), FRAC_CONST(0.3940011747306560), FRAC_CONST(0.3963346306567764), FRAC_CONST(0.3986712800706062), FRAC_CONST(0.4010110523130271), FRAC_CONST(0.4033538764687756), FRAC_CONST(0.4056996813717284), FRAC_CONST(0.4080483956102172), FRAC_CONST(0.4103999475323736), FRAC_CONST(0.4127542652515031), FRAC_CONST(0.4151112766514873), FRAC_CONST(0.4174709093922143), FRAC_CONST(0.4198330909150365), FRAC_CONST(0.4221977484482556), FRAC_CONST(0.4245648090126334), FRAC_CONST(0.4269341994269293), FRAC_CONST(0.4293058463134616), FRAC_CONST(0.4316796761036958), FRAC_CONST(0.4340556150438547), FRAC_CONST(0.4364335892005536), FRAC_CONST(0.4388135244664580), FRAC_CONST(0.4411953465659639), FRAC_CONST(0.4435789810609000), FRAC_CONST(0.4459643533562509), FRAC_CONST(0.4483513887059016), FRAC_CONST(0.4507400122184019), FRAC_CONST(0.4531301488627497), FRAC_CONST(0.4555217234741947), FRAC_CONST(0.4579146607600593), FRAC_CONST(0.4603088853055777), FRAC_CONST(0.4627043215797521), FRAC_CONST(0.4651008939412254), FRAC_CONST(0.4674985266441709), FRAC_CONST(0.4698971438441951), FRAC_CONST(0.4722966696042580), FRAC_CONST(0.4746970279006055), FRAC_CONST(0.4770981426287164), FRAC_CONST(0.4794999376092619), FRAC_CONST(0.4819023365940778), FRAC_CONST(0.4843052632721476), FRAC_CONST(0.4867086412755978), FRAC_CONST(0.4891123941857028), FRAC_CONST(0.4915164455388997), FRAC_CONST(0.4939207188328126), FRAC_CONST(0.4963251375322855), FRAC_CONST(0.4987296250754225), FRAC_CONST(0.5011341048796359), FRAC_CONST(0.5035385003477012), FRAC_CONST(0.5059427348738168), FRAC_CONST(0.5083467318496706), FRAC_CONST(0.5107504146705106), FRAC_CONST(0.5131537067412193), FRAC_CONST(0.5155565314823923), FRAC_CONST(0.5179588123364193), FRAC_CONST(0.5203604727735667), FRAC_CONST(0.5227614362980630), FRAC_CONST(0.5251616264541841), FRAC_CONST(0.5275609668323384), FRAC_CONST(0.5299593810751532), FRAC_CONST(0.5323567928835578), FRAC_CONST(0.5347531260228663), FRAC_CONST(0.5371483043288580), FRAC_CONST(0.5395422517138538), FRAC_CONST(0.5419348921727899), FRAC_CONST(0.5443261497892862), FRAC_CONST(0.5467159487417104), FRAC_CONST(0.5491042133092364), FRAC_CONST(0.5514908678778958), FRAC_CONST(0.5538758369466227), FRAC_CONST(0.5562590451332913), FRAC_CONST(0.5586404171807443), FRAC_CONST(0.5610198779628133), FRAC_CONST(0.5633973524903286), FRAC_CONST(0.5657727659171199), FRAC_CONST(0.5681460435460047), FRAC_CONST(0.5705171108347663), FRAC_CONST(0.5728858934021188), FRAC_CONST(0.5752523170336598), FRAC_CONST(0.5776163076878088), FRAC_CONST(0.5799777915017323), FRAC_CONST(0.5823366947972535), FRAC_CONST(0.5846929440867458), FRAC_CONST(0.5870464660790119), FRAC_CONST(0.5893971876851449), FRAC_CONST(0.5917450360243719), FRAC_CONST(0.5940899384298793), FRAC_CONST(0.5964318224546208), FRAC_CONST(0.5987706158771039), FRAC_CONST(0.6011062467071583), FRAC_CONST(0.6034386431916822), FRAC_CONST(0.6057677338203681), FRAC_CONST(0.6080934473314057), FRAC_CONST(0.6104157127171639), FRAC_CONST(0.6127344592298474), FRAC_CONST(0.6150496163871310), FRAC_CONST(0.6173611139777690), FRAC_CONST(0.6196688820671789), FRAC_CONST(0.6219728510029997), FRAC_CONST(0.6242729514206247), FRAC_CONST(0.6265691142487051), FRAC_CONST(0.6288612707146283), FRAC_CONST(0.6311493523499663), FRAC_CONST(0.6334332909958958), FRAC_CONST(0.6357130188085891), FRAC_CONST(0.6379884682645743), FRAC_CONST(0.6402595721660647), FRAC_CONST(0.6425262636462578), FRAC_CONST(0.6447884761746012), FRAC_CONST(0.6470461435620266), FRAC_CONST(0.6492991999661505), FRAC_CONST(0.6515475798964411), FRAC_CONST(0.6537912182193508), FRAC_CONST(0.6560300501634142), FRAC_CONST(0.6582640113243098), FRAC_CONST(0.6604930376698862), FRAC_CONST(0.6627170655451516), FRAC_CONST(0.6649360316772256), FRAC_CONST(0.6671498731802533), FRAC_CONST(0.6693585275602818), FRAC_CONST(0.6715619327200959), FRAC_CONST(0.6737600269640164), FRAC_CONST(0.6759527490026566), FRAC_CONST(0.6781400379576392), FRAC_CONST(0.6803218333662715), FRAC_CONST(0.6824980751861787), FRAC_CONST(0.6846687037998949), FRAC_CONST(0.6868336600194123), FRAC_CONST(0.6889928850906855), FRAC_CONST(0.6911463206980928), FRAC_CONST(0.6932939089688525), FRAC_CONST(0.6954355924773949), FRAC_CONST(0.6975713142496884), FRAC_CONST(0.6997010177675195), FRAC_CONST(0.7018246469727265), FRAC_CONST(0.7039421462713862), FRAC_CONST(0.7060534605379528), FRAC_CONST(0.7081585351193496), FRAC_CONST(0.7102573158390105), FRAC_CONST(0.7123497490008750), FRAC_CONST(0.7144357813933307), FRAC_CONST(0.7165153602931092), FRAC_CONST(0.7185884334691287), FRAC_CONST(0.7206549491862871), FRAC_CONST(0.7227148562092042), FRAC_CONST(0.7247681038059106), FRAC_CONST(0.7268146417514855), FRAC_CONST(0.7288544203316418), FRAC_CONST(0.7308873903462577), FRAC_CONST(0.7329135031128549), FRAC_CONST(0.7349327104700221), FRAC_CONST(0.7369449647807855), FRAC_CONST(0.7389502189359237), FRAC_CONST(0.7409484263572271), FRAC_CONST(0.7429395410007016), FRAC_CONST(0.7449235173597176), FRAC_CONST(0.7469003104681008), FRAC_CONST(0.7488698759031670), FRAC_CONST(0.7508321697887005), FRAC_CONST(0.7527871487978728), FRAC_CONST(0.7547347701561059), FRAC_CONST(0.7566749916438754), FRAC_CONST(0.7586077715994560), FRAC_CONST(0.7605330689216074), FRAC_CONST(0.7624508430722016), FRAC_CONST(0.7643610540787891), FRAC_CONST(0.7662636625371070), FRAC_CONST(0.7681586296135255), FRAC_CONST(0.7700459170474343), FRAC_CONST(0.7719254871535672), FRAC_CONST(0.7737973028242671), FRAC_CONST(0.7756613275316875), FRAC_CONST(0.7775175253299340), FRAC_CONST(0.7793658608571425), FRAC_CONST(0.7812062993374951), FRAC_CONST(0.7830388065831744), FRAC_CONST(0.7848633489962533), FRAC_CONST(0.7866798935705233), FRAC_CONST(0.7884884078932579), FRAC_CONST(0.7902888601469138), FRAC_CONST(0.7920812191107668), FRAC_CONST(0.7938654541624850), FRAC_CONST(0.7956415352796368), FRAC_CONST(0.7974094330411343), FRAC_CONST(0.7991691186286133), FRAC_CONST(0.8009205638277465), FRAC_CONST(0.8026637410294932), FRAC_CONST(0.8043986232312831), FRAC_CONST(0.8061251840381346), FRAC_CONST(0.8078433976637077), FRAC_CONST(0.8095532389312917), FRAC_CONST(0.8112546832747255), FRAC_CONST(0.8129477067392539), FRAC_CONST(0.8146322859823164), FRAC_CONST(0.8163083982742698), FRAC_CONST(0.8179760214990457), FRAC_CONST(0.8196351341547393), FRAC_CONST(0.8212857153541345), FRAC_CONST(0.8229277448251595), FRAC_CONST(0.8245612029112778), FRAC_CONST(0.8261860705718113), FRAC_CONST(0.8278023293821971), FRAC_CONST(0.8294099615341773), FRAC_CONST(0.8310089498359212), FRAC_CONST(0.8325992777120815), FRAC_CONST(0.8341809292037831), FRAC_CONST(0.8357538889685445), FRAC_CONST(0.8373181422801330), FRAC_CONST(0.8388736750283521), FRAC_CONST(0.8404204737187619), FRAC_CONST(0.8419585254723335), FRAC_CONST(0.8434878180250348), FRAC_CONST(0.8450083397273509), FRAC_CONST(0.8465200795437368), FRAC_CONST(0.8480230270520029), FRAC_CONST(0.8495171724426350), FRAC_CONST(0.8510025065180464), FRAC_CONST(0.8524790206917633), FRAC_CONST(0.8539467069875448), FRAC_CONST(0.8554055580384357), FRAC_CONST(0.8568555670857525), FRAC_CONST(0.8582967279780043), FRAC_CONST(0.8597290351697464), FRAC_CONST(0.8611524837203691), FRAC_CONST(0.8625670692928198), FRAC_CONST(0.8639727881522599), FRAC_CONST(0.8653696371646555), FRAC_CONST(0.8667576137953045), FRAC_CONST(0.8681367161072958), FRAC_CONST(0.8695069427599065), FRAC_CONST(0.8708682930069319), FRAC_CONST(0.8722207666949527), FRAC_CONST(0.8735643642615368), FRAC_CONST(0.8748990867333771), FRAC_CONST(0.8762249357243662), FRAC_CONST(0.8775419134336067), FRAC_CONST(0.8788500226433579), FRAC_CONST(0.8801492667169208), FRAC_CONST(0.8814396495964587), FRAC_CONST(0.8827211758007560), FRAC_CONST(0.8839938504229149), FRAC_CONST(0.8852576791279895), FRAC_CONST(0.8865126681505587), FRAC_CONST(0.8877588242922386), FRAC_CONST(0.8889961549191320), FRAC_CONST(0.8902246679592184), FRAC_CONST(0.8914443718996848), FRAC_CONST(0.8926552757841945), FRAC_CONST(0.8938573892100969), FRAC_CONST(0.8950507223255798), FRAC_CONST(0.8962352858267605), FRAC_CONST(0.8974110909547198), FRAC_CONST(0.8985781494924783), FRAC_CONST(0.8997364737619142), FRAC_CONST(0.9008860766206249), FRAC_CONST(0.9020269714587307), FRAC_CONST(0.9031591721956235), FRAC_CONST(0.9042826932766591), FRAC_CONST(0.9053975496697941), FRAC_CONST(0.9065037568621681), FRAC_CONST(0.9076013308566311), FRAC_CONST(0.9086902881682180), FRAC_CONST(0.9097706458205682), FRAC_CONST(0.9108424213422940), FRAC_CONST(0.9119056327632955), FRAC_CONST(0.9129602986110235), FRAC_CONST(0.9140064379066919), FRAC_CONST(0.9150440701614393), FRAC_CONST(0.9160732153724396), FRAC_CONST(0.9170938940189634), FRAC_CONST(0.9181061270583908), FRAC_CONST(0.9191099359221748), FRAC_CONST(0.9201053425117579), FRAC_CONST(0.9210923691944400), FRAC_CONST(0.9220710387992010), FRAC_CONST(0.9230413746124764), FRAC_CONST(0.9240034003738882), FRAC_CONST(0.9249571402719298), FRAC_CONST(0.9259026189396085), FRAC_CONST(0.9268398614500427), FRAC_CONST(0.9277688933120170), FRAC_CONST(0.9286897404654957), FRAC_CONST(0.9296024292770939), FRAC_CONST(0.9305069865355076), FRAC_CONST(0.9314034394469048), FRAC_CONST(0.9322918156302762), FRAC_CONST(0.9331721431127471), FRAC_CONST(0.9340444503248519), FRAC_CONST(0.9349087660957711), FRAC_CONST(0.9357651196485313), FRAC_CONST(0.9366135405951697), FRAC_CONST(0.9374540589318637), FRAC_CONST(0.9382867050340261), FRAC_CONST(0.9391115096513655), FRAC_CONST(0.9399285039029165), FRAC_CONST(0.9407377192720349), FRAC_CONST(0.9415391876013639), FRAC_CONST(0.9423329410877687), FRAC_CONST(0.9431190122772415), FRAC_CONST(0.9438974340597782), FRAC_CONST(0.9446682396642262), FRAC_CONST(0.9454314626531054), FRAC_CONST(0.9461871369174033), FRAC_CONST(0.9469352966713429), FRAC_CONST(0.9476759764471278), FRAC_CONST(0.9484092110896616), FRAC_CONST(0.9491350357512457), FRAC_CONST(0.9498534858862532), FRAC_CONST(0.9505645972457831), FRAC_CONST(0.9512684058722927), FRAC_CONST(0.9519649480942105), FRAC_CONST(0.9526542605205314), FRAC_CONST(0.9533363800353921), FRAC_CONST(0.9540113437926313), FRAC_CONST(0.9546791892103320), FRAC_CONST(0.9553399539653500), FRAC_CONST(0.9559936759878265), FRAC_CONST(0.9566403934556893), FRAC_CONST(0.9572801447891388), FRAC_CONST(0.9579129686451244), FRAC_CONST(0.9585389039118085), FRAC_CONST(0.9591579897030224), FRAC_CONST(0.9597702653527108), FRAC_CONST(0.9603757704093711), FRAC_CONST(0.9609745446304828), FRAC_CONST(0.9615666279769324), FRAC_CONST(0.9621520606074324), FRAC_CONST(0.9627308828729358), FRAC_CONST(0.9633031353110477), FRAC_CONST(0.9638688586404335), FRAC_CONST(0.9644280937552258), FRAC_CONST(0.9649808817194311), FRAC_CONST(0.9655272637613366), FRAC_CONST(0.9660672812679171), FRAC_CONST(0.9666009757792454), FRAC_CONST(0.9671283889829055), FRAC_CONST(0.9676495627084089), FRAC_CONST(0.9681645389216160), FRAC_CONST(0.9686733597191652), FRAC_CONST(0.9691760673229058), FRAC_CONST(0.9696727040743406), FRAC_CONST(0.9701633124290767), FRAC_CONST(0.9706479349512860), FRAC_CONST(0.9711266143081750), FRAC_CONST(0.9715993932644684), FRAC_CONST(0.9720663146769026), FRAC_CONST(0.9725274214887337), FRAC_CONST(0.9729827567242596), FRAC_CONST(0.9734323634833574), FRAC_CONST(0.9738762849360358), FRAC_CONST(0.9743145643170059), FRAC_CONST(0.9747472449202687), FRAC_CONST(0.9751743700937215), FRAC_CONST(0.9755959832337850), FRAC_CONST(0.9760121277800496), FRAC_CONST(0.9764228472099433), FRAC_CONST(0.9768281850334235), FRAC_CONST(0.9772281847876897), FRAC_CONST(0.9776228900319223), FRAC_CONST(0.9780123443420448), FRAC_CONST(0.9783965913055132), FRAC_CONST(0.9787756745161313), FRAC_CONST(0.9791496375688939), FRAC_CONST(0.9795185240548578), FRAC_CONST(0.9798823775560431), FRAC_CONST(0.9802412416403639), FRAC_CONST(0.9805951598565897), FRAC_CONST(0.9809441757293399), FRAC_CONST(0.9812883327541090), FRAC_CONST(0.9816276743923267), FRAC_CONST(0.9819622440664515), FRAC_CONST(0.9822920851550995), FRAC_CONST(0.9826172409882086), FRAC_CONST(0.9829377548422400), FRAC_CONST(0.9832536699354163), FRAC_CONST(0.9835650294229984), FRAC_CONST(0.9838718763926001), FRAC_CONST(0.9841742538595437), FRAC_CONST(0.9844722047622547), FRAC_CONST(0.9847657719576983), FRAC_CONST(0.9850549982168574), FRAC_CONST(0.9853399262202529), FRAC_CONST(0.9856205985535073), FRAC_CONST(0.9858970577029519), FRAC_CONST(0.9861693460512790), FRAC_CONST(0.9864375058732389), FRAC_CONST(0.9867015793313820), FRAC_CONST(0.9869616084718489), FRAC_CONST(0.9872176352202061), FRAC_CONST(0.9874697013773301), FRAC_CONST(0.9877178486153397), FRAC_CONST(0.9879621184735767), FRAC_CONST(0.9882025523546365), FRAC_CONST(0.9884391915204485), FRAC_CONST(0.9886720770884069), FRAC_CONST(0.9889012500275530), FRAC_CONST(0.9891267511548089), FRAC_CONST(0.9893486211312621), FRAC_CONST(0.9895669004585049), FRAC_CONST(0.9897816294750255), FRAC_CONST(0.9899928483526520), FRAC_CONST(0.9902005970930525), FRAC_CONST(0.9904049155242876), FRAC_CONST(0.9906058432974180), FRAC_CONST(0.9908034198831690), FRAC_CONST(0.9909976845686489), FRAC_CONST(0.9911886764541239), FRAC_CONST(0.9913764344498495), FRAC_CONST(0.9915609972729590), FRAC_CONST(0.9917424034444086), FRAC_CONST(0.9919206912859797), FRAC_CONST(0.9920958989173397), FRAC_CONST(0.9922680642531603), FRAC_CONST(0.9924372250002933), FRAC_CONST(0.9926034186550070), FRAC_CONST(0.9927666825002789), FRAC_CONST(0.9929270536031491), FRAC_CONST(0.9930845688121325), FRAC_CONST(0.9932392647546895), FRAC_CONST(0.9933911778347579), FRAC_CONST(0.9935403442303433), FRAC_CONST(0.9936867998911693), FRAC_CONST(0.9938305805363887), FRAC_CONST(0.9939717216523539), FRAC_CONST(0.9941102584904481), FRAC_CONST(0.9942462260649764), FRAC_CONST(0.9943796591511174), FRAC_CONST(0.9945105922829353), FRAC_CONST(0.9946390597514524), FRAC_CONST(0.9947650956027824), FRAC_CONST(0.9948887336363228), FRAC_CONST(0.9950100074030103), FRAC_CONST(0.9951289502036336), FRAC_CONST(0.9952455950872091), FRAC_CONST(0.9953599748494155), FRAC_CONST(0.9954721220310890), FRAC_CONST(0.9955820689167787), FRAC_CONST(0.9956898475333619), FRAC_CONST(0.9957954896487196), FRAC_CONST(0.9958990267704713), FRAC_CONST(0.9960004901447701), FRAC_CONST(0.9960999107551559), FRAC_CONST(0.9961973193214694), FRAC_CONST(0.9962927462988245), FRAC_CONST(0.9963862218766388), FRAC_CONST(0.9964777759777242), FRAC_CONST(0.9965674382574342), FRAC_CONST(0.9966552381028704), FRAC_CONST(0.9967412046321465), FRAC_CONST(0.9968253666937095), FRAC_CONST(0.9969077528657186), FRAC_CONST(0.9969883914554805), FRAC_CONST(0.9970673104989413), FRAC_CONST(0.9971445377602348), FRAC_CONST(0.9972201007312871), FRAC_CONST(0.9972940266314749), FRAC_CONST(0.9973663424073412), FRAC_CONST(0.9974370747323638), FRAC_CONST(0.9975062500067785), FRAC_CONST(0.9975738943574574), FRAC_CONST(0.9976400336378379), FRAC_CONST(0.9977046934279079), FRAC_CONST(0.9977678990342401), FRAC_CONST(0.9978296754900812), FRAC_CONST(0.9978900475554902), FRAC_CONST(0.9979490397175296), FRAC_CONST(0.9980066761905056), FRAC_CONST(0.9980629809162593), FRAC_CONST(0.9981179775645063), FRAC_CONST(0.9981716895332257), FRAC_CONST(0.9982241399490979), FRAC_CONST(0.9982753516679893), FRAC_CONST(0.9983253472754841), FRAC_CONST(0.9983741490874634), FRAC_CONST(0.9984217791507299), FRAC_CONST(0.9984682592436778), FRAC_CONST(0.9985136108770075), FRAC_CONST(0.9985578552944850), FRAC_CONST(0.9986010134737439), FRAC_CONST(0.9986431061271304), FRAC_CONST(0.9986841537025921), FRAC_CONST(0.9987241763846056), FRAC_CONST(0.9987631940951476), FRAC_CONST(0.9988012264947044), FRAC_CONST(0.9988382929833222), FRAC_CONST(0.9988744127016956), FRAC_CONST(0.9989096045322947), FRAC_CONST(0.9989438871005292), FRAC_CONST(0.9989772787759494), FRAC_CONST(0.9990097976734847), FRAC_CONST(0.9990414616547146), FRAC_CONST(0.9990722883291779), FRAC_CONST(0.9991022950557125), FRAC_CONST(0.9991314989438310), FRAC_CONST(0.9991599168551279), FRAC_CONST(0.9991875654047181), FRAC_CONST(0.9992144609627068), FRAC_CONST(0.9992406196556911), FRAC_CONST(0.9992660573682882), FRAC_CONST(0.9992907897446957), FRAC_CONST(0.9993148321902777), FRAC_CONST(0.9993381998731797), FRAC_CONST(0.9993609077259696), FRAC_CONST(0.9993829704473038), FRAC_CONST(0.9994044025036201), FRAC_CONST(0.9994252181308537), FRAC_CONST(0.9994454313361775), FRAC_CONST(0.9994650558997651), FRAC_CONST(0.9994841053765757), FRAC_CONST(0.9995025930981609), FRAC_CONST(0.9995205321744921), FRAC_CONST(0.9995379354958073), FRAC_CONST(0.9995548157344778), FRAC_CONST(0.9995711853468930), FRAC_CONST(0.9995870565753632), FRAC_CONST(0.9996024414500382), FRAC_CONST(0.9996173517908444), FRAC_CONST(0.9996317992094352), FRAC_CONST(0.9996457951111574), FRAC_CONST(0.9996593506970310), FRAC_CONST(0.9996724769657434), FRAC_CONST(0.9996851847156547), FRAC_CONST(0.9996974845468164), FRAC_CONST(0.9997093868630000), FRAC_CONST(0.9997209018737374), FRAC_CONST(0.9997320395963699), FRAC_CONST(0.9997428098581069), FRAC_CONST(0.9997532222980933), FRAC_CONST(0.9997632863694836), FRAC_CONST(0.9997730113415246), FRAC_CONST(0.9997824063016426), FRAC_CONST(0.9997914801575380), FRAC_CONST(0.9998002416392840), FRAC_CONST(0.9998086993014300), FRAC_CONST(0.9998168615251084), FRAC_CONST(0.9998247365201450), FRAC_CONST(0.9998323323271717), FRAC_CONST(0.9998396568197407), FRAC_CONST(0.9998467177064404), FRAC_CONST(0.9998535225330116), FRAC_CONST(0.9998600786844637), FRAC_CONST(0.9998663933871905), FRAC_CONST(0.9998724737110845), FRAC_CONST(0.9998783265716498), FRAC_CONST(0.9998839587321121), FRAC_CONST(0.9998893768055266), FRAC_CONST(0.9998945872568815), FRAC_CONST(0.9998995964051983), FRAC_CONST(0.9999044104256269), FRAC_CONST(0.9999090353515359), FRAC_CONST(0.9999134770765971), FRAC_CONST(0.9999177413568642), FRAC_CONST(0.9999218338128448), FRAC_CONST(0.9999257599315647), FRAC_CONST(0.9999295250686255), FRAC_CONST(0.9999331344502529), FRAC_CONST(0.9999365931753376), FRAC_CONST(0.9999399062174669), FRAC_CONST(0.9999430784269460), FRAC_CONST(0.9999461145328103), FRAC_CONST(0.9999490191448277), FRAC_CONST(0.9999517967554878), FRAC_CONST(0.9999544517419835), FRAC_CONST(0.9999569883681778), FRAC_CONST(0.9999594107865607), FRAC_CONST(0.9999617230401926), FRAC_CONST(0.9999639290646355), FRAC_CONST(0.9999660326898712), FRAC_CONST(0.9999680376422052), FRAC_CONST(0.9999699475461585), FRAC_CONST(0.9999717659263435), FRAC_CONST(0.9999734962093266), FRAC_CONST(0.9999751417254756), FRAC_CONST(0.9999767057107922), FRAC_CONST(0.9999781913087290), FRAC_CONST(0.9999796015719915), FRAC_CONST(0.9999809394643231), FRAC_CONST(0.9999822078622751), FRAC_CONST(0.9999834095569596), FRAC_CONST(0.9999845472557860), FRAC_CONST(0.9999856235841805), FRAC_CONST(0.9999866410872889), FRAC_CONST(0.9999876022316609), FRAC_CONST(0.9999885094069193), FRAC_CONST(0.9999893649274085), FRAC_CONST(0.9999901710338274), FRAC_CONST(0.9999909298948430), FRAC_CONST(0.9999916436086862), FRAC_CONST(0.9999923142047299), FRAC_CONST(0.9999929436450469), FRAC_CONST(0.9999935338259505), FRAC_CONST(0.9999940865795161), FRAC_CONST(0.9999946036750835), FRAC_CONST(0.9999950868207405), FRAC_CONST(0.9999955376647868), FRAC_CONST(0.9999959577971798), FRAC_CONST(0.9999963487509599), FRAC_CONST(0.9999967120036571), FRAC_CONST(0.9999970489786785), FRAC_CONST(0.9999973610466748), FRAC_CONST(0.9999976495268890), FRAC_CONST(0.9999979156884846), FRAC_CONST(0.9999981607518545), FRAC_CONST(0.9999983858899099), FRAC_CONST(0.9999985922293493), FRAC_CONST(0.9999987808519092), FRAC_CONST(0.9999989527955938), FRAC_CONST(0.9999991090558848), FRAC_CONST(0.9999992505869332), FRAC_CONST(0.9999993783027293), FRAC_CONST(0.9999994930782556), FRAC_CONST(0.9999995957506171), FRAC_CONST(0.9999996871201549), FRAC_CONST(0.9999997679515386), FRAC_CONST(0.9999998389748399), FRAC_CONST(0.9999999008865869), FRAC_CONST(0.9999999543507984) }; #endif ALIGN static const real_t kbd_short_128[] = { FRAC_CONST(4.3795702929468881e-005), FRAC_CONST(0.00011867384265436617), FRAC_CONST(0.0002307165763996192), FRAC_CONST(0.00038947282760568383), FRAC_CONST(0.00060581272288302553), FRAC_CONST(0.00089199695169487453), FRAC_CONST(0.0012617254423430522), FRAC_CONST(0.0017301724373162003), FRAC_CONST(0.0023140071937421476), FRAC_CONST(0.0030313989666022221), FRAC_CONST(0.0039020049735530842), FRAC_CONST(0.0049469401815512024), FRAC_CONST(0.0061887279335368318), FRAC_CONST(0.0076512306364647726), FRAC_CONST(0.0093595599562652423), FRAC_CONST(0.011339966208377799), FRAC_CONST(0.013619706891715299), FRAC_CONST(0.016226894586323766), FRAC_CONST(0.019190324717288168), FRAC_CONST(0.022539283975960878), FRAC_CONST(0.026303340480472455), FRAC_CONST(0.030512117046644357), FRAC_CONST(0.03519504922365594), FRAC_CONST(0.040381130021856941), FRAC_CONST(0.046098643518702249), FRAC_CONST(0.052374889768730587), FRAC_CONST(0.059235903660769147), FRAC_CONST(0.066706170556282418), FRAC_CONST(0.074808341703430481), FRAC_CONST(0.083562952548726227), FRAC_CONST(0.092988147159339674), FRAC_CONST(0.1030994120216919), FRAC_CONST(0.11390932249409955), FRAC_CONST(0.12542730516149531), FRAC_CONST(0.13765941926783826), FRAC_CONST(0.15060816028651081), FRAC_CONST(0.16427228853114245), FRAC_CONST(0.17864668550988483), FRAC_CONST(0.19372224048676889), FRAC_CONST(0.20948576943658073), FRAC_CONST(0.22591996826744942), FRAC_CONST(0.24300340184133981), FRAC_CONST(0.26071052995068139), FRAC_CONST(0.27901177101369551), FRAC_CONST(0.29787360383626599), FRAC_CONST(0.3172587073594233), FRAC_CONST(0.33712613787396362), FRAC_CONST(0.35743154274286698), FRAC_CONST(0.37812740923363009), FRAC_CONST(0.39916334663203618), FRAC_CONST(0.42048639939189658), FRAC_CONST(0.4420413886774246), FRAC_CONST(0.4637712792815169), FRAC_CONST(0.4856175685594023), FRAC_CONST(0.50752069370766872), FRAC_CONST(0.52942045344797806), FRAC_CONST(0.55125643994680196), FRAC_CONST(0.57296847662071559), FRAC_CONST(0.59449705734411495), FRAC_CONST(0.61578378249506627), FRAC_CONST(0.63677178724712891), FRAC_CONST(0.65740615754163356), FRAC_CONST(0.67763432925662526), FRAC_CONST(0.69740646622548552), FRAC_CONST(0.71667581294953808), FRAC_CONST(0.73539901809352737), FRAC_CONST(0.75353642514900732), FRAC_CONST(0.77105232699609816), FRAC_CONST(0.78791518148597028), FRAC_CONST(0.80409778560147072), FRAC_CONST(0.81957740622770781), FRAC_CONST(0.83433586607383625), FRAC_CONST(0.84835958382689225), FRAC_CONST(0.86163956818294229), FRAC_CONST(0.87417136598406997), FRAC_CONST(0.88595496528524853), FRAC_CONST(0.89699465477567619), FRAC_CONST(0.90729884157670959), FRAC_CONST(0.91687983002436779), FRAC_CONST(0.92575356460899649), FRAC_CONST(0.93393934077779084), FRAC_CONST(0.94145948779657318), FRAC_CONST(0.94833902830402828), FRAC_CONST(0.95460531956280026), FRAC_CONST(0.96028768170574896), FRAC_CONST(0.96541701848104766), FRAC_CONST(0.97002543610646474), FRAC_CONST(0.97414586584250062), FRAC_CONST(0.97781169577969584), FRAC_CONST(0.98105641710392333), FRAC_CONST(0.98391328975491177), FRAC_CONST(0.98641503193166202), FRAC_CONST(0.98859353733226141), FRAC_CONST(0.99047962335771556), FRAC_CONST(0.9921028127769449), FRAC_CONST(0.99349115056397752), FRAC_CONST(0.99467105680259038), FRAC_CONST(0.9956672157341897), FRAC_CONST(0.99650250022834352), FRAC_CONST(0.99719793020823266), FRAC_CONST(0.99777266288955657), FRAC_CONST(0.99824401211201486), FRAC_CONST(0.99862749357391212), FRAC_CONST(0.99893689243401962), FRAC_CONST(0.99918434952623147), FRAC_CONST(0.99938046234161726), FRAC_CONST(0.99953439696357238), FRAC_CONST(0.99965400728430465), FRAC_CONST(0.99974595807027455), FRAC_CONST(0.99981584876278362), FRAC_CONST(0.99986833527824281), FRAC_CONST(0.99990724749057802), FRAC_CONST(0.99993570051598468), FRAC_CONST(0.99995619835942084), FRAC_CONST(0.99997072890647543), FRAC_CONST(0.9999808496399144), FRAC_CONST(0.99998776381655818), FRAC_CONST(0.99999238714961569), FRAC_CONST(0.99999540529959718), FRAC_CONST(0.99999732268176988), FRAC_CONST(0.99999850325054862), FRAC_CONST(0.99999920402413744), FRAC_CONST(0.9999996021706401), FRAC_CONST(0.99999981649545566), FRAC_CONST(0.99999992415545547), FRAC_CONST(0.99999997338493041), FRAC_CONST(0.99999999295825959), FRAC_CONST(0.99999999904096815) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t kbd_short_120[] = { FRAC_CONST(0.0000452320086910), FRAC_CONST(0.0001274564692111), FRAC_CONST(0.0002529398385345), FRAC_CONST(0.0004335140496648), FRAC_CONST(0.0006827100966952), FRAC_CONST(0.0010158708222246), FRAC_CONST(0.0014502162869659), FRAC_CONST(0.0020048865156264), FRAC_CONST(0.0027009618393178), FRAC_CONST(0.0035614590925043), FRAC_CONST(0.0046113018122711), FRAC_CONST(0.0058772627936484), FRAC_CONST(0.0073878776584103), FRAC_CONST(0.0091733284512589), FRAC_CONST(0.0112652966728373), FRAC_CONST(0.0136967855861945), FRAC_CONST(0.0165019120857793), FRAC_CONST(0.0197156688892217), FRAC_CONST(0.0233736582950619), FRAC_CONST(0.0275117992367496), FRAC_CONST(0.0321660098468534), FRAC_CONST(0.0373718682174417), FRAC_CONST(0.0431642544948834), FRAC_CONST(0.0495769778717676), FRAC_CONST(0.0566423924273392), FRAC_CONST(0.0643910061132260), FRAC_CONST(0.0728510874761729), FRAC_CONST(0.0820482749475221), FRAC_CONST(0.0920051937045235), FRAC_CONST(0.1027410852163450), FRAC_CONST(0.1142714546239370), FRAC_CONST(0.1266077410648368), FRAC_CONST(0.1397570159398145), FRAC_CONST(0.1537217139274270), FRAC_CONST(0.1684994012857075), FRAC_CONST(0.1840825856392944), FRAC_CONST(0.2004585710384133), FRAC_CONST(0.2176093615976121), FRAC_CONST(0.2355116164824983), FRAC_CONST(0.2541366584185075), FRAC_CONST(0.2734505372545160), FRAC_CONST(0.2934141494343369), FRAC_CONST(0.3139834135200387), FRAC_CONST(0.3351095011824163), FRAC_CONST(0.3567391223361566), FRAC_CONST(0.3788148623608774), FRAC_CONST(0.4012755686250732), FRAC_CONST(0.4240567828288110), FRAC_CONST(0.4470912150133537), FRAC_CONST(0.4703092544619664), FRAC_CONST(0.4936395121456694), FRAC_CONST(0.5170093888596962), FRAC_CONST(0.5403456627591340), FRAC_CONST(0.5635750896430154), FRAC_CONST(0.5866250090612892), FRAC_CONST(0.6094239491338723), FRAC_CONST(0.6319022228794100), FRAC_CONST(0.6539925088563087), FRAC_CONST(0.6756304090216887), FRAC_CONST(0.6967549769155277), FRAC_CONST(0.7173092095766250), FRAC_CONST(0.7372404969921184), FRAC_CONST(0.7565010233699827), FRAC_CONST(0.7750481150999984), FRAC_CONST(0.7928445309277697), FRAC_CONST(0.8098586906021583), FRAC_CONST(0.8260648390616000), FRAC_CONST(0.8414431440907889), FRAC_CONST(0.8559797262966709), FRAC_CONST(0.8696666212110165), FRAC_CONST(0.8825016743142358), FRAC_CONST(0.8944883707784486), FRAC_CONST(0.9056356027326216), FRAC_CONST(0.9159573778427816), FRAC_CONST(0.9254724739583072), FRAC_CONST(0.9342040454819434), FRAC_CONST(0.9421791879559176), FRAC_CONST(0.9494284680976784), FRAC_CONST(0.9559854271440150), FRAC_CONST(0.9618860658493898), FRAC_CONST(0.9671683198119525), FRAC_CONST(0.9718715339497299), FRAC_CONST(0.9760359449042233), FRAC_CONST(0.9797021798981759), FRAC_CONST(0.9829107801140203), FRAC_CONST(0.9857017559923277), FRAC_CONST(0.9881141809867999), FRAC_CONST(0.9901858292742826), FRAC_CONST(0.9919528617340944), FRAC_CONST(0.9934495632180476), FRAC_CONST(0.9947081327749199), FRAC_CONST(0.9957585271195989), FRAC_CONST(0.9966283562984427), FRAC_CONST(0.9973428292485683), FRAC_CONST(0.9979247458259197), FRAC_CONST(0.9983945309245774), FRAC_CONST(0.9987703055583410), FRAC_CONST(0.9990679892449266), FRAC_CONST(0.9993014277313617), FRAC_CONST(0.9994825400228521), FRAC_CONST(0.9996214788122335), FRAC_CONST(0.9997267987294857), FRAC_CONST(0.9998056273097539), FRAC_CONST(0.9998638341781910), FRAC_CONST(0.9999061946325793), FRAC_CONST(0.9999365445321382), FRAC_CONST(0.9999579241373735), FRAC_CONST(0.9999727092594598), FRAC_CONST(0.9999827287418790), FRAC_CONST(0.9999893678912771), FRAC_CONST(0.9999936579844555), FRAC_CONST(0.9999963523959187), FRAC_CONST(0.9999979902130101), FRAC_CONST(0.9999989484358076), FRAC_CONST(0.9999994840031031), FRAC_CONST(0.9999997669534347), FRAC_CONST(0.9999999060327799), FRAC_CONST(0.9999999680107184), FRAC_CONST(0.9999999918774242), FRAC_CONST(0.9999999989770326) }; #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/libfaad.sln000066400000000000000000000015161357201522000212510ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "libfaad.vcproj", "{BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}.Debug|Win32.ActiveCfg = Debug|Win32 {BC3EFE27-9015-4C9C-AD3C-72B3B7ED2114}.Release|Win32.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} EndGlobalSection EndGlobal welle.io-2.1/src/libs/faad2/libfaad/libfaad.vcproj000066400000000000000000000607141357201522000217650ustar00rootroot00000000000000 welle.io-2.1/src/libs/faad2/libfaad/libfaad2.def000066400000000000000000000006021357201522000212700ustar00rootroot00000000000000LIBRARY libfaad2.dll EXPORTS ; ; libfaad2 exports ; NeAACDecOpen @1 NeAACDecGetCurrentConfiguration @2 NeAACDecSetConfiguration @3 NeAACDecInit @4 NeAACDecInit2 @5 NeAACDecDecode @6 NeAACDecClose @7 NeAACDecGetErrorMessage @8 NeAACDecAudioSpecificConfig @9 welle.io-2.1/src/libs/faad2/libfaad/libfaad2_dll.sln000066400000000000000000000015451357201522000221700ustar00rootroot00000000000000Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad2_dll", "libfaad2_dll.vcproj", "{482DA264-EE88-4575-B208-87C4CB80CD08}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {482DA264-EE88-4575-B208-87C4CB80CD08}.Debug|Win32.ActiveCfg = Debug|Win32 {482DA264-EE88-4575-B208-87C4CB80CD08}.Debug|Win32.Build.0 = Debug|Win32 {482DA264-EE88-4575-B208-87C4CB80CD08}.Release|Win32.ActiveCfg = Release|Win32 {482DA264-EE88-4575-B208-87C4CB80CD08}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal welle.io-2.1/src/libs/faad2/libfaad/libfaad2_dll.vcproj000066400000000000000000000207141357201522000226760ustar00rootroot00000000000000 welle.io-2.1/src/libs/faad2/libfaad/lt_predict.c000066400000000000000000000141671357201522000214540ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: lt_predict.c,v 1.27 2007/11/01 12:33:31 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef LTP_DEC #include #include "syntax.h" #include "lt_predict.h" #include "filtbank.h" #include "tns.h" /* static function declarations */ static int16_t real_to_int16(real_t sig_in); /* check if the object type is an object type that can have LTP */ uint8_t is_ltp_ot(uint8_t object_type) { #ifdef LTP_DEC if ((object_type == LTP) #ifdef ERROR_RESILIENCE || (object_type == ER_LTP) #endif #ifdef LD_DEC || (object_type == LD) #endif ) { return 1; } #endif return 0; } ALIGN static const real_t codebook[8] = { REAL_CONST(0.570829), REAL_CONST(0.696616), REAL_CONST(0.813004), REAL_CONST(0.911304), REAL_CONST(0.984900), REAL_CONST(1.067894), REAL_CONST(1.194601), REAL_CONST(1.369533) }; void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, uint8_t win_shape_prev, uint8_t sr_index, uint8_t object_type, uint16_t frame_len) { uint8_t sfb; uint16_t bin, i, num_samples; ALIGN real_t x_est[2048]; ALIGN real_t X_est[2048]; if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) { if (ltp->data_present) { num_samples = frame_len << 1; for(i = 0; i < num_samples; i++) { /* The extra lookback M (N/2 for LD, 0 for LTP) is handled in the buffer updating */ #if 0 x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag], codebook[ltp->coef]); #else /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real this gives a real for x_est */ x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef]; #endif } filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev, x_est, X_est, object_type, frame_len); tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est, frame_len); for (sfb = 0; sfb < ltp->last_band; sfb++) { if (ltp->long_used[sfb]) { uint16_t low = ics->swb_offset[sfb]; uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max); for (bin = low; bin < high; bin++) { spec[bin] += X_est[bin]; } } } } } } #ifdef FIXED_POINT static INLINE int16_t real_to_int16(real_t sig_in) { if (sig_in >= 0) { sig_in += (1 << (REAL_BITS-1)); if (sig_in >= REAL_CONST(32768)) return 32767; } else { sig_in += -(1 << (REAL_BITS-1)); if (sig_in <= REAL_CONST(-32768)) return -32768; } return (sig_in >> REAL_BITS); } #else static INLINE int16_t real_to_int16(real_t sig_in) { if (sig_in >= 0) { #ifndef HAS_LRINTF sig_in += 0.5f; #endif if (sig_in >= 32768.0f) return 32767; } else { #ifndef HAS_LRINTF sig_in += -0.5f; #endif if (sig_in <= -32768.0f) return -32768; } return lrintf(sig_in); } #endif void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap, uint16_t frame_len, uint8_t object_type) { uint16_t i; /* * The reference point for index i and the content of the buffer * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1) * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous * fully reconstructed time domain samples, i.e., output of the decoder. * * These values are shifted up by N*2 to avoid (i<0) * * For the LD object type an extra 512 samples lookback is accomodated here. */ #ifdef LD_DEC if (object_type == LD) { for (i = 0; i < frame_len; i++) { lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len]; lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)]; lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]); lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]); } } else { #endif for (i = 0; i < frame_len; i++) { lt_pred_stat[i] = lt_pred_stat[i + frame_len]; lt_pred_stat[frame_len + i] = real_to_int16(time[i]); lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]); #if 0 /* set to zero once upon initialisation */ lt_pred_stat[(frame_len * 3) + i] = 0; #endif } #ifdef LD_DEC } #endif } #endif welle.io-2.1/src/libs/faad2/libfaad/lt_predict.h000066400000000000000000000040621357201522000214520ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: lt_predict.h,v 1.20 2007/11/01 12:33:31 menno Exp $ **/ #ifdef LTP_DEC #ifndef __LT_PREDICT_H__ #define __LT_PREDICT_H__ #ifdef __cplusplus extern "C" { #endif #include "filtbank.h" uint8_t is_ltp_ot(uint8_t object_type); void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, uint8_t win_shape_prev, uint8_t sr_index, uint8_t object_type, uint16_t frame_len); void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap, uint16_t frame_len, uint8_t object_type); #ifdef __cplusplus } #endif #endif #endif welle.io-2.1/src/libs/faad2/libfaad/mdct.c000066400000000000000000000201041357201522000202360ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: mdct.c,v 1.47 2007/11/01 12:33:31 menno Exp $ **/ /* * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform) * and consists of three steps: pre-(I)FFT complex multiplication, complex * (I)FFT, post-(I)FFT complex multiplication, * * As described in: * P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the * Implementation of Filter Banks Based on 'Time Domain Aliasing * Cancellation," IEEE Proc. on ICASSP91, 1991, pp. 2209-2212. * * * As of April 6th 2002 completely rewritten. * This (I)MDCT can now be used for any data size n, where n is divisible by 8. * */ #include "common.h" #include "structs.h" #include #ifdef _WIN32_WCE #define assert(x) #else #include #endif #include "cfft.h" #include "mdct.h" #include "mdct_tab.h" mdct_info *faad_mdct_init(uint16_t N) { mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); assert(N % 8 == 0); mdct->N = N; /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be * scaled by sqrt("(nearest power of 2) > N" / N) */ /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N)); * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */ /* scale is 1 for fixed point, sqrt(N) for floating point */ switch (N) { case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break; case 256: mdct->sincos = (complex_t*)mdct_tab_256; break; #ifdef LD_DEC case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break; #endif #ifdef ALLOW_SMALL_FRAMELENGTH case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break; case 240: mdct->sincos = (complex_t*)mdct_tab_240; break; #ifdef LD_DEC case 960: mdct->sincos = (complex_t*)mdct_tab_960; break; #endif #endif #ifdef SSR_DEC case 512: mdct->sincos = (complex_t*)mdct_tab_512; break; case 64: mdct->sincos = (complex_t*)mdct_tab_64; break; #endif } /* initialise fft */ mdct->cfft = cffti(N/4); #ifdef PROFILE mdct->cycles = 0; mdct->fft_cycles = 0; #endif return mdct; } void faad_mdct_end(mdct_info *mdct) { if (mdct != NULL) { #ifdef PROFILE printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles); printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles); #endif cfftu(mdct->cfft); faad_free(mdct); } } void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out) { uint16_t k; complex_t x; #ifdef ALLOW_SMALL_FRAMELENGTH #ifdef FIXED_POINT real_t scale, b_scale = 0; #endif #endif ALIGN complex_t Z1[512]; complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; uint16_t N2 = N >> 1; uint16_t N4 = N >> 2; uint16_t N8 = N >> 3; #ifdef PROFILE int64_t count1, count2 = faad_get_ts(); #endif #ifdef ALLOW_SMALL_FRAMELENGTH #ifdef FIXED_POINT /* detect non-power of 2 */ if (N & (N-1)) { /* adjust scale for non-power of 2 MDCT */ /* 2048/1920 */ b_scale = 1; scale = COEF_CONST(1.0666666666666667); } #endif #endif /* pre-IFFT complex multiplication */ for (k = 0; k < N4; k++) { ComplexMult(&IM(Z1[k]), &RE(Z1[k]), X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k])); } #ifdef PROFILE count1 = faad_get_ts(); #endif /* complex IFFT, any non-scaling FFT can be used here */ cfftb(mdct->cfft, Z1); #ifdef PROFILE count1 = faad_get_ts() - count1; #endif /* post-IFFT complex multiplication */ for (k = 0; k < N4; k++) { RE(x) = RE(Z1[k]); IM(x) = IM(Z1[k]); ComplexMult(&IM(Z1[k]), &RE(Z1[k]), IM(x), RE(x), RE(sincos[k]), IM(sincos[k])); #ifdef ALLOW_SMALL_FRAMELENGTH #ifdef FIXED_POINT /* non-power of 2 MDCT scaling */ if (b_scale) { RE(Z1[k]) = MUL_C(RE(Z1[k]), scale); IM(Z1[k]) = MUL_C(IM(Z1[k]), scale); } #endif #endif } /* reordering */ for (k = 0; k < N8; k+=2) { X_out[ 2*k] = IM(Z1[N8 + k]); X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]); X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]); X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]); X_out[N4 + 2*k] = RE(Z1[ k]); X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]); X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]); X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]); X_out[N2 + 2*k] = RE(Z1[N8 + k]); X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]); X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]); X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]); X_out[N2 + N4 + 2*k] = -IM(Z1[ k]); X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]); X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]); X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]); } #ifdef PROFILE count2 = faad_get_ts() - count2; mdct->fft_cycles += count1; mdct->cycles += (count2 - count1); #endif } #ifdef LTP_DEC void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out) { uint16_t k; complex_t x; ALIGN complex_t Z1[512]; complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; uint16_t N2 = N >> 1; uint16_t N4 = N >> 2; uint16_t N8 = N >> 3; #ifndef FIXED_POINT real_t scale = REAL_CONST(N); #else real_t scale = REAL_CONST(4.0/N); #endif #ifdef ALLOW_SMALL_FRAMELENGTH #ifdef FIXED_POINT /* detect non-power of 2 */ if (N & (N-1)) { /* adjust scale for non-power of 2 MDCT */ /* *= sqrt(2048/1920) */ scale = MUL_C(scale, COEF_CONST(1.0327955589886444)); } #endif #endif /* pre-FFT complex multiplication */ for (k = 0; k < N8; k++) { uint16_t n = k << 1; RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n]; IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n]; ComplexMult(&RE(Z1[k]), &IM(Z1[k]), RE(x), IM(x), RE(sincos[k]), IM(sincos[k])); RE(Z1[k]) = MUL_R(RE(Z1[k]), scale); IM(Z1[k]) = MUL_R(IM(Z1[k]), scale); RE(x) = X_in[N2 - 1 - n] - X_in[ n]; IM(x) = X_in[N2 + n] + X_in[N - 1 - n]; ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]), RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8])); RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale); IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale); } /* complex FFT, any non-scaling FFT can be used here */ cfftf(mdct->cfft, Z1); /* post-FFT complex multiplication */ for (k = 0; k < N4; k++) { uint16_t n = k << 1; ComplexMult(&RE(x), &IM(x), RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k])); X_out[ n] = -RE(x); X_out[N2 - 1 - n] = IM(x); X_out[N2 + n] = -IM(x); X_out[N - 1 - n] = RE(x); } } #endif welle.io-2.1/src/libs/faad2/libfaad/mdct.h000066400000000000000000000031231357201522000202450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: mdct.h,v 1.30 2007/11/01 12:33:31 menno Exp $ **/ #ifndef __MDCT_H__ #define __MDCT_H__ #ifdef __cplusplus extern "C" { #endif mdct_info *faad_mdct_init(uint16_t N); void faad_mdct_end(mdct_info *mdct); void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out); void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/mdct_tab.h000066400000000000000000007464211357201522000211120ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: mdct_tab.h,v 1.7 2007/11/01 12:33:32 menno Exp $ **/ #ifndef __MDCT_TAB_H__ #define __MDCT_TAB_H__ #ifdef __cplusplus extern "C" { #endif #ifdef FIXED_POINT /* 256 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_2048[] = { { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) }, { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) }, { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) }, { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) }, { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) }, { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) }, { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) }, { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) }, { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) }, { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) }, { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) }, { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) }, { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) }, { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) }, { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) }, { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) }, { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) }, { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) }, { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) }, { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) }, { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) }, { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) }, { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) }, { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) }, { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) }, { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) }, { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) }, { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) }, { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) }, { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) }, { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) }, { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) }, { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) }, { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) }, { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) }, { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) }, { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) }, { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) }, { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) }, { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) }, { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) }, { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) }, { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) }, { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) }, { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) }, { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) }, { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) }, { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) }, { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) }, { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) }, { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) }, { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) }, { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) }, { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) }, { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) }, { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) }, { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) }, { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) }, { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) }, { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) }, { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) }, { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) }, { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) }, { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) }, { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) }, { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) }, { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) }, { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) }, { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) }, { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) }, { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) }, { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) }, { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) }, { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) }, { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) }, { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) }, { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) }, { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) }, { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) }, { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) }, { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) }, { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) }, { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) }, { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) }, { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) }, { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) }, { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) }, { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) }, { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) }, { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) }, { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) }, { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) }, { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) }, { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) }, { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) }, { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) }, { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) }, { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) }, { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) }, { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) }, { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) }, { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) }, { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) }, { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) }, { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) }, { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) }, { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) }, { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) }, { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) }, { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) }, { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) }, { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) }, { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) }, { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) }, { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) }, { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) }, { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) }, { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) }, { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) }, { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) }, { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) }, { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) }, { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) }, { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) }, { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) }, { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) }, { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) }, { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) }, { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) }, { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) }, { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) }, { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) }, { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) }, { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) }, { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) }, { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) }, { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) }, { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) }, { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) }, { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) }, { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) }, { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) }, { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) }, { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) }, { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) }, { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) }, { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) }, { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) }, { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) }, { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) }, { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) }, { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) }, { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) }, { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) }, { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) }, { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) }, { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) }, { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) }, { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) }, { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) }, { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) }, { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) }, { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) }, { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) }, { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) }, { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) }, { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) }, { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) }, { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) }, { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) }, { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) }, { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) }, { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) }, { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) }, { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) }, { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) }, { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) }, { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) }, { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) }, { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) }, { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) }, { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) }, { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) }, { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) }, { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) }, { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) }, { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) }, { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) }, { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) }, { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) }, { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) }, { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) }, { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) }, { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) }, { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) }, { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) }, { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) }, { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) }, { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) }, { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) }, { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) }, { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) }, { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) }, { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) }, { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) }, { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) }, { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) }, { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) }, { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) }, { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) }, { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) }, { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) }, { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) }, { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) }, { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) }, { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) }, { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) }, { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) }, { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) }, { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) }, { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) }, { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) }, { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) }, { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) }, { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) }, { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) }, { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) }, { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) }, { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) }, { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) }, { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) }, { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) }, { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) }, { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) }, { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) }, { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) }, { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) }, { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) }, { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) }, { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) }, { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) }, { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) }, { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) }, { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) }, { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) }, { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) }, { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) }, { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) }, { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) }, { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) }, { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) }, { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) }, { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) }, { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) }, { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) }, { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) }, { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) }, { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) }, { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) }, { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) }, { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) }, { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) }, { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) }, { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) }, { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) }, { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) }, { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) }, { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) }, { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) }, { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) }, { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) }, { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) }, { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) }, { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) }, { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) }, { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) }, { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) }, { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) }, { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) }, { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) }, { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) }, { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) }, { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) }, { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) }, { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) }, { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) }, { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) }, { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) }, { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) }, { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) }, { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) }, { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) }, { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) }, { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) }, { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) }, { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) }, { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) }, { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) }, { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) }, { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) }, { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) }, { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) }, { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) }, { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) }, { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) }, { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) }, { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) }, { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) }, { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) }, { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) }, { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) }, { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) }, { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) }, { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) }, { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) }, { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) }, { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) }, { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) }, { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) }, { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) }, { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) }, { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) }, { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) }, { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) }, { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) }, { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) }, { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) }, { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) }, { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) }, { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) }, { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) }, { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) }, { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) }, { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) }, { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) }, { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) }, { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) }, { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) }, { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) }, { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) }, { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) }, { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) }, { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) }, { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) }, { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) }, { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) }, { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) }, { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) }, { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) }, { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) }, { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) }, { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) }, { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) }, { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) }, { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) }, { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) }, { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) }, { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) }, { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) }, { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) }, { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) }, { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) }, { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) }, { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) }, { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) }, { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) }, { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) }, { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) }, { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) }, { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) }, { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) }, { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) }, { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) }, { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) }, { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) }, { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) }, { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) }, { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) }, { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) }, { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) }, { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) }, { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) }, { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) }, { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) }, { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) }, { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) }, { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) }, { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) }, { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) }, { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) }, { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) }, { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) }, { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) }, { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) }, { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) }, { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) }, { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) }, { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) }, { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) }, { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) }, { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) }, { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) }, { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) }, { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) }, { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) }, { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) }, { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) }, { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) }, { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) }, { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) }, { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) }, { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) }, { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) }, { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) }, { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) }, { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) }, { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) }, { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) }, { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) }, { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) }, { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) }, { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) }, { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) }, { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) }, { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) }, { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) }, { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) }, { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) }, { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) }, { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) }, { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) }, { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) }, { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) }, { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) }, { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) }, { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) }, { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) }, { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) }, { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) }, { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) }, { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) }, { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) }, { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) }, { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) }, { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) }, { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) }, { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) }, { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) }, { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) }, { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) }, { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) }, { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) }, { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) }, { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) }, { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) }, { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) }, { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) }, { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) }, { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) }, { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) }, { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) }, { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) }, { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) }, { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) }, { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) }, { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) }, { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) }, { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) }, { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) }, { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) }, { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) }, { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) }, { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) }, { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) }, { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) }, { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) }, { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) }, { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) }, { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) }, { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) }, { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) }, { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) }, { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) }, { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) }, { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) }, { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) }, { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) }, { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) }, { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) }, { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) }, { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) }, { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) }, { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) }, { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) }, { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) }, { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) }, { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) }, { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) }, { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) }, { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) }, { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) }, { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) }, { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) }, { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) }, { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) }, { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) }, { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) }, { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) }, { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) }, { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) }, { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) }, { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) } }; /* 64 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_256[] = { { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) }, { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) }, { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) }, { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) }, { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) }, { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) }, { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) }, { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) }, { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) }, { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) }, { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) }, { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) }, { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) }, { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) }, { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) }, { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) }, { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) }, { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) }, { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) }, { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) }, { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) }, { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) }, { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) }, { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) }, { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) }, { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) }, { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) }, { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) }, { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) }, { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) }, { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) }, { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) }, { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) }, { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) }, { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) }, { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) }, { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) }, { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) }, { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) }, { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) }, { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) }, { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) }, { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) }, { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) }, { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) }, { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) }, { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) }, { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) }, { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) }, { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) }, { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) }, { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) }, { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) }, { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) }, { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) }, { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) }, { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) }, { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) }, { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) }, { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) }, { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) }, { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) }, { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) }, { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) } }; #ifdef LD_DEC /* 256 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_1024[] = { { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) }, { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) }, { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) }, { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) }, { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) }, { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) }, { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) }, { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) }, { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) }, { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) }, { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) }, { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) }, { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) }, { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) }, { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) }, { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) }, { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) }, { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) }, { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) }, { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) }, { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) }, { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) }, { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) }, { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) }, { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) }, { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) }, { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) }, { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) }, { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) }, { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) }, { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) }, { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) }, { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) }, { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) }, { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) }, { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) }, { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) }, { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) }, { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) }, { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) }, { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) }, { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) }, { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) }, { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) }, { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) }, { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) }, { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) }, { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) }, { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) }, { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) }, { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) }, { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) }, { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) }, { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) }, { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) }, { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) }, { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) }, { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) }, { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) }, { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) }, { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) }, { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) }, { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) }, { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) }, { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) }, { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) }, { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) }, { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) }, { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) }, { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) }, { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) }, { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) }, { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) }, { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) }, { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) }, { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) }, { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) }, { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) }, { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) }, { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) }, { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) }, { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) }, { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) }, { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) }, { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) }, { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) }, { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) }, { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) }, { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) }, { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) }, { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) }, { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) }, { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) }, { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) }, { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) }, { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) }, { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) }, { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) }, { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) }, { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) }, { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) }, { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) }, { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) }, { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) }, { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) }, { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) }, { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) }, { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) }, { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) }, { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) }, { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) }, { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) }, { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) }, { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) }, { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) }, { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) }, { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) }, { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) }, { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) }, { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) }, { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) }, { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) }, { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) }, { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) }, { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) }, { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) }, { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) }, { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) }, { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) }, { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) }, { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) }, { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) }, { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) }, { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) }, { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) }, { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) }, { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) }, { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) }, { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) }, { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) }, { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) }, { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) }, { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) }, { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) }, { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) }, { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) }, { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) }, { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) }, { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) }, { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) }, { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) }, { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) }, { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) }, { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) }, { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) }, { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) }, { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) }, { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) }, { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) }, { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) }, { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) }, { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) }, { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) }, { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) }, { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) }, { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) }, { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) }, { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) }, { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) }, { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) }, { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) }, { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) }, { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) }, { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) }, { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) }, { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) }, { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) }, { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) }, { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) }, { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) }, { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) }, { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) }, { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) }, { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) }, { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) }, { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) }, { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) }, { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) }, { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) }, { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) }, { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) }, { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) }, { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) }, { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) }, { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) }, { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) }, { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) }, { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) }, { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) }, { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) }, { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) }, { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) }, { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) }, { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) }, { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) }, { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) }, { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) }, { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) }, { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) }, { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) }, { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) }, { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) }, { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) }, { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) }, { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) }, { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) }, { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) }, { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) }, { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) }, { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) }, { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) }, { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) }, { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) }, { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) }, { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) }, { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) }, { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) }, { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) }, { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) }, { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) }, { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) }, { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) }, { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) }, { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) }, { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) }, { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) }, { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) }, { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) }, { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) }, { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) }, { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) }, { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) }, { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) }, { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) }, { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) }, { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) }, { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) }, { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) }, { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) }, { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) }, { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) }, { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) }, { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) }, { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) }, { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) }, { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) } }; #endif // LD_DEC #ifdef ALLOW_SMALL_FRAMELENGTH /* 480 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_1920[] = { { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) }, { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) }, { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) }, { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) }, { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) }, { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) }, { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) }, { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) }, { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) }, { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) }, { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) }, { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) }, { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) }, { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) }, { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) }, { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) }, { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) }, { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) }, { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) }, { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) }, { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) }, { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) }, { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) }, { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) }, { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) }, { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) }, { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) }, { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) }, { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) }, { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) }, { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) }, { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) }, { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) }, { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) }, { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) }, { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) }, { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) }, { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) }, { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) }, { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) }, { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) }, { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) }, { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) }, { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) }, { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) }, { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) }, { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) }, { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) }, { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) }, { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) }, { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) }, { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) }, { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) }, { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) }, { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) }, { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) }, { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) }, { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) }, { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) }, { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) }, { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) }, { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) }, { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) }, { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) }, { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) }, { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) }, { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) }, { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) }, { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) }, { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) }, { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) }, { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) }, { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) }, { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) }, { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) }, { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) }, { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) }, { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) }, { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) }, { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) }, { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) }, { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) }, { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) }, { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) }, { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) }, { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) }, { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) }, { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) }, { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) }, { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) }, { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) }, { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) }, { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) }, { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) }, { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) }, { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) }, { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) }, { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) }, { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) }, { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) }, { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) }, { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) }, { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) }, { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) }, { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) }, { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) }, { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) }, { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) }, { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) }, { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) }, { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) }, { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) }, { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) }, { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) }, { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) }, { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) }, { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) }, { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) }, { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) }, { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) }, { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) }, { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) }, { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) }, { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) }, { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) }, { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) }, { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) }, { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) }, { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) }, { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) }, { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) }, { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) }, { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) }, { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) }, { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) }, { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) }, { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) }, { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) }, { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) }, { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) }, { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) }, { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) }, { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) }, { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) }, { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) }, { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) }, { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) }, { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) }, { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) }, { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) }, { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) }, { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) }, { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) }, { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) }, { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) }, { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) }, { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) }, { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) }, { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) }, { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) }, { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) }, { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) }, { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) }, { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) }, { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) }, { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) }, { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) }, { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) }, { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) }, { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) }, { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) }, { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) }, { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) }, { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) }, { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) }, { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) }, { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) }, { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) }, { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) }, { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) }, { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) }, { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) }, { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) }, { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) }, { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) }, { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) }, { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) }, { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) }, { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) }, { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) }, { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) }, { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) }, { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) }, { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) }, { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) }, { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) }, { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) }, { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) }, { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) }, { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) }, { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) }, { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) }, { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) }, { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) }, { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) }, { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) }, { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) }, { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) }, { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) }, { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) }, { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) }, { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) }, { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) }, { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) }, { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) }, { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) }, { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) }, { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) }, { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) }, { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) }, { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) }, { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) }, { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) }, { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) }, { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) }, { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) }, { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) }, { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) }, { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) }, { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) }, { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) }, { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) }, { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) }, { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) }, { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) }, { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) }, { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) }, { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) }, { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) }, { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) }, { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) }, { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) }, { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) }, { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) }, { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) }, { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) }, { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) }, { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) }, { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) }, { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) }, { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) }, { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) }, { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) }, { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) }, { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) }, { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) }, { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) }, { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) }, { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) }, { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) }, { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) }, { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) }, { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) }, { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) }, { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) }, { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) }, { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) }, { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) }, { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) }, { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) }, { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) }, { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) }, { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) }, { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) }, { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) }, { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) }, { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) }, { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) }, { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) }, { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) }, { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) }, { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) }, { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) }, { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) }, { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) }, { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) }, { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) }, { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) }, { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) }, { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) }, { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) }, { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) }, { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) }, { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) }, { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) }, { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) }, { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) }, { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) }, { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) }, { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) }, { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) }, { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) }, { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) }, { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) }, { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) }, { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) }, { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) }, { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) }, { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) }, { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) }, { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) }, { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) }, { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) }, { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) }, { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) }, { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) }, { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) }, { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) }, { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) }, { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) }, { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) }, { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) }, { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) }, { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) }, { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) }, { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) }, { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) }, { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) }, { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) }, { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) }, { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) }, { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) }, { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) }, { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) }, { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) }, { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) }, { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) }, { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) }, { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) }, { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) }, { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) }, { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) }, { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) }, { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) }, { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) }, { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) }, { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) }, { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) }, { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) }, { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) }, { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) }, { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) }, { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) }, { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) }, { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) }, { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) }, { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) }, { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) }, { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) }, { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) }, { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) }, { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) }, { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) }, { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) }, { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) }, { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) }, { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) }, { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) }, { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) }, { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) }, { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) }, { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) }, { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) }, { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) }, { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) }, { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) }, { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) }, { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) }, { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) }, { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) }, { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) }, { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) }, { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) }, { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) }, { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) }, { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) }, { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) }, { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) }, { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) }, { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) }, { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) }, { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) }, { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) }, { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) }, { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) }, { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) }, { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) }, { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) }, { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) }, { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) }, { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) }, { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) }, { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) }, { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) }, { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) }, { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) }, { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) }, { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) }, { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) }, { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) }, { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) }, { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) }, { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) }, { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) }, { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) }, { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) }, { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) }, { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) }, { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) }, { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) }, { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) }, { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) }, { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) }, { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) }, { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) }, { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) }, { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) }, { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) }, { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) }, { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) }, { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) }, { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) }, { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) }, { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) }, { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) }, { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) }, { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) }, { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) }, { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) }, { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) }, { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) }, { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) }, { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) }, { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) }, { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) }, { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) }, { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) }, { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) }, { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) }, { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) }, { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) }, { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) }, { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) }, { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) }, { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) }, { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) }, { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) }, { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) }, { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) }, { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) }, { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) }, { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) }, { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) }, { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) }, { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) }, { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) }, { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) }, { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) }, { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) }, { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) }, { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) }, { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) }, { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) }, { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) }, { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) }, { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) }, { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) }, { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) }, { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) }, { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) } }; #ifdef LD_DEC /* 240 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_960[] = { { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) }, { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) }, { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) }, { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) }, { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) }, { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) }, { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) }, { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) }, { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) }, { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) }, { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) }, { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) }, { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) }, { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) }, { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) }, { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) }, { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) }, { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) }, { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) }, { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) }, { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) }, { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) }, { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) }, { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) }, { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) }, { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) }, { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) }, { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) }, { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) }, { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) }, { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) }, { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) }, { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) }, { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) }, { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) }, { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) }, { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) }, { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) }, { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) }, { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) }, { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) }, { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) }, { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) }, { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) }, { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) }, { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) }, { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) }, { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) }, { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) }, { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) }, { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) }, { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) }, { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) }, { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) }, { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) }, { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) }, { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) }, { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) }, { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) }, { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) }, { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) }, { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) }, { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) }, { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) }, { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) }, { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) }, { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) }, { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) }, { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) }, { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) }, { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) }, { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) }, { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) }, { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) }, { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) }, { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) }, { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) }, { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) }, { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) }, { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) }, { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) }, { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) }, { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) }, { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) }, { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) }, { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) }, { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) }, { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) }, { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) }, { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) }, { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) }, { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) }, { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) }, { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) }, { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) }, { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) }, { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) }, { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) }, { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) }, { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) }, { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) }, { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) }, { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) }, { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) }, { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) }, { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) }, { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) }, { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) }, { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) }, { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) }, { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) }, { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) }, { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) }, { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) }, { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) }, { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) }, { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) }, { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) }, { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) }, { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) }, { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) }, { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) }, { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) }, { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) }, { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) }, { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) }, { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) }, { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) }, { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) }, { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) }, { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) }, { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) }, { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) }, { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) }, { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) }, { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) }, { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) }, { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) }, { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) }, { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) }, { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) }, { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) }, { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) }, { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) }, { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) }, { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) }, { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) }, { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) }, { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) }, { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) }, { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) }, { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) }, { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) }, { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) }, { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) }, { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) }, { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) }, { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) }, { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) }, { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) }, { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) }, { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) }, { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) }, { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) }, { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) }, { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) }, { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) }, { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) }, { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) }, { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) }, { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) }, { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) }, { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) }, { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) }, { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) }, { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) }, { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) }, { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) }, { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) }, { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) }, { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) }, { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) }, { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) }, { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) }, { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) }, { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) }, { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) }, { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) }, { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) }, { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) }, { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) }, { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) }, { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) }, { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) }, { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) }, { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) }, { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) }, { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) }, { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) }, { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) }, { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) }, { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) }, { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) }, { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) }, { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) }, { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) }, { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) }, { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) }, { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) }, { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) }, { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) }, { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) }, { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) }, { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) }, { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) }, { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) }, { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) }, { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) }, { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) }, { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) }, { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) }, { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) }, { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) }, { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) }, { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) }, { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) }, { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) }, { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) }, { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) }, { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) }, { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) }, { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) }, { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) }, { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) }, { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) }, { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) }, { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) }, { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) }, { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) }, { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) } }; #endif // LD_DEC /* 60 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_240[] = { { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) }, { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) }, { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) }, { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) }, { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) }, { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) }, { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) }, { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) }, { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) }, { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) }, { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) }, { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) }, { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) }, { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) }, { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) }, { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) }, { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) }, { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) }, { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) }, { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) }, { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) }, { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) }, { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) }, { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) }, { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) }, { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) }, { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) }, { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) }, { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) }, { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) }, { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) }, { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) }, { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) }, { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) }, { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) }, { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) }, { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) }, { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) }, { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) }, { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) }, { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) }, { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) }, { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) }, { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) }, { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) }, { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) }, { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) }, { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) }, { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) }, { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) }, { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) }, { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) }, { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) }, { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) }, { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) }, { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) }, { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) }, { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) }, { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) }, { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) } }; #endif // ALLOW_SMALL_FRAMELENGTH #ifdef SSR_DEC /* 128 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_512[] = { { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) }, { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) }, { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) }, { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) }, { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) }, { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) }, { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) }, { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) }, { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) }, { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) }, { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) }, { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) }, { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) }, { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) }, { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) }, { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) }, { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) }, { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) }, { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) }, { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) }, { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) }, { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) }, { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) }, { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) }, { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) }, { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) }, { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) }, { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) }, { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) }, { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) }, { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) }, { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) }, { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) }, { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) }, { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) }, { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) }, { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) }, { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) }, { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) }, { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) }, { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) }, { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) }, { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) }, { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) }, { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) }, { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) }, { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) }, { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) }, { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) }, { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) }, { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) }, { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) }, { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) }, { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) }, { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) }, { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) }, { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) }, { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) }, { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) }, { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) }, { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) }, { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) }, { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) }, { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) }, { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) }, { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) }, { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) }, { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) }, { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) }, { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) }, { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) }, { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) }, { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) }, { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) }, { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) }, { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) }, { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) }, { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) }, { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) }, { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) }, { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) }, { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) }, { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) }, { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) }, { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) }, { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) }, { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) }, { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) }, { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) }, { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) }, { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) }, { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) }, { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) }, { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) }, { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) }, { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) }, { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) }, { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) }, { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) }, { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) }, { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) }, { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) }, { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) }, { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) }, { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) }, { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) }, { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) }, { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) }, { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) }, { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) }, { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) }, { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) }, { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) }, { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) }, { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) }, { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) }, { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) }, { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) }, { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) }, { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) }, { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) }, { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) }, { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) }, { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) }, { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) }, { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) }, { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) }, { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) } }; /* 16 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_64[] = { { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) }, { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) }, { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) }, { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) }, { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) }, { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) }, { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) }, { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) }, { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) }, { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) }, { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) }, { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) }, { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) }, { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) }, { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) }, { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) } }; #endif // SSR_DEC #else // FIXED_POINT /* 256 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_2048[] = { { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) }, { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) }, { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) }, { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) }, { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) }, { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) }, { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) }, { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) }, { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) }, { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) }, { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) }, { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) }, { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) }, { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) }, { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) }, { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) }, { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) }, { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) }, { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) }, { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) }, { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) }, { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) }, { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) }, { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) }, { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) }, { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) }, { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) }, { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) }, { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) }, { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) }, { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) }, { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) }, { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) }, { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) }, { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) }, { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) }, { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) }, { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) }, { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) }, { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) }, { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) }, { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) }, { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) }, { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) }, { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) }, { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) }, { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) }, { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) }, { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) }, { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) }, { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) }, { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) }, { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) }, { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) }, { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) }, { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) }, { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) }, { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) }, { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) }, { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) }, { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) }, { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) }, { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) }, { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) }, { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) }, { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) }, { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) }, { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) }, { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) }, { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) }, { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) }, { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) }, { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) }, { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) }, { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) }, { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) }, { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) }, { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) }, { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) }, { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) }, { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) }, { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) }, { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) }, { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) }, { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) }, { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) }, { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) }, { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) }, { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) }, { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) }, { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) }, { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) }, { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) }, { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) }, { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) }, { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) }, { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) }, { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) }, { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) }, { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) }, { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) }, { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) }, { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) }, { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) }, { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) }, { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) }, { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) }, { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) }, { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) }, { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) }, { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) }, { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) }, { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) }, { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) }, { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) }, { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) }, { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) }, { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) }, { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) }, { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) }, { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) }, { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) }, { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) }, { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) }, { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) }, { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) }, { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) }, { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) }, { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) }, { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) }, { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) }, { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) }, { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) }, { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) }, { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) }, { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) }, { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) }, { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) }, { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) }, { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) }, { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) }, { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) }, { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) }, { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) }, { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) }, { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) }, { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) }, { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) }, { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) }, { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) }, { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) }, { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) }, { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) }, { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) }, { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) }, { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) }, { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) }, { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) }, { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) }, { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) }, { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) }, { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) }, { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) }, { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) }, { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) }, { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) }, { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) }, { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) }, { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) }, { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) }, { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) }, { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) }, { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) }, { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) }, { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) }, { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) }, { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) }, { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) }, { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) }, { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) }, { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) }, { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) }, { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) }, { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) }, { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) }, { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) }, { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) }, { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) }, { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) }, { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) }, { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) }, { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) }, { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) }, { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) }, { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) }, { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) }, { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) }, { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) }, { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) }, { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) }, { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) }, { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) }, { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) }, { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) }, { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) }, { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) }, { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) }, { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) }, { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) }, { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) }, { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) }, { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) }, { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) }, { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) }, { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) }, { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) }, { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) }, { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) }, { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) }, { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) }, { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) }, { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) }, { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) }, { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) }, { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) }, { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) }, { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) }, { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) }, { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) }, { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) }, { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) }, { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) }, { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) }, { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) }, { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) }, { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) }, { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) }, { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) }, { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) }, { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) }, { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) }, { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) }, { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) }, { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) }, { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) }, { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) }, { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) }, { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) }, { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) }, { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) }, { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) }, { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) }, { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) }, { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) }, { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) }, { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) }, { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) }, { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) }, { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) }, { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) }, { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) }, { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) }, { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) }, { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) }, { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) }, { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) }, { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) }, { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) }, { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) }, { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) }, { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) }, { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) }, { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) }, { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) }, { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) }, { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) }, { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) }, { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) }, { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) }, { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) }, { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) }, { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) }, { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) }, { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) }, { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) }, { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) }, { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) }, { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) }, { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) }, { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) }, { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) }, { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) }, { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) }, { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) }, { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) }, { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) }, { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) }, { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) }, { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) }, { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) }, { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) }, { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) }, { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) }, { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) }, { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) }, { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) }, { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) }, { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) }, { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) }, { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) }, { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) }, { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) }, { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) }, { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) }, { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) }, { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) }, { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) }, { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) }, { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) }, { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) }, { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) }, { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) }, { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) }, { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) }, { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) }, { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) }, { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) }, { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) }, { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) }, { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) }, { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) }, { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) }, { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) }, { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) }, { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) }, { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) }, { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) }, { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) }, { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) }, { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) }, { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) }, { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) }, { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) }, { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) }, { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) }, { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) }, { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) }, { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) }, { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) }, { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) }, { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) }, { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) }, { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) }, { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) }, { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) }, { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) }, { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) }, { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) }, { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) }, { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) }, { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) }, { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) }, { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) }, { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) }, { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) }, { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) }, { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) }, { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) }, { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) }, { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) }, { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) }, { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) }, { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) }, { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) }, { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) }, { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) }, { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) }, { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) }, { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) }, { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) }, { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) }, { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) }, { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) }, { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) }, { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) }, { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) }, { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) }, { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) }, { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) }, { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) }, { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) }, { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) }, { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) }, { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) }, { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) }, { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) }, { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) }, { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) }, { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) }, { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) }, { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) }, { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) }, { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) }, { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) }, { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) }, { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) }, { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) }, { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) }, { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) }, { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) }, { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) }, { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) }, { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) }, { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) }, { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) }, { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) }, { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) }, { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) }, { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) }, { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) }, { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) }, { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) }, { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) }, { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) }, { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) }, { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) }, { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) }, { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) }, { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) }, { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) }, { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) }, { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) }, { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) }, { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) }, { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) }, { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) }, { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) }, { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) }, { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) }, { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) }, { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) }, { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) }, { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) }, { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) }, { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) }, { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) }, { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) }, { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) }, { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) }, { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) }, { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) }, { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) }, { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) }, { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) }, { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) }, { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) }, { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) }, { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) }, { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) }, { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) }, { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) }, { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) }, { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) }, { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) }, { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) }, { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) }, { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) }, { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) }, { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) }, { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) }, { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) }, { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) }, { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) }, { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) }, { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) }, { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) }, { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) }, { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) }, { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) }, { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) }, { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) }, { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) }, { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) }, { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) }, { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) }, { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) }, { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) }, { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) }, { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) }, { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) }, { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) }, { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) }, { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) }, { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) }, { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) }, { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) }, { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) }, { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) }, { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) }, { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) }, { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) }, { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) }, { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) }, { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) }, { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) }, { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) }, { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) }, { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) }, { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) }, { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) }, { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) }, { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) } }; /* 64 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_256[] = { { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) }, { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) }, { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) }, { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) }, { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) }, { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) }, { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) }, { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) }, { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) }, { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) }, { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) }, { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) }, { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) }, { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) }, { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) }, { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) }, { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) }, { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) }, { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) }, { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) }, { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) }, { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) }, { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) }, { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) }, { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) }, { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) }, { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) }, { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) }, { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) }, { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) }, { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) }, { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) }, { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) }, { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) }, { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) }, { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) }, { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) }, { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) }, { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) }, { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) }, { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) }, { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) }, { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) }, { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) }, { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) }, { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) }, { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) }, { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) }, { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) }, { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) }, { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) }, { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) }, { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) }, { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) }, { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) }, { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) }, { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) }, { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) }, { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) }, { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) }, { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) }, { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) }, { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) }, { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) } }; #ifdef LD_DEC /* 128 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_1024[] = { { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) }, { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) }, { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) }, { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) }, { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) }, { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) }, { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) }, { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) }, { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) }, { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) }, { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) }, { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) }, { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) }, { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) }, { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) }, { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) }, { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) }, { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) }, { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) }, { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) }, { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) }, { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) }, { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) }, { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) }, { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) }, { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) }, { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) }, { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) }, { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) }, { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) }, { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) }, { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) }, { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) }, { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) }, { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) }, { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) }, { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) }, { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) }, { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) }, { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) }, { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) }, { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) }, { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) }, { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) }, { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) }, { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) }, { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) }, { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) }, { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) }, { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) }, { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) }, { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) }, { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) }, { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) }, { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) }, { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) }, { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) }, { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) }, { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) }, { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) }, { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) }, { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) }, { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) }, { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) }, { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) }, { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) }, { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) }, { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) }, { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) }, { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) }, { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) }, { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) }, { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) }, { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) }, { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) }, { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) }, { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) }, { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) }, { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) }, { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) }, { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) }, { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) }, { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) }, { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) }, { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) }, { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) }, { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) }, { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) }, { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) }, { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) }, { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) }, { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) }, { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) }, { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) }, { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) }, { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) }, { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) }, { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) }, { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) }, { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) }, { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) }, { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) }, { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) }, { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) }, { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) }, { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) }, { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) }, { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) }, { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) }, { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) }, { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) }, { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) }, { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) }, { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) }, { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) }, { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) }, { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) }, { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) }, { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) }, { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) }, { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) }, { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) }, { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) }, { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) }, { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) }, { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) }, { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) }, { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) }, { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) }, { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) }, { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) }, { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) }, { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) }, { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) }, { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) }, { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) }, { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) }, { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) }, { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) }, { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) }, { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) }, { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) }, { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) }, { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) }, { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) }, { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) }, { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) }, { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) }, { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) }, { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) }, { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) }, { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) }, { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) }, { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) }, { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) }, { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) }, { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) }, { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) }, { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) }, { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) }, { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) }, { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) }, { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) }, { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) }, { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) }, { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) }, { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) }, { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) }, { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) }, { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) }, { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) }, { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) }, { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) }, { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) }, { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) }, { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) }, { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) }, { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) }, { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) }, { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) }, { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) }, { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) }, { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) }, { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) }, { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) }, { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) }, { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) }, { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) }, { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) }, { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) }, { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) }, { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) }, { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) }, { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) }, { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) }, { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) }, { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) }, { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) }, { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) }, { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) }, { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) }, { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) }, { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) }, { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) }, { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) }, { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) }, { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) }, { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) }, { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) }, { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) }, { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) }, { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) }, { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) }, { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) }, { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) }, { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) }, { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) }, { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) }, { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) }, { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) }, { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) }, { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) }, { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) }, { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) }, { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) }, { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) }, { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) }, { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) }, { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) }, { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) }, { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) }, { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) }, { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) }, { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) }, { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) }, { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) }, { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) }, { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) }, { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) }, { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) }, { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) }, { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) }, { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) }, { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) }, { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) }, { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) }, { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) }, { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) }, { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) }, { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) }, { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) }, { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) }, { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) }, { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) }, { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) }, { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) } }; #endif // LD_DEC #ifdef ALLOW_SMALL_FRAMELENGTH /* 480 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_1920[] = { { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) }, { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) }, { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) }, { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) }, { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) }, { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) }, { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) }, { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) }, { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) }, { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) }, { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) }, { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) }, { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) }, { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) }, { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) }, { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) }, { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) }, { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) }, { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) }, { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) }, { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) }, { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) }, { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) }, { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) }, { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) }, { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) }, { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) }, { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) }, { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) }, { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) }, { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) }, { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) }, { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) }, { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) }, { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) }, { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) }, { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) }, { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) }, { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) }, { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) }, { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) }, { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) }, { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) }, { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) }, { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) }, { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) }, { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) }, { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) }, { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) }, { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) }, { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) }, { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) }, { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) }, { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) }, { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) }, { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) }, { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) }, { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) }, { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) }, { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) }, { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) }, { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) }, { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) }, { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) }, { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) }, { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) }, { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) }, { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) }, { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) }, { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) }, { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) }, { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) }, { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) }, { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) }, { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) }, { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) }, { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) }, { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) }, { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) }, { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) }, { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) }, { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) }, { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) }, { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) }, { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) }, { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) }, { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) }, { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) }, { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) }, { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) }, { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) }, { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) }, { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) }, { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) }, { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) }, { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) }, { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) }, { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) }, { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) }, { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) }, { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) }, { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) }, { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) }, { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) }, { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) }, { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) }, { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) }, { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) }, { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) }, { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) }, { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) }, { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) }, { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) }, { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) }, { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) }, { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) }, { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) }, { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) }, { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) }, { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) }, { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) }, { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) }, { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) }, { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) }, { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) }, { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) }, { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) }, { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) }, { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) }, { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) }, { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) }, { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) }, { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) }, { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) }, { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) }, { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) }, { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) }, { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) }, { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) }, { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) }, { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) }, { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) }, { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) }, { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) }, { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) }, { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) }, { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) }, { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) }, { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) }, { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) }, { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) }, { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) }, { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) }, { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) }, { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) }, { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) }, { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) }, { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) }, { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) }, { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) }, { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) }, { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) }, { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) }, { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) }, { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) }, { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) }, { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) }, { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) }, { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) }, { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) }, { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) }, { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) }, { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) }, { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) }, { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) }, { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) }, { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) }, { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) }, { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) }, { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) }, { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) }, { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) }, { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) }, { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) }, { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) }, { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) }, { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) }, { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) }, { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) }, { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) }, { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) }, { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) }, { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) }, { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) }, { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) }, { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) }, { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) }, { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) }, { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) }, { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) }, { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) }, { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) }, { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) }, { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) }, { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) }, { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) }, { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) }, { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) }, { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) }, { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) }, { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) }, { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) }, { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) }, { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) }, { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) }, { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) }, { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) }, { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) }, { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) }, { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) }, { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) }, { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) }, { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) }, { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) }, { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) }, { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) }, { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) }, { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) }, { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) }, { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) }, { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) }, { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) }, { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) }, { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) }, { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) }, { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) }, { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) }, { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) }, { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) }, { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) }, { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) }, { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) }, { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) }, { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) }, { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) }, { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) }, { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) }, { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) }, { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) }, { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) }, { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) }, { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) }, { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) }, { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) }, { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) }, { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) }, { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) }, { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) }, { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) }, { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) }, { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) }, { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) }, { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) }, { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) }, { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) }, { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) }, { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) }, { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) }, { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) }, { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) }, { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) }, { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) }, { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) }, { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) }, { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) }, { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) }, { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) }, { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) }, { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) }, { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) }, { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) }, { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) }, { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) }, { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) }, { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) }, { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) }, { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) }, { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) }, { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) }, { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) }, { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) }, { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) }, { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) }, { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) }, { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) }, { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) }, { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) }, { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) }, { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) }, { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) }, { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) }, { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) }, { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) }, { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) }, { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) }, { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) }, { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) }, { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) }, { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) }, { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) }, { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) }, { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) }, { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) }, { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) }, { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) }, { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) }, { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) }, { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) }, { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) }, { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) }, { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) }, { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) }, { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) }, { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) }, { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) }, { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) }, { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) }, { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) }, { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) }, { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) }, { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) }, { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) }, { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) }, { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) }, { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) }, { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) }, { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) }, { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) }, { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) }, { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) }, { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) }, { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) }, { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) }, { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) }, { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) }, { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) }, { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) }, { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) }, { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) }, { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) }, { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) }, { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) }, { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) }, { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) }, { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) }, { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) }, { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) }, { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) }, { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) }, { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) }, { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) }, { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) }, { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) }, { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) }, { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) }, { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) }, { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) }, { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) }, { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) }, { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) }, { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) }, { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) }, { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) }, { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) }, { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) }, { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) }, { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) }, { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) }, { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) }, { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) }, { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) }, { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) }, { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) }, { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) }, { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) }, { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) }, { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) }, { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) }, { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) }, { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) }, { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) }, { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) }, { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) }, { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) }, { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) }, { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) }, { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) }, { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) }, { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) }, { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) }, { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) }, { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) }, { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) }, { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) }, { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) }, { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) }, { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) }, { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) }, { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) }, { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) }, { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) }, { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) }, { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) }, { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) }, { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) }, { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) }, { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) }, { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) }, { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) }, { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) }, { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) }, { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) }, { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) }, { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) }, { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) }, { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) }, { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) }, { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) }, { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) }, { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) }, { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) }, { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) }, { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) }, { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) }, { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) }, { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) }, { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) }, { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) }, { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) }, { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) }, { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) }, { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) }, { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) }, { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) }, { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) }, { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) }, { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) }, { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) }, { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) }, { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) }, { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) }, { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) }, { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) }, { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) }, { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) }, { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) }, { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) }, { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) }, { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) }, { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) }, { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) }, { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) }, { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) }, { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) }, { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) }, { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) }, { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) }, { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) }, { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) }, { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) }, { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) }, { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) }, { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) }, { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) }, { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) }, { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) }, { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) }, { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) }, { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) }, { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) } }; #ifdef LD_DEC /* 240 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_960[] = { { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) }, { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) }, { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) }, { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) }, { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) }, { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) }, { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) }, { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) }, { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) }, { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) }, { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) }, { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) }, { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) }, { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) }, { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) }, { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) }, { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) }, { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) }, { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) }, { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) }, { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) }, { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) }, { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) }, { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) }, { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) }, { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) }, { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) }, { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) }, { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) }, { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) }, { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) }, { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) }, { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) }, { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) }, { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) }, { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) }, { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) }, { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) }, { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) }, { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) }, { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) }, { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) }, { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) }, { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) }, { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) }, { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) }, { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) }, { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) }, { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) }, { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) }, { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) }, { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) }, { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) }, { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) }, { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) }, { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) }, { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) }, { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) }, { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) }, { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) }, { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) }, { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) }, { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) }, { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) }, { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) }, { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) }, { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) }, { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) }, { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) }, { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) }, { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) }, { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) }, { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) }, { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) }, { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) }, { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) }, { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) }, { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) }, { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) }, { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) }, { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) }, { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) }, { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) }, { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) }, { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) }, { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) }, { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) }, { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) }, { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) }, { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) }, { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) }, { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) }, { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) }, { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) }, { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) }, { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) }, { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) }, { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) }, { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) }, { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) }, { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) }, { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) }, { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) }, { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) }, { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) }, { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) }, { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) }, { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) }, { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) }, { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) }, { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) }, { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) }, { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) }, { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) }, { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) }, { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) }, { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) }, { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) }, { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) }, { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) }, { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) }, { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) }, { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) }, { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) }, { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) }, { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) }, { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) }, { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) }, { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) }, { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) }, { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) }, { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) }, { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) }, { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) }, { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) }, { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) }, { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) }, { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) }, { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) }, { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) }, { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) }, { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) }, { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) }, { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) }, { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) }, { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) }, { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) }, { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) }, { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) }, { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) }, { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) }, { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) }, { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) }, { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) }, { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) }, { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) }, { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) }, { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) }, { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) }, { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) }, { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) }, { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) }, { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) }, { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) }, { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) }, { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) }, { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) }, { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) }, { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) }, { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) }, { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) }, { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) }, { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) }, { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) }, { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) }, { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) }, { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) }, { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) }, { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) }, { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) }, { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) }, { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) }, { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) }, { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) }, { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) }, { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) }, { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) }, { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) }, { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) }, { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) }, { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) }, { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) }, { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) }, { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) }, { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) }, { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) }, { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) }, { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) }, { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) }, { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) }, { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) }, { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) }, { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) }, { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) }, { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) }, { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) }, { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) }, { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) }, { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) }, { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) }, { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) }, { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) }, { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) }, { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) }, { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) }, { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) }, { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) }, { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) }, { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) }, { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) }, { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) }, { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) }, { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) }, { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) }, { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) }, { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) }, { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) }, { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) }, { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) }, { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) }, { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) }, { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) }, { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) }, { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) }, { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) }, { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) }, { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) }, { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) }, { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) }, { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) } }; #endif // LD_DEC /* 60 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_240[] = { { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) }, { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) }, { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) }, { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) }, { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) }, { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) }, { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) }, { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) }, { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) }, { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) }, { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) }, { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) }, { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) }, { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) }, { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) }, { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) }, { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) }, { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) }, { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) }, { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) }, { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) }, { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) }, { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) }, { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) }, { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) }, { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) }, { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) }, { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) }, { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) }, { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) }, { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) }, { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) }, { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) }, { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) }, { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) }, { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) }, { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) }, { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) }, { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) }, { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) }, { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) }, { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) }, { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) }, { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) }, { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) }, { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) }, { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) }, { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) }, { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) }, { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) }, { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) }, { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) }, { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) }, { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) }, { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) }, { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) }, { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) }, { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) }, { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) }, { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) } }; #endif // ALLOW_SMALL_FRAMELENGTH #ifdef SSR_DEC /* 128 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_512[] = { { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) }, { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) }, { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) }, { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) }, { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) }, { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) }, { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) }, { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) }, { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) }, { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) }, { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) }, { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) }, { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) }, { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) }, { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) }, { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) }, { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) }, { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) }, { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) }, { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) }, { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) }, { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) }, { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) }, { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) }, { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) }, { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) }, { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) }, { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) }, { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) }, { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) }, { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) }, { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) }, { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) }, { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) }, { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) }, { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) }, { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) }, { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) }, { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) }, { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) }, { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) }, { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) }, { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) }, { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) }, { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) }, { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) }, { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) }, { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) }, { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) }, { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) }, { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) }, { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) }, { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) }, { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) }, { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) }, { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) }, { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) }, { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) }, { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) }, { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) }, { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) }, { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) }, { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) }, { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) }, { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) }, { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) }, { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) }, { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) }, { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) }, { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) }, { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) }, { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) }, { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) }, { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) }, { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) }, { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) }, { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) }, { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) }, { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) }, { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) }, { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) }, { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) }, { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) }, { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) }, { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) }, { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) }, { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) }, { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) }, { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) }, { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) }, { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) }, { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) }, { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) }, { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) }, { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) }, { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) }, { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) }, { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) }, { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) }, { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) }, { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) }, { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) }, { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) }, { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) }, { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) }, { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) }, { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) }, { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) }, { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) }, { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) }, { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) }, { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) }, { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) }, { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) }, { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) }, { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) }, { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) }, { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) }, { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) }, { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) }, { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) }, { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) }, { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) }, { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) }, { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) }, { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) }, { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) }, { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) } }; /* 16 (N/4) complex twiddle factors */ ALIGN static const complex_t mdct_tab_64[] = { { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) }, { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) }, { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) }, { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) }, { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) }, { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) }, { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) }, { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) }, { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) }, { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) }, { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) }, { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) }, { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) }, { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) }, { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) }, { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) } }; #endif // SSR_DEC #endif // FIXED_POINT #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/mp4.c000066400000000000000000000225741357201522000200240ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: mp4.c,v 1.40 2009/02/06 03:39:58 menno Exp $ **/ #include "common.h" #include "structs.h" #include #include "bits.h" #include "mp4.h" #include "syntax.h" /* defines if an object type can be decoded by this library or not */ static uint8_t ObjectTypesTable[32] = { 0, /* 0 NULL */ #ifdef MAIN_DEC 1, /* 1 AAC Main */ #else 0, /* 1 AAC Main */ #endif 1, /* 2 AAC LC */ #ifdef SSR_DEC 1, /* 3 AAC SSR */ #else 0, /* 3 AAC SSR */ #endif #ifdef LTP_DEC 1, /* 4 AAC LTP */ #else 0, /* 4 AAC LTP */ #endif #ifdef SBR_DEC 1, /* 5 SBR */ #else 0, /* 5 SBR */ #endif 0, /* 6 AAC Scalable */ 0, /* 7 TwinVQ */ 0, /* 8 CELP */ 0, /* 9 HVXC */ 0, /* 10 Reserved */ 0, /* 11 Reserved */ 0, /* 12 TTSI */ 0, /* 13 Main synthetic */ 0, /* 14 Wavetable synthesis */ 0, /* 15 General MIDI */ 0, /* 16 Algorithmic Synthesis and Audio FX */ /* MPEG-4 Version 2 */ #ifdef ERROR_RESILIENCE 1, /* 17 ER AAC LC */ 0, /* 18 (Reserved) */ #ifdef LTP_DEC 1, /* 19 ER AAC LTP */ #else 0, /* 19 ER AAC LTP */ #endif 0, /* 20 ER AAC scalable */ 0, /* 21 ER TwinVQ */ 0, /* 22 ER BSAC */ #ifdef LD_DEC 1, /* 23 ER AAC LD */ #else 0, /* 23 ER AAC LD */ #endif 0, /* 24 ER CELP */ 0, /* 25 ER HVXC */ 0, /* 26 ER HILN */ 0, /* 27 ER Parametric */ #else /* No ER defined */ 0, /* 17 ER AAC LC */ 0, /* 18 (Reserved) */ 0, /* 19 ER AAC LTP */ 0, /* 20 ER AAC scalable */ 0, /* 21 ER TwinVQ */ 0, /* 22 ER BSAC */ 0, /* 23 ER AAC LD */ 0, /* 24 ER CELP */ 0, /* 25 ER HVXC */ 0, /* 26 ER HILN */ 0, /* 27 ER Parametric */ #endif 0, /* 28 (Reserved) */ 0, /* 29 (Reserved) */ 0, /* 30 (Reserved) */ 0 /* 31 (Reserved) */ }; /* Table 1.6.1 */ char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, unsigned long buffer_size, mp4AudioSpecificConfig *mp4ASC) { return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL, 0); } int8_t AudioSpecificConfigFromBitfile(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, program_config *pce, uint32_t buffer_size, uint8_t short_form) { int8_t result = 0; uint32_t startpos = faad_get_processed_bits(ld); #ifdef SBR_DEC int8_t bits_to_decode = 0; #endif if (mp4ASC == NULL) return -8; memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig)); mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex")); if(mp4ASC->samplingFrequencyIndex==0x0f) faad_getbits(ld, 24); mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration")); mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1) { return -1; } if (mp4ASC->samplingFrequency == 0) { return -2; } if (mp4ASC->channelsConfiguration > 7) { return -3; } #if (defined(PS_DEC) || defined(DRM_PS)) /* check if we have a mono file */ if (mp4ASC->channelsConfiguration == 1) { /* upMatrix to 2 channels for implicit signalling of PS */ mp4ASC->channelsConfiguration = 2; } #endif #ifdef SBR_DEC mp4ASC->sbr_present_flag = -1; if (mp4ASC->objectTypeIndex == 5) { uint8_t tmp; mp4ASC->sbr_present_flag = 1; tmp = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); /* check for downsampled SBR */ if (tmp == mp4ASC->samplingFrequencyIndex) mp4ASC->downSampledSBR = 1; mp4ASC->samplingFrequencyIndex = tmp; if (mp4ASC->samplingFrequencyIndex == 15) { mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24 DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); } else { mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); } mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); } #endif /* get GASpecificConfig */ if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 || mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 || mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7) { result = GASpecificConfig(ld, mp4ASC, pce); #ifdef ERROR_RESILIENCE } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */ result = GASpecificConfig(ld, mp4ASC, pce); mp4ASC->epConfig = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig")); if (mp4ASC->epConfig != 0) result = -5; #endif } else { result = -4; } #ifdef SSR_DEC /* shorter frames not allowed for SSR */ if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag) return -6; #endif #ifdef SBR_DEC if(short_form) bits_to_decode = 0; else bits_to_decode = (int8_t)(buffer_size*8 - (startpos-faad_get_processed_bits(ld))); if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16)) { int16_t syncExtensionType = (int16_t)faad_getbits(ld, 11 DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType")); if (syncExtensionType == 0x2b7) { uint8_t tmp_OTi = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType")); if (tmp_OTi == 5) { mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(ld DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag")); if (mp4ASC->sbr_present_flag) { uint8_t tmp; /* Don't set OT to SBR until checked that it is actually there */ mp4ASC->objectTypeIndex = tmp_OTi; tmp = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); /* check for downsampled SBR */ if (tmp == mp4ASC->samplingFrequencyIndex) mp4ASC->downSampledSBR = 1; mp4ASC->samplingFrequencyIndex = tmp; if (mp4ASC->samplingFrequencyIndex == 15) { mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24 DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); } else { mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); } } } } } /* no SBR signalled, this could mean either implicit signalling or no SBR in this file */ /* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */ if (mp4ASC->sbr_present_flag == -1) { if (mp4ASC->samplingFrequency <= 24000) { mp4ASC->samplingFrequency *= 2; mp4ASC->forceUpSampling = 1; } else /* > 24000*/ { mp4ASC->downSampledSBR = 1; } } #endif faad_endbits(ld); return result; } int8_t AudioSpecificConfig2(uint8_t *pBuffer, uint32_t buffer_size, mp4AudioSpecificConfig *mp4ASC, program_config *pce, uint8_t short_form) { uint8_t ret = 0; bitfile ld; faad_initbits(&ld, pBuffer, buffer_size); faad_byte_align(&ld); ret = AudioSpecificConfigFromBitfile(&ld, mp4ASC, pce, buffer_size, short_form); faad_endbits(&ld); return ret; } welle.io-2.1/src/libs/faad2/libfaad/mp4.h000066400000000000000000000035311357201522000200210ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: mp4.h,v 1.28 2009/02/05 00:51:03 menno Exp $ **/ #ifndef __MP4_H__ #define __MP4_H__ #ifdef __cplusplus extern "C" { #endif #include "neaacdec.h" int8_t AudioSpecificConfig2(uint8_t *pBuffer, uint32_t buffer_size, mp4AudioSpecificConfig *mp4ASC, program_config *pce, uint8_t short_form); int8_t AudioSpecificConfigFromBitfile(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, program_config *pce, uint32_t bsize, uint8_t short_form); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ms.c000066400000000000000000000053401357201522000177330ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ms.c,v 1.21 2007/11/01 12:33:32 menno Exp $ **/ #include "common.h" #include "structs.h" #include "syntax.h" #include "ms.h" #include "is.h" #include "pns.h" void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, uint16_t frame_len) { uint8_t g, b, sfb; uint8_t group = 0; uint16_t nshort = frame_len/8; uint16_t i, k; real_t tmp; if (ics->ms_mask_present >= 1) { for (g = 0; g < ics->num_window_groups; g++) { for (b = 0; b < ics->window_group_length[g]; b++) { for (sfb = 0; sfb < ics->max_sfb; sfb++) { /* If intensity stereo coding or noise substitution is on for a particular scalefactor band, no M/S stereo decoding is carried out. */ if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) && !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb)) { for (i = ics->swb_offset[sfb]; i < min(ics->swb_offset[sfb+1], ics->swb_offset_max); i++) { k = (group*nshort) + i; tmp = l_spec[k] - r_spec[k]; l_spec[k] = l_spec[k] + r_spec[k]; r_spec[k] = tmp; } } } group++; } } } } welle.io-2.1/src/libs/faad2/libfaad/ms.h000066400000000000000000000027661357201522000177510ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ms.h,v 1.19 2007/11/01 12:33:32 menno Exp $ **/ #ifndef __MS_H__ #define __MS_H__ #ifdef __cplusplus extern "C" { #endif void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, uint16_t frame_len); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/out.txt000066400000000000000000000001511357201522000205130ustar00rootroot00000000000000hcb_10.h hcb_11.h hcb_1.h hcb_2.h hcb_3.h hcb_4.h hcb_5.h hcb_6.h hcb_7.h hcb_8.h hcb_9.h hcb.h hcb_sf.h welle.io-2.1/src/libs/faad2/libfaad/output.c000066400000000000000000000425741357201522000206660ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: output.c,v 1.47 2009/01/26 23:51:15 menno Exp $ **/ #include "common.h" #include "structs.h" #include "output.h" #ifndef FIXED_POINT #define FLOAT_SCALE (1.0f/(1<<15)) #define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) #define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, uint8_t down_matrix, uint8_t *internal_channel) { if (!down_matrix) return input[internal_channel[channel]][sample]; if (channel == 0) { return DM_MUL * (input[internal_channel[1]][sample] + input[internal_channel[0]][sample] * RSQRT2 + input[internal_channel[3]][sample] * RSQRT2); } else { return DM_MUL * (input[internal_channel[2]][sample] + input[internal_channel[0]][sample] * RSQRT2 + input[internal_channel[4]][sample] * RSQRT2); } } #ifndef HAS_LRINTF #define CLIP(sample, max, min) \ if (sample >= 0.0f) \ { \ sample += 0.5f; \ if (sample >= max) \ sample = max; \ } else { \ sample += -0.5f; \ if (sample <= min) \ sample = min; \ } #else #define CLIP(sample, max, min) \ if (sample >= 0.0f) \ { \ if (sample >= max) \ sample = max; \ } else { \ if (sample <= min) \ sample = min; \ } #endif #define CONV(a,b) ((a<<1)|(b&0x1)) static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int16_t **sample_buffer) { uint8_t ch, ch1; uint16_t i; switch (CONV(channels,hDecoder->downMatrix)) { case CONV(1,0): case CONV(1,1): for(i = 0; i < frame_len; i++) { real_t inp = input[hDecoder->internal_channel[0]][i]; CLIP(inp, 32767.0f, -32768.0f); (*sample_buffer)[i] = (int16_t)lrintf(inp); } break; case CONV(2,0): if (hDecoder->upMatrix) { ch = hDecoder->internal_channel[0]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch][i]; CLIP(inp0, 32767.0f, -32768.0f); (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0); } } else { ch = hDecoder->internal_channel[0]; ch1 = hDecoder->internal_channel[1]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch ][i]; real_t inp1 = input[ch1][i]; CLIP(inp0, 32767.0f, -32768.0f); CLIP(inp1, 32767.0f, -32768.0f); (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1); } } break; default: for (ch = 0; ch < channels; ch++) { for(i = 0; i < frame_len; i++) { real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); CLIP(inp, 32767.0f, -32768.0f); (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp); } } break; } } static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int32_t **sample_buffer) { uint8_t ch, ch1; uint16_t i; switch (CONV(channels,hDecoder->downMatrix)) { case CONV(1,0): case CONV(1,1): for(i = 0; i < frame_len; i++) { real_t inp = input[hDecoder->internal_channel[0]][i]; inp *= 256.0f; CLIP(inp, 8388607.0f, -8388608.0f); (*sample_buffer)[i] = (int32_t)lrintf(inp); } break; case CONV(2,0): if (hDecoder->upMatrix) { ch = hDecoder->internal_channel[0]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch][i]; inp0 *= 256.0f; CLIP(inp0, 8388607.0f, -8388608.0f); (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); } } else { ch = hDecoder->internal_channel[0]; ch1 = hDecoder->internal_channel[1]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch ][i]; real_t inp1 = input[ch1][i]; inp0 *= 256.0f; inp1 *= 256.0f; CLIP(inp0, 8388607.0f, -8388608.0f); CLIP(inp1, 8388607.0f, -8388608.0f); (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); } } break; default: for (ch = 0; ch < channels; ch++) { for(i = 0; i < frame_len; i++) { real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); inp *= 256.0f; CLIP(inp, 8388607.0f, -8388608.0f); (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); } } break; } } static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, int32_t **sample_buffer) { uint8_t ch, ch1; uint16_t i; switch (CONV(channels,hDecoder->downMatrix)) { case CONV(1,0): case CONV(1,1): for(i = 0; i < frame_len; i++) { real_t inp = input[hDecoder->internal_channel[0]][i]; inp *= 65536.0f; CLIP(inp, 2147483647.0f, -2147483648.0f); (*sample_buffer)[i] = (int32_t)lrintf(inp); } break; case CONV(2,0): if (hDecoder->upMatrix) { ch = hDecoder->internal_channel[0]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch][i]; inp0 *= 65536.0f; CLIP(inp0, 2147483647.0f, -2147483648.0f); (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); } } else { ch = hDecoder->internal_channel[0]; ch1 = hDecoder->internal_channel[1]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch ][i]; real_t inp1 = input[ch1][i]; inp0 *= 65536.0f; inp1 *= 65536.0f; CLIP(inp0, 2147483647.0f, -2147483648.0f); CLIP(inp1, 2147483647.0f, -2147483648.0f); (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); } } break; default: for (ch = 0; ch < channels; ch++) { for(i = 0; i < frame_len; i++) { real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); inp *= 65536.0f; CLIP(inp, 2147483647.0f, -2147483648.0f); (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); } } break; } } static void to_PCM_float(NeAACDecStruct *hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, float32_t **sample_buffer) { uint8_t ch, ch1; uint16_t i; switch (CONV(channels,hDecoder->downMatrix)) { case CONV(1,0): case CONV(1,1): for(i = 0; i < frame_len; i++) { real_t inp = input[hDecoder->internal_channel[0]][i]; (*sample_buffer)[i] = inp*FLOAT_SCALE; } break; case CONV(2,0): if (hDecoder->upMatrix) { ch = hDecoder->internal_channel[0]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch][i]; (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE; } } else { ch = hDecoder->internal_channel[0]; ch1 = hDecoder->internal_channel[1]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch ][i]; real_t inp1 = input[ch1][i]; (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE; } } break; default: for (ch = 0; ch < channels; ch++) { for(i = 0; i < frame_len; i++) { real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE; } } break; } } static void to_PCM_double(NeAACDecStruct *hDecoder, real_t **input, uint8_t channels, uint16_t frame_len, double **sample_buffer) { uint8_t ch, ch1; uint16_t i; switch (CONV(channels,hDecoder->downMatrix)) { case CONV(1,0): case CONV(1,1): for(i = 0; i < frame_len; i++) { real_t inp = input[hDecoder->internal_channel[0]][i]; (*sample_buffer)[i] = (double)inp*FLOAT_SCALE; } break; case CONV(2,0): if (hDecoder->upMatrix) { ch = hDecoder->internal_channel[0]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch][i]; (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE; } } else { ch = hDecoder->internal_channel[0]; ch1 = hDecoder->internal_channel[1]; for(i = 0; i < frame_len; i++) { real_t inp0 = input[ch ][i]; real_t inp1 = input[ch1][i]; (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE; } } break; default: for (ch = 0; ch < channels; ch++) { for(i = 0; i < frame_len; i++) { real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE; } } break; } } void *output_to_PCM(NeAACDecStruct *hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { int16_t *short_sample_buffer = (int16_t*)sample_buffer; int32_t *int_sample_buffer = (int32_t*)sample_buffer; float32_t *float_sample_buffer = (float32_t*)sample_buffer; double *double_sample_buffer = (double*)sample_buffer; #ifdef PROFILE int64_t count = faad_get_ts(); #endif /* Copy output to a standard PCM buffer */ switch (format) { case FAAD_FMT_16BIT: to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer); break; case FAAD_FMT_24BIT: to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer); break; case FAAD_FMT_32BIT: to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer); break; case FAAD_FMT_FLOAT: to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer); break; case FAAD_FMT_DOUBLE: to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer); break; } #ifdef PROFILE count = faad_get_ts() - count; hDecoder->output_cycles += count; #endif return sample_buffer; } #else #define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) #define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2) static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, uint8_t down_matrix, uint8_t up_matrix, uint8_t *internal_channel) { if (up_matrix == 1) return input[internal_channel[0]][sample]; if (!down_matrix) return input[internal_channel[channel]][sample]; if (channel == 0) { real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2); real_t cum = input[internal_channel[1]][sample] + C + L_S; return MUL_F(cum, DM_MUL); } else { real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2); real_t cum = input[internal_channel[2]][sample] + C + R_S; return MUL_F(cum, DM_MUL); } } void* output_to_PCM(NeAACDecStruct *hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { uint8_t ch; uint16_t i; int16_t *short_sample_buffer = (int16_t*)sample_buffer; int32_t *int_sample_buffer = (int32_t*)sample_buffer; /* Copy output to a standard PCM buffer */ for (ch = 0; ch < channels; ch++) { switch (format) { case FAAD_FMT_16BIT: for(i = 0; i < frame_len; i++) { int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (REAL_BITS-1)); if (tmp >= REAL_CONST(32767)) { tmp = REAL_CONST(32767); } } else { tmp += -(1 << (REAL_BITS-1)); if (tmp <= REAL_CONST(-32768)) { tmp = REAL_CONST(-32768); } } tmp >>= REAL_BITS; short_sample_buffer[(i*channels)+ch] = (int16_t)tmp; } break; case FAAD_FMT_24BIT: for(i = 0; i < frame_len; i++) { int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (REAL_BITS-9)); tmp >>= (REAL_BITS-8); if (tmp >= 8388607) { tmp = 8388607; } } else { tmp += -(1 << (REAL_BITS-9)); tmp >>= (REAL_BITS-8); if (tmp <= -8388608) { tmp = -8388608; } } int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; } break; case FAAD_FMT_32BIT: for(i = 0; i < frame_len; i++) { int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (16-REAL_BITS-1)); tmp <<= (16-REAL_BITS); } else { tmp += -(1 << (16-REAL_BITS-1)); tmp <<= (16-REAL_BITS); } int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; } break; case FAAD_FMT_FIXED: for(i = 0; i < frame_len; i++) { real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, hDecoder->internal_channel); int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; } break; } } return sample_buffer; } #endif welle.io-2.1/src/libs/faad2/libfaad/output.h000066400000000000000000000031731357201522000206630ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: output.h,v 1.26 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __OUTPUT_H__ #define __OUTPUT_H__ #ifdef __cplusplus extern "C" { #endif void* output_to_PCM(NeAACDecStruct *hDecoder, real_t **input, void *samplebuffer, uint8_t channels, uint16_t frame_len, uint8_t format); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/pns.c000066400000000000000000000213531357201522000201160ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: pns.c,v 1.38 2007/11/01 12:33:32 menno Exp $ **/ #include "common.h" #include "structs.h" #include "pns.h" /* static function declarations */ static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, uint8_t sub, /* RNG states */ uint32_t *__r1, uint32_t *__r2); #ifdef FIXED_POINT #define DIV(A, B) (((int64_t)A << REAL_BITS)/B) #define step(shift) \ if ((0x40000000l >> shift) + root <= value) \ { \ value -= (0x40000000l >> shift) + root; \ root = (root >> 1) | (0x40000000l >> shift); \ } else { \ root = root >> 1; \ } /* fixed point square root approximation */ /* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */ real_t fp_sqrt(real_t value) { real_t root = 0; step( 0); step( 2); step( 4); step( 6); step( 8); step(10); step(12); step(14); step(16); step(18); step(20); step(22); step(24); step(26); step(28); step(30); if (root < value) ++root; root <<= (REAL_BITS/2); return root; } static real_t const pow2_table[] = { COEF_CONST(1.0), COEF_CONST(1.18920711500272), COEF_CONST(1.41421356237310), COEF_CONST(1.68179283050743) }; #endif /* The function gen_rand_vector(addr, size) generates a vector of length with signed random values of average energy MEAN_NRG per random value. A suitable random number generator can be realized using one multiplication/accumulation per random value. */ static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, uint8_t sub, /* RNG states */ uint32_t *__r1, uint32_t *__r2) { #ifndef FIXED_POINT uint16_t i; real_t energy = 0.0; real_t scale = (real_t)1.0/(real_t)size; for (i = 0; i < size; i++) { real_t tmp = scale*(real_t)(int32_t)ne_rng(__r1, __r2); spec[i] = tmp; energy += tmp*tmp; } scale = (real_t)1.0/(real_t)sqrt(energy); scale *= (real_t)pow(2.0, 0.25 * scale_factor); for (i = 0; i < size; i++) { spec[i] *= scale; } #else uint16_t i; real_t energy = 0, scale; int32_t exp, frac; for (i = 0; i < size; i++) { /* this can be replaced by a 16 bit random generator!!!! */ real_t tmp = (int32_t)ne_rng(__r1, __r2); if (tmp < 0) tmp = -(tmp & ((1<<(REAL_BITS-1))-1)); else tmp = (tmp & ((1<<(REAL_BITS-1))-1)); energy += MUL_R(tmp,tmp); spec[i] = tmp; } energy = fp_sqrt(energy); if (energy > 0) { scale = DIV(REAL_CONST(1),energy); exp = scale_factor >> 2; frac = scale_factor & 3; /* IMDCT pre-scaling */ exp -= sub; if (exp < 0) scale >>= -exp; else scale <<= exp; if (frac) scale = MUL_C(scale, pow2_table[frac]); for (i = 0; i < size; i++) { spec[i] = MUL_R(spec[i], scale); } } #endif } void pns_decode(ic_stream *ics_left, ic_stream *ics_right, real_t *spec_left, real_t *spec_right, uint16_t frame_len, uint8_t channel_pair, uint8_t object_type, /* RNG states */ uint32_t *__r1, uint32_t *__r2) { uint8_t g, sfb, b; uint16_t size, offs; uint8_t group = 0; uint16_t nshort = frame_len >> 3; uint8_t sub = 0; #ifdef FIXED_POINT /* IMDCT scaling */ if (object_type == LD) { sub = 9 /*9*/; } else { if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE) sub = 7 /*7*/; else sub = 10 /*10*/; } #endif for (g = 0; g < ics_left->num_window_groups; g++) { /* Do perceptual noise substitution decoding */ for (b = 0; b < ics_left->window_group_length[g]; b++) { for (sfb = 0; sfb < ics_left->max_sfb; sfb++) { if (is_noise(ics_left, g, sfb)) { #ifdef LTP_DEC /* Simultaneous use of LTP and PNS is not prevented in the syntax. If both LTP, and PNS are enabled on the same scalefactor band, PNS takes precedence, and no prediction is applied to this band. */ ics_left->ltp.long_used[sfb] = 0; ics_left->ltp2.long_used[sfb] = 0; #endif #ifdef MAIN_DEC /* For scalefactor bands coded using PNS the corresponding predictors are switched to "off". */ ics_left->pred.prediction_used[sfb] = 0; #endif offs = ics_left->swb_offset[sfb]; size = min(ics_left->swb_offset[sfb+1], ics_left->swb_offset_max) - offs; /* Generate random vector */ gen_rand_vector(&spec_left[(group*nshort)+offs], ics_left->scale_factors[g][sfb], size, sub, __r1, __r2); } /* From the spec: If the same scalefactor band and group is coded by perceptual noise substitution in both channels of a channel pair, the correlation of the noise signal can be controlled by means of the ms_used field: While the default noise generation process works independently for each channel (separate generation of random vectors), the same random vector is used for both channels if ms_used[] is set for a particular scalefactor band and group. In this case, no M/S stereo coding is carried out (because M/S stereo coding and noise substitution coding are mutually exclusive). If the same scalefactor band and group is coded by perceptual noise substitution in only one channel of a channel pair the setting of ms_used[] is not evaluated. */ if (channel_pair) { if (is_noise(ics_right, g, sfb)) { if (((ics_left->ms_mask_present == 1) && (ics_left->ms_used[g][sfb])) || (ics_left->ms_mask_present == 2)) { uint16_t c; offs = ics_right->swb_offset[sfb]; size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs; for (c = 0; c < size; c++) { spec_right[(group*nshort) + offs + c] = spec_left[(group*nshort) + offs + c]; } } else /*if (ics_left->ms_mask_present == 0)*/ { #ifdef LTP_DEC ics_right->ltp.long_used[sfb] = 0; ics_right->ltp2.long_used[sfb] = 0; #endif #ifdef MAIN_DEC ics_right->pred.prediction_used[sfb] = 0; #endif offs = ics_right->swb_offset[sfb]; size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs; /* Generate random vector */ gen_rand_vector(&spec_right[(group*nshort)+offs], ics_right->scale_factors[g][sfb], size, sub, __r1, __r2); } } } } /* sfb */ group++; } /* b */ } /* g */ } welle.io-2.1/src/libs/faad2/libfaad/pns.h000066400000000000000000000035241357201522000201230ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: pns.h,v 1.27 2007/11/01 12:33:33 menno Exp $ **/ #ifndef __PNS_H__ #define __PNS_H__ #ifdef __cplusplus extern "C" { #endif #include "syntax.h" #define NOISE_OFFSET 90 void pns_decode(ic_stream *ics_left, ic_stream *ics_right, real_t *spec_left, real_t *spec_right, uint16_t frame_len, uint8_t channel_pair, uint8_t object_type, /* RNG states */ uint32_t *__r1, uint32_t *__r2); static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb) { if (ics->sfb_cb[group][sfb] == NOISE_HCB) return 1; return 0; } #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ps_dec.c000066400000000000000000002132171357201522000205550ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ps_dec.c,v 1.16 2009/01/26 22:32:31 menno Exp $ **/ #include "common.h" #ifdef PS_DEC #include #include "ps_dec.h" #include "ps_tables.h" /* constants */ #define NEGATE_IPD_MASK (0x1000) #define DECAY_SLOPE FRAC_CONST(0.05) #define COEF_SQRT2 COEF_CONST(1.4142135623731) /* tables */ /* filters are mirrored in coef 6, second half left out */ static const real_t p8_13_20[7] = { FRAC_CONST(0.00746082949812), FRAC_CONST(0.02270420949825), FRAC_CONST(0.04546865930473), FRAC_CONST(0.07266113929591), FRAC_CONST(0.09885108575264), FRAC_CONST(0.11793710567217), FRAC_CONST(0.125) }; static const real_t p2_13_20[7] = { FRAC_CONST(0.0), FRAC_CONST(0.01899487526049), FRAC_CONST(0.0), FRAC_CONST(-0.07293139167538), FRAC_CONST(0.0), FRAC_CONST(0.30596630545168), FRAC_CONST(0.5) }; static const real_t p12_13_34[7] = { FRAC_CONST(0.04081179924692), FRAC_CONST(0.03812810994926), FRAC_CONST(0.05144908135699), FRAC_CONST(0.06399831151592), FRAC_CONST(0.07428313801106), FRAC_CONST(0.08100347892914), FRAC_CONST(0.08333333333333) }; static const real_t p8_13_34[7] = { FRAC_CONST(0.01565675600122), FRAC_CONST(0.03752716391991), FRAC_CONST(0.05417891378782), FRAC_CONST(0.08417044116767), FRAC_CONST(0.10307344158036), FRAC_CONST(0.12222452249753), FRAC_CONST(0.125) }; static const real_t p4_13_34[7] = { FRAC_CONST(-0.05908211155639), FRAC_CONST(-0.04871498374946), FRAC_CONST(0.0), FRAC_CONST(0.07778723915851), FRAC_CONST(0.16486303567403), FRAC_CONST(0.23279856662996), FRAC_CONST(0.25) }; #ifdef PARAM_32KHZ static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] = { { 1, 2, 3 } /* d_24kHz */, { 3, 4, 5 } /* d_48kHz */ }; #else static const uint8_t delay_length_d[NO_ALLPASS_LINKS] = { 3, 4, 5 /* d_48kHz */ }; #endif static const real_t filter_a[NO_ALLPASS_LINKS] = { /* a(m) = exp(-d_48kHz(m)/7) */ FRAC_CONST(0.65143905753106), FRAC_CONST(0.56471812200776), FRAC_CONST(0.48954165955695) }; static const uint8_t group_border20[10+12 + 1] = { 6, 7, 0, 1, 2, 3, /* 6 subqmf subbands */ 9, 8, /* 2 subqmf subbands */ 10, 11, /* 2 subqmf subbands */ 3, 4, 5, 6, 7, 8, 9, 11, 14, 18, 23, 35, 64 }; static const uint8_t group_border34[32+18 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */ 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */ 20, 21, 22, 23, /* 4 subqmf subbands */ 24, 25, 26, 27, /* 4 subqmf subbands */ 28, 29, 30, 31, /* 4 subqmf subbands */ 32-27, 33-27, 34-27, 35-27, 36-27, 37-27, 38-27, 40-27, 42-27, 44-27, 46-27, 48-27, 51-27, 54-27, 57-27, 60-27, 64-27, 68-27, 91-27 }; static const uint16_t map_group2bk20[10+12] = { (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; static const uint16_t map_group2bk34[32+18] = { 0, 1, 2, 3, 4, 5, 6, 6, 7, (NEGATE_IPD_MASK | 2), (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), 10, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 9, 14, 11, 12, 13, 14, 15, 16, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 }; /* type definitions */ typedef struct { uint8_t frame_len; uint8_t resolution20[3]; uint8_t resolution34[5]; qmf_t *work; qmf_t **buffer; qmf_t **temp; } hyb_info; /* static function declarations */ static void ps_data_decode(ps_info *ps); static hyb_info *hybrid_init(uint8_t numTimeSlotsRate); static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid); static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid); static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], uint8_t use34, uint8_t numTimeSlotsRate); static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], uint8_t use34, uint8_t numTimeSlotsRate); static int8_t delta_clip(int8_t i, int8_t min, int8_t max); static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, uint8_t dt_flag, uint8_t nr_par, uint8_t stride, int8_t min_index, int8_t max_index); static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, uint8_t dt_flag, uint8_t nr_par, uint8_t stride, int8_t and_modulo); static void map20indexto34(int8_t *index, uint8_t bins); #ifdef PS_LOW_POWER static void map34indexto20(int8_t *index, uint8_t bins); #endif static void ps_data_decode(ps_info *ps); static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); /* */ static hyb_info *hybrid_init(uint8_t numTimeSlotsRate) { uint8_t i; hyb_info *hyb = (hyb_info*)faad_malloc(sizeof(hyb_info)); hyb->resolution34[0] = 12; hyb->resolution34[1] = 8; hyb->resolution34[2] = 4; hyb->resolution34[3] = 4; hyb->resolution34[4] = 4; hyb->resolution20[0] = 8; hyb->resolution20[1] = 2; hyb->resolution20[2] = 2; hyb->frame_len = numTimeSlotsRate; hyb->work = (qmf_t*)faad_malloc((hyb->frame_len+12) * sizeof(qmf_t)); memset(hyb->work, 0, (hyb->frame_len+12) * sizeof(qmf_t)); hyb->buffer = (qmf_t**)faad_malloc(5 * sizeof(qmf_t*)); for (i = 0; i < 5; i++) { hyb->buffer[i] = (qmf_t*)faad_malloc(hyb->frame_len * sizeof(qmf_t)); memset(hyb->buffer[i], 0, hyb->frame_len * sizeof(qmf_t)); } hyb->temp = (qmf_t**)faad_malloc(hyb->frame_len * sizeof(qmf_t*)); for (i = 0; i < hyb->frame_len; i++) { hyb->temp[i] = (qmf_t*)faad_malloc(12 /*max*/ * sizeof(qmf_t)); } return hyb; } static void hybrid_free(hyb_info *hyb) { uint8_t i; if (!hyb) return; if (hyb->work) faad_free(hyb->work); for (i = 0; i < 5; i++) { if (hyb->buffer[i]) faad_free(hyb->buffer[i]); } if (hyb->buffer) faad_free(hyb->buffer); for (i = 0; i < hyb->frame_len; i++) { if (hyb->temp[i]) faad_free(hyb->temp[i]); } if (hyb->temp) faad_free(hyb->temp); faad_free(hyb); } /* real filter, size 2 */ static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid) { uint8_t i; for (i = 0; i < frame_len; i++) { real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))); real_t r1 = MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))); real_t r2 = MUL_F(filter[2],(QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i]))); real_t r3 = MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); real_t r4 = MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); real_t r5 = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); real_t r6 = MUL_F(filter[6],QMF_RE(buffer[6+i])); real_t i0 = MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))); real_t i1 = MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))); real_t i2 = MUL_F(filter[2],(QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i]))); real_t i3 = MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); real_t i4 = MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); real_t i5 = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); real_t i6 = MUL_F(filter[6],QMF_IM(buffer[6+i])); /* q = 0 */ QMF_RE(X_hybrid[i][0]) = r0 + r1 + r2 + r3 + r4 + r5 + r6; QMF_IM(X_hybrid[i][0]) = i0 + i1 + i2 + i3 + i4 + i5 + i6; /* q = 1 */ QMF_RE(X_hybrid[i][1]) = r0 - r1 + r2 - r3 + r4 - r5 + r6; QMF_IM(X_hybrid[i][1]) = i0 - i1 + i2 - i3 + i4 - i5 + i6; } } /* complex filter, size 4 */ static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid) { uint8_t i; real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; for (i = 0; i < frame_len; i++) { input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + MUL_F(filter[6], QMF_RE(buffer[i+6])); input_re1[1] = MUL_F(FRAC_CONST(-0.70710678118655), (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) + MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) - MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7]))))); input_im1[0] = MUL_F(filter[0], (QMF_IM(buffer[i+0]) - QMF_IM(buffer[i+12]))) - MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8]))); input_im1[1] = MUL_F(FRAC_CONST(0.70710678118655), (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) - MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) - MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7]))))); input_re2[0] = MUL_F(filter[0], (QMF_RE(buffer[i+0]) - QMF_RE(buffer[i+12]))) - MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8]))); input_re2[1] = MUL_F(FRAC_CONST(0.70710678118655), (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) - MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) - MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7]))))); input_im2[0] = -MUL_F(filter[2], (QMF_IM(buffer[i+2]) + QMF_IM(buffer[i+10]))) + MUL_F(filter[6], QMF_IM(buffer[i+6])); input_im2[1] = MUL_F(FRAC_CONST(-0.70710678118655), (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) + MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) - MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7]))))); /* q == 0 */ QMF_RE(X_hybrid[i][0]) = input_re1[0] + input_re1[1] + input_im1[0] + input_im1[1]; QMF_IM(X_hybrid[i][0]) = -input_re2[0] - input_re2[1] + input_im2[0] + input_im2[1]; /* q == 1 */ QMF_RE(X_hybrid[i][1]) = input_re1[0] - input_re1[1] - input_im1[0] + input_im1[1]; QMF_IM(X_hybrid[i][1]) = input_re2[0] - input_re2[1] + input_im2[0] - input_im2[1]; /* q == 2 */ QMF_RE(X_hybrid[i][2]) = input_re1[0] - input_re1[1] + input_im1[0] - input_im1[1]; QMF_IM(X_hybrid[i][2]) = -input_re2[0] + input_re2[1] + input_im2[0] - input_im2[1]; /* q == 3 */ QMF_RE(X_hybrid[i][3]) = input_re1[0] + input_re1[1] - input_im1[0] - input_im1[1]; QMF_IM(X_hybrid[i][3]) = input_re2[0] + input_re2[1] + input_im2[0] + input_im2[1]; } } static void INLINE DCT3_4_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8; f0 = MUL_F(x[2], FRAC_CONST(0.7071067811865476)); f1 = x[0] - f0; f2 = x[0] + f0; f3 = x[1] + x[3]; f4 = MUL_C(x[1], COEF_CONST(1.3065629648763766)); f5 = MUL_F(f3, FRAC_CONST(-0.9238795325112866)); f6 = MUL_F(x[3], FRAC_CONST(-0.5411961001461967)); f7 = f4 + f5; f8 = f6 - f5; y[3] = f2 - f8; y[0] = f2 + f8; y[2] = f1 - f7; y[1] = f1 + f7; } /* complex filter, size 8 */ static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid) { uint8_t i, n; real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4]; real_t x[4]; for (i = 0; i < frame_len; i++) { input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i])); input_re1[1] = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); input_re1[2] = -MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); input_re1[3] = -MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); input_im1[0] = MUL_F(filter[5],(QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i]))); input_im1[1] = MUL_F(filter[0],(QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4],(QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i]))); input_im1[2] = MUL_F(filter[1],(QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3],(QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i]))); input_im1[3] = MUL_F(filter[2],(QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i]))); for (n = 0; n < 4; n++) { x[n] = input_re1[n] - input_im1[3-n]; } DCT3_4_unscaled(x, x); QMF_RE(X_hybrid[i][7]) = x[0]; QMF_RE(X_hybrid[i][5]) = x[2]; QMF_RE(X_hybrid[i][3]) = x[3]; QMF_RE(X_hybrid[i][1]) = x[1]; for (n = 0; n < 4; n++) { x[n] = input_re1[n] + input_im1[3-n]; } DCT3_4_unscaled(x, x); QMF_RE(X_hybrid[i][6]) = x[1]; QMF_RE(X_hybrid[i][4]) = x[3]; QMF_RE(X_hybrid[i][2]) = x[2]; QMF_RE(X_hybrid[i][0]) = x[0]; input_im2[0] = MUL_F(filter[6],QMF_IM(buffer[6+i])); input_im2[1] = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); input_im2[2] = -MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); input_im2[3] = -MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); input_re2[0] = MUL_F(filter[5],(QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i]))); input_re2[1] = MUL_F(filter[0],(QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4],(QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i]))); input_re2[2] = MUL_F(filter[1],(QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3],(QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i]))); input_re2[3] = MUL_F(filter[2],(QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i]))); for (n = 0; n < 4; n++) { x[n] = input_im2[n] + input_re2[3-n]; } DCT3_4_unscaled(x, x); QMF_IM(X_hybrid[i][7]) = x[0]; QMF_IM(X_hybrid[i][5]) = x[2]; QMF_IM(X_hybrid[i][3]) = x[3]; QMF_IM(X_hybrid[i][1]) = x[1]; for (n = 0; n < 4; n++) { x[n] = input_im2[n] - input_re2[3-n]; } DCT3_4_unscaled(x, x); QMF_IM(X_hybrid[i][6]) = x[1]; QMF_IM(X_hybrid[i][4]) = x[3]; QMF_IM(X_hybrid[i][2]) = x[2]; QMF_IM(X_hybrid[i][0]) = x[0]; } } static void INLINE DCT3_6_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7; f0 = MUL_F(x[3], FRAC_CONST(0.70710678118655)); f1 = x[0] + f0; f2 = x[0] - f0; f3 = MUL_F((x[1] - x[5]), FRAC_CONST(0.70710678118655)); f4 = MUL_F(x[2], FRAC_CONST(0.86602540378444)) + MUL_F(x[4], FRAC_CONST(0.5)); f5 = f4 - x[4]; f6 = MUL_F(x[1], FRAC_CONST(0.96592582628907)) + MUL_F(x[5], FRAC_CONST(0.25881904510252)); f7 = f6 - f3; y[0] = f1 + f6 + f4; y[1] = f2 + f3 - x[4]; y[2] = f7 + f2 - f5; y[3] = f1 - f7 - f5; y[4] = f1 - f3 - x[4]; y[5] = f2 - f6 + f4; } /* complex filter, size 12 */ static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *filter, qmf_t *buffer, qmf_t **X_hybrid) { uint8_t i, n; real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6]; real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6]; for (i = 0; i < frame_len; i++) { for (n = 0; n < 6; n++) { if (n == 0) { input_re1[0] = MUL_F(QMF_RE(buffer[6+i]), filter[6]); input_re2[0] = MUL_F(QMF_IM(buffer[6+i]), filter[6]); } else { input_re1[6-n] = MUL_F((QMF_RE(buffer[n+i]) + QMF_RE(buffer[12-n+i])), filter[n]); input_re2[6-n] = MUL_F((QMF_IM(buffer[n+i]) + QMF_IM(buffer[12-n+i])), filter[n]); } input_im2[n] = MUL_F((QMF_RE(buffer[n+i]) - QMF_RE(buffer[12-n+i])), filter[n]); input_im1[n] = MUL_F((QMF_IM(buffer[n+i]) - QMF_IM(buffer[12-n+i])), filter[n]); } DCT3_6_unscaled(out_re1, input_re1); DCT3_6_unscaled(out_re2, input_re2); DCT3_6_unscaled(out_im1, input_im1); DCT3_6_unscaled(out_im2, input_im2); for (n = 0; n < 6; n += 2) { QMF_RE(X_hybrid[i][n]) = out_re1[n] - out_im1[n]; QMF_IM(X_hybrid[i][n]) = out_re2[n] + out_im2[n]; QMF_RE(X_hybrid[i][n+1]) = out_re1[n+1] + out_im1[n+1]; QMF_IM(X_hybrid[i][n+1]) = out_re2[n+1] - out_im2[n+1]; QMF_RE(X_hybrid[i][10-n]) = out_re1[n+1] - out_im1[n+1]; QMF_IM(X_hybrid[i][10-n]) = out_re2[n+1] + out_im2[n+1]; QMF_RE(X_hybrid[i][11-n]) = out_re1[n] + out_im1[n]; QMF_IM(X_hybrid[i][11-n]) = out_re2[n] - out_im2[n]; } } } /* Hybrid analysis: further split up QMF subbands * to improve frequency resolution */ static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], uint8_t use34, uint8_t numTimeSlotsRate) { uint8_t k, n, band; uint8_t offset = 0; uint8_t qmf_bands = (use34) ? 5 : 3; uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; for (band = 0; band < qmf_bands; band++) { /* build working buffer */ memcpy(hyb->work, hyb->buffer[band], 12 * sizeof(qmf_t)); /* add new samples */ for (n = 0; n < hyb->frame_len; n++) { QMF_RE(hyb->work[12 + n]) = QMF_RE(X[n + 6 /*delay*/][band]); QMF_IM(hyb->work[12 + n]) = QMF_IM(X[n + 6 /*delay*/][band]); } /* store samples */ memcpy(hyb->buffer[band], hyb->work + hyb->frame_len, 12 * sizeof(qmf_t)); switch(resolution[band]) { case 2: /* Type B real filter, Q[p] = 2 */ channel_filter2(hyb, hyb->frame_len, p2_13_20, hyb->work, hyb->temp); break; case 4: /* Type A complex filter, Q[p] = 4 */ channel_filter4(hyb, hyb->frame_len, p4_13_34, hyb->work, hyb->temp); break; case 8: /* Type A complex filter, Q[p] = 8 */ channel_filter8(hyb, hyb->frame_len, (use34) ? p8_13_34 : p8_13_20, hyb->work, hyb->temp); break; case 12: /* Type A complex filter, Q[p] = 12 */ channel_filter12(hyb, hyb->frame_len, p12_13_34, hyb->work, hyb->temp); break; } for (n = 0; n < hyb->frame_len; n++) { for (k = 0; k < resolution[band]; k++) { QMF_RE(X_hybrid[n][offset + k]) = QMF_RE(hyb->temp[n][k]); QMF_IM(X_hybrid[n][offset + k]) = QMF_IM(hyb->temp[n][k]); } } offset += resolution[band]; } /* group hybrid channels */ if (!use34) { for (n = 0; n < numTimeSlotsRate; n++) { QMF_RE(X_hybrid[n][3]) += QMF_RE(X_hybrid[n][4]); QMF_IM(X_hybrid[n][3]) += QMF_IM(X_hybrid[n][4]); QMF_RE(X_hybrid[n][4]) = 0; QMF_IM(X_hybrid[n][4]) = 0; QMF_RE(X_hybrid[n][2]) += QMF_RE(X_hybrid[n][5]); QMF_IM(X_hybrid[n][2]) += QMF_IM(X_hybrid[n][5]); QMF_RE(X_hybrid[n][5]) = 0; QMF_IM(X_hybrid[n][5]) = 0; } } } static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], uint8_t use34, uint8_t numTimeSlotsRate) { uint8_t k, n, band; uint8_t offset = 0; uint8_t qmf_bands = (use34) ? 5 : 3; uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; for(band = 0; band < qmf_bands; band++) { for (n = 0; n < hyb->frame_len; n++) { QMF_RE(X[n][band]) = 0; QMF_IM(X[n][band]) = 0; for (k = 0; k < resolution[band]; k++) { QMF_RE(X[n][band]) += QMF_RE(X_hybrid[n][offset + k]); QMF_IM(X[n][band]) += QMF_IM(X_hybrid[n][offset + k]); } } offset += resolution[band]; } } /* limits the value i to the range [min,max] */ static int8_t delta_clip(int8_t i, int8_t min, int8_t max) { if (i < min) return min; else if (i > max) return max; else return i; } //int iid = 0; /* delta decode array */ static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, uint8_t dt_flag, uint8_t nr_par, uint8_t stride, int8_t min_index, int8_t max_index) { int8_t i; if (enable == 1) { if (dt_flag == 0) { /* delta coded in frequency direction */ index[0] = 0 + index[0]; index[0] = delta_clip(index[0], min_index, max_index); for (i = 1; i < nr_par; i++) { index[i] = index[i-1] + index[i]; index[i] = delta_clip(index[i], min_index, max_index); } } else { /* delta coded in time direction */ for (i = 0; i < nr_par; i++) { //int8_t tmp2; //int8_t tmp = index[i]; //printf("%d %d\n", index_prev[i*stride], index[i]); //printf("%d\n", index[i]); index[i] = index_prev[i*stride] + index[i]; //tmp2 = index[i]; index[i] = delta_clip(index[i], min_index, max_index); //if (iid) //{ // if (index[i] == 7) // { // printf("%d %d %d\n", index_prev[i*stride], tmp, tmp2); // } //} } } } else { /* set indices to zero */ for (i = 0; i < nr_par; i++) { index[i] = 0; } } /* coarse */ if (stride == 2) { for (i = (nr_par<<1)-1; i > 0; i--) { index[i] = index[i>>1]; } } } /* delta modulo decode array */ /* in: log2 value of the modulo value to allow using AND instead of MOD */ static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, uint8_t dt_flag, uint8_t nr_par, uint8_t stride, int8_t and_modulo) { int8_t i; if (enable == 1) { if (dt_flag == 0) { /* delta coded in frequency direction */ index[0] = 0 + index[0]; index[0] &= and_modulo; for (i = 1; i < nr_par; i++) { index[i] = index[i-1] + index[i]; index[i] &= and_modulo; } } else { /* delta coded in time direction */ for (i = 0; i < nr_par; i++) { index[i] = index_prev[i*stride] + index[i]; index[i] &= and_modulo; } } } else { /* set indices to zero */ for (i = 0; i < nr_par; i++) { index[i] = 0; } } /* coarse */ if (stride == 2) { index[0] = 0; for (i = (nr_par<<1)-1; i > 0; i--) { index[i] = index[i>>1]; } } } #ifdef PS_LOW_POWER static void map34indexto20(int8_t *index, uint8_t bins) { index[0] = (2*index[0]+index[1])/3; index[1] = (index[1]+2*index[2])/3; index[2] = (2*index[3]+index[4])/3; index[3] = (index[4]+2*index[5])/3; index[4] = (index[6]+index[7])/2; index[5] = (index[8]+index[9])/2; index[6] = index[10]; index[7] = index[11]; index[8] = (index[12]+index[13])/2; index[9] = (index[14]+index[15])/2; index[10] = index[16]; if (bins == 34) { index[11] = index[17]; index[12] = index[18]; index[13] = index[19]; index[14] = (index[20]+index[21])/2; index[15] = (index[22]+index[23])/2; index[16] = (index[24]+index[25])/2; index[17] = (index[26]+index[27])/2; index[18] = (index[28]+index[29]+index[30]+index[31])/4; index[19] = (index[32]+index[33])/2; } } #endif static void map20indexto34(int8_t *index, uint8_t bins) { index[0] = index[0]; index[1] = (index[0] + index[1])/2; index[2] = index[1]; index[3] = index[2]; index[4] = (index[2] + index[3])/2; index[5] = index[3]; index[6] = index[4]; index[7] = index[4]; index[8] = index[5]; index[9] = index[5]; index[10] = index[6]; index[11] = index[7]; index[12] = index[8]; index[13] = index[8]; index[14] = index[9]; index[15] = index[9]; index[16] = index[10]; if (bins == 34) { index[17] = index[11]; index[18] = index[12]; index[19] = index[13]; index[20] = index[14]; index[21] = index[14]; index[22] = index[15]; index[23] = index[15]; index[24] = index[16]; index[25] = index[16]; index[26] = index[17]; index[27] = index[17]; index[28] = index[18]; index[29] = index[18]; index[30] = index[18]; index[31] = index[18]; index[32] = index[19]; index[33] = index[19]; } } /* parse the bitstream data decoded in ps_data() */ static void ps_data_decode(ps_info *ps) { uint8_t env, bin; /* ps data not available, use data from previous frame */ if (ps->ps_data_available == 0) { ps->num_env = 0; } for (env = 0; env < ps->num_env; env++) { int8_t *iid_index_prev; int8_t *icc_index_prev; int8_t *ipd_index_prev; int8_t *opd_index_prev; int8_t num_iid_steps = (ps->iid_mode < 3) ? 7 : 15 /*fine quant*/; if (env == 0) { /* take last envelope from previous frame */ iid_index_prev = ps->iid_index_prev; icc_index_prev = ps->icc_index_prev; ipd_index_prev = ps->ipd_index_prev; opd_index_prev = ps->opd_index_prev; } else { /* take index values from previous envelope */ iid_index_prev = ps->iid_index[env - 1]; icc_index_prev = ps->icc_index[env - 1]; ipd_index_prev = ps->ipd_index[env - 1]; opd_index_prev = ps->opd_index[env - 1]; } // iid = 1; /* delta decode iid parameters */ delta_decode(ps->enable_iid, ps->iid_index[env], iid_index_prev, ps->iid_dt[env], ps->nr_iid_par, (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1, -num_iid_steps, num_iid_steps); // iid = 0; /* delta decode icc parameters */ delta_decode(ps->enable_icc, ps->icc_index[env], icc_index_prev, ps->icc_dt[env], ps->nr_icc_par, (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1, 0, 7); /* delta modulo decode ipd parameters */ delta_modulo_decode(ps->enable_ipdopd, ps->ipd_index[env], ipd_index_prev, ps->ipd_dt[env], ps->nr_ipdopd_par, 1, 7); /* delta modulo decode opd parameters */ delta_modulo_decode(ps->enable_ipdopd, ps->opd_index[env], opd_index_prev, ps->opd_dt[env], ps->nr_ipdopd_par, 1, 7); } /* handle error case */ if (ps->num_env == 0) { /* force to 1 */ ps->num_env = 1; if (ps->enable_iid) { for (bin = 0; bin < 34; bin++) ps->iid_index[0][bin] = ps->iid_index_prev[bin]; } else { for (bin = 0; bin < 34; bin++) ps->iid_index[0][bin] = 0; } if (ps->enable_icc) { for (bin = 0; bin < 34; bin++) ps->icc_index[0][bin] = ps->icc_index_prev[bin]; } else { for (bin = 0; bin < 34; bin++) ps->icc_index[0][bin] = 0; } if (ps->enable_ipdopd) { for (bin = 0; bin < 17; bin++) { ps->ipd_index[0][bin] = ps->ipd_index_prev[bin]; ps->opd_index[0][bin] = ps->opd_index_prev[bin]; } } else { for (bin = 0; bin < 17; bin++) { ps->ipd_index[0][bin] = 0; ps->opd_index[0][bin] = 0; } } } /* update previous indices */ for (bin = 0; bin < 34; bin++) ps->iid_index_prev[bin] = ps->iid_index[ps->num_env-1][bin]; for (bin = 0; bin < 34; bin++) ps->icc_index_prev[bin] = ps->icc_index[ps->num_env-1][bin]; for (bin = 0; bin < 17; bin++) { ps->ipd_index_prev[bin] = ps->ipd_index[ps->num_env-1][bin]; ps->opd_index_prev[bin] = ps->opd_index[ps->num_env-1][bin]; } ps->ps_data_available = 0; if (ps->frame_class == 0) { ps->border_position[0] = 0; for (env = 1; env < ps->num_env; env++) { ps->border_position[env] = (env * ps->numTimeSlotsRate) / ps->num_env; } ps->border_position[ps->num_env] = ps->numTimeSlotsRate; } else { ps->border_position[0] = 0; if (ps->border_position[ps->num_env] < ps->numTimeSlotsRate) { for (bin = 0; bin < 34; bin++) { ps->iid_index[ps->num_env][bin] = ps->iid_index[ps->num_env-1][bin]; ps->icc_index[ps->num_env][bin] = ps->icc_index[ps->num_env-1][bin]; } for (bin = 0; bin < 17; bin++) { ps->ipd_index[ps->num_env][bin] = ps->ipd_index[ps->num_env-1][bin]; ps->opd_index[ps->num_env][bin] = ps->opd_index[ps->num_env-1][bin]; } ps->num_env++; ps->border_position[ps->num_env] = ps->numTimeSlotsRate; } for (env = 1; env < ps->num_env; env++) { int8_t thr = ps->numTimeSlotsRate - (ps->num_env - env); if (ps->border_position[env] > thr) { ps->border_position[env] = thr; } else { thr = ps->border_position[env-1]+1; if (ps->border_position[env] < thr) { ps->border_position[env] = thr; } } } } /* make sure that the indices of all parameters can be mapped * to the same hybrid synthesis filterbank */ #ifdef PS_LOW_POWER for (env = 0; env < ps->num_env; env++) { if (ps->iid_mode == 2 || ps->iid_mode == 5) map34indexto20(ps->iid_index[env], 34); if (ps->icc_mode == 2 || ps->icc_mode == 5) map34indexto20(ps->icc_index[env], 34); /* disable ipd/opd */ for (bin = 0; bin < 17; bin++) { ps->aaIpdIndex[env][bin] = 0; ps->aaOpdIndex[env][bin] = 0; } } #else if (ps->use34hybrid_bands) { for (env = 0; env < ps->num_env; env++) { if (ps->iid_mode != 2 && ps->iid_mode != 5) map20indexto34(ps->iid_index[env], 34); if (ps->icc_mode != 2 && ps->icc_mode != 5) map20indexto34(ps->icc_index[env], 34); if (ps->ipd_mode != 2 && ps->ipd_mode != 5) { map20indexto34(ps->ipd_index[env], 17); map20indexto34(ps->opd_index[env], 17); } } } #endif #if 0 for (env = 0; env < ps->num_env; env++) { printf("iid[env:%d]:", env); for (bin = 0; bin < 34; bin++) { printf(" %d", ps->iid_index[env][bin]); } printf("\n"); } for (env = 0; env < ps->num_env; env++) { printf("icc[env:%d]:", env); for (bin = 0; bin < 34; bin++) { printf(" %d", ps->icc_index[env][bin]); } printf("\n"); } for (env = 0; env < ps->num_env; env++) { printf("ipd[env:%d]:", env); for (bin = 0; bin < 17; bin++) { printf(" %d", ps->ipd_index[env][bin]); } printf("\n"); } for (env = 0; env < ps->num_env; env++) { printf("opd[env:%d]:", env); for (bin = 0; bin < 17; bin++) { printf(" %d", ps->opd_index[env][bin]); } printf("\n"); } printf("\n"); #endif } /* decorrelate the mono signal using an allpass filter */ static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) { uint8_t gr, n, m, bk; uint8_t temp_delay; uint8_t sb, maxsb; const complex_t *Phi_Fract_SubQmf; uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; real_t P_SmoothPeakDecayDiffNrg, nrg; real_t P[32][34]; real_t G_TransientRatio[32][34] = {{0}}; complex_t inputLeft; /* chose hybrid filterbank: 20 or 34 band case */ if (ps->use34hybrid_bands) { Phi_Fract_SubQmf = Phi_Fract_SubQmf34; } else{ Phi_Fract_SubQmf = Phi_Fract_SubQmf20; } /* clear the energy values */ for (n = 0; n < 32; n++) { for (bk = 0; bk < 34; bk++) { P[n][bk] = 0; } } /* calculate the energy in each parameter band b(k) */ for (gr = 0; gr < ps->num_groups; gr++) { /* select the parameter index b(k) to which this group belongs */ bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; /* select the upper subband border for this group */ maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr]+1 : ps->group_border[gr+1]; for (sb = ps->group_border[gr]; sb < maxsb; sb++) { for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) { #ifdef FIXED_POINT uint32_t in_re, in_im; #endif /* input from hybrid subbands or QMF subbands */ if (gr < ps->num_hybrid_groups) { RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); } else { RE(inputLeft) = QMF_RE(X_left[n][sb]); IM(inputLeft) = QMF_IM(X_left[n][sb]); } /* accumulate energy */ #ifdef FIXED_POINT /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF * meaning that P will be scaled by 2^(-10) compared to floating point version */ in_re = ((abs(RE(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); in_im = ((abs(IM(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); P[n][bk] += in_re*in_re + in_im*in_im; #else P[n][bk] += MUL_R(RE(inputLeft),RE(inputLeft)) + MUL_R(IM(inputLeft),IM(inputLeft)); #endif } } } #if 0 for (n = 0; n < 32; n++) { for (bk = 0; bk < 34; bk++) { #ifdef FIXED_POINT printf("%d %d: %d\n", n, bk, P[n][bk] /*/(float)REAL_PRECISION*/); #else printf("%d %d: %f\n", n, bk, P[n][bk]/1024.0); #endif } } #endif /* calculate transient reduction ratio for each parameter band b(k) */ for (bk = 0; bk < ps->nr_par_bands; bk++) { for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) { const real_t gamma = COEF_CONST(1.5); ps->P_PeakDecayNrg[bk] = MUL_F(ps->P_PeakDecayNrg[bk], ps->alpha_decay); if (ps->P_PeakDecayNrg[bk] < P[n][bk]) ps->P_PeakDecayNrg[bk] = P[n][bk]; /* apply smoothing filter to peak decay energy */ P_SmoothPeakDecayDiffNrg = ps->P_SmoothPeakDecayDiffNrg_prev[bk]; P_SmoothPeakDecayDiffNrg += MUL_F((ps->P_PeakDecayNrg[bk] - P[n][bk] - ps->P_SmoothPeakDecayDiffNrg_prev[bk]), ps->alpha_smooth); ps->P_SmoothPeakDecayDiffNrg_prev[bk] = P_SmoothPeakDecayDiffNrg; /* apply smoothing filter to energy */ nrg = ps->P_prev[bk]; nrg += MUL_F((P[n][bk] - ps->P_prev[bk]), ps->alpha_smooth); ps->P_prev[bk] = nrg; /* calculate transient ratio */ if (MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg) { G_TransientRatio[n][bk] = REAL_CONST(1.0); } else { G_TransientRatio[n][bk] = DIV_R(nrg, (MUL_C(P_SmoothPeakDecayDiffNrg, gamma))); } } } #if 0 for (n = 0; n < 32; n++) { for (bk = 0; bk < 34; bk++) { #ifdef FIXED_POINT printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]/(float)REAL_PRECISION); #else printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]); #endif } } #endif /* apply stereo decorrelation filter to the signal */ for (gr = 0; gr < ps->num_groups; gr++) { if (gr < ps->num_hybrid_groups) maxsb = ps->group_border[gr] + 1; else maxsb = ps->group_border[gr + 1]; /* QMF channel */ for (sb = ps->group_border[gr]; sb < maxsb; sb++) { real_t g_DecaySlope; real_t g_DecaySlope_filt[NO_ALLPASS_LINKS]; /* g_DecaySlope: [0..1] */ if (gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff) { g_DecaySlope = FRAC_CONST(1.0); } else { int8_t decay = ps->decay_cutoff - sb; if (decay <= -20 /* -1/DECAY_SLOPE */) { g_DecaySlope = 0; } else { /* decay(int)*decay_slope(frac) = g_DecaySlope(frac) */ g_DecaySlope = FRAC_CONST(1.0) + DECAY_SLOPE * decay; } } /* calculate g_DecaySlope_filt for every m multiplied by filter_a[m] */ for (m = 0; m < NO_ALLPASS_LINKS; m++) { g_DecaySlope_filt[m] = MUL_F(g_DecaySlope, filter_a[m]); } /* set delay indices */ temp_delay = ps->saved_delay; for (n = 0; n < NO_ALLPASS_LINKS; n++) temp_delay_ser[n] = ps->delay_buf_index_ser[n]; for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) { complex_t tmp, tmp0, R0; if (gr < ps->num_hybrid_groups) { /* hybrid filterbank input */ RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); } else { /* QMF filterbank input */ RE(inputLeft) = QMF_RE(X_left[n][sb]); IM(inputLeft) = QMF_IM(X_left[n][sb]); } if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) { /* delay */ /* never hybrid subbands here, always QMF subbands */ RE(tmp) = RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); IM(tmp) = IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); RE(R0) = RE(tmp); IM(R0) = IM(tmp); RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = RE(inputLeft); IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = IM(inputLeft); } else { /* allpass filter */ uint8_t m; complex_t Phi_Fract; /* fetch parameters */ if (gr < ps->num_hybrid_groups) { /* select data from the hybrid subbands */ RE(tmp0) = RE(ps->delay_SubQmf[temp_delay][sb]); IM(tmp0) = IM(ps->delay_SubQmf[temp_delay][sb]); RE(ps->delay_SubQmf[temp_delay][sb]) = RE(inputLeft); IM(ps->delay_SubQmf[temp_delay][sb]) = IM(inputLeft); RE(Phi_Fract) = RE(Phi_Fract_SubQmf[sb]); IM(Phi_Fract) = IM(Phi_Fract_SubQmf[sb]); } else { /* select data from the QMF subbands */ RE(tmp0) = RE(ps->delay_Qmf[temp_delay][sb]); IM(tmp0) = IM(ps->delay_Qmf[temp_delay][sb]); RE(ps->delay_Qmf[temp_delay][sb]) = RE(inputLeft); IM(ps->delay_Qmf[temp_delay][sb]) = IM(inputLeft); RE(Phi_Fract) = RE(Phi_Fract_Qmf[sb]); IM(Phi_Fract) = IM(Phi_Fract_Qmf[sb]); } /* z^(-2) * Phi_Fract[k] */ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); RE(R0) = RE(tmp); IM(R0) = IM(tmp); for (m = 0; m < NO_ALLPASS_LINKS; m++) { complex_t Q_Fract_allpass, tmp2; /* fetch parameters */ if (gr < ps->num_hybrid_groups) { /* select data from the hybrid subbands */ RE(tmp0) = RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); IM(tmp0) = IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); if (ps->use34hybrid_bands) { RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf34[sb][m]); IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf34[sb][m]); } else { RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf20[sb][m]); IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf20[sb][m]); } } else { /* select data from the QMF subbands */ RE(tmp0) = RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); IM(tmp0) = IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); RE(Q_Fract_allpass) = RE(Q_Fract_allpass_Qmf[sb][m]); IM(Q_Fract_allpass) = IM(Q_Fract_allpass_Qmf[sb][m]); } /* delay by a fraction */ /* z^(-d(m)) * Q_Fract_allpass[k,m] */ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Q_Fract_allpass), IM(Q_Fract_allpass)); /* -a(m) * g_DecaySlope[k] */ RE(tmp) += -MUL_F(g_DecaySlope_filt[m], RE(R0)); IM(tmp) += -MUL_F(g_DecaySlope_filt[m], IM(R0)); /* -a(m) * g_DecaySlope[k] * Q_Fract_allpass[k,m] * z^(-d(m)) */ RE(tmp2) = RE(R0) + MUL_F(g_DecaySlope_filt[m], RE(tmp)); IM(tmp2) = IM(R0) + MUL_F(g_DecaySlope_filt[m], IM(tmp)); /* store sample */ if (gr < ps->num_hybrid_groups) { RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); } else { RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); } /* store for next iteration (or as output value if last iteration) */ RE(R0) = RE(tmp); IM(R0) = IM(tmp); } } /* select b(k) for reading the transient ratio */ bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; /* duck if a past transient is found */ RE(R0) = MUL_R(G_TransientRatio[n][bk], RE(R0)); IM(R0) = MUL_R(G_TransientRatio[n][bk], IM(R0)); if (gr < ps->num_hybrid_groups) { /* hybrid */ QMF_RE(X_hybrid_right[n][sb]) = RE(R0); QMF_IM(X_hybrid_right[n][sb]) = IM(R0); } else { /* QMF */ QMF_RE(X_right[n][sb]) = RE(R0); QMF_IM(X_right[n][sb]) = IM(R0); } /* Update delay buffer index */ if (++temp_delay >= 2) { temp_delay = 0; } /* update delay indices */ if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) { /* delay_D depends on the samplerate, it can hold the values 14 and 1 */ if (++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb]) { ps->delay_buf_index_delay[sb] = 0; } } for (m = 0; m < NO_ALLPASS_LINKS; m++) { if (++temp_delay_ser[m] >= ps->num_sample_delay_ser[m]) { temp_delay_ser[m] = 0; } } } } } /* update delay indices */ ps->saved_delay = temp_delay; for (m = 0; m < NO_ALLPASS_LINKS; m++) ps->delay_buf_index_ser[m] = temp_delay_ser[m]; } #ifdef FIXED_POINT #define step(shift) \ if ((0x40000000l >> shift) + root <= value) \ { \ value -= (0x40000000l >> shift) + root; \ root = (root >> 1) | (0x40000000l >> shift); \ } else { \ root = root >> 1; \ } /* fixed point square root approximation */ static real_t ps_sqrt(real_t value) { real_t root = 0; step( 0); step( 2); step( 4); step( 6); step( 8); step(10); step(12); step(14); step(16); step(18); step(20); step(22); step(24); step(26); step(28); step(30); if (root < value) ++root; root <<= (REAL_BITS/2); return root; } #else #define ps_sqrt(A) sqrt(A) #endif static const real_t ipdopd_cos_tab[] = { FRAC_CONST(1.000000000000000), FRAC_CONST(0.707106781186548), FRAC_CONST(0.000000000000000), FRAC_CONST(-0.707106781186547), FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.707106781186548), FRAC_CONST(-0.000000000000000), FRAC_CONST(0.707106781186547), FRAC_CONST(1.000000000000000) }; static const real_t ipdopd_sin_tab[] = { FRAC_CONST(0.000000000000000), FRAC_CONST(0.707106781186547), FRAC_CONST(1.000000000000000), FRAC_CONST(0.707106781186548), FRAC_CONST(0.000000000000000), FRAC_CONST(-0.707106781186547), FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.707106781186548), FRAC_CONST(-0.000000000000000) }; static real_t magnitude_c(complex_t c) { #ifdef FIXED_POINT #define ps_abs(A) (((A) > 0) ? (A) : (-(A))) #define ALPHA FRAC_CONST(0.948059448969) #define BETA FRAC_CONST(0.392699081699) real_t abs_inphase = ps_abs(RE(c)); real_t abs_quadrature = ps_abs(IM(c)); if (abs_inphase > abs_quadrature) { return MUL_F(abs_inphase, ALPHA) + MUL_F(abs_quadrature, BETA); } else { return MUL_F(abs_quadrature, ALPHA) + MUL_F(abs_inphase, BETA); } #else return sqrt(RE(c)*RE(c) + IM(c)*IM(c)); #endif } static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) { uint8_t n; uint8_t gr; uint8_t bk = 0; uint8_t sb, maxsb; uint8_t env; uint8_t nr_ipdopd_par; complex_t h11, h12, h21, h22; complex_t H11, H12, H21, H22; complex_t deltaH11, deltaH12, deltaH21, deltaH22; complex_t tempLeft; complex_t tempRight; complex_t phaseLeft; complex_t phaseRight; real_t L; const real_t *sf_iid; uint8_t no_iid_steps; if (ps->iid_mode >= 3) { no_iid_steps = 15; sf_iid = sf_iid_fine; } else { no_iid_steps = 7; sf_iid = sf_iid_normal; } if (ps->ipd_mode == 0 || ps->ipd_mode == 3) { nr_ipdopd_par = 11; /* resolution */ } else { nr_ipdopd_par = ps->nr_ipdopd_par; } for (gr = 0; gr < ps->num_groups; gr++) { bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; /* use one channel per group in the subqmf domain */ maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr + 1]; for (env = 0; env < ps->num_env; env++) { if (ps->icc_mode < 3) { /* type 'A' mixing as described in 8.6.4.6.2.1 */ real_t c_1, c_2; real_t cosa, sina; real_t cosb, sinb; real_t ab1, ab2; real_t ab3, ab4; /* c_1 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps + iid_index] / 10.0))); c_2 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps - iid_index] / 10.0))); alpha = 0.5 * acos(quant_rho[icc_index]); beta = alpha * ( c_1 - c_2 ) / sqrt(2.0); */ //printf("%d\n", ps->iid_index[env][bk]); /* calculate the scalefactors c_1 and c_2 from the intensity differences */ c_1 = sf_iid[no_iid_steps + ps->iid_index[env][bk]]; c_2 = sf_iid[no_iid_steps - ps->iid_index[env][bk]]; /* calculate alpha and beta using the ICC parameters */ cosa = cos_alphas[ps->icc_index[env][bk]]; sina = sin_alphas[ps->icc_index[env][bk]]; if (ps->iid_mode >= 3) { if (ps->iid_index[env][bk] < 0) { cosb = cos_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sinb = -sin_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; } else { cosb = cos_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sinb = sin_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; } } else { if (ps->iid_index[env][bk] < 0) { cosb = cos_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sinb = -sin_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; } else { cosb = cos_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sinb = sin_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; } } ab1 = MUL_C(cosb, cosa); ab2 = MUL_C(sinb, sina); ab3 = MUL_C(sinb, cosa); ab4 = MUL_C(cosb, sina); /* h_xy: COEF */ RE(h11) = MUL_C(c_2, (ab1 - ab2)); RE(h12) = MUL_C(c_1, (ab1 + ab2)); RE(h21) = MUL_C(c_2, (ab3 + ab4)); RE(h22) = MUL_C(c_1, (ab3 - ab4)); } else { /* type 'B' mixing as described in 8.6.4.6.2.2 */ real_t sina, cosa; real_t cosg, sing; /* real_t c, rho, mu, alpha, gamma; uint8_t i; i = ps->iid_index[env][bk]; c = (real_t)pow(10.0, ((i)?(((i>0)?1:-1)*quant_iid[((i>0)?i:-i)-1]):0.)/20.0); rho = quant_rho[ps->icc_index[env][bk]]; if (rho == 0.0f && c == 1.) { alpha = (real_t)M_PI/4.0f; rho = 0.05f; } else { if (rho <= 0.05f) { rho = 0.05f; } alpha = 0.5f*(real_t)atan( (2.0f*c*rho) / (c*c-1.0f) ); if (alpha < 0.) { alpha += (real_t)M_PI/2.0f; } if (rho < 0.) { alpha += (real_t)M_PI; } } mu = c+1.0f/c; mu = 1+(4.0f*rho*rho-4.0f)/(mu*mu); gamma = (real_t)atan(sqrt((1.0f-sqrt(mu))/(1.0f+sqrt(mu)))); */ if (ps->iid_mode >= 3) { uint8_t abs_iid = abs(ps->iid_index[env][bk]); cosa = sincos_alphas_B_fine[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sina = sincos_alphas_B_fine[30 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; cosg = cos_gammas_fine[abs_iid][ps->icc_index[env][bk]]; sing = sin_gammas_fine[abs_iid][ps->icc_index[env][bk]]; } else { uint8_t abs_iid = abs(ps->iid_index[env][bk]); cosa = sincos_alphas_B_normal[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; sina = sincos_alphas_B_normal[14 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; cosg = cos_gammas_normal[abs_iid][ps->icc_index[env][bk]]; sing = sin_gammas_normal[abs_iid][ps->icc_index[env][bk]]; } RE(h11) = MUL_C(COEF_SQRT2, MUL_C(cosa, cosg)); RE(h12) = MUL_C(COEF_SQRT2, MUL_C(sina, cosg)); RE(h21) = MUL_C(COEF_SQRT2, MUL_C(-cosa, sing)); RE(h22) = MUL_C(COEF_SQRT2, MUL_C(sina, sing)); } /* calculate phase rotation parameters H_xy */ /* note that the imaginary part of these parameters are only calculated when IPD and OPD are enabled */ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) { int8_t i; real_t xy, pq, xypq; /* ringbuffer index */ i = ps->phase_hist; /* previous value */ #ifdef FIXED_POINT /* divide by 4, shift right 2 bits */ RE(tempLeft) = RE(ps->ipd_prev[bk][i]) >> 2; IM(tempLeft) = IM(ps->ipd_prev[bk][i]) >> 2; RE(tempRight) = RE(ps->opd_prev[bk][i]) >> 2; IM(tempRight) = IM(ps->opd_prev[bk][i]) >> 2; #else RE(tempLeft) = MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); IM(tempLeft) = MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); RE(tempRight) = MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); IM(tempRight) = MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); #endif /* save current value */ RE(ps->ipd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->ipd_index[env][bk])]; IM(ps->ipd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->ipd_index[env][bk])]; RE(ps->opd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->opd_index[env][bk])]; IM(ps->opd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->opd_index[env][bk])]; /* add current value */ RE(tempLeft) += RE(ps->ipd_prev[bk][i]); IM(tempLeft) += IM(ps->ipd_prev[bk][i]); RE(tempRight) += RE(ps->opd_prev[bk][i]); IM(tempRight) += IM(ps->opd_prev[bk][i]); /* ringbuffer index */ if (i == 0) { i = 2; } i--; /* get value before previous */ #ifdef FIXED_POINT /* dividing by 2, shift right 1 bit */ RE(tempLeft) += (RE(ps->ipd_prev[bk][i]) >> 1); IM(tempLeft) += (IM(ps->ipd_prev[bk][i]) >> 1); RE(tempRight) += (RE(ps->opd_prev[bk][i]) >> 1); IM(tempRight) += (IM(ps->opd_prev[bk][i]) >> 1); #else RE(tempLeft) += MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); IM(tempLeft) += MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); RE(tempRight) += MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); IM(tempRight) += MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); #endif #if 0 /* original code */ ipd = (float)atan2(IM(tempLeft), RE(tempLeft)); opd = (float)atan2(IM(tempRight), RE(tempRight)); /* phase rotation */ RE(phaseLeft) = (float)cos(opd); IM(phaseLeft) = (float)sin(opd); opd -= ipd; RE(phaseRight) = (float)cos(opd); IM(phaseRight) = (float)sin(opd); #else // x = IM(tempLeft) // y = RE(tempLeft) // p = IM(tempRight) // q = RE(tempRight) // cos(atan2(x,y)) = y/sqrt((x*x) + (y*y)) // sin(atan2(x,y)) = x/sqrt((x*x) + (y*y)) // cos(atan2(x,y)-atan2(p,q)) = (y*q + x*p) / ( sqrt((x*x) + (y*y)) * sqrt((p*p) + (q*q)) ); // sin(atan2(x,y)-atan2(p,q)) = (x*q - y*p) / ( sqrt((x*x) + (y*y)) * sqrt((p*p) + (q*q)) ); xy = magnitude_c(tempRight); pq = magnitude_c(tempLeft); if (xy != 0) { RE(phaseLeft) = DIV_R(RE(tempRight), xy); IM(phaseLeft) = DIV_R(IM(tempRight), xy); } else { RE(phaseLeft) = 0; IM(phaseLeft) = 0; } xypq = MUL_R(xy, pq); if (xypq != 0) { real_t tmp1 = MUL_R(RE(tempRight), RE(tempLeft)) + MUL_R(IM(tempRight), IM(tempLeft)); real_t tmp2 = MUL_R(IM(tempRight), RE(tempLeft)) - MUL_R(RE(tempRight), IM(tempLeft)); RE(phaseRight) = DIV_R(tmp1, xypq); IM(phaseRight) = DIV_R(tmp2, xypq); } else { RE(phaseRight) = 0; IM(phaseRight) = 0; } #endif /* MUL_F(COEF, REAL) = COEF */ IM(h11) = MUL_R(RE(h11), IM(phaseLeft)); IM(h12) = MUL_R(RE(h12), IM(phaseRight)); IM(h21) = MUL_R(RE(h21), IM(phaseLeft)); IM(h22) = MUL_R(RE(h22), IM(phaseRight)); RE(h11) = MUL_R(RE(h11), RE(phaseLeft)); RE(h12) = MUL_R(RE(h12), RE(phaseRight)); RE(h21) = MUL_R(RE(h21), RE(phaseLeft)); RE(h22) = MUL_R(RE(h22), RE(phaseRight)); } /* length of the envelope n_e+1 - n_e (in time samples) */ /* 0 < L <= 32: integer */ L = (real_t)(ps->border_position[env + 1] - ps->border_position[env]); /* obtain final H_xy by means of linear interpolation */ RE(deltaH11) = (RE(h11) - RE(ps->h11_prev[gr])) / L; RE(deltaH12) = (RE(h12) - RE(ps->h12_prev[gr])) / L; RE(deltaH21) = (RE(h21) - RE(ps->h21_prev[gr])) / L; RE(deltaH22) = (RE(h22) - RE(ps->h22_prev[gr])) / L; RE(H11) = RE(ps->h11_prev[gr]); RE(H12) = RE(ps->h12_prev[gr]); RE(H21) = RE(ps->h21_prev[gr]); RE(H22) = RE(ps->h22_prev[gr]); RE(ps->h11_prev[gr]) = RE(h11); RE(ps->h12_prev[gr]) = RE(h12); RE(ps->h21_prev[gr]) = RE(h21); RE(ps->h22_prev[gr]) = RE(h22); /* only calculate imaginary part when needed */ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) { /* obtain final H_xy by means of linear interpolation */ IM(deltaH11) = (IM(h11) - IM(ps->h11_prev[gr])) / L; IM(deltaH12) = (IM(h12) - IM(ps->h12_prev[gr])) / L; IM(deltaH21) = (IM(h21) - IM(ps->h21_prev[gr])) / L; IM(deltaH22) = (IM(h22) - IM(ps->h22_prev[gr])) / L; IM(H11) = IM(ps->h11_prev[gr]); IM(H12) = IM(ps->h12_prev[gr]); IM(H21) = IM(ps->h21_prev[gr]); IM(H22) = IM(ps->h22_prev[gr]); if ((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0) { IM(deltaH11) = -IM(deltaH11); IM(deltaH12) = -IM(deltaH12); IM(deltaH21) = -IM(deltaH21); IM(deltaH22) = -IM(deltaH22); IM(H11) = -IM(H11); IM(H12) = -IM(H12); IM(H21) = -IM(H21); IM(H22) = -IM(H22); } IM(ps->h11_prev[gr]) = IM(h11); IM(ps->h12_prev[gr]) = IM(h12); IM(ps->h21_prev[gr]) = IM(h21); IM(ps->h22_prev[gr]) = IM(h22); } /* apply H_xy to the current envelope band of the decorrelated subband */ for (n = ps->border_position[env]; n < ps->border_position[env + 1]; n++) { /* addition finalises the interpolation over every n */ RE(H11) += RE(deltaH11); RE(H12) += RE(deltaH12); RE(H21) += RE(deltaH21); RE(H22) += RE(deltaH22); if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) { IM(H11) += IM(deltaH11); IM(H12) += IM(deltaH12); IM(H21) += IM(deltaH21); IM(H22) += IM(deltaH22); } /* channel is an alias to the subband */ for (sb = ps->group_border[gr]; sb < maxsb; sb++) { complex_t inLeft, inRight; /* load decorrelated samples */ if (gr < ps->num_hybrid_groups) { RE(inLeft) = RE(X_hybrid_left[n][sb]); IM(inLeft) = IM(X_hybrid_left[n][sb]); RE(inRight) = RE(X_hybrid_right[n][sb]); IM(inRight) = IM(X_hybrid_right[n][sb]); } else { RE(inLeft) = RE(X_left[n][sb]); IM(inLeft) = IM(X_left[n][sb]); RE(inRight) = RE(X_right[n][sb]); IM(inRight) = IM(X_right[n][sb]); } /* apply mixing */ RE(tempLeft) = MUL_C(RE(H11), RE(inLeft)) + MUL_C(RE(H21), RE(inRight)); IM(tempLeft) = MUL_C(RE(H11), IM(inLeft)) + MUL_C(RE(H21), IM(inRight)); RE(tempRight) = MUL_C(RE(H12), RE(inLeft)) + MUL_C(RE(H22), RE(inRight)); IM(tempRight) = MUL_C(RE(H12), IM(inLeft)) + MUL_C(RE(H22), IM(inRight)); /* only perform imaginary operations when needed */ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) { /* apply rotation */ RE(tempLeft) -= MUL_C(IM(H11), IM(inLeft)) + MUL_C(IM(H21), IM(inRight)); IM(tempLeft) += MUL_C(IM(H11), RE(inLeft)) + MUL_C(IM(H21), RE(inRight)); RE(tempRight) -= MUL_C(IM(H12), IM(inLeft)) + MUL_C(IM(H22), IM(inRight)); IM(tempRight) += MUL_C(IM(H12), RE(inLeft)) + MUL_C(IM(H22), RE(inRight)); } /* store final samples */ if (gr < ps->num_hybrid_groups) { RE(X_hybrid_left[n][sb]) = RE(tempLeft); IM(X_hybrid_left[n][sb]) = IM(tempLeft); RE(X_hybrid_right[n][sb]) = RE(tempRight); IM(X_hybrid_right[n][sb]) = IM(tempRight); } else { RE(X_left[n][sb]) = RE(tempLeft); IM(X_left[n][sb]) = IM(tempLeft); RE(X_right[n][sb]) = RE(tempRight); IM(X_right[n][sb]) = IM(tempRight); } } } /* shift phase smoother's circular buffer index */ ps->phase_hist++; if (ps->phase_hist == 2) { ps->phase_hist = 0; } } } } void ps_free(ps_info *ps) { /* free hybrid filterbank structures */ hybrid_free(ps->hyb); faad_free(ps); } ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate) { uint8_t i; uint8_t short_delay_band; ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info)); memset(ps, 0, sizeof(ps_info)); ps->hyb = hybrid_init(numTimeSlotsRate); ps->numTimeSlotsRate = numTimeSlotsRate; ps->ps_data_available = 0; /* delay stuff*/ ps->saved_delay = 0; for (i = 0; i < 64; i++) { ps->delay_buf_index_delay[i] = 0; } for (i = 0; i < NO_ALLPASS_LINKS; i++) { ps->delay_buf_index_ser[i] = 0; #ifdef PARAM_32KHZ if (sr_index <= 5) /* >= 32 kHz*/ { ps->num_sample_delay_ser[i] = delay_length_d[1][i]; } else { ps->num_sample_delay_ser[i] = delay_length_d[0][i]; } #else /* THESE ARE CONSTANTS NOW */ ps->num_sample_delay_ser[i] = delay_length_d[i]; #endif } #ifdef PARAM_32KHZ if (sr_index <= 5) /* >= 32 kHz*/ { short_delay_band = 35; ps->nr_allpass_bands = 22; ps->alpha_decay = FRAC_CONST(0.76592833836465); ps->alpha_smooth = FRAC_CONST(0.25); } else { short_delay_band = 64; ps->nr_allpass_bands = 45; ps->alpha_decay = FRAC_CONST(0.58664621951003); ps->alpha_smooth = FRAC_CONST(0.6); } #else /* THESE ARE CONSTANTS NOW */ short_delay_band = 35; ps->nr_allpass_bands = 22; ps->alpha_decay = FRAC_CONST(0.76592833836465); ps->alpha_smooth = FRAC_CONST(0.25); #endif /* THESE ARE CONSTANT NOW IF PS IS INDEPENDANT OF SAMPLERATE */ for (i = 0; i < short_delay_band; i++) { ps->delay_D[i] = 14; } for (i = short_delay_band; i < 64; i++) { ps->delay_D[i] = 1; } /* mixing and phase */ for (i = 0; i < 50; i++) { RE(ps->h11_prev[i]) = 1; IM(ps->h12_prev[i]) = 1; RE(ps->h11_prev[i]) = 1; IM(ps->h12_prev[i]) = 1; } ps->phase_hist = 0; for (i = 0; i < 20; i++) { RE(ps->ipd_prev[i][0]) = 0; IM(ps->ipd_prev[i][0]) = 0; RE(ps->ipd_prev[i][1]) = 0; IM(ps->ipd_prev[i][1]) = 0; RE(ps->opd_prev[i][0]) = 0; IM(ps->opd_prev[i][0]) = 0; RE(ps->opd_prev[i][1]) = 0; IM(ps->opd_prev[i][1]) = 0; } return ps; } /* main Parametric Stereo decoding function */ uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) { qmf_t X_hybrid_left[32][32] = {{0}}; qmf_t X_hybrid_right[32][32] = {{0}}; /* delta decoding of the bitstream data */ ps_data_decode(ps); /* set up some parameters depending on filterbank type */ if (ps->use34hybrid_bands) { ps->group_border = (uint8_t*)group_border34; ps->map_group2bk = (uint16_t*)map_group2bk34; ps->num_groups = 32+18; ps->num_hybrid_groups = 32; ps->nr_par_bands = 34; ps->decay_cutoff = 5; } else { ps->group_border = (uint8_t*)group_border20; ps->map_group2bk = (uint16_t*)map_group2bk20; ps->num_groups = 10+12; ps->num_hybrid_groups = 10; ps->nr_par_bands = 20; ps->decay_cutoff = 3; } /* Perform further analysis on the lowest subbands to get a higher * frequency resolution */ hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands, ps->numTimeSlotsRate); /* decorrelate mono signal */ ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); /* apply mixing and phase parameters */ ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); /* hybrid synthesis, to rebuild the SBR QMF matrices */ hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands, ps->numTimeSlotsRate); hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right, ps->use34hybrid_bands, ps->numTimeSlotsRate); return 0; } #endif welle.io-2.1/src/libs/faad2/libfaad/ps_dec.h000066400000000000000000000101771357201522000205620ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ps_dec.h,v 1.13 2009/01/26 22:32:31 menno Exp $ **/ #ifndef __PS_DEC_H__ #define __PS_DEC_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define EXTENSION_ID_PS 2 #define MAX_PS_ENVELOPES 5 #define NO_ALLPASS_LINKS 3 typedef struct { /* bitstream parameters */ uint8_t enable_iid; uint8_t enable_icc; uint8_t enable_ext; uint8_t iid_mode; uint8_t icc_mode; uint8_t nr_iid_par; uint8_t nr_ipdopd_par; uint8_t nr_icc_par; uint8_t frame_class; uint8_t num_env; uint8_t border_position[MAX_PS_ENVELOPES+1]; uint8_t iid_dt[MAX_PS_ENVELOPES]; uint8_t icc_dt[MAX_PS_ENVELOPES]; uint8_t enable_ipdopd; uint8_t ipd_mode; uint8_t ipd_dt[MAX_PS_ENVELOPES]; uint8_t opd_dt[MAX_PS_ENVELOPES]; /* indices */ int8_t iid_index_prev[34]; int8_t icc_index_prev[34]; int8_t ipd_index_prev[17]; int8_t opd_index_prev[17]; int8_t iid_index[MAX_PS_ENVELOPES][34]; int8_t icc_index[MAX_PS_ENVELOPES][34]; int8_t ipd_index[MAX_PS_ENVELOPES][17]; int8_t opd_index[MAX_PS_ENVELOPES][17]; int8_t ipd_index_1[17]; int8_t opd_index_1[17]; int8_t ipd_index_2[17]; int8_t opd_index_2[17]; /* ps data was correctly read */ uint8_t ps_data_available; /* a header has been read */ uint8_t header_read; /* hybrid filterbank parameters */ void *hyb; uint8_t use34hybrid_bands; uint8_t numTimeSlotsRate; /**/ uint8_t num_groups; uint8_t num_hybrid_groups; uint8_t nr_par_bands; uint8_t nr_allpass_bands; uint8_t decay_cutoff; uint8_t *group_border; uint16_t *map_group2bk; /* filter delay handling */ uint8_t saved_delay; uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS]; uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS]; uint8_t delay_D[64]; uint8_t delay_buf_index_delay[64]; complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */ complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */ complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */ complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */ /* transients */ real_t alpha_decay; real_t alpha_smooth; real_t P_PeakDecayNrg[34]; real_t P_prev[34]; real_t P_SmoothPeakDecayDiffNrg_prev[34]; /* mixing and phase */ complex_t h11_prev[50]; complex_t h12_prev[50]; complex_t h21_prev[50]; complex_t h22_prev[50]; uint8_t phase_hist; complex_t ipd_prev[20][2]; complex_t opd_prev[20][2]; } ps_info; /* ps_syntax.c */ uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header); /* ps_dec.c */ ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate); void ps_free(ps_info *ps); uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ps_syntax.c000066400000000000000000000606711357201522000213540ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ps_syntax.c,v 1.11 2007/11/01 12:33:33 menno Exp $ **/ #include "common.h" #ifdef PS_DEC #include "bits.h" #include "ps_dec.h" /* type definitaions */ typedef const int8_t (*ps_huff_tab)[2]; /* static data tables */ static const uint8_t nr_iid_par_tab[] = { 10, 20, 34, 10, 20, 34, 0, 0 }; static const uint8_t nr_ipdopd_par_tab[] = { 5, 11, 17, 5, 11, 17, 0, 0 }; static const uint8_t nr_icc_par_tab[] = { 10, 20, 34, 10, 20, 34, 0, 0 }; static const uint8_t num_env_tab[][4] = { { 0, 1, 2, 4 }, { 1, 2, 3, 4 } }; /* binary lookup huffman tables */ static const int8_t f_huff_iid_def[][2] = { { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 1x */ { /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */ { 4, 5 }, /* index 3: 3 bits: 11x */ { /*2*/ -29, /*-2*/ -33 }, /* index 4: 4 bits: 110x */ { 6, 7 }, /* index 5: 4 bits: 111x */ { /*3*/ -28, /*-3*/ -34 }, /* index 6: 5 bits: 1110x */ { 8, 9 }, /* index 7: 5 bits: 1111x */ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 11110x */ { /*5*/ -26, 10 }, /* index 9: 6 bits: 11111x */ { /*-5*/ -36, 11 }, /* index 10: 7 bits: 111111x */ { /*6*/ -25, 12 }, /* index 11: 8 bits: 1111111x */ { /*-6*/ -37, 13 }, /* index 12: 9 bits: 11111111x */ { /*-7*/ -38, 14 }, /* index 13: 10 bits: 111111111x */ { /*7*/ -24, 15 }, /* index 14: 11 bits: 1111111111x */ { 16, 17 }, /* index 15: 12 bits: 11111111111x */ { /*8*/ -23, /*-8*/ -39 }, /* index 16: 13 bits: 111111111110x */ { 18, 19 }, /* index 17: 13 bits: 111111111111x */ { /*9*/ -22, /*10*/ -21 }, /* index 18: 14 bits: 1111111111110x */ { 20, 21 }, /* index 19: 14 bits: 1111111111111x */ { /*-9*/ -40, /*11*/ -20 }, /* index 20: 15 bits: 11111111111110x */ { 22, 23 }, /* index 21: 15 bits: 11111111111111x */ { /*-10*/ -41, 24 }, /* index 22: 16 bits: 111111111111110x */ { 25, 26 }, /* index 23: 16 bits: 111111111111111x */ { /*-11*/ -42, /*-14*/ -45 }, /* index 24: 17 bits: 1111111111111101x */ { /*-13*/ -44, /*-12*/ -43 }, /* index 25: 17 bits: 1111111111111110x */ { /*12*/ -19, 27 }, /* index 26: 17 bits: 1111111111111111x */ { /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */ }; static const int8_t t_huff_iid_def[][2] = { { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ { /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */ { /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */ { /*-2*/ -33, 4 }, /* index 3: 4 bits: 111x */ { /*2*/ -29, 5 }, /* index 4: 5 bits: 1111x */ { /*-3*/ -34, 6 }, /* index 5: 6 bits: 11111x */ { /*3*/ -28, 7 }, /* index 6: 7 bits: 111111x */ { /*-4*/ -35, 8 }, /* index 7: 8 bits: 1111111x */ { /*4*/ -27, 9 }, /* index 8: 9 bits: 11111111x */ { /*-5*/ -36, 10 }, /* index 9: 10 bits: 111111111x */ { /*5*/ -26, 11 }, /* index 10: 11 bits: 1111111111x */ { /*-6*/ -37, 12 }, /* index 11: 12 bits: 11111111111x */ { /*6*/ -25, 13 }, /* index 12: 13 bits: 111111111111x */ { /*7*/ -24, 14 }, /* index 13: 14 bits: 1111111111111x */ { /*-7*/ -38, 15 }, /* index 14: 15 bits: 11111111111111x */ { 16, 17 }, /* index 15: 16 bits: 111111111111111x */ { /*8*/ -23, /*-8*/ -39 }, /* index 16: 17 bits: 1111111111111110x */ { 18, 19 }, /* index 17: 17 bits: 1111111111111111x */ { 20, 21 }, /* index 18: 18 bits: 11111111111111110x */ { 22, 23 }, /* index 19: 18 bits: 11111111111111111x */ { /*9*/ -22, /*-14*/ -45 }, /* index 20: 19 bits: 111111111111111100x */ { /*-13*/ -44, /*-12*/ -43 }, /* index 21: 19 bits: 111111111111111101x */ { 24, 25 }, /* index 22: 19 bits: 111111111111111110x */ { 26, 27 }, /* index 23: 19 bits: 111111111111111111x */ { /*-11*/ -42, /*-10*/ -41 }, /* index 24: 20 bits: 1111111111111111100x */ { /*-9*/ -40, /*10*/ -21 }, /* index 25: 20 bits: 1111111111111111101x */ { /*11*/ -20, /*12*/ -19 }, /* index 26: 20 bits: 1111111111111111110x */ { /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */ }; static const int8_t f_huff_iid_fine[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 0x */ { 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */ { /*1*/ -30, 5 }, /* index 3: 3 bits: 01x */ { /*-2*/ -33, /*2*/ -29 }, /* index 4: 4 bits: 000x */ { 6, 7 }, /* index 5: 4 bits: 011x */ { /*-3*/ -34, /*3*/ -28 }, /* index 6: 5 bits: 0110x */ { 8, 9 }, /* index 7: 5 bits: 0111x */ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 01110x */ { 10, 11 }, /* index 9: 6 bits: 01111x */ { /*-5*/ -36, /*5*/ -26 }, /* index 10: 7 bits: 011110x */ { 12, 13 }, /* index 11: 7 bits: 011111x */ { /*-6*/ -37, /*6*/ -25 }, /* index 12: 8 bits: 0111110x */ { 14, 15 }, /* index 13: 8 bits: 0111111x */ { /*7*/ -24, 16 }, /* index 14: 9 bits: 01111110x */ { 17, 18 }, /* index 15: 9 bits: 01111111x */ { 19, /*-8*/ -39 }, /* index 16: 10 bits: 011111101x */ { /*8*/ -23, 20 }, /* index 17: 10 bits: 011111110x */ { 21, /*-7*/ -38 }, /* index 18: 10 bits: 011111111x */ { /*10*/ -21, 22 }, /* index 19: 11 bits: 0111111010x */ { 23, /*-9*/ -40 }, /* index 20: 11 bits: 0111111101x */ { /*9*/ -22, 24 }, /* index 21: 11 bits: 0111111110x */ { /*-11*/ -42, /*11*/ -20 }, /* index 22: 12 bits: 01111110101x */ { 25, 26 }, /* index 23: 12 bits: 01111111010x */ { 27, /*-10*/ -41 }, /* index 24: 12 bits: 01111111101x */ { 28, /*-12*/ -43 }, /* index 25: 13 bits: 011111110100x */ { /*12*/ -19, 29 }, /* index 26: 13 bits: 011111110101x */ { 30, 31 }, /* index 27: 13 bits: 011111111010x */ { 32, /*-14*/ -45 }, /* index 28: 14 bits: 0111111101000x */ { /*14*/ -17, 33 }, /* index 29: 14 bits: 0111111101011x */ { 34, /*-13*/ -44 }, /* index 30: 14 bits: 0111111110100x */ { /*13*/ -18, 35 }, /* index 31: 14 bits: 0111111110101x */ { 36, 37 }, /* index 32: 15 bits: 01111111010000x */ { 38, /*-15*/ -46 }, /* index 33: 15 bits: 01111111010111x */ { /*15*/ -16, 39 }, /* index 34: 15 bits: 01111111101000x */ { 40, 41 }, /* index 35: 15 bits: 01111111101011x */ { 42, 43 }, /* index 36: 16 bits: 011111110100000x */ { /*-17*/ -48, /*17*/ -14 }, /* index 37: 16 bits: 011111110100001x */ { 44, 45 }, /* index 38: 16 bits: 011111110101110x */ { 46, 47 }, /* index 39: 16 bits: 011111111010001x */ { 48, 49 }, /* index 40: 16 bits: 011111111010110x */ { /*-16*/ -47, /*16*/ -15 }, /* index 41: 16 bits: 011111111010111x */ { /*-21*/ -52, /*21*/ -10 }, /* index 42: 17 bits: 0111111101000000x */ { /*-19*/ -50, /*19*/ -12 }, /* index 43: 17 bits: 0111111101000001x */ { /*-18*/ -49, /*18*/ -13 }, /* index 44: 17 bits: 0111111101011100x */ { 50, 51 }, /* index 45: 17 bits: 0111111101011101x */ { 52, 53 }, /* index 46: 17 bits: 0111111110100010x */ { 54, 55 }, /* index 47: 17 bits: 0111111110100011x */ { 56, 57 }, /* index 48: 17 bits: 0111111110101100x */ { 58, 59 }, /* index 49: 17 bits: 0111111110101101x */ { /*-26*/ -57, /*-25*/ -56 }, /* index 50: 18 bits: 01111111010111010x */ { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 18 bits: 01111111010111011x */ { /*-22*/ -53, /*22*/ -9 }, /* index 52: 18 bits: 01111111101000100x */ { /*-24*/ -55, /*-23*/ -54 }, /* index 53: 18 bits: 01111111101000101x */ { /*25*/ -6, /*26*/ -5 }, /* index 54: 18 bits: 01111111101000110x */ { /*23*/ -8, /*24*/ -7 }, /* index 55: 18 bits: 01111111101000111x */ { /*29*/ -2, /*30*/ -1 }, /* index 56: 18 bits: 01111111101011000x */ { /*27*/ -4, /*28*/ -3 }, /* index 57: 18 bits: 01111111101011001x */ { /*-30*/ -61, /*-29*/ -60 }, /* index 58: 18 bits: 01111111101011010x */ { /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */ }; static const int8_t t_huff_iid_fine[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */ { 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */ { 4, 5 }, /* index 3: 4 bits: 010x */ { 6, 7 }, /* index 4: 5 bits: 0100x */ { /*-2*/ -33, /*2*/ -29 }, /* index 5: 5 bits: 0101x */ { 8, /*-3*/ -34 }, /* index 6: 6 bits: 01000x */ { /*3*/ -28, 9 }, /* index 7: 6 bits: 01001x */ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 7 bits: 010000x */ { 10, 11 }, /* index 9: 7 bits: 010011x */ { /*5*/ -26, 12 }, /* index 10: 8 bits: 0100110x */ { 13, 14 }, /* index 11: 8 bits: 0100111x */ { /*-6*/ -37, /*6*/ -25 }, /* index 12: 9 bits: 01001101x */ { 15, 16 }, /* index 13: 9 bits: 01001110x */ { 17, /*-5*/ -36 }, /* index 14: 9 bits: 01001111x */ { 18, /*-7*/ -38 }, /* index 15: 10 bits: 010011100x */ { /*7*/ -24, 19 }, /* index 16: 10 bits: 010011101x */ { 20, 21 }, /* index 17: 10 bits: 010011110x */ { /*9*/ -22, 22 }, /* index 18: 11 bits: 0100111000x */ { 23, 24 }, /* index 19: 11 bits: 0100111011x */ { /*-8*/ -39, /*8*/ -23 }, /* index 20: 11 bits: 0100111100x */ { 25, 26 }, /* index 21: 11 bits: 0100111101x */ { /*11*/ -20, 27 }, /* index 22: 12 bits: 01001110001x */ { 28, 29 }, /* index 23: 12 bits: 01001110110x */ { /*-10*/ -41, /*10*/ -21 }, /* index 24: 12 bits: 01001110111x */ { 30, 31 }, /* index 25: 12 bits: 01001111010x */ { 32, /*-9*/ -40 }, /* index 26: 12 bits: 01001111011x */ { 33, /*-13*/ -44 }, /* index 27: 13 bits: 010011100011x */ { /*13*/ -18, 34 }, /* index 28: 13 bits: 010011101100x */ { 35, 36 }, /* index 29: 13 bits: 010011101101x */ { 37, /*-12*/ -43 }, /* index 30: 13 bits: 010011110100x */ { /*12*/ -19, 38 }, /* index 31: 13 bits: 010011110101x */ { 39, /*-11*/ -42 }, /* index 32: 13 bits: 010011110110x */ { 40, 41 }, /* index 33: 14 bits: 0100111000110x */ { 42, 43 }, /* index 34: 14 bits: 0100111011001x */ { 44, 45 }, /* index 35: 14 bits: 0100111011010x */ { 46, /*-15*/ -46 }, /* index 36: 14 bits: 0100111011011x */ { /*15*/ -16, 47 }, /* index 37: 14 bits: 0100111101000x */ { /*-14*/ -45, /*14*/ -17 }, /* index 38: 14 bits: 0100111101011x */ { 48, 49 }, /* index 39: 14 bits: 0100111101100x */ { /*-21*/ -52, /*-20*/ -51 }, /* index 40: 15 bits: 01001110001100x */ { /*18*/ -13, /*19*/ -12 }, /* index 41: 15 bits: 01001110001101x */ { /*-19*/ -50, /*-18*/ -49 }, /* index 42: 15 bits: 01001110110010x */ { 50, 51 }, /* index 43: 15 bits: 01001110110011x */ { 52, 53 }, /* index 44: 15 bits: 01001110110100x */ { 54, 55 }, /* index 45: 15 bits: 01001110110101x */ { 56, /*-17*/ -48 }, /* index 46: 15 bits: 01001110110110x */ { /*17*/ -14, 57 }, /* index 47: 15 bits: 01001111010001x */ { 58, /*-16*/ -47 }, /* index 48: 15 bits: 01001111011000x */ { /*16*/ -15, 59 }, /* index 49: 15 bits: 01001111011001x */ { /*-26*/ -57, /*26*/ -5 }, /* index 50: 16 bits: 010011101100110x */ { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 16 bits: 010011101100111x */ { /*29*/ -2, /*30*/ -1 }, /* index 52: 16 bits: 010011101101000x */ { /*27*/ -4, /*28*/ -3 }, /* index 53: 16 bits: 010011101101001x */ { /*-30*/ -61, /*-29*/ -60 }, /* index 54: 16 bits: 010011101101010x */ { /*-25*/ -56, /*25*/ -6 }, /* index 55: 16 bits: 010011101101011x */ { /*-24*/ -55, /*24*/ -7 }, /* index 56: 16 bits: 010011101101100x */ { /*-23*/ -54, /*23*/ -8 }, /* index 57: 16 bits: 010011110100011x */ { /*-22*/ -53, /*22*/ -9 }, /* index 58: 16 bits: 010011110110000x */ { /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */ }; static const int8_t f_huff_icc[][2] = { { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ { /*5*/ -26, 9 }, /* index 8: 9 bits: 11111111x */ { /*-4*/ -35, 10 }, /* index 9: 10 bits: 111111111x */ { /*6*/ -25, 11 }, /* index 10: 11 bits: 1111111111x */ { /*-5*/ -36, 12 }, /* index 11: 12 bits: 11111111111x */ { /*7*/ -24, 13 }, /* index 12: 13 bits: 111111111111x */ { /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */ }; static const int8_t t_huff_icc[][2] = { { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ { /*-4*/ -35, 9 }, /* index 8: 9 bits: 11111111x */ { /*5*/ -26, 10 }, /* index 9: 10 bits: 111111111x */ { /*-5*/ -36, 11 }, /* index 10: 11 bits: 1111111111x */ { /*6*/ -25, 12 }, /* index 11: 12 bits: 11111111111x */ { /*-6*/ -37, 13 }, /* index 12: 13 bits: 111111111111x */ { /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */ }; static const int8_t f_huff_ipd[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 0x */ { /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */ { 5, 6 }, /* index 3: 3 bits: 01x */ { /*4*/ -27, /*5*/ -26 }, /* index 4: 4 bits: 001x */ { /*3*/ -28, /*6*/ -25 }, /* index 5: 4 bits: 010x */ { /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */ }; static const int8_t t_huff_ipd[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 0x */ { 4, 5 }, /* index 2: 3 bits: 00x */ { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */ { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */ { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */ }; static const int8_t f_huff_opd[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 0x */ { /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */ { 4, 5 }, /* index 3: 3 bits: 01x */ { /*3*/ -28, /*6*/ -25 }, /* index 4: 4 bits: 010x */ { /*2*/ -29, 6 }, /* index 5: 4 bits: 011x */ { /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */ }; static const int8_t t_huff_opd[][2] = { { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ { 2, 3 }, /* index 1: 2 bits: 0x */ { 4, 5 }, /* index 2: 3 bits: 00x */ { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ { /*5*/ -26, /*2*/ -29 }, /* index 4: 4 bits: 000x */ { /*6*/ -25, 6 }, /* index 5: 4 bits: 001x */ { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0011x */ }; /* static function declarations */ static uint16_t ps_extension(ps_info *ps, bitfile *ld, const uint8_t ps_extension_id, const uint16_t num_bits_left); static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par); static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff); uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header) { uint8_t tmp, n; uint16_t bits = (uint16_t)faad_get_processed_bits(ld); *header = 0; /* check for new PS header */ if (faad_get1bit(ld DEBUGVAR(1,1000,"ps_data(): enable_ps_header"))) { *header = 1; ps->header_read = 1; ps->use34hybrid_bands = 0; /* Inter-channel Intensity Difference (IID) parameters enabled */ ps->enable_iid = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1001,"ps_data(): enable_iid")); if (ps->enable_iid) { ps->iid_mode = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1002,"ps_data(): iid_mode")); ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode]; ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode]; if (ps->iid_mode == 2 || ps->iid_mode == 5) ps->use34hybrid_bands = 1; /* IPD freq res equal to IID freq res */ ps->ipd_mode = ps->iid_mode; } /* Inter-channel Coherence (ICC) parameters enabled */ ps->enable_icc = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1003,"ps_data(): enable_icc")); if (ps->enable_icc) { ps->icc_mode = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1004,"ps_data(): icc_mode")); ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode]; if (ps->icc_mode == 2 || ps->icc_mode == 5) ps->use34hybrid_bands = 1; } /* PS extension layer enabled */ ps->enable_ext = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1005,"ps_data(): enable_ext")); } /* we are here, but no header has been read yet */ if (ps->header_read == 0) { ps->ps_data_available = 0; return 1; } ps->frame_class = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1006,"ps_data(): frame_class")); tmp = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1007,"ps_data(): num_env_idx")); ps->num_env = num_env_tab[ps->frame_class][tmp]; if (ps->frame_class) { for (n = 1; n < ps->num_env+1; n++) { ps->border_position[n] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1008,"ps_data(): border_position")) + 1; } } if (ps->enable_iid) { for (n = 0; n < ps->num_env; n++) { ps->iid_dt[n] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1009,"ps_data(): iid_dt")); /* iid_data */ if (ps->iid_mode < 3) { huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def, f_huff_iid_def, ps->iid_index[n]); } else { huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine, f_huff_iid_fine, ps->iid_index[n]); } } } if (ps->enable_icc) { for (n = 0; n < ps->num_env; n++) { ps->icc_dt[n] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1010,"ps_data(): icc_dt")); /* icc_data */ huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc, f_huff_icc, ps->icc_index[n]); } } if (ps->enable_ext) { uint16_t num_bits_left; uint16_t cnt = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,1011,"ps_data(): ps_extension_size")); if (cnt == 15) { cnt += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,1012,"ps_data(): esc_count")); } num_bits_left = 8 * cnt; while (num_bits_left > 7) { uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1013,"ps_data(): ps_extension_size")); num_bits_left -= 2; num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left); } faad_getbits(ld, num_bits_left DEBUGVAR(1,1014,"ps_data(): fill_bits")); } bits = (uint16_t)faad_get_processed_bits(ld) - bits; ps->ps_data_available = 1; return bits; } static uint16_t ps_extension(ps_info *ps, bitfile *ld, const uint8_t ps_extension_id, const uint16_t num_bits_left) { uint8_t n; uint16_t bits = (uint16_t)faad_get_processed_bits(ld); if (ps_extension_id == 0) { ps->enable_ipdopd = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd")); if (ps->enable_ipdopd) { for (n = 0; n < ps->num_env; n++) { ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1016,"ps_extension(): ipd_dt")); /* ipd_data */ huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd, f_huff_ipd, ps->ipd_index[n]); ps->opd_dt[n] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,1017,"ps_extension(): opd_dt")); /* opd_data */ huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd, f_huff_opd, ps->opd_index[n]); } } faad_get1bit(ld DEBUGVAR(1,1018,"ps_extension(): reserved_ps")); } /* return number of bits read */ bits = (uint16_t)faad_get_processed_bits(ld) - bits; return bits; } /* read huffman data coded in either the frequency or the time direction */ static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par) { uint8_t n; if (dt) { /* coded in time direction */ for (n = 0; n < nr_par; n++) { par[n] = ps_huff_dec(ld, t_huff); } } else { /* coded in frequency direction */ par[0] = ps_huff_dec(ld, f_huff); for (n = 1; n < nr_par; n++) { par[n] = ps_huff_dec(ld, f_huff); } } } /* binary search huffman decoding */ static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff) { uint8_t bit; int16_t index = 0; while (index >= 0) { bit = (uint8_t)faad_get1bit(ld); index = t_huff[index][bit]; } return index + 31; } #endif welle.io-2.1/src/libs/faad2/libfaad/ps_tables.h000066400000000000000000001727151357201522000213100ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ps_tables.h,v 1.8 2007/11/01 12:33:33 menno Exp $ **/ #ifndef __PS_TABLES_H__ #define __PS_TABLES_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif #if 0 #if 0 float f_center_20[12] = { 0.5/4, 1.5/4, 2.5/4, 3.5/4, 4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4, 3.5/2, 2.5/2, 4.5/2, 5.5/2 }; #else float f_center_20[12] = { 0.5/8, 1.5/8, 2.5/8, 3.5/8, 4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8, 3.5/4, 2.5/4, 4.5/4, 5.5/4 }; #endif float f_center_34[32] = { 1/12, 3/12, 5/12, 7/12, 9/12, 11/12, 13/12, 15/12, 17/12, -5/12, -3/12, -1/12, 17/8, 19/8, 5/8, 7/8, 9/8, 11/8, 13/8, 15/8, 9/4, 11/4, 13/4, 7/4, 17/4, 11/4, 13/4, 15/4, 17/4, 19/4, 21/4, 15/4 }; static const real_t frac_delay_q[] = { FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347) }; #endif /* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */ /* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */ static const complex_t Phi_Fract_Qmf[] = { { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } }; /* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */ /* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */ static const complex_t Phi_Fract_SubQmf20[] = { { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) }, { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) }, { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) }, { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) }, { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) }, { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) }, { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) }, { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) }, { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) } }; /* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */ /* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */ static const complex_t Phi_Fract_SubQmf34[] = { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) }, { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) } }; /* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */ /* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */ static const complex_t Q_Fract_allpass_Qmf[][3] = { { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } }; /* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */ /* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */ static const complex_t Q_Fract_allpass_SubQmf20[][3] = { { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } }, { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } }, { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } }, { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } }, { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } }, { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } }, { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } }, { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } }, { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } } }; /* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */ /* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */ static const complex_t Q_Fract_allpass_SubQmf34[][3] = { { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } }, { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } } }; #if 0 static float quant_rho[8] = { FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092), FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0) }; static const uint8_t quant_iid_normal[7] = { 2, 4, 7, 10, 14, 18, 25 }; static const uint8_t quant_iid_fine[15] = { 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50 }; #endif static const real_t cos_alphas[] = { COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210), COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812), COEF_CONST(0.4533210856), COEF_CONST(0.0000000000) }; static const real_t sin_alphas[] = { COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763), COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812), COEF_CONST(0.8913472911), COEF_CONST(1.0000000000) }; static const real_t cos_betas_normal[][8] = { { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) } }; static const real_t sin_betas_normal[][8] = { { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) } }; static const real_t cos_betas_fine[][8] = { { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) } }; static const real_t sin_betas_fine[][8] = { { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) }, { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) } }; static const real_t sincos_alphas_B_normal[][8] = { { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) }, { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) }, { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) }, { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) }, { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) }, { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) }, { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) } }; static const real_t sincos_alphas_B_fine[][8] = { { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) }, { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) }, { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) }, { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) }, { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) }, { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) }, { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) }, { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) }, { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) }, { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) }, { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) }, { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) }, { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) }, { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) }, { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) }, { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) }, { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) }, { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }, { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) }, { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) }, { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) }, { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) }, { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) } }; static const real_t cos_gammas_normal[][8] = { { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) } }; static const real_t cos_gammas_fine[][8] = { { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) }, { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) } }; static const real_t sin_gammas_normal[][8] = { { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) } }; static const real_t sin_gammas_fine[][8] = { { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) }, { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) }, { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) } }; static const real_t sf_iid_normal[] = { COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023), COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363), COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272) }; static const real_t sf_iid_fine[] = { COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471), COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747), COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564), COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403), COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662), COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363), COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875), COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170), COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812), COEF_CONST(0.0044721137) }; #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/pulse.c000066400000000000000000000036111357201522000204430ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: pulse.c,v 1.21 2007/11/01 12:33:34 menno Exp $ **/ #include "common.h" #include "structs.h" #include "syntax.h" #include "pulse.h" uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen) { uint8_t i; uint16_t k; pulse_info *pul = &(ics->pul); k = min(ics->swb_offset[pul->pulse_start_sfb], ics->swb_offset_max); for (i = 0; i <= pul->number_pulse; i++) { k += pul->pulse_offset[i]; if (k >= framelen) return 15; /* should not be possible */ if (spec_data[k] > 0) spec_data[k] += pul->pulse_amp[i]; else spec_data[k] -= pul->pulse_amp[i]; } return 0; } welle.io-2.1/src/libs/faad2/libfaad/pulse.h000066400000000000000000000027301357201522000204510ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: pulse.h,v 1.20 2007/11/01 12:33:34 menno Exp $ **/ #ifndef __PULSE_H__ #define __PULSE_H__ #ifdef __cplusplus extern "C" { #endif uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/rvlc.c000066400000000000000000000363651357201522000202750ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: rvlc.c,v 1.21 2007/11/01 12:33:34 menno Exp $ **/ /* RVLC scalefactor decoding * * RVLC works like this: * 1. Only symmetric huffman codewords are used * 2. Total length of the scalefactor data is stored in the bitsream * 3. Scalefactors are DPCM coded * 4. Next to the starting value for DPCM the ending value is also stored * * With all this it is possible to read the scalefactor data from 2 sides. * If there is a bit error in the scalefactor data it is possible to start * decoding from the other end of the data, to find all but 1 scalefactor. */ #include "common.h" #include "structs.h" #include #include "syntax.h" #include "bits.h" #include "rvlc.h" #ifdef ERROR_RESILIENCE //#define PRINT_RVLC /* static function declarations */ static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, uint8_t *is_used); #if 0 static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, uint8_t is_used); #endif static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, int8_t direction); static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction); uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld) { uint8_t bits = 9; ics->sf_concealment = faad_get1bit(ld DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment")); ics->rev_global_gain = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain")); if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) bits = 11; /* the number of bits used for the huffman codewords */ ics->length_of_rvlc_sf = (uint16_t)faad_getbits(ld, bits DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf")); if (ics->noise_used) { ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9 DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg")); ics->length_of_rvlc_sf -= 9; } ics->sf_escapes_present = faad_get1bit(ld DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present")); if (ics->sf_escapes_present) { ics->length_of_rvlc_escapes = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes")); } if (ics->noise_used) { ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9 DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position")); } return 0; } uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld) { uint8_t result; uint8_t intensity_used = 0; uint8_t *rvlc_sf_buffer = NULL; uint8_t *rvlc_esc_buffer = NULL; bitfile ld_rvlc_sf, ld_rvlc_esc; // bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev; if (ics->length_of_rvlc_sf > 0) { /* We read length_of_rvlc_sf bits here to put it in a seperate bitfile. */ rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf")); faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf)); // faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer, // ics->length_of_rvlc_sf); } if (ics->sf_escapes_present) { /* We read length_of_rvlc_escapes bits here to put it in a seperate bitfile. */ rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes")); faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes)); // faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer, // ics->length_of_rvlc_escapes); } /* decode the rvlc scale factors and escapes */ result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf, &ld_rvlc_esc, &intensity_used); // result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev, // &ld_rvlc_esc_rev, intensity_used); if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer); if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer); if (ics->length_of_rvlc_sf > 0) faad_endbits(&ld_rvlc_sf); if (ics->sf_escapes_present) faad_endbits(&ld_rvlc_esc); return result; } static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, uint8_t *intensity_used) { int8_t g, sfb; int8_t t = 0; int8_t error = 0; int8_t noise_pcm_flag = 1; int16_t scale_factor = ics->global_gain; int16_t is_position = 0; int16_t noise_energy = ics->global_gain - 90 - 256; #ifdef PRINT_RVLC printf("\nglobal_gain: %d\n", ics->global_gain); #endif for (g = 0; g < ics->num_window_groups; g++) { for (sfb = 0; sfb < ics->max_sfb; sfb++) { if (error) { ics->scale_factors[g][sfb] = 0; } else { switch (ics->sfb_cb[g][sfb]) { case ZERO_HCB: /* zero book */ ics->scale_factors[g][sfb] = 0; break; case INTENSITY_HCB: /* intensity books */ case INTENSITY_HCB2: *intensity_used = 1; /* decode intensity position */ t = rvlc_huffman_sf(ld_sf, ld_esc, +1); is_position += t; ics->scale_factors[g][sfb] = is_position; break; case NOISE_HCB: /* noise books */ /* decode noise energy */ if (noise_pcm_flag) { int16_t n = ics->dpcm_noise_nrg; noise_pcm_flag = 0; noise_energy += n; } else { t = rvlc_huffman_sf(ld_sf, ld_esc, +1); noise_energy += t; } ics->scale_factors[g][sfb] = noise_energy; break; default: /* spectral books */ /* decode scale factor */ t = rvlc_huffman_sf(ld_sf, ld_esc, +1); scale_factor += t; if (scale_factor < 0) return 4; ics->scale_factors[g][sfb] = scale_factor; break; } #ifdef PRINT_RVLC printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], ics->scale_factors[g][sfb]); #endif if (t == 99) { error = 1; } } } } #ifdef PRINT_RVLC printf("\n\n"); #endif return 0; } #if 0 // not used right now, doesn't work correctly yet static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, uint8_t intensity_used) { int8_t g, sfb; int8_t t = 0; int8_t error = 0; int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1; int16_t scale_factor = ics->rev_global_gain; int16_t is_position = 0; int16_t noise_energy = ics->rev_global_gain; #ifdef PRINT_RVLC printf("\nrev_global_gain: %d\n", ics->rev_global_gain); #endif if (intensity_used) { is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1); #ifdef PRINT_RVLC printf("is_position: %d\n", is_position); #endif } for (g = ics->num_window_groups-1; g >= 0; g--) { for (sfb = ics->max_sfb-1; sfb >= 0; sfb--) { if (error) { ics->scale_factors[g][sfb] = 0; } else { switch (ics->sfb_cb[g][sfb]) { case ZERO_HCB: /* zero book */ ics->scale_factors[g][sfb] = 0; break; case INTENSITY_HCB: /* intensity books */ case INTENSITY_HCB2: if (is_pcm_flag) { is_pcm_flag = 0; ics->scale_factors[g][sfb] = is_position; } else { t = rvlc_huffman_sf(ld_sf, ld_esc, -1); is_position -= t; ics->scale_factors[g][sfb] = (uint8_t)is_position; } break; case NOISE_HCB: /* noise books */ /* decode noise energy */ if (noise_pcm_flag) { noise_pcm_flag = 0; noise_energy = ics->dpcm_noise_last_position; } else { t = rvlc_huffman_sf(ld_sf, ld_esc, -1); noise_energy -= t; } ics->scale_factors[g][sfb] = (uint8_t)noise_energy; break; default: /* spectral books */ if (sf_pcm_flag || (sfb == 0)) { sf_pcm_flag = 0; if (sfb == 0) scale_factor = ics->global_gain; } else { /* decode scale factor */ t = rvlc_huffman_sf(ld_sf, ld_esc, -1); scale_factor -= t; } if (scale_factor < 0) return 4; ics->scale_factors[g][sfb] = (uint8_t)scale_factor; break; } #ifdef PRINT_RVLC printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], ics->scale_factors[g][sfb]); #endif if (t == 99) { error = 1; } } } } #ifdef PRINT_RVLC printf("\n\n"); #endif return 0; } #endif /* index == 99 means not allowed codeword */ static rvlc_huff_table book_rvlc[] = { /*index length codeword */ { 0, 1, 0 }, /* 0 */ { -1, 3, 5 }, /* 101 */ { 1, 3, 7 }, /* 111 */ { -2, 4, 9 }, /* 1001 */ { -3, 5, 17 }, /* 10001 */ { 2, 5, 27 }, /* 11011 */ { -4, 6, 33 }, /* 100001 */ { 99, 6, 50 }, /* 110010 */ { 3, 6, 51 }, /* 110011 */ { 99, 6, 52 }, /* 110100 */ { -7, 7, 65 }, /* 1000001 */ { 99, 7, 96 }, /* 1100000 */ { 99, 7, 98 }, /* 1100010 */ { 7, 7, 99 }, /* 1100011 */ { 4, 7, 107 }, /* 1101011 */ { -5, 8, 129 }, /* 10000001 */ { 99, 8, 194 }, /* 11000010 */ { 5, 8, 195 }, /* 11000011 */ { 99, 8, 212 }, /* 11010100 */ { 99, 9, 256 }, /* 100000000 */ { -6, 9, 257 }, /* 100000001 */ { 99, 9, 426 }, /* 110101010 */ { 6, 9, 427 }, /* 110101011 */ { 99, 10, 0 } /* Shouldn't come this far */ }; static rvlc_huff_table book_escape[] = { /*index length codeword */ { 1, 2, 0 }, { 0, 2, 2 }, { 3, 3, 2 }, { 2, 3, 6 }, { 4, 4, 14 }, { 7, 5, 13 }, { 6, 5, 15 }, { 5, 5, 31 }, { 11, 6, 24 }, { 10, 6, 25 }, { 9, 6, 29 }, { 8, 6, 61 }, { 13, 7, 56 }, { 12, 7, 120 }, { 15, 8, 114 }, { 14, 8, 242 }, { 17, 9, 230 }, { 16, 9, 486 }, { 19, 10, 463 }, { 18, 10, 974 }, { 22, 11, 925 }, { 20, 11, 1950 }, { 21, 11, 1951 }, { 23, 12, 1848 }, { 25, 13, 3698 }, { 24, 14, 7399 }, { 26, 15, 14797 }, { 49, 19, 236736 }, { 50, 19, 236737 }, { 51, 19, 236738 }, { 52, 19, 236739 }, { 53, 19, 236740 }, { 27, 20, 473482 }, { 28, 20, 473483 }, { 29, 20, 473484 }, { 30, 20, 473485 }, { 31, 20, 473486 }, { 32, 20, 473487 }, { 33, 20, 473488 }, { 34, 20, 473489 }, { 35, 20, 473490 }, { 36, 20, 473491 }, { 37, 20, 473492 }, { 38, 20, 473493 }, { 39, 20, 473494 }, { 40, 20, 473495 }, { 41, 20, 473496 }, { 42, 20, 473497 }, { 43, 20, 473498 }, { 44, 20, 473499 }, { 45, 20, 473500 }, { 46, 20, 473501 }, { 47, 20, 473502 }, { 48, 20, 473503 }, { 99, 21, 0 } /* Shouldn't come this far */ }; static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, int8_t direction) { uint8_t i, j; int8_t index; uint32_t cw; rvlc_huff_table *h = book_rvlc; i = h->len; if (direction > 0) cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,"")); else cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,"")); while ((cw != h->cw) && (i < 10)) { h++; j = h->len-i; i += j; cw <<= j; if (direction > 0) cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,"")); else cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,"")); } index = h->index; if (index == +ESC_VAL) { int8_t esc = rvlc_huffman_esc(ld_esc, direction); if (esc == 99) return 99; index += esc; #ifdef PRINT_RVLC printf("esc: %d - ", esc); #endif } if (index == -ESC_VAL) { int8_t esc = rvlc_huffman_esc(ld_esc, direction); if (esc == 99) return 99; index -= esc; #ifdef PRINT_RVLC printf("esc: %d - ", esc); #endif } return index; } static int8_t rvlc_huffman_esc(bitfile *ld, int8_t direction) { uint8_t i, j; uint32_t cw; rvlc_huff_table *h = book_escape; i = h->len; if (direction > 0) cw = faad_getbits(ld, i DEBUGVAR(1,0,"")); else cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,"")); while ((cw != h->cw) && (i < 21)) { h++; j = h->len-i; i += j; cw <<= j; if (direction > 0) cw |= faad_getbits(ld, j DEBUGVAR(1,0,"")); else cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,"")); } return h->index; } #endif welle.io-2.1/src/libs/faad2/libfaad/rvlc.h000066400000000000000000000031741357201522000202720ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: rvlc.h,v 1.17 2007/11/01 12:33:34 menno Exp $ **/ #ifndef __RVLC_SCF_H__ #define __RVLC_SCF_H__ #ifdef __cplusplus extern "C" { #endif typedef struct { int8_t index; uint8_t len; uint32_t cw; } rvlc_huff_table; #define ESC_VAL 7 uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld); uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_dct.c000066400000000000000000002401521357201522000207360ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_dct.c,v 1.20 2007/11/01 12:33:34 menno Exp $ **/ /* Most of the DCT/DST codes here are generated using Spiral which is GPL * For more info see: http://www.spiral.net/ */ #include "common.h" #ifdef SBR_DEC #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif #include "sbr_dct.h" void DCT4_32(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280; real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290; real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300; real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312; real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328; real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342; real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358; real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372; real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388; real_t f389, f390, f391, f394, f395, f396, f397; f0 = x[15] - x[16]; f1 = x[15] + x[16]; f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1); f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0); f4 = x[8] - x[23]; f5 = x[8] + x[23]; f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5); f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4); f8 = x[12] - x[19]; f9 = x[12] + x[19]; f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9); f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8); f12 = x[11] - x[20]; f13 = x[11] + x[20]; f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13); f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12); f16 = x[14] - x[17]; f17 = x[14] + x[17]; f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17); f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16); f20 = x[9] - x[22]; f21 = x[9] + x[22]; f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21); f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20); f24 = x[13] - x[18]; f25 = x[13] + x[18]; f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25); f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24); f28 = x[10] - x[21]; f29 = x[10] + x[21]; f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29); f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28); f32 = x[0] - f2; f33 = x[0] + f2; f34 = x[31] - f3; f35 = x[31] + f3; f36 = x[7] - f6; f37 = x[7] + f6; f38 = x[24] - f7; f39 = x[24] + f7; f40 = x[3] - f10; f41 = x[3] + f10; f42 = x[28] - f11; f43 = x[28] + f11; f44 = x[4] - f14; f45 = x[4] + f14; f46 = x[27] - f15; f47 = x[27] + f15; f48 = x[1] - f18; f49 = x[1] + f18; f50 = x[30] - f19; f51 = x[30] + f19; f52 = x[6] - f22; f53 = x[6] + f22; f54 = x[25] - f23; f55 = x[25] + f23; f56 = x[2] - f26; f57 = x[2] + f26; f58 = x[29] - f27; f59 = x[29] + f27; f60 = x[5] - f30; f61 = x[5] + f30; f62 = x[26] - f31; f63 = x[26] + f31; f64 = f39 + f37; f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39); f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64); f67 = MUL_C(COEF_CONST(1.3065629648763766), f37); f68 = f65 + f66; f69 = f67 - f66; f70 = f38 + f36; f71 = MUL_C(COEF_CONST(1.3065629648763770), f38); f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70); f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36); f74 = f71 + f72; f75 = f73 - f72; f76 = f47 + f45; f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47); f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76); f79 = MUL_C(COEF_CONST(1.3065629648763766), f45); f80 = f77 + f78; f81 = f79 - f78; f82 = f46 + f44; f83 = MUL_C(COEF_CONST(1.3065629648763770), f46); f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82); f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44); f86 = f83 + f84; f87 = f85 - f84; f88 = f55 + f53; f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55); f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88); f91 = MUL_C(COEF_CONST(1.3065629648763766), f53); f92 = f89 + f90; f93 = f91 - f90; f94 = f54 + f52; f95 = MUL_C(COEF_CONST(1.3065629648763770), f54); f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94); f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52); f98 = f95 + f96; f99 = f97 - f96; f100 = f63 + f61; f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63); f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100); f103 = MUL_C(COEF_CONST(1.3065629648763766), f61); f104 = f101 + f102; f105 = f103 - f102; f106 = f62 + f60; f107 = MUL_C(COEF_CONST(1.3065629648763770), f62); f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106); f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60); f110 = f107 + f108; f111 = f109 - f108; f112 = f33 - f68; f113 = f33 + f68; f114 = f35 - f69; f115 = f35 + f69; f116 = f32 - f74; f117 = f32 + f74; f118 = f34 - f75; f119 = f34 + f75; f120 = f41 - f80; f121 = f41 + f80; f122 = f43 - f81; f123 = f43 + f81; f124 = f40 - f86; f125 = f40 + f86; f126 = f42 - f87; f127 = f42 + f87; f128 = f49 - f92; f129 = f49 + f92; f130 = f51 - f93; f131 = f51 + f93; f132 = f48 - f98; f133 = f48 + f98; f134 = f50 - f99; f135 = f50 + f99; f136 = f57 - f104; f137 = f57 + f104; f138 = f59 - f105; f139 = f59 + f105; f140 = f56 - f110; f141 = f56 + f110; f142 = f58 - f111; f143 = f58 + f111; f144 = f123 + f121; f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123); f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144); f147 = MUL_C(COEF_CONST(1.1758756024193588), f121); f148 = f145 + f146; f149 = f147 - f146; f150 = f127 + f125; f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127); f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150); f153 = MUL_C(COEF_CONST(1.3870398453221475), f125); f154 = f151 + f152; f155 = f153 - f152; f156 = f122 + f120; f157 = MUL_C(COEF_CONST(1.1758756024193591), f122); f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156); f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120); f160 = f157 + f158; f161 = f159 - f158; f162 = f126 + f124; f163 = MUL_C(COEF_CONST(1.3870398453221473), f126); f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162); f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124); f166 = f163 + f164; f167 = f165 - f164; f168 = f139 + f137; f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139); f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168); f171 = MUL_C(COEF_CONST(1.1758756024193588), f137); f172 = f169 + f170; f173 = f171 - f170; f174 = f143 + f141; f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143); f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174); f177 = MUL_C(COEF_CONST(1.3870398453221475), f141); f178 = f175 + f176; f179 = f177 - f176; f180 = f138 + f136; f181 = MUL_C(COEF_CONST(1.1758756024193591), f138); f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180); f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136); f184 = f181 + f182; f185 = f183 - f182; f186 = f142 + f140; f187 = MUL_C(COEF_CONST(1.3870398453221473), f142); f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186); f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140); f190 = f187 + f188; f191 = f189 - f188; f192 = f113 - f148; f193 = f113 + f148; f194 = f115 - f149; f195 = f115 + f149; f196 = f117 - f154; f197 = f117 + f154; f198 = f119 - f155; f199 = f119 + f155; f200 = f112 - f160; f201 = f112 + f160; f202 = f114 - f161; f203 = f114 + f161; f204 = f116 - f166; f205 = f116 + f166; f206 = f118 - f167; f207 = f118 + f167; f208 = f129 - f172; f209 = f129 + f172; f210 = f131 - f173; f211 = f131 + f173; f212 = f133 - f178; f213 = f133 + f178; f214 = f135 - f179; f215 = f135 + f179; f216 = f128 - f184; f217 = f128 + f184; f218 = f130 - f185; f219 = f130 + f185; f220 = f132 - f190; f221 = f132 + f190; f222 = f134 - f191; f223 = f134 + f191; f224 = f211 + f209; f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211); f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224); f227 = MUL_C(COEF_CONST(1.0932018670017576), f209); f228 = f225 + f226; f229 = f227 - f226; f230 = f215 + f213; f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215); f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230); f233 = MUL_C(COEF_CONST(1.3533180011743529), f213); f234 = f231 + f232; f235 = f233 - f232; f236 = f219 + f217; f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219); f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236); f239 = MUL_C(COEF_CONST(1.4074037375263826), f217); f240 = f237 + f238; f241 = f239 - f238; f242 = f223 + f221; f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223); f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242); f245 = MUL_C(COEF_CONST(1.2472250129866711), f221); f246 = f243 + f244; f247 = f245 - f244; f248 = f210 + f208; f249 = MUL_C(COEF_CONST(1.0932018670017574), f210); f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248); f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208); f252 = f249 + f250; f253 = f251 - f250; f254 = f214 + f212; f255 = MUL_C(COEF_CONST(1.3533180011743529), f214); f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254); f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212); f258 = f255 + f256; f259 = f257 - f256; f260 = f218 + f216; f261 = MUL_C(COEF_CONST(1.4074037375263826), f218); f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260); f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216); f264 = f261 + f262; f265 = f263 - f262; f266 = f222 + f220; f267 = MUL_C(COEF_CONST(1.2472250129866711), f222); f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266); f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220); f270 = f267 + f268; f271 = f269 - f268; f272 = f193 - f228; f273 = f193 + f228; f274 = f195 - f229; f275 = f195 + f229; f276 = f197 - f234; f277 = f197 + f234; f278 = f199 - f235; f279 = f199 + f235; f280 = f201 - f240; f281 = f201 + f240; f282 = f203 - f241; f283 = f203 + f241; f284 = f205 - f246; f285 = f205 + f246; f286 = f207 - f247; f287 = f207 + f247; f288 = f192 - f252; f289 = f192 + f252; f290 = f194 - f253; f291 = f194 + f253; f292 = f196 - f258; f293 = f196 + f258; f294 = f198 - f259; f295 = f198 + f259; f296 = f200 - f264; f297 = f200 + f264; f298 = f202 - f265; f299 = f202 + f265; f300 = f204 - f270; f301 = f204 + f270; f302 = f206 - f271; f303 = f206 + f271; f304 = f275 + f273; f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275); f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304); f307 = MUL_C(COEF_CONST(1.0242400472191164), f273); y[0] = f305 + f306; y[31] = f307 - f306; f310 = f279 + f277; f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279); f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310); f313 = MUL_C(COEF_CONST(1.1148902097979263), f277); y[2] = f311 + f312; y[29] = f313 - f312; f316 = f283 + f281; f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283); f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316); f319 = MUL_C(COEF_CONST(1.1948033701953984), f281); y[4] = f317 + f318; y[27] = f319 - f318; f322 = f287 + f285; f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287); f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322); f325 = MUL_C(COEF_CONST(1.2632099209919283), f285); y[6] = f323 + f324; y[25] = f325 - f324; f328 = f291 + f289; f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291); f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328); f331 = MUL_C(COEF_CONST(1.3194510697085207), f289); y[8] = f329 + f330; y[23] = f331 - f330; f334 = f295 + f293; f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295); f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334); f337 = MUL_C(COEF_CONST(1.3629851833384954), f293); y[10] = f335 + f336; y[21] = f337 - f336; f340 = f299 + f297; f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299); f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340); f343 = MUL_C(COEF_CONST(1.3933930045694289), f297); y[12] = f341 + f342; y[19] = f343 - f342; f346 = f303 + f301; f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303); f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346); f349 = MUL_C(COEF_CONST(1.4103816894602612), f301); y[14] = f347 + f348; y[17] = f349 - f348; f352 = f274 + f272; f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274); f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352); f355 = MUL_C(COEF_CONST(1.4137876276885337), f272); y[16] = f353 + f354; y[15] = f355 - f354; f358 = f278 + f276; f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278); f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358); f361 = MUL_C(COEF_CONST(1.4035780182072330), f276); y[18] = f359 + f360; y[13] = f361 - f360; f364 = f282 + f280; f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282); f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364); f367 = MUL_C(COEF_CONST(1.3798511851368043), f280); y[20] = f365 + f366; y[11] = f367 - f366; f370 = f286 + f284; f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286); f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370); f373 = MUL_C(COEF_CONST(1.3428356308501219), f284); y[22] = f371 + f372; y[9] = f373 - f372; f376 = f290 + f288; f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290); f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376); f379 = MUL_C(COEF_CONST(1.2928878353697271), f288); y[24] = f377 + f378; y[7] = f379 - f378; f382 = f294 + f292; f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294); f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382); f385 = MUL_C(COEF_CONST(1.2304888232703382), f292); y[26] = f383 + f384; y[5] = f385 - f384; f388 = f298 + f296; f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298); f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388); f391 = MUL_C(COEF_CONST(1.1562395311492424), f296); y[28] = f389 + f390; y[3] = f391 - f390; f394 = f302 + f300; f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302); f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394); f397 = MUL_C(COEF_CONST(1.0708550202783576), f300); y[30] = f395 + f396; y[1] = f397 - f396; } void DST4_32(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19; real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29; real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39; real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49; real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59; real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69; real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79; real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89; real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99; real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109; real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119; real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129; real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139; real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149; real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159; real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169; real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179; real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189; real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199; real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209; real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219; real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229; real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239; real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249; real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259; real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269; real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279; real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289; real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299; real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309; real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319; real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329; real_t f330, f331, f332, f333, f334, f335; f0 = x[0] - x[1]; f1 = x[2] - x[1]; f2 = x[2] - x[3]; f3 = x[4] - x[3]; f4 = x[4] - x[5]; f5 = x[6] - x[5]; f6 = x[6] - x[7]; f7 = x[8] - x[7]; f8 = x[8] - x[9]; f9 = x[10] - x[9]; f10 = x[10] - x[11]; f11 = x[12] - x[11]; f12 = x[12] - x[13]; f13 = x[14] - x[13]; f14 = x[14] - x[15]; f15 = x[16] - x[15]; f16 = x[16] - x[17]; f17 = x[18] - x[17]; f18 = x[18] - x[19]; f19 = x[20] - x[19]; f20 = x[20] - x[21]; f21 = x[22] - x[21]; f22 = x[22] - x[23]; f23 = x[24] - x[23]; f24 = x[24] - x[25]; f25 = x[26] - x[25]; f26 = x[26] - x[27]; f27 = x[28] - x[27]; f28 = x[28] - x[29]; f29 = x[30] - x[29]; f30 = x[30] - x[31]; f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15); f32 = x[0] - f31; f33 = x[0] + f31; f34 = f7 + f23; f35 = MUL_C(COEF_CONST(1.3065629648763766), f7); f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34); f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23); f38 = f35 + f36; f39 = f37 - f36; f40 = f33 - f39; f41 = f33 + f39; f42 = f32 - f38; f43 = f32 + f38; f44 = f11 - f19; f45 = f11 + f19; f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45); f47 = f3 - f46; f48 = f3 + f46; f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44); f50 = f49 - f27; f51 = f49 + f27; f52 = f51 + f48; f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51); f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52); f55 = MUL_C(COEF_CONST(1.1758756024193588), f48); f56 = f53 + f54; f57 = f55 - f54; f58 = f50 + f47; f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50); f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58); f61 = MUL_C(COEF_CONST(1.3870398453221475), f47); f62 = f59 + f60; f63 = f61 - f60; f64 = f41 - f56; f65 = f41 + f56; f66 = f43 - f62; f67 = f43 + f62; f68 = f42 - f63; f69 = f42 + f63; f70 = f40 - f57; f71 = f40 + f57; f72 = f5 - f9; f73 = f5 + f9; f74 = f13 - f17; f75 = f13 + f17; f76 = f21 - f25; f77 = f21 + f25; f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75); f79 = f1 - f78; f80 = f1 + f78; f81 = f73 + f77; f82 = MUL_C(COEF_CONST(1.3065629648763766), f73); f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81); f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77); f85 = f82 + f83; f86 = f84 - f83; f87 = f80 - f86; f88 = f80 + f86; f89 = f79 - f85; f90 = f79 + f85; f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74); f92 = f29 - f91; f93 = f29 + f91; f94 = f76 + f72; f95 = MUL_C(COEF_CONST(1.3065629648763766), f76); f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94); f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72); f98 = f95 + f96; f99 = f97 - f96; f100 = f93 - f99; f101 = f93 + f99; f102 = f92 - f98; f103 = f92 + f98; f104 = f101 + f88; f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101); f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104); f107 = MUL_C(COEF_CONST(1.0932018670017576), f88); f108 = f105 + f106; f109 = f107 - f106; f110 = f90 - f103; f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103); f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110); f113 = MUL_C(COEF_CONST(1.2472250129866713), f90); f114 = f112 - f111; f115 = f113 - f112; f116 = f102 + f89; f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102); f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116); f119 = MUL_C(COEF_CONST(1.3533180011743529), f89); f120 = f117 + f118; f121 = f119 - f118; f122 = f87 - f100; f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100); f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122); f125 = MUL_C(COEF_CONST(1.4074037375263826), f87); f126 = f124 - f123; f127 = f125 - f124; f128 = f65 - f108; f129 = f65 + f108; f130 = f67 - f114; f131 = f67 + f114; f132 = f69 - f120; f133 = f69 + f120; f134 = f71 - f126; f135 = f71 + f126; f136 = f70 - f127; f137 = f70 + f127; f138 = f68 - f121; f139 = f68 + f121; f140 = f66 - f115; f141 = f66 + f115; f142 = f64 - f109; f143 = f64 + f109; f144 = f0 + f30; f145 = MUL_C(COEF_CONST(1.0478631305325901), f0); f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144); f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30); f148 = f145 + f146; f149 = f147 - f146; f150 = f4 + f26; f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4); f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150); f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26); f154 = f151 + f152; f155 = f153 - f152; f156 = f8 + f22; f157 = MUL_C(COEF_CONST(1.3315443865537255), f8); f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156); f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22); f160 = f157 + f158; f161 = f159 - f158; f162 = f12 + f18; f163 = MUL_C(COEF_CONST(1.3989068359730781), f12); f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162); f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18); f166 = f163 + f164; f167 = f165 - f164; f168 = f16 + f14; f169 = MUL_C(COEF_CONST(1.4125100802019777), f16); f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168); f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14); f172 = f169 + f170; f173 = f171 - f170; f174 = f20 + f10; f175 = MUL_C(COEF_CONST(1.3718313541934939), f20); f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174); f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10); f178 = f175 + f176; f179 = f177 - f176; f180 = f24 + f6; f181 = MUL_C(COEF_CONST(1.2784339185752409), f24); f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180); f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6); f184 = f181 + f182; f185 = f183 - f182; f186 = f28 + f2; f187 = MUL_C(COEF_CONST(1.1359069844201433), f28); f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186); f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2); f190 = f187 + f188; f191 = f189 - f188; f192 = f149 - f173; f193 = f149 + f173; f194 = f148 - f172; f195 = f148 + f172; f196 = f155 - f179; f197 = f155 + f179; f198 = f154 - f178; f199 = f154 + f178; f200 = f161 - f185; f201 = f161 + f185; f202 = f160 - f184; f203 = f160 + f184; f204 = f167 - f191; f205 = f167 + f191; f206 = f166 - f190; f207 = f166 + f190; f208 = f192 + f194; f209 = MUL_C(COEF_CONST(1.1758756024193588), f192); f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208); f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194); f212 = f209 + f210; f213 = f211 - f210; f214 = f196 + f198; f215 = MUL_C(COEF_CONST(1.3870398453221475), f196); f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214); f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198); f218 = f215 + f216; f219 = f217 - f216; f220 = f200 + f202; f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200); f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220); f223 = MUL_C(COEF_CONST(1.1758756024193586), f202); f224 = f221 + f222; f225 = f223 - f222; f226 = f204 + f206; f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204); f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226); f229 = MUL_C(COEF_CONST(1.3870398453221475), f206); f230 = f227 + f228; f231 = f229 - f228; f232 = f193 - f201; f233 = f193 + f201; f234 = f195 - f203; f235 = f195 + f203; f236 = f197 - f205; f237 = f197 + f205; f238 = f199 - f207; f239 = f199 + f207; f240 = f213 - f225; f241 = f213 + f225; f242 = f212 - f224; f243 = f212 + f224; f244 = f219 - f231; f245 = f219 + f231; f246 = f218 - f230; f247 = f218 + f230; f248 = f232 + f234; f249 = MUL_C(COEF_CONST(1.3065629648763766), f232); f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248); f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234); f252 = f249 + f250; f253 = f251 - f250; f254 = f236 + f238; f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236); f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254); f257 = MUL_C(COEF_CONST(1.3065629648763766), f238); f258 = f255 + f256; f259 = f257 - f256; f260 = f240 + f242; f261 = MUL_C(COEF_CONST(1.3065629648763766), f240); f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260); f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242); f264 = f261 + f262; f265 = f263 - f262; f266 = f244 + f246; f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244); f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266); f269 = MUL_C(COEF_CONST(1.3065629648763766), f246); f270 = f267 + f268; f271 = f269 - f268; f272 = f233 - f237; f273 = f233 + f237; f274 = f235 - f239; f275 = f235 + f239; f276 = f253 - f259; f277 = f253 + f259; f278 = f252 - f258; f279 = f252 + f258; f280 = f241 - f245; f281 = f241 + f245; f282 = f243 - f247; f283 = f243 + f247; f284 = f265 - f271; f285 = f265 + f271; f286 = f264 - f270; f287 = f264 + f270; f288 = f272 - f274; f289 = f272 + f274; f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288); f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289); f292 = f276 - f278; f293 = f276 + f278; f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292); f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293); f296 = f280 - f282; f297 = f280 + f282; f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296); f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297); f300 = f284 - f286; f301 = f284 + f286; f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300); f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301); f304 = f129 - f273; f305 = f129 + f273; f306 = f131 - f281; f307 = f131 + f281; f308 = f133 - f285; f309 = f133 + f285; f310 = f135 - f277; f311 = f135 + f277; f312 = f137 - f295; f313 = f137 + f295; f314 = f139 - f303; f315 = f139 + f303; f316 = f141 - f299; f317 = f141 + f299; f318 = f143 - f291; f319 = f143 + f291; f320 = f142 - f290; f321 = f142 + f290; f322 = f140 - f298; f323 = f140 + f298; f324 = f138 - f302; f325 = f138 + f302; f326 = f136 - f294; f327 = f136 + f294; f328 = f134 - f279; f329 = f134 + f279; f330 = f132 - f287; f331 = f132 + f287; f332 = f130 - f283; f333 = f130 + f283; f334 = f128 - f275; f335 = f128 + f275; y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305); y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307); y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309); y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311); y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313); y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315); y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317); y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319); y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321); y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323); y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325); y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327); y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329); y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331); y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333); y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335); y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334); y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332); y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330); y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328); y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326); y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324); y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322); y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320); y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318); y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316); y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314); y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312); y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310); y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308); y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306); y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304); } #ifdef SBR_LOW_POWER void DCT2_16_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32; real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44; real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58; real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68; real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78; real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88; real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102; real_t f103, f104, f107, f108, f109, f110; f0 = x[0] - x[15]; f1 = x[0] + x[15]; f2 = x[1] - x[14]; f3 = x[1] + x[14]; f4 = x[2] - x[13]; f5 = x[2] + x[13]; f6 = x[3] - x[12]; f7 = x[3] + x[12]; f8 = x[4] - x[11]; f9 = x[4] + x[11]; f10 = x[5] - x[10]; f11 = x[5] + x[10]; f12 = x[6] - x[9]; f13 = x[6] + x[9]; f14 = x[7] - x[8]; f15 = x[7] + x[8]; f16 = f1 - f15; f17 = f1 + f15; f18 = f3 - f13; f19 = f3 + f13; f20 = f5 - f11; f21 = f5 + f11; f22 = f7 - f9; f23 = f7 + f9; f24 = f17 - f23; f25 = f17 + f23; f26 = f19 - f21; f27 = f19 + f21; f28 = f25 - f27; y[0] = f25 + f27; y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476)); f31 = f24 + f26; f32 = MUL_C(f24, COEF_CONST(1.3065629648763766)); f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866)); f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967)); y[12] = f32 + f33; y[4] = f34 - f33; f37 = f16 + f22; f38 = MUL_C(f16, COEF_CONST(1.1758756024193588)); f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304)); f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021)); f41 = f38 + f39; f42 = f40 - f39; f43 = f18 + f20; f44 = MUL_C(f18, COEF_CONST(1.3870398453221473)); f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455)); f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436)); f47 = f44 + f45; f48 = f46 - f45; f49 = f42 - f48; y[2] = f42 + f48; f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476)); y[14] = f41 - f47; f53 = f41 + f47; f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476)); y[10] = f51 - f54; y[6] = f51 + f54; f57 = f2 - f4; f58 = f2 + f4; f59 = f6 - f8; f60 = f6 + f8; f61 = f10 - f12; f62 = f10 + f12; f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476)); f64 = f0 - f63; f65 = f0 + f63; f66 = f58 + f62; f67 = MUL_C(f58, COEF_CONST(1.3065629648763766)); f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866)); f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967)); f70 = f67 + f68; f71 = f69 - f68; f72 = f65 - f71; f73 = f65 + f71; f74 = f64 - f70; f75 = f64 + f70; f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476)); f77 = f14 - f76; f78 = f14 + f76; f79 = f61 + f57; f80 = MUL_C(f61, COEF_CONST(1.3065629648763766)); f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866)); f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967)); f83 = f80 + f81; f84 = f82 - f81; f85 = f78 - f84; f86 = f78 + f84; f87 = f77 - f83; f88 = f77 + f83; f89 = f86 + f73; f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361)); f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968)); f92 = MUL_C(f73, COEF_CONST(1.0932018670017576)); y[1] = f90 + f91; y[15] = f92 - f91; f95 = f75 - f88; f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466)); f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089)); f98 = MUL_C(f75, COEF_CONST(1.2472250129866713)); y[3] = f97 - f96; y[13] = f98 - f97; f101 = f87 + f74; f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571)); f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549)); f104 = MUL_C(f74, COEF_CONST(1.3533180011743529)); y[5] = f102 + f103; y[11] = f104 - f103; f107 = f72 - f85; f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915)); f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370)); f110 = MUL_C(f72, COEF_CONST(1.4074037375263826)); y[7] = f109 - f108; y[9] = f110 - f109; } void DCT4_16(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132; real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152; real_t f153, f156, f157; f0 = x[0] + x[15]; f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]); f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0); f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]); f4 = f1 + f2; f5 = f3 - f2; f6 = x[2] + x[13]; f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]); f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6); f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]); f10 = f7 + f8; f11 = f9 - f8; f12 = x[4] + x[11]; f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]); f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12); f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]); f16 = f13 + f14; f17 = f15 - f14; f18 = x[6] + x[9]; f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]); f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18); f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]); f22 = f19 + f20; f23 = f21 - f20; f24 = x[8] + x[7]; f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]); f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24); f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]); f28 = f25 + f26; f29 = f27 - f26; f30 = x[10] + x[5]; f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]); f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30); f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]); f34 = f31 + f32; f35 = f33 - f32; f36 = x[12] + x[3]; f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]); f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36); f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]); f40 = f37 + f38; f41 = f39 - f38; f42 = x[14] + x[1]; f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]); f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42); f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]); f46 = f43 + f44; f47 = f45 - f44; f48 = f5 - f29; f49 = f5 + f29; f50 = f4 - f28; f51 = f4 + f28; f52 = f11 - f35; f53 = f11 + f35; f54 = f10 - f34; f55 = f10 + f34; f56 = f17 - f41; f57 = f17 + f41; f58 = f16 - f40; f59 = f16 + f40; f60 = f23 - f47; f61 = f23 + f47; f62 = f22 - f46; f63 = f22 + f46; f64 = f48 + f50; f65 = MUL_C(COEF_CONST(1.1758756024193588), f48); f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64); f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50); f68 = f65 + f66; f69 = f67 - f66; f70 = f52 + f54; f71 = MUL_C(COEF_CONST(1.3870398453221475), f52); f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70); f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54); f74 = f71 + f72; f75 = f73 - f72; f76 = f56 + f58; f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56); f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76); f79 = MUL_C(COEF_CONST(1.1758756024193586), f58); f80 = f77 + f78; f81 = f79 - f78; f82 = f60 + f62; f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60); f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82); f85 = MUL_C(COEF_CONST(1.3870398453221475), f62); f86 = f83 + f84; f87 = f85 - f84; f88 = f49 - f57; f89 = f49 + f57; f90 = f51 - f59; f91 = f51 + f59; f92 = f53 - f61; f93 = f53 + f61; f94 = f55 - f63; f95 = f55 + f63; f96 = f69 - f81; f97 = f69 + f81; f98 = f68 - f80; f99 = f68 + f80; f100 = f75 - f87; f101 = f75 + f87; f102 = f74 - f86; f103 = f74 + f86; f104 = f88 + f90; f105 = MUL_C(COEF_CONST(1.3065629648763766), f88); f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104); f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90); f108 = f105 + f106; f109 = f107 - f106; f110 = f92 + f94; f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92); f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110); f113 = MUL_C(COEF_CONST(1.3065629648763766), f94); f114 = f111 + f112; f115 = f113 - f112; f116 = f96 + f98; f117 = MUL_C(COEF_CONST(1.3065629648763766), f96); f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116); f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98); f120 = f117 + f118; f121 = f119 - f118; f122 = f100 + f102; f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100); f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122); f125 = MUL_C(COEF_CONST(1.3065629648763766), f102); f126 = f123 + f124; f127 = f125 - f124; f128 = f89 - f93; y[0] = f89 + f93; f130 = f91 - f95; y[15] = f91 + f95; f132 = f109 - f115; y[3] = f109 + f115; f134 = f108 - f114; y[12] = f108 + f114; f136 = f97 - f101; y[1] = f97 + f101; f138 = f99 - f103; y[14] = f99 + f103; f140 = f121 - f127; y[2] = f121 + f127; f142 = f120 - f126; y[13] = f120 + f126; f144 = f128 - f130; f145 = f128 + f130; y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144); y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145); f148 = f132 - f134; f149 = f132 + f134; y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148); y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149); f152 = f136 - f138; f153 = f136 + f138; y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152); y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153); f156 = f140 - f142; f157 = f140 + f142; y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156); y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157); } void DCT3_32_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; real_t f271, f272; f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476)); f1 = x[0] - f0; f2 = x[0] + f0; f3 = x[8] + x[24]; f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766)); f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866))); f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967))); f7 = f4 + f5; f8 = f6 - f5; f9 = f2 - f8; f10 = f2 + f8; f11 = f1 - f7; f12 = f1 + f7; f13 = x[4] + x[28]; f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588)); f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304))); f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021))); f17 = f14 + f15; f18 = f16 - f15; f19 = x[12] + x[20]; f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473)); f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455))); f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436))); f23 = f20 + f21; f24 = f22 - f21; f25 = f18 - f24; f26 = f18 + f24; f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476)); f28 = f17 - f23; f29 = f17 + f23; f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476)); f31 = f27 - f30; f32 = f27 + f30; f33 = f10 - f26; f34 = f10 + f26; f35 = f12 - f32; f36 = f12 + f32; f37 = f11 - f31; f38 = f11 + f31; f39 = f9 - f28; f40 = f9 + f28; f41 = x[2] + x[30]; f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569)); f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969))); f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368))); f45 = f42 + f43; f46 = f44 - f43; f47 = x[6] + x[26]; f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711)); f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089))); f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469))); f51 = f48 + f49; f52 = f50 - f49; f53 = x[10] + x[22]; f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526)); f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551))); f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575))); f57 = f54 + f55; f58 = f56 - f55; f59 = x[14] + x[18]; f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826)); f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369))); f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913))); f63 = f60 + f61; f64 = f62 - f61; f65 = f46 - f64; f66 = f46 + f64; f67 = f52 - f58; f68 = f52 + f58; f69 = f66 - f68; f70 = f66 + f68; f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476)); f72 = f65 + f67; f73 = MUL_C(f65, COEF_CONST(1.3065629648763766)); f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866))); f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967))); f76 = f73 + f74; f77 = f75 - f74; f78 = f45 - f63; f79 = f45 + f63; f80 = f51 - f57; f81 = f51 + f57; f82 = f79 + f81; f83 = MUL_C(f79, COEF_CONST(1.3065629648763770)); f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904))); f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961)); f86 = f83 + f84; f87 = f85 - f84; f88 = f78 - f80; f89 = f78 + f80; f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476)); f91 = f77 - f87; f92 = f77 + f87; f93 = f71 - f90; f94 = f71 + f90; f95 = f76 - f86; f96 = f76 + f86; f97 = f34 - f70; f98 = f34 + f70; f99 = f36 - f92; f100 = f36 + f92; f101 = f38 - f91; f102 = f38 + f91; f103 = f40 - f94; f104 = f40 + f94; f105 = f39 - f93; f106 = f39 + f93; f107 = f37 - f96; f108 = f37 + f96; f109 = f35 - f95; f110 = f35 + f95; f111 = f33 - f88; f112 = f33 + f88; f113 = x[1] + x[31]; f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901)); f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724))); f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548))); f117 = f114 + f115; f118 = f116 - f115; f119 = x[5] + x[27]; f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077)); f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440))); f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803))); f123 = f120 + f121; f124 = f122 - f121; f125 = x[9] + x[23]; f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255)); f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433))); f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612))); f129 = f126 + f127; f130 = f128 - f127; f131 = x[13] + x[19]; f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781)); f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453))); f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124))); f135 = f132 + f133; f136 = f134 - f133; f137 = x[17] + x[15]; f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777)); f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187))); f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402)); f141 = f138 + f139; f142 = f140 - f139; f143 = x[21] + x[11]; f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939)); f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219))); f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501)); f147 = f144 + f145; f148 = f146 - f145; f149 = x[25] + x[7]; f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409)); f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200))); f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008)); f153 = f150 + f151; f154 = f152 - f151; f155 = x[29] + x[3]; f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433)); f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624))); f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185)); f159 = f156 + f157; f160 = f158 - f157; f161 = f118 - f142; f162 = f118 + f142; f163 = f117 - f141; f164 = f117 + f141; f165 = f124 - f148; f166 = f124 + f148; f167 = f123 - f147; f168 = f123 + f147; f169 = f130 - f154; f170 = f130 + f154; f171 = f129 - f153; f172 = f129 + f153; f173 = f136 - f160; f174 = f136 + f160; f175 = f135 - f159; f176 = f135 + f159; f177 = f161 + f163; f178 = MUL_C(f161, COEF_CONST(1.1758756024193588)); f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304))); f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021))); f181 = f178 + f179; f182 = f180 - f179; f183 = f165 + f167; f184 = MUL_C(f165, COEF_CONST(1.3870398453221475)); f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022))); f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431)); f187 = f184 + f185; f188 = f186 - f185; f189 = f169 + f171; f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022)); f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283)); f192 = MUL_C(f171, COEF_CONST(1.1758756024193586)); f193 = f190 + f191; f194 = f192 - f191; f195 = f173 + f175; f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430))); f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452)); f198 = MUL_C(f175, COEF_CONST(1.3870398453221475)); f199 = f196 + f197; f200 = f198 - f197; f201 = f162 - f170; f202 = f162 + f170; f203 = f164 - f172; f204 = f164 + f172; f205 = f166 - f174; f206 = f166 + f174; f207 = f168 - f176; f208 = f168 + f176; f209 = f182 - f194; f210 = f182 + f194; f211 = f181 - f193; f212 = f181 + f193; f213 = f188 - f200; f214 = f188 + f200; f215 = f187 - f199; f216 = f187 + f199; f217 = f201 + f203; f218 = MUL_C(f201, COEF_CONST(1.3065629648763766)); f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866))); f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967))); f221 = f218 + f219; f222 = f220 - f219; f223 = f205 + f207; f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969)); f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898)); f226 = MUL_C(f207, COEF_CONST(1.3065629648763766)); f227 = f224 + f225; f228 = f226 - f225; f229 = f209 + f211; f230 = MUL_C(f209, COEF_CONST(1.3065629648763766)); f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866))); f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967))); f233 = f230 + f231; f234 = f232 - f231; f235 = f213 + f215; f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969)); f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898)); f238 = MUL_C(f215, COEF_CONST(1.3065629648763766)); f239 = f236 + f237; f240 = f238 - f237; f241 = f202 - f206; f242 = f202 + f206; f243 = f204 - f208; f244 = f204 + f208; f245 = f222 - f228; f246 = f222 + f228; f247 = f221 - f227; f248 = f221 + f227; f249 = f210 - f214; f250 = f210 + f214; f251 = f212 - f216; f252 = f212 + f216; f253 = f234 - f240; f254 = f234 + f240; f255 = f233 - f239; f256 = f233 + f239; f257 = f241 - f243; f258 = f241 + f243; f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474)); f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474)); f261 = f245 - f247; f262 = f245 + f247; f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474)); f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474)); f265 = f249 - f251; f266 = f249 + f251; f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474)); f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474)); f269 = f253 - f255; f270 = f253 + f255; f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474)); f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474)); y[31] = f98 - f242; y[0] = f98 + f242; y[30] = f100 - f250; y[1] = f100 + f250; y[29] = f102 - f254; y[2] = f102 + f254; y[28] = f104 - f246; y[3] = f104 + f246; y[27] = f106 - f264; y[4] = f106 + f264; y[26] = f108 - f272; y[5] = f108 + f272; y[25] = f110 - f268; y[6] = f110 + f268; y[24] = f112 - f260; y[7] = f112 + f260; y[23] = f111 - f259; y[8] = f111 + f259; y[22] = f109 - f267; y[9] = f109 + f267; y[21] = f107 - f271; y[10] = f107 + f271; y[20] = f105 - f263; y[11] = f105 + f263; y[19] = f103 - f248; y[12] = f103 + f248; y[18] = f101 - f256; y[13] = f101 + f256; y[17] = f99 - f252; y[14] = f99 + f252; y[16] = f97 - f244; y[15] = f97 + f244; } void DCT2_32_unscaled(real_t *y, real_t *x) { real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74; real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86; real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98; real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108; real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118; real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130; real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146; real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156; real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166; real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176; real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186; real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196; real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206; real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216; real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226; real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236; real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248; real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262; real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278; real_t f279, f280, f283, f284, f285, f286; f0 = x[0] - x[31]; f1 = x[0] + x[31]; f2 = x[1] - x[30]; f3 = x[1] + x[30]; f4 = x[2] - x[29]; f5 = x[2] + x[29]; f6 = x[3] - x[28]; f7 = x[3] + x[28]; f8 = x[4] - x[27]; f9 = x[4] + x[27]; f10 = x[5] - x[26]; f11 = x[5] + x[26]; f12 = x[6] - x[25]; f13 = x[6] + x[25]; f14 = x[7] - x[24]; f15 = x[7] + x[24]; f16 = x[8] - x[23]; f17 = x[8] + x[23]; f18 = x[9] - x[22]; f19 = x[9] + x[22]; f20 = x[10] - x[21]; f21 = x[10] + x[21]; f22 = x[11] - x[20]; f23 = x[11] + x[20]; f24 = x[12] - x[19]; f25 = x[12] + x[19]; f26 = x[13] - x[18]; f27 = x[13] + x[18]; f28 = x[14] - x[17]; f29 = x[14] + x[17]; f30 = x[15] - x[16]; f31 = x[15] + x[16]; f32 = f1 - f31; f33 = f1 + f31; f34 = f3 - f29; f35 = f3 + f29; f36 = f5 - f27; f37 = f5 + f27; f38 = f7 - f25; f39 = f7 + f25; f40 = f9 - f23; f41 = f9 + f23; f42 = f11 - f21; f43 = f11 + f21; f44 = f13 - f19; f45 = f13 + f19; f46 = f15 - f17; f47 = f15 + f17; f48 = f33 - f47; f49 = f33 + f47; f50 = f35 - f45; f51 = f35 + f45; f52 = f37 - f43; f53 = f37 + f43; f54 = f39 - f41; f55 = f39 + f41; f56 = f49 - f55; f57 = f49 + f55; f58 = f51 - f53; f59 = f51 + f53; f60 = f57 - f59; y[0] = f57 + f59; y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60); f63 = f56 + f58; f64 = MUL_C(COEF_CONST(1.3065629648763766), f56); f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63); f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58); y[24] = f64 + f65; y[8] = f66 - f65; f69 = f48 + f54; f70 = MUL_C(COEF_CONST(1.1758756024193588), f48); f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69); f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54); f73 = f70 + f71; f74 = f72 - f71; f75 = f50 + f52; f76 = MUL_C(COEF_CONST(1.3870398453221473), f50); f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75); f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52); f79 = f76 + f77; f80 = f78 - f77; f81 = f74 - f80; y[4] = f74 + f80; f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81); y[28] = f73 - f79; f85 = f73 + f79; f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85); y[20] = f83 - f86; y[12] = f83 + f86; f89 = f34 - f36; f90 = f34 + f36; f91 = f38 - f40; f92 = f38 + f40; f93 = f42 - f44; f94 = f42 + f44; f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92); f96 = f32 - f95; f97 = f32 + f95; f98 = f90 + f94; f99 = MUL_C(COEF_CONST(1.3065629648763766), f90); f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98); f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94); f102 = f99 + f100; f103 = f101 - f100; f104 = f97 - f103; f105 = f97 + f103; f106 = f96 - f102; f107 = f96 + f102; f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91); f109 = f46 - f108; f110 = f46 + f108; f111 = f93 + f89; f112 = MUL_C(COEF_CONST(1.3065629648763766), f93); f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111); f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89); f115 = f112 + f113; f116 = f114 - f113; f117 = f110 - f116; f118 = f110 + f116; f119 = f109 - f115; f120 = f109 + f115; f121 = f118 + f105; f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118); f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121); f124 = MUL_C(COEF_CONST(1.0932018670017576), f105); y[2] = f122 + f123; y[30] = f124 - f123; f127 = f107 - f120; f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120); f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127); f130 = MUL_C(COEF_CONST(1.2472250129866713), f107); y[6] = f129 - f128; y[26] = f130 - f129; f133 = f119 + f106; f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119); f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133); f136 = MUL_C(COEF_CONST(1.3533180011743529), f106); y[10] = f134 + f135; y[22] = f136 - f135; f139 = f104 - f117; f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117); f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139); f142 = MUL_C(COEF_CONST(1.4074037375263826), f104); y[14] = f141 - f140; y[18] = f142 - f141; f145 = f2 - f4; f146 = f2 + f4; f147 = f6 - f8; f148 = f6 + f8; f149 = f10 - f12; f150 = f10 + f12; f151 = f14 - f16; f152 = f14 + f16; f153 = f18 - f20; f154 = f18 + f20; f155 = f22 - f24; f156 = f22 + f24; f157 = f26 - f28; f158 = f26 + f28; f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152); f160 = f0 - f159; f161 = f0 + f159; f162 = f148 + f156; f163 = MUL_C(COEF_CONST(1.3065629648763766), f148); f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162); f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156); f166 = f163 + f164; f167 = f165 - f164; f168 = f161 - f167; f169 = f161 + f167; f170 = f160 - f166; f171 = f160 + f166; f172 = f146 + f158; f173 = MUL_C(COEF_CONST(1.1758756024193588), f146); f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172); f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158); f176 = f173 + f174; f177 = f175 - f174; f178 = f150 + f154; f179 = MUL_C(COEF_CONST(1.3870398453221473), f150); f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178); f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154); f182 = f179 + f180; f183 = f181 - f180; f184 = f177 - f183; f185 = f177 + f183; f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184); f187 = f176 - f182; f188 = f176 + f182; f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188); f190 = f186 - f189; f191 = f186 + f189; f192 = f169 - f185; f193 = f169 + f185; f194 = f171 - f191; f195 = f171 + f191; f196 = f170 - f190; f197 = f170 + f190; f198 = f168 - f187; f199 = f168 + f187; f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151); f201 = f30 - f200; f202 = f30 + f200; f203 = f155 + f147; f204 = MUL_C(COEF_CONST(1.3065629648763766), f155); f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203); f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147); f207 = f204 + f205; f208 = f206 - f205; f209 = f202 - f208; f210 = f202 + f208; f211 = f201 - f207; f212 = f201 + f207; f213 = f157 + f145; f214 = MUL_C(COEF_CONST(1.1758756024193588), f157); f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213); f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145); f217 = f214 + f215; f218 = f216 - f215; f219 = f153 + f149; f220 = MUL_C(COEF_CONST(1.3870398453221473), f153); f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219); f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149); f223 = f220 + f221; f224 = f222 - f221; f225 = f218 - f224; f226 = f218 + f224; f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225); f228 = f217 - f223; f229 = f217 + f223; f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229); f231 = f227 - f230; f232 = f227 + f230; f233 = f210 - f226; f234 = f210 + f226; f235 = f212 - f232; f236 = f212 + f232; f237 = f211 - f231; f238 = f211 + f231; f239 = f209 - f228; f240 = f209 + f228; f241 = f234 + f193; f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234); f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241); f244 = MUL_C(COEF_CONST(1.0478631305325905), f193); y[1] = f242 + f243; y[31] = f244 - f243; f247 = f195 - f236; f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236); f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247); f250 = MUL_C(COEF_CONST(1.1359069844201428), f195); y[3] = f249 - f248; y[29] = f250 - f249; f253 = f238 + f197; f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238); f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253); f256 = MUL_C(COEF_CONST(1.2130114330978079), f197); y[5] = f254 + f255; y[27] = f256 - f255; f259 = f199 - f240; f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240); f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259); f262 = MUL_C(COEF_CONST(1.2784339185752409), f199); y[7] = f261 - f260; y[25] = f262 - f261; f265 = f239 + f198; f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239); f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265); f268 = MUL_C(COEF_CONST(1.3315443865537255), f198); y[9] = f266 + f267; y[23] = f268 - f267; f271 = f196 - f237; f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237); f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271); f274 = MUL_C(COEF_CONST(1.3718313541934939), f196); y[11] = f273 - f272; y[21] = f274 - f273; f277 = f235 + f194; f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235); f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277); f280 = MUL_C(COEF_CONST(1.3989068359730783), f194); y[13] = f278 + f279; y[19] = f280 - f279; f283 = f192 - f233; f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233); f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283); f286 = MUL_C(COEF_CONST(1.4125100802019774), f192); y[15] = f285 - f284; y[17] = f286 - f285; } #else #define n 32 #define log2n 5 // w_array_real[i] = cos(2*M_PI*i/32) static const real_t w_array_real[] = { FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272), FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765), FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169), FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576), FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552), FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553), FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257), FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607) }; // w_array_imag[i] = sin(-2*M_PI*i/32) static const real_t w_array_imag[] = { FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064), FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862), FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512), FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940), FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601), FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016), FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476), FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088) }; // FFT decimation in frequency // 4*16*2+16=128+16=144 multiplications // 6*16*2+10*8+4*16*2=192+80+128=400 additions static void fft_dif(real_t * Real, real_t * Imag) { real_t w_real, w_imag; // For faster access real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access uint32_t j, i, i2, w_index; // Counters // First 2 stages of 32 point FFT decimation in frequency // 4*16*2=64*2=128 multiplications // 6*16*2=96*2=192 additions // Stage 1 of 32 point FFT decimation in frequency for (i = 0; i < 16; i++) { point1_real = Real[i]; point1_imag = Imag[i]; i2 = i+16; point2_real = Real[i2]; point2_imag = Imag[i2]; w_real = w_array_real[i]; w_imag = w_array_imag[i]; // temp1 = x[i] - x[i2] point1_real -= point2_real; point1_imag -= point2_imag; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * w Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); } // Stage 2 of 32 point FFT decimation in frequency for (j = 0, w_index = 0; j < 8; j++, w_index += 2) { w_real = w_array_real[w_index]; w_imag = w_array_imag[w_index]; i = j; point1_real = Real[i]; point1_imag = Imag[i]; i2 = i+8; point2_real = Real[i2]; point2_imag = Imag[i2]; // temp1 = x[i] - x[i2] point1_real -= point2_real; point1_imag -= point2_imag; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * w Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); i = j+16; point1_real = Real[i]; point1_imag = Imag[i]; i2 = i+8; point2_real = Real[i2]; point2_imag = Imag[i2]; // temp1 = x[i] - x[i2] point1_real -= point2_real; point1_imag -= point2_imag; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * w Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); } // Stage 3 of 32 point FFT decimation in frequency // 2*4*2=16 multiplications // 4*4*2+6*4*2=10*8=80 additions for (i = 0; i < n; i += 8) { i2 = i+4; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // out[i1] = point1 + point2 Real[i] += point2_real; Imag[i] += point2_imag; // out[i2] = point1 - point2 Real[i2] = point1_real - point2_real; Imag[i2] = point1_imag - point2_imag; } w_real = w_array_real[4]; // = sqrt(2)/2 // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2 for (i = 1; i < n; i += 8) { i2 = i+4; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // temp1 = x[i] - x[i2] point1_real -= point2_real; point1_imag -= point2_imag; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * w Real[i2] = MUL_F(point1_real+point1_imag, w_real); Imag[i2] = MUL_F(point1_imag-point1_real, w_real); } for (i = 2; i < n; i += 8) { i2 = i+4; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // x[i] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * (-i) Real[i2] = point1_imag - point2_imag; Imag[i2] = point2_real - point1_real; } w_real = w_array_real[12]; // = -sqrt(2)/2 // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2 for (i = 3; i < n; i += 8) { i2 = i+4; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // temp1 = x[i] - x[i2] point1_real -= point2_real; point1_imag -= point2_imag; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * w Real[i2] = MUL_F(point1_real-point1_imag, w_real); Imag[i2] = MUL_F(point1_real+point1_imag, w_real); } // Stage 4 of 32 point FFT decimation in frequency (no multiplications) // 16*4=64 additions for (i = 0; i < n; i += 4) { i2 = i+2; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // x[i1] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = x[i] - x[i2] Real[i2] = point1_real - point2_real; Imag[i2] = point1_imag - point2_imag; } for (i = 1; i < n; i += 4) { i2 = i+2; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // x[i] = x[i] + x[i2] Real[i] += point2_real; Imag[i] += point2_imag; // x[i2] = (x[i] - x[i2]) * (-i) Real[i2] = point1_imag - point2_imag; Imag[i2] = point2_real - point1_real; } // Stage 5 of 32 point FFT decimation in frequency (no multiplications) // 16*4=64 additions for (i = 0; i < n; i += 2) { i2 = i+1; point1_real = Real[i]; point1_imag = Imag[i]; point2_real = Real[i2]; point2_imag = Imag[i2]; // out[i1] = point1 + point2 Real[i] += point2_real; Imag[i] += point2_imag; // out[i2] = point1 - point2 Real[i2] = point1_real - point2_real; Imag[i2] = point1_imag - point2_imag; } #ifdef REORDER_IN_FFT FFTReorder(Real, Imag); #endif // #ifdef REORDER_IN_FFT } #undef n #undef log2n static const real_t dct4_64_tab[] = { COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507), COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537), COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708), COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462), COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627), COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471), COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592), COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979), COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146), COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291), COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091), COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643), COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127), COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700), COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423), COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828), COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626), COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974), COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658), COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784), COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981), COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980), COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093), COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162), COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640), COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904), COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420), COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944), COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476), COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670), COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128), COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182), COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388), COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101), COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759), COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140), COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596), COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318), COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446), COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152), COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704), COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322), COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238), COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981), COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577), COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592), COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960), COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205), COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734), COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526), COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092), COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721), COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959), COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014), COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227), COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424), COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756), COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734), COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437), COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838), COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899), COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223), COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439), COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320), COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086), COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159), COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605), COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942), COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475), COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740), COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961), COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470), COEF_CONST(0), COEF_CONST(-1.412510156631470), COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961), COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740), COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475), COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942), COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315), COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449), COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086), COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382), COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249), COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224), COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500), COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443), COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933), COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493), COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023), COEF_CONST(0), COEF_CONST(0.069392263889313), COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493), COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222), COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121), COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500), COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869), COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249), COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382) }; /* size 64 only! */ void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag) { // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 }; uint32_t i, i_rev; /* Step 2: modulate */ // 3*32=96 multiplications // 3*32=96 additions for (i = 0; i < 32; i++) { real_t x_re, x_im, tmp; x_re = in_real[i]; x_im = in_imag[i]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i]); in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp; in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp; } /* Step 3: FFT, but with output in bit reverse order */ fft_dif(in_real, in_imag); /* Step 4: modulate + bitreverse reordering */ // 3*31+2=95 multiplications // 3*31+2=95 additions for (i = 0; i < 16; i++) { real_t x_re, x_im, tmp; i_rev = bit_rev_tab[i]; x_re = in_real[i_rev]; x_im = in_imag[i_rev]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; } // i = 16, i_rev = 1 = rev(16); out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]); out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]); for (i = 17; i < 32; i++) { real_t x_re, x_im, tmp; i_rev = bit_rev_tab[i]; x_re = in_real[i_rev]; x_im = in_imag[i_rev]; tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; } } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_dct.h000066400000000000000000000033431357201522000207420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_dct.h,v 1.19 2007/11/01 12:33:34 menno Exp $ **/ #ifndef __SBR_DCT_H__ #define __SBR_DCT_H__ #ifdef __cplusplus extern "C" { #endif void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag); void DCT3_32_unscaled(real_t *y, real_t *x); void DCT4_32(real_t *y, real_t *x); void DST4_32(real_t *y, real_t *x); void DCT2_32_unscaled(real_t *y, real_t *x); void DCT4_16(real_t *y, real_t *x); void DCT2_16_unscaled(real_t *y, real_t *x); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_dec.c000066400000000000000000000437731357201522000207310ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_dec.c,v 1.44 2009/01/26 22:32:31 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include #include #include "syntax.h" #include "bits.h" #include "sbr_syntax.h" #include "sbr_qmf.h" #include "sbr_hfgen.h" #include "sbr_hfadj.h" /* static function declarations */ static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch); static void sbr_save_matrix(sbr_info *sbr, uint8_t ch); sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint32_t sample_rate, uint8_t downSampledSBR #ifdef DRM , uint8_t IsDRM #endif ) { sbr_info *sbr = faad_malloc(sizeof(sbr_info)); memset(sbr, 0, sizeof(sbr_info)); /* save id of the parent element */ sbr->id_aac = id_aac; sbr->sample_rate = sample_rate; sbr->bs_freq_scale = 2; sbr->bs_alter_scale = 1; sbr->bs_noise_bands = 2; sbr->bs_limiter_bands = 2; sbr->bs_limiter_gains = 2; sbr->bs_interpol_freq = 1; sbr->bs_smoothing_mode = 1; sbr->bs_start_freq = 5; sbr->bs_amp_res = 1; sbr->bs_samplerate_mode = 1; sbr->prevEnvIsShort[0] = -1; sbr->prevEnvIsShort[1] = -1; sbr->header_count = 0; sbr->Reset = 1; #ifdef DRM sbr->Is_DRM_SBR = IsDRM; #endif sbr->tHFGen = T_HFGEN; sbr->tHFAdj = T_HFADJ; sbr->bsco = 0; sbr->bsco_prev = 0; sbr->M_prev = 0; sbr->frame_len = framelength; /* force sbr reset */ sbr->bs_start_freq_prev = -1; if (framelength == 960) { sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960; sbr->numTimeSlots = NO_TIME_SLOTS_960; } else { sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS; sbr->numTimeSlots = NO_TIME_SLOTS; } sbr->GQ_ringbuf_index[0] = 0; sbr->GQ_ringbuf_index[1] = 0; if (id_aac == ID_CPE) { /* stereo */ uint8_t j; sbr->qmfa[0] = qmfa_init(32); sbr->qmfa[1] = qmfa_init(32); sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); for (j = 0; j < 5; j++) { sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); } memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); } else { /* mono */ uint8_t j; sbr->qmfa[0] = qmfa_init(32); sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); sbr->qmfs[1] = NULL; for (j = 0; j < 5; j++) { sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); } memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); } return sbr; } void sbrDecodeEnd(sbr_info *sbr) { uint8_t j; if (sbr) { qmfa_end(sbr->qmfa[0]); qmfs_end(sbr->qmfs[0]); if (sbr->qmfs[1] != NULL) { qmfa_end(sbr->qmfa[1]); qmfs_end(sbr->qmfs[1]); } for (j = 0; j < 5; j++) { if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]); if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]); if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]); if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]); } #ifdef PS_DEC if (sbr->ps != NULL) ps_free(sbr->ps); #endif #ifdef DRM_PS if (sbr->drm_ps != NULL) drm_ps_free(sbr->drm_ps); #endif faad_free(sbr); } } void sbrReset(sbr_info *sbr) { uint8_t j; if (sbr->qmfa[0] != NULL) memset(sbr->qmfa[0]->x, 0, 2 * sbr->qmfa[0]->channels * 10 * sizeof(real_t)); if (sbr->qmfa[1] != NULL) memset(sbr->qmfa[1]->x, 0, 2 * sbr->qmfa[1]->channels * 10 * sizeof(real_t)); if (sbr->qmfs[0] != NULL) memset(sbr->qmfs[0]->v, 0, 2 * sbr->qmfs[0]->channels * 20 * sizeof(real_t)); if (sbr->qmfs[1] != NULL) memset(sbr->qmfs[1]->v, 0, 2 * sbr->qmfs[1]->channels * 20 * sizeof(real_t)); for (j = 0; j < 5; j++) { if (sbr->G_temp_prev[0][j] != NULL) memset(sbr->G_temp_prev[0][j], 0, 64*sizeof(real_t)); if (sbr->G_temp_prev[1][j] != NULL) memset(sbr->G_temp_prev[1][j], 0, 64*sizeof(real_t)); if (sbr->Q_temp_prev[0][j] != NULL) memset(sbr->Q_temp_prev[0][j], 0, 64*sizeof(real_t)); if (sbr->Q_temp_prev[1][j] != NULL) memset(sbr->Q_temp_prev[1][j], 0, 64*sizeof(real_t)); } memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); sbr->GQ_ringbuf_index[0] = 0; sbr->GQ_ringbuf_index[1] = 0; sbr->header_count = 0; sbr->Reset = 1; sbr->L_E_prev[0] = 0; sbr->L_E_prev[1] = 0; sbr->bs_freq_scale = 2; sbr->bs_alter_scale = 1; sbr->bs_noise_bands = 2; sbr->bs_limiter_bands = 2; sbr->bs_limiter_gains = 2; sbr->bs_interpol_freq = 1; sbr->bs_smoothing_mode = 1; sbr->bs_start_freq = 5; sbr->bs_amp_res = 1; sbr->bs_samplerate_mode = 1; sbr->prevEnvIsShort[0] = -1; sbr->prevEnvIsShort[1] = -1; sbr->bsco = 0; sbr->bsco_prev = 0; sbr->M_prev = 0; sbr->bs_start_freq_prev = -1; sbr->f_prev[0] = 0; sbr->f_prev[1] = 0; for (j = 0; j < MAX_M; j++) { sbr->E_prev[0][j] = 0; sbr->Q_prev[0][j] = 0; sbr->E_prev[1][j] = 0; sbr->Q_prev[1][j] = 0; sbr->bs_add_harmonic_prev[0][j] = 0; sbr->bs_add_harmonic_prev[1][j] = 0; } sbr->bs_add_harmonic_flag_prev[0] = 0; sbr->bs_add_harmonic_flag_prev[1] = 0; } static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch) { uint8_t i; /* save data for next frame */ sbr->kx_prev = sbr->kx; sbr->M_prev = sbr->M; sbr->bsco_prev = sbr->bsco; sbr->L_E_prev[ch] = sbr->L_E[ch]; /* sbr->L_E[ch] can become 0 on files with bit errors */ if (sbr->L_E[ch] <= 0) return 19; sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1]; for (i = 0; i < MAX_M; i++) { sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1]; sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1]; } for (i = 0; i < MAX_M; i++) { sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i]; } sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch]; if (sbr->l_A[ch] == sbr->L_E[ch]) sbr->prevEnvIsShort[ch] = 0; else sbr->prevEnvIsShort[ch] = -1; return 0; } static void sbr_save_matrix(sbr_info *sbr, uint8_t ch) { uint8_t i; for (i = 0; i < sbr->tHFGen; i++) { memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t)); } for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++) { memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t)); } } static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], uint8_t ch, uint8_t dont_process, const uint8_t downSampledSBR) { int16_t k, l; uint8_t ret = 0; #ifdef SBR_LOW_POWER ALIGN real_t deg[64]; #endif #ifdef DRM if (sbr->Is_DRM_SBR) { sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0); } else { #endif sbr->bsco = 0; #ifdef DRM } #endif //#define PRE_QMF_PRINT #ifdef PRE_QMF_PRINT { int i; for (i = 0; i < 1024; i++) { printf("%d\n", channel_buf[i]); } } #endif /* subband analysis */ if (dont_process) sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32); else sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx); if (!dont_process) { #if 1 /* insert high frequencies here */ /* hf generation using patching */ hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch] #ifdef SBR_LOW_POWER ,deg #endif ,ch); #endif #if 0 //def SBR_LOW_POWER for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++) { for (k = 0; k < sbr->kx; k++) { QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0; } } #endif #if 1 /* hf adjustment */ ret = hf_adjustment(sbr, sbr->Xsbr[ch] #ifdef SBR_LOW_POWER ,deg #endif ,ch); #endif if (ret > 0) { dont_process = 1; } } if ((sbr->just_seeked != 0) || dont_process) { for (l = 0; l < sbr->numTimeSlotsRate; l++) { for (k = 0; k < 32; k++) { QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); #ifndef SBR_LOW_POWER QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); #endif } for (k = 32; k < 64; k++) { QMF_RE(X[l][k]) = 0; #ifndef SBR_LOW_POWER QMF_IM(X[l][k]) = 0; #endif } } } else { for (l = 0; l < sbr->numTimeSlotsRate; l++) { uint8_t kx_band, M_band, bsco_band; if (l < sbr->t_E[ch][0]) { kx_band = sbr->kx_prev; M_band = sbr->M_prev; bsco_band = sbr->bsco_prev; } else { kx_band = sbr->kx; M_band = sbr->M; bsco_band = sbr->bsco; } #ifndef SBR_LOW_POWER for (k = 0; k < kx_band + bsco_band; k++) { QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); } for (k = kx_band + bsco_band; k < kx_band + M_band; k++) { QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); } for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) { QMF_RE(X[l][k]) = 0; QMF_IM(X[l][k]) = 0; } #else for (k = 0; k < kx_band + bsco_band; k++) { QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); } for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++) { QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); } for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) { QMF_RE(X[l][k]) = 0; } QMF_RE(X[l][kx_band - 1 + bsco_band]) += QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]); #endif } } return ret; } uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, const uint8_t just_seeked, const uint8_t downSampledSBR) { uint8_t dont_process = 0; uint8_t ret = 0; ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; /* case can occur due to bit errors */ if (sbr->id_aac != ID_CPE) return 21; if (sbr->ret || (sbr->header_count == 0)) { /* don't process just upsample */ dont_process = 1; /* Re-activate reset for next frame */ if (sbr->ret && sbr->Reset) sbr->bs_start_freq_prev = -1; } if (just_seeked) { sbr->just_seeked = 1; } else { sbr->just_seeked = 0; } sbr->ret += sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR); /* subband synthesis */ if (downSampledSBR) { sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan); } else { sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan); } sbr->ret += sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR); /* subband synthesis */ if (downSampledSBR) { sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan); } else { sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan); } if (sbr->bs_header_flag) sbr->just_seeked = 0; if (sbr->header_count != 0 && sbr->ret == 0) { ret = sbr_save_prev_data(sbr, 0); if (ret) return ret; ret = sbr_save_prev_data(sbr, 1); if (ret) return ret; } sbr_save_matrix(sbr, 0); sbr_save_matrix(sbr, 1); sbr->frame++; //#define POST_QMF_PRINT #ifdef POST_QMF_PRINT { int i; for (i = 0; i < 2048; i++) { printf("%d\n", left_chan[i]); } for (i = 0; i < 2048; i++) { printf("%d\n", right_chan[i]); } } #endif return 0; } uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, const uint8_t just_seeked, const uint8_t downSampledSBR) { uint8_t dont_process = 0; uint8_t ret = 0; ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; /* case can occur due to bit errors */ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) return 21; if (sbr->ret || (sbr->header_count == 0)) { /* don't process just upsample */ dont_process = 1; /* Re-activate reset for next frame */ if (sbr->ret && sbr->Reset) sbr->bs_start_freq_prev = -1; } if (just_seeked) { sbr->just_seeked = 1; } else { sbr->just_seeked = 0; } sbr->ret += sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR); /* subband synthesis */ if (downSampledSBR) { sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel); } else { sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel); } if (sbr->bs_header_flag) sbr->just_seeked = 0; if (sbr->header_count != 0 && sbr->ret == 0) { ret = sbr_save_prev_data(sbr, 0); if (ret) return ret; } sbr_save_matrix(sbr, 0); sbr->frame++; //#define POST_QMF_PRINT #ifdef POST_QMF_PRINT { int i; for (i = 0; i < 2048; i++) { printf("%d\n", channel[i]); } } #endif return 0; } #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, const uint8_t just_seeked, const uint8_t downSampledSBR) { uint8_t l, k; uint8_t dont_process = 0; uint8_t ret = 0; ALIGN qmf_t X_left[38][64] = {{0}}; ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ if (sbr == NULL) return 20; /* case can occur due to bit errors */ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) return 21; if (sbr->ret || (sbr->header_count == 0)) { /* don't process just upsample */ dont_process = 1; /* Re-activate reset for next frame */ if (sbr->ret && sbr->Reset) sbr->bs_start_freq_prev = -1; } if (just_seeked) { sbr->just_seeked = 1; } else { sbr->just_seeked = 0; } if (sbr->qmfs[1] == NULL) { sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); } sbr->ret += sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR); /* copy some extra data for PS */ for (l = sbr->numTimeSlotsRate; l < sbr->numTimeSlotsRate + 6; l++) { for (k = 0; k < 5; k++) { QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]); QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]); } } /* perform parametric stereo */ #ifdef DRM_PS if (sbr->Is_DRM_SBR) { drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), X_left, X_right); } else { #endif #ifdef PS_DEC ps_decode(sbr->ps, X_left, X_right); #endif #ifdef DRM_PS } #endif /* subband synthesis */ if (downSampledSBR) { sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel); sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel); } else { sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel); sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel); } if (sbr->bs_header_flag) sbr->just_seeked = 0; if (sbr->header_count != 0 && sbr->ret == 0) { ret = sbr_save_prev_data(sbr, 0); if (ret) return ret; } sbr_save_matrix(sbr, 0); sbr->frame++; return 0; } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_dec.h000066400000000000000000000144151357201522000207250ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_dec.h,v 1.39 2007/11/01 12:33:34 menno Exp $ **/ #ifndef __SBR_DEC_H__ #define __SBR_DEC_H__ #ifdef __cplusplus extern "C" { #endif #ifdef PS_DEC #include "ps_dec.h" #endif #ifdef DRM_PS #include "drm_dec.h" #endif /* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ #define MAX_NTSRHFG 40 #define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ /* MAX_M: maximum value for M */ #define MAX_M 49 /* MAX_L_E: maximum value for L_E */ #define MAX_L_E 5 typedef struct { real_t *x; int16_t x_index; uint8_t channels; } qmfa_info; typedef struct { real_t *v; int16_t v_index; uint8_t channels; } qmfs_info; typedef struct { uint32_t sample_rate; uint32_t maxAACLine; uint8_t rate; uint8_t just_seeked; uint8_t ret; uint8_t amp_res[2]; uint8_t k0; uint8_t kx; uint8_t M; uint8_t N_master; uint8_t N_high; uint8_t N_low; uint8_t N_Q; uint8_t N_L[4]; uint8_t n[2]; uint8_t f_master[64]; uint8_t f_table_res[2][64]; uint8_t f_table_noise[64]; uint8_t f_table_lim[4][64]; #ifdef SBR_LOW_POWER uint8_t f_group[5][64]; uint8_t N_G[5]; #endif uint8_t table_map_k_to_g[64]; uint8_t abs_bord_lead[2]; uint8_t abs_bord_trail[2]; uint8_t n_rel_lead[2]; uint8_t n_rel_trail[2]; uint8_t L_E[2]; uint8_t L_E_prev[2]; uint8_t L_Q[2]; uint8_t t_E[2][MAX_L_E+1]; uint8_t t_Q[2][3]; uint8_t f[2][MAX_L_E+1]; uint8_t f_prev[2]; real_t *G_temp_prev[2][5]; real_t *Q_temp_prev[2][5]; int8_t GQ_ringbuf_index[2]; int16_t E[2][64][MAX_L_E]; int16_t E_prev[2][64]; #ifndef FIXED_POINT real_t E_orig[2][64][MAX_L_E]; #endif real_t E_curr[2][64][MAX_L_E]; int32_t Q[2][64][2]; #ifndef FIXED_POINT real_t Q_div[2][64][2]; real_t Q_div2[2][64][2]; #endif int32_t Q_prev[2][64]; int8_t l_A[2]; int8_t l_A_prev[2]; uint8_t bs_invf_mode[2][MAX_L_E]; uint8_t bs_invf_mode_prev[2][MAX_L_E]; real_t bwArray[2][64]; real_t bwArray_prev[2][64]; uint8_t noPatches; uint8_t patchNoSubbands[64]; uint8_t patchStartSubband[64]; uint8_t bs_add_harmonic[2][64]; uint8_t bs_add_harmonic_prev[2][64]; uint16_t index_noise_prev[2]; uint8_t psi_is_prev[2]; uint8_t bs_start_freq_prev; uint8_t bs_stop_freq_prev; uint8_t bs_xover_band_prev; uint8_t bs_freq_scale_prev; uint8_t bs_alter_scale_prev; uint8_t bs_noise_bands_prev; int8_t prevEnvIsShort[2]; int8_t kx_prev; uint8_t bsco; uint8_t bsco_prev; uint8_t M_prev; uint16_t frame_len; uint8_t Reset; uint32_t frame; uint32_t header_count; uint8_t id_aac; qmfa_info *qmfa[2]; qmfs_info *qmfs[2]; qmf_t Xsbr[2][MAX_NTSRHFG][64]; #ifdef DRM uint8_t Is_DRM_SBR; #ifdef DRM_PS drm_ps_info *drm_ps; #endif #endif uint8_t numTimeSlotsRate; uint8_t numTimeSlots; uint8_t tHFGen; uint8_t tHFAdj; #ifdef PS_DEC ps_info *ps; #endif #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t ps_used; uint8_t psResetFlag; #endif /* to get it compiling */ /* we'll see during the coding of all the tools, whether these are all used or not. */ uint8_t bs_header_flag; uint8_t bs_crc_flag; uint16_t bs_sbr_crc_bits; uint8_t bs_protocol_version; uint8_t bs_amp_res; uint8_t bs_start_freq; uint8_t bs_stop_freq; uint8_t bs_xover_band; uint8_t bs_freq_scale; uint8_t bs_alter_scale; uint8_t bs_noise_bands; uint8_t bs_limiter_bands; uint8_t bs_limiter_gains; uint8_t bs_interpol_freq; uint8_t bs_smoothing_mode; uint8_t bs_samplerate_mode; uint8_t bs_add_harmonic_flag[2]; uint8_t bs_add_harmonic_flag_prev[2]; uint8_t bs_extended_data; uint8_t bs_extension_id; uint8_t bs_extension_data; uint8_t bs_coupling; uint8_t bs_frame_class[2]; uint8_t bs_rel_bord[2][9]; uint8_t bs_rel_bord_0[2][9]; uint8_t bs_rel_bord_1[2][9]; uint8_t bs_pointer[2]; uint8_t bs_abs_bord_0[2]; uint8_t bs_abs_bord_1[2]; uint8_t bs_num_rel_0[2]; uint8_t bs_num_rel_1[2]; uint8_t bs_df_env[2][9]; uint8_t bs_df_noise[2][3]; } sbr_info; sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, uint32_t sample_rate, uint8_t downSampledSBR #ifdef DRM , uint8_t IsDRM #endif ); void sbrDecodeEnd(sbr_info *sbr); void sbrReset(sbr_info *sbr); uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, const uint8_t just_seeked, const uint8_t downSampledSBR); uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, const uint8_t just_seeked, const uint8_t downSampledSBR); #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, const uint8_t just_seeked, const uint8_t downSampledSBR); #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_e_nf.c000066400000000000000000001416501357201522000210760ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_e_nf.c,v 1.22 2008/03/23 23:03:29 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include #include "sbr_syntax.h" #include "sbr_e_nf.h" void extract_envelope_data(sbr_info *sbr, uint8_t ch) { uint8_t l, k; for (l = 0; l < sbr->L_E[ch]; l++) { if (sbr->bs_df_env[ch][l] == 0) { for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++) { sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l]; if (sbr->E[ch][k][l] < 0) sbr->E[ch][k][l] = 0; } } else { /* bs_df_env == 1 */ uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1]; int16_t E_prev; if (sbr->f[ch][l] == g) { for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) { if (l == 0) E_prev = sbr->E_prev[ch][k]; else E_prev = sbr->E[ch][k][l - 1]; sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; } } else if ((g == 1) && (sbr->f[ch][l] == 0)) { uint8_t i; for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) { for (i = 0; i < sbr->N_high; i++) { if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k]) { if (l == 0) E_prev = sbr->E_prev[ch][i]; else E_prev = sbr->E[ch][i][l - 1]; sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; } } } } else if ((g == 0) && (sbr->f[ch][l] == 1)) { uint8_t i; for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) { for (i = 0; i < sbr->N_low; i++) { if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) && (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1])) { if (l == 0) E_prev = sbr->E_prev[ch][i]; else E_prev = sbr->E[ch][i][l - 1]; sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; } } } } } } } void extract_noise_floor_data(sbr_info *sbr, uint8_t ch) { uint8_t l, k; for (l = 0; l < sbr->L_Q[ch]; l++) { if (sbr->bs_df_noise[ch][l] == 0) { for (k = 1; k < sbr->N_Q; k++) { sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l]; } } else { if (l == 0) { for (k = 0; k < sbr->N_Q; k++) { sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0]; } } else { for (k = 0; k < sbr->N_Q; k++) { sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l]; } } } } } #ifndef FIXED_POINT /* table for Q_div values when no coupling */ static const real_t Q_div_tab[31] = { FRAC_CONST(0.0153846), FRAC_CONST(0.030303), FRAC_CONST(0.0588235), FRAC_CONST(0.111111), FRAC_CONST(0.2), FRAC_CONST(0.333333), FRAC_CONST(0.5), FRAC_CONST(0.666667), FRAC_CONST(0.8), FRAC_CONST(0.888889), FRAC_CONST(0.941176), FRAC_CONST(0.969697), FRAC_CONST(0.984615), FRAC_CONST(0.992248), FRAC_CONST(0.996109), FRAC_CONST(0.998051), FRAC_CONST(0.999024), FRAC_CONST(0.999512), FRAC_CONST(0.999756), FRAC_CONST(0.999878), FRAC_CONST(0.999939), FRAC_CONST(0.999969), FRAC_CONST(0.999985), FRAC_CONST(0.999992), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }; static const real_t Q_div_tab_left[31][13] = { { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) }, { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) }, { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) }, { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) }, { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) }, { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) }, { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) }, { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) }, { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) }, { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) }, { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) }, { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) }, { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) }, { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) }, { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) }, { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) }, { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) }, { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } }; static const real_t Q_div_tab_right[31][13] = { { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) }, { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) }, { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) }, { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) }, { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) }, { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) }, { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) }, { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) }, { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) }, { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) }, { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) }, { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) }, { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) }, { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) }, { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) }, { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) }, { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) }, { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) }, { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } }; /* calculates 1/(1+Q) */ /* [0..1] */ static real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) { if (sbr->bs_coupling) { /* left channel */ if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) { return 0; } else { /* the pan parameter is always even */ if (ch == 0) { return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; } else { return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; } } } else { /* no coupling */ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) { return 0; } else { return Q_div_tab[sbr->Q[ch][m][l]]; } } } /* table for Q_div2 values when no coupling */ static const real_t Q_div2_tab[31] = { FRAC_CONST(0.984615), FRAC_CONST(0.969697), FRAC_CONST(0.941176), FRAC_CONST(0.888889), FRAC_CONST(0.8), FRAC_CONST(0.666667), FRAC_CONST(0.5), FRAC_CONST(0.333333), FRAC_CONST(0.2), FRAC_CONST(0.111111), FRAC_CONST(0.0588235), FRAC_CONST(0.030303), FRAC_CONST(0.0153846), FRAC_CONST(0.00775194), FRAC_CONST(0.00389105), FRAC_CONST(0.00194932), FRAC_CONST(0.00097561), FRAC_CONST(0.000488043), FRAC_CONST(0.000244081), FRAC_CONST(0.000122055), FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(5.96046E-008) }; static const real_t Q_div2_tab_left[31][13] = { { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) }, { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) }, { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) }, { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) }, { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) }, { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) }, { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) }, { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) }, { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) }, { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) }, { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) }, { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) }, { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) }, { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) }, { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) }, { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) }, { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) }, { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) }, { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) }, { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) }, { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) }, { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) }, { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) }, { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) }, { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) }, { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) }, { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) }, { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) }, { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) }, { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) }, { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) } }; static const real_t Q_div2_tab_right[31][13] = { { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) }, { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) }, { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) }, { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) }, { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) }, { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) }, { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) }, { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) }, { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) }, { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) }, { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) }, { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) }, { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) }, { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) }, { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) }, { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) }, { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) }, { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) }, { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) }, { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) }, { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) }, { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) }, { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) }, { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) }, { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) }, { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) }, { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) }, { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) }, { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) }, { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) }, { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) } }; /* calculates Q/(1+Q) */ /* [0..1] */ static real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) { if (sbr->bs_coupling) { if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) { return 0; } else { /* the pan parameter is always even */ if (ch == 0) { return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; } else { return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; } } } else { /* no coupling */ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) { return 0; } else { return Q_div2_tab[sbr->Q[ch][m][l]]; } } } static const real_t E_deq_tab[64] = { 64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f, 16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f, 4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f, 1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f, 2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f, 7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f, 1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f, 4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f }; void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch) { if (sbr->bs_coupling == 0) { int16_t exp; uint8_t l, k; uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1; for (l = 0; l < sbr->L_E[ch]; l++) { for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) { /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed) * since this is a energy value: (x/32)^2 = (x^2)/1024 */ /* exp = (sbr->E[ch][k][l] >> amp) + 6; */ exp = (sbr->E[ch][k][l] >> amp); if ((exp < 0) || (exp >= 64)) { sbr->E_orig[ch][k][l] = 0; } else { sbr->E_orig[ch][k][l] = E_deq_tab[exp]; /* save half the table size at the cost of 1 multiply */ if (amp && (sbr->E[ch][k][l] & 1)) { sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562)); } } } } for (l = 0; l < sbr->L_Q[ch]; l++) { for (k = 0; k < sbr->N_Q; k++) { sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l); sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l); } } } } static const real_t E_pan_tab[25] = { FRAC_CONST(0.000244081), FRAC_CONST(0.000488043), FRAC_CONST(0.00097561), FRAC_CONST(0.00194932), FRAC_CONST(0.00389105), FRAC_CONST(0.00775194), FRAC_CONST(0.0153846), FRAC_CONST(0.030303), FRAC_CONST(0.0588235), FRAC_CONST(0.111111), FRAC_CONST(0.2), FRAC_CONST(0.333333), FRAC_CONST(0.5), FRAC_CONST(0.666667), FRAC_CONST(0.8), FRAC_CONST(0.888889), FRAC_CONST(0.941176), FRAC_CONST(0.969697), FRAC_CONST(0.984615), FRAC_CONST(0.992248), FRAC_CONST(0.996109), FRAC_CONST(0.998051), FRAC_CONST(0.999024), FRAC_CONST(0.999512), FRAC_CONST(0.999756) }; void unmap_envelope_noise(sbr_info *sbr) { real_t tmp; int16_t exp0, exp1; uint8_t l, k; uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; for (l = 0; l < sbr->L_E[0]; l++) { for (k = 0; k < sbr->n[sbr->f[0][l]]; k++) { /* +6: * 64 ; +1: * 2 ; */ exp0 = (sbr->E[0][k][l] >> amp0) + 1; /* UN_MAP removed: (x / 4096) same as (x >> 12) */ /* E[1] is always even so no need for compensating the divide by 2 with * an extra multiplication */ /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */ exp1 = (sbr->E[1][k][l] >> amp1); if ((exp0 < 0) || (exp0 >= 64) || (exp1 < 0) || (exp1 > 24)) { sbr->E_orig[1][k][l] = 0; sbr->E_orig[0][k][l] = 0; } else { tmp = E_deq_tab[exp0]; if (amp0 && (sbr->E[0][k][l] & 1)) { tmp = MUL_C(tmp, COEF_CONST(1.414213562)); } /* panning */ sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]); sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]); } } } for (l = 0; l < sbr->L_Q[0]; l++) { for (k = 0; k < sbr->N_Q; k++) { sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l); sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l); sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l); sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l); } } } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_e_nf.h000066400000000000000000000032131357201522000210730ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_e_nf.h,v 1.18 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_E_NF_H__ #define __SBR_E_NF_H__ #ifdef __cplusplus extern "C" { #endif void extract_envelope_data(sbr_info *sbr, uint8_t ch); void extract_noise_floor_data(sbr_info *sbr, uint8_t ch); #ifndef FIXED_POINT void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch); void unmap_envelope_noise(sbr_info *sbr); #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_fbt.c000066400000000000000000000572151357201522000207450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_fbt.c,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ /* Calculate frequency band tables */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include #include "sbr_syntax.h" #include "sbr_fbt.h" /* static function declarations */ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1); /* calculate the start QMF channel for the master frequency band table */ /* parameter is also called k0 */ uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, uint32_t sample_rate) { static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16, 17, 24, 32, 35, 48 }; static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0, 6, 6, 6 }; static const int8_t offset[7][16] = { { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }, { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 }, { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 }, { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 }, { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 } }; uint8_t startMin = startMinTable[get_sr_index(sample_rate)]; uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)]; #if 0 /* replaced with table (startMinTable) */ if (sample_rate >= 64000) { startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5); } else if (sample_rate < 32000) { startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5); } else { startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5); } #endif if (bs_samplerate_mode) { return startMin + offset[offsetIndex][bs_start_freq]; #if 0 /* replaced by offsetIndexTable */ switch (sample_rate) { case 16000: return startMin + offset[0][bs_start_freq]; case 22050: return startMin + offset[1][bs_start_freq]; case 24000: return startMin + offset[2][bs_start_freq]; case 32000: return startMin + offset[3][bs_start_freq]; default: if (sample_rate > 64000) { return startMin + offset[5][bs_start_freq]; } else { /* 44100 <= sample_rate <= 64000 */ return startMin + offset[4][bs_start_freq]; } } #endif } else { return startMin + offset[6][bs_start_freq]; } } static int longcmp(const void *a, const void *b) { return ((int)(*(int32_t*)a - *(int32_t*)b)); } /* calculate the stop QMF channel for the master frequency band table */ /* parameter is also called k2 */ uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, uint8_t k0) { if (bs_stop_freq == 15) { return min(64, k0 * 3); } else if (bs_stop_freq == 14) { return min(64, k0 * 2); } else { static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23, 32, 32, 35, 48, 64, 70, 96 }; static const int8_t offset[12][14] = { { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 }, { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 }, { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 }, { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 } }; #if 0 uint8_t i; int32_t stopDk[13], stopDk_t[14], k2; #endif uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)]; #if 0 /* replaced by table lookup */ if (sample_rate >= 64000) { stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5); } else if (sample_rate < 32000) { stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5); } else { stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5); } #endif #if 0 /* replaced by table lookup */ /* diverging power series */ for (i = 0; i <= 13; i++) { stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5); } for (i = 0; i < 13; i++) { stopDk[i] = stopDk_t[i+1] - stopDk_t[i]; } /* needed? */ qsort(stopDk, 13, sizeof(stopDk[0]), longcmp); k2 = stopMin; for (i = 0; i < bs_stop_freq; i++) { k2 += stopDk[i]; } return min(64, k2); #endif /* bs_stop_freq <= 13 */ return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]); } return 0; } /* calculate the master frequency table from k0, k2, bs_freq_scale and bs_alter_scale version for bs_freq_scale = 0 */ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_alter_scale) { int8_t incr; uint8_t k; uint8_t dk; uint32_t nrBands, k2Achieved; int32_t k2Diff, vDk[64] = {0}; /* mft only defined for k2 > k0 */ if (k2 <= k0) { sbr->N_master = 0; return 1; } dk = bs_alter_scale ? 2 : 1; #if 0 /* replaced by float-less design */ nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f); #else if (bs_alter_scale) { nrBands = (((k2-k0+2)>>2)<<1); } else { nrBands = (((k2-k0)>>1)<<1); } #endif nrBands = min(nrBands, 63); if (nrBands <= 0) return 1; k2Achieved = k0 + nrBands * dk; k2Diff = k2 - k2Achieved; for (k = 0; k < nrBands; k++) vDk[k] = dk; if (k2Diff) { incr = (k2Diff > 0) ? -1 : 1; k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0); while (k2Diff != 0) { vDk[k] -= incr; k += incr; k2Diff += incr; } } sbr->f_master[0] = k0; for (k = 1; k <= nrBands; k++) sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]); sbr->N_master = (uint8_t)nrBands; sbr->N_master = (min(sbr->N_master, 64)); #if 0 printf("f_master[%d]: ", nrBands); for (k = 0; k <= nrBands; k++) { printf("%d ", sbr->f_master[k]); } printf("\n"); #endif return 0; } /* This function finds the number of bands using this formula: bands * log(a1/a0)/log(2.0) + 0.5 */ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1) { #ifdef FIXED_POINT /* table with log2() values */ static const real_t log2Table[65] = { COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007), COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221), COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186), COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956), COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134), COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561), COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022), COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104), COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169), COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189), COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547), COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517), COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420), COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135), COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494), COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235), COEF_CONST(6.0) }; real_t r0 = log2Table[a0]; /* coef */ real_t r1 = log2Table[a1]; /* coef */ real_t r2 = (r1 - r0); /* coef */ if (warp) r2 = MUL_C(r2, COEF_CONST(1.0/1.3)); /* convert r2 to real and then multiply and round */ r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1)); return (r2 >> REAL_BITS); #else real_t div = (real_t)log(2.0); if (warp) div *= (real_t)1.3; return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5); #endif } static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1) { #ifdef FIXED_POINT /* table with log() values */ static const real_t logTable[65] = { COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887), COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491), COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728), COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011), COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792), COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159), COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660), COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045), COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615), COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461), COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157), COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017), COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327), COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852), COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439), COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264), COEF_CONST(4.158883083) }; /* standard Taylor polynomial coefficients for exp(x) around 0 */ /* a polynomial around x=1 is more precise, as most values are around 1.07, but this is just fine already */ static const real_t c1 = COEF_CONST(1.0); static const real_t c2 = COEF_CONST(1.0/2.0); static const real_t c3 = COEF_CONST(1.0/6.0); static const real_t c4 = COEF_CONST(1.0/24.0); real_t r0 = logTable[a0]; /* coef */ real_t r1 = logTable[a1]; /* coef */ real_t r2 = (r1 - r0) / bands; /* coef */ real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2); return (rexp >> (COEF_BITS-REAL_BITS)); /* real */ #else return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands); #endif } /* version for bs_freq_scale > 0 */ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_freq_scale, uint8_t bs_alter_scale) { uint8_t k, bands, twoRegions; uint8_t k1; uint8_t nrBand0, nrBand1; int32_t vDk0[64] = {0}, vDk1[64] = {0}; int32_t vk0[64] = {0}, vk1[64] = {0}; uint8_t temp1[] = { 6, 5, 4 }; real_t q, qk; int32_t A_1; #ifdef FIXED_POINT real_t rk2, rk0; #endif /* mft only defined for k2 > k0 */ if (k2 <= k0) { sbr->N_master = 0; return 1; } bands = temp1[bs_freq_scale-1]; #ifdef FIXED_POINT rk0 = (real_t)k0 << REAL_BITS; rk2 = (real_t)k2 << REAL_BITS; if (rk2 > MUL_C(rk0, COEF_CONST(2.2449))) #else if ((float)k2/(float)k0 > 2.2449) #endif { twoRegions = 1; k1 = k0 << 1; } else { twoRegions = 0; k1 = k2; } nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1)); nrBand0 = min(nrBand0, 63); if (nrBand0 <= 0) return 1; q = find_initial_power(nrBand0, k0, k1); #ifdef FIXED_POINT qk = (real_t)k0 << REAL_BITS; //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); A_1 = k0; #else qk = REAL_CONST(k0); A_1 = (int32_t)(qk + .5); #endif for (k = 0; k <= nrBand0; k++) { int32_t A_0 = A_1; #ifdef FIXED_POINT qk = MUL_R(qk,q); A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); #else qk *= q; A_1 = (int32_t)(qk + 0.5); #endif vDk0[k] = A_1 - A_0; } /* needed? */ qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp); vk0[0] = k0; for (k = 1; k <= nrBand0; k++) { vk0[k] = vk0[k-1] + vDk0[k-1]; if (vDk0[k-1] == 0) return 1; } if (!twoRegions) { for (k = 0; k <= nrBand0; k++) sbr->f_master[k] = (uint8_t) vk0[k]; sbr->N_master = nrBand0; sbr->N_master = min(sbr->N_master, 64); return 0; } nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2)); nrBand1 = min(nrBand1, 63); q = find_initial_power(nrBand1, k1, k2); #ifdef FIXED_POINT qk = (real_t)k1 << REAL_BITS; //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); A_1 = k1; #else qk = REAL_CONST(k1); A_1 = (int32_t)(qk + .5); #endif for (k = 0; k <= nrBand1 - 1; k++) { int32_t A_0 = A_1; #ifdef FIXED_POINT qk = MUL_R(qk,q); A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); #else qk *= q; A_1 = (int32_t)(qk + 0.5); #endif vDk1[k] = A_1 - A_0; } if (vDk1[0] < vDk0[nrBand0 - 1]) { int32_t change; /* needed? */ qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp); change = vDk0[nrBand0 - 1] - vDk1[0]; vDk1[0] = vDk0[nrBand0 - 1]; vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change; } /* needed? */ qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp); vk1[0] = k1; for (k = 1; k <= nrBand1; k++) { vk1[k] = vk1[k-1] + vDk1[k-1]; if (vDk1[k-1] == 0) return 1; } sbr->N_master = nrBand0 + nrBand1; sbr->N_master = min(sbr->N_master, 64); for (k = 0; k <= nrBand0; k++) { sbr->f_master[k] = (uint8_t) vk0[k]; } for (k = nrBand0 + 1; k <= sbr->N_master; k++) { sbr->f_master[k] = (uint8_t) vk1[k - nrBand0]; } #if 0 printf("f_master[%d]: ", sbr->N_master); for (k = 0; k <= sbr->N_master; k++) { printf("%d ", sbr->f_master[k]); } printf("\n"); #endif return 0; } /* calculate the derived frequency border tables from f_master */ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, uint8_t k2) { uint8_t k, i; uint32_t minus; /* The following relation shall be satisfied: bs_xover_band < N_Master */ if (sbr->N_master <= bs_xover_band) return 1; sbr->N_high = sbr->N_master - bs_xover_band; sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1)); sbr->n[0] = sbr->N_low; sbr->n[1] = sbr->N_high; for (k = 0; k <= sbr->N_high; k++) { sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band]; } sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0]; sbr->kx = sbr->f_table_res[HI_RES][0]; if (sbr->kx > 32) return 1; if (sbr->kx + sbr->M > 64) return 1; minus = (sbr->N_high & 1) ? 1 : 0; for (k = 0; k <= sbr->N_low; k++) { if (k == 0) i = 0; else i = (uint8_t)(2*k - minus); sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i]; } #if 0 printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); printf("f_table_res[HI_RES][%d]: ", sbr->N_high); for (k = 0; k <= sbr->N_high; k++) { printf("%d ", sbr->f_table_res[HI_RES][k]); } printf("\n"); #endif #if 0 printf("f_table_res[LO_RES][%d]: ", sbr->N_low); for (k = 0; k <= sbr->N_low; k++) { printf("%d ", sbr->f_table_res[LO_RES][k]); } printf("\n"); #endif sbr->N_Q = 0; if (sbr->bs_noise_bands == 0) { sbr->N_Q = 1; } else { #if 0 sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5)); #else sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2))); #endif sbr->N_Q = min(5, sbr->N_Q); } for (k = 0; k <= sbr->N_Q; k++) { if (k == 0) { i = 0; } else { /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */ i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k); } sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i]; } /* build table for mapping k to g in hf patching */ for (k = 0; k < 64; k++) { uint8_t g; for (g = 0; g < sbr->N_Q; g++) { if ((sbr->f_table_noise[g] <= k) && (k < sbr->f_table_noise[g+1])) { sbr->table_map_k_to_g[k] = g; break; } } } #if 0 printf("f_table_noise[%d]: ", sbr->N_Q); for (k = 0; k <= sbr->N_Q; k++) { printf("%d ", sbr->f_table_noise[k] - sbr->kx); } printf("\n"); #endif return 0; } /* TODO: blegh, ugly */ /* Modified to calculate for all possible bs_limiter_bands always * This reduces the number calls to this functions needed (now only on * header reset) */ void limiter_frequency_table(sbr_info *sbr) { #if 0 static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2), REAL_CONST(2), REAL_CONST(3) }; #else static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152), REAL_CONST(1.185093), REAL_CONST(1.119872) }; #endif uint8_t k, s; int8_t nrLim; #if 0 real_t limBands; #endif sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx; sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx; sbr->N_L[0] = 1; #if 0 printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]); for (k = 0; k <= sbr->N_L[0]; k++) { printf("%d ", sbr->f_table_lim[0][k]); } printf("\n"); #endif for (s = 1; s < 4; s++) { int32_t limTable[100 /*TODO*/] = {0}; uint8_t patchBorders[64/*??*/] = {0}; #if 0 limBands = limiterBandsPerOctave[s - 1]; #endif patchBorders[0] = sbr->kx; for (k = 1; k <= sbr->noPatches; k++) { patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1]; } for (k = 0; k <= sbr->N_low; k++) { limTable[k] = sbr->f_table_res[LO_RES][k]; } for (k = 1; k < sbr->noPatches; k++) { limTable[k+sbr->N_low] = patchBorders[k]; } /* needed */ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); k = 1; nrLim = sbr->noPatches + sbr->N_low - 1; if (nrLim < 0) // TODO: BIG FAT PROBLEM return; restart: if (k <= nrLim) { real_t nOctaves; if (limTable[k-1] != 0) #if 0 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0)); #else #ifdef FIXED_POINT nOctaves = DIV_R((limTable[k]<noPatches; i++) { if (limTable[k] == patchBorders[i]) found = 1; } if (found) { found2 = 0; for (i = 0; i <= sbr->noPatches; i++) { if (limTable[k-1] == patchBorders[i]) found2 = 1; } if (found2) { k++; goto restart; } else { /* remove (k-1)th element */ limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low]; qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); nrLim--; goto restart; } } } /* remove kth element */ limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low]; qsort(limTable, nrLim, sizeof(limTable[0]), longcmp); nrLim--; goto restart; } else { k++; goto restart; } } sbr->N_L[s] = nrLim; for (k = 0; k <= nrLim; k++) { sbr->f_table_lim[s][k] = limTable[k] - sbr->kx; } #if 0 printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]); for (k = 0; k <= sbr->N_L[s]; k++) { printf("%d ", sbr->f_table_lim[s][k]); } printf("\n"); #endif } } #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_fbt.h000066400000000000000000000040711357201522000207420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_fbt.h,v 1.18 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_FBT_H__ #define __SBR_FBT_H__ #ifdef __cplusplus extern "C" { #endif uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, uint32_t sample_rate); uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, uint8_t k0); uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_alter_scale); uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_freq_scale, uint8_t bs_alter_scale); uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, uint8_t k2); void limiter_frequency_table(sbr_info *sbr); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_hfadj.c000066400000000000000000002474721357201522000212540ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfadj.c,v 1.23 2008/09/19 22:50:20 menno Exp $ **/ /* High Frequency adjustment */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "sbr_hfadj.h" #include "sbr_noise.h" /* static function declarations */ static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch); #ifdef SBR_LOW_POWER static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); #endif static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg /* aliasing degree */ #endif ,uint8_t ch) { ALIGN sbr_hfadj_info adj = {{{0}}}; uint8_t ret = 0; if (sbr->bs_frame_class[ch] == FIXFIX) { sbr->l_A[ch] = -1; } else if (sbr->bs_frame_class[ch] == VARFIX) { if (sbr->bs_pointer[ch] > 1) sbr->l_A[ch] = sbr->bs_pointer[ch] - 1; else sbr->l_A[ch] = -1; } else { if (sbr->bs_pointer[ch] == 0) sbr->l_A[ch] = -1; else sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; } ret = estimate_current_envelope(sbr, &adj, Xsbr, ch); if (ret > 0) return 1; calculate_gain(sbr, &adj, ch); #ifdef SBR_LOW_POWER calc_gain_groups(sbr, &adj, deg, ch); aliasing_reduction(sbr, &adj, deg, ch); #endif hf_assembly(sbr, &adj, Xsbr, ch); return 0; } static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band) { if (sbr->f[ch][l] == HI_RES) { /* in case of using f_table_high we just have 1 to 1 mapping * from bs_add_harmonic[l][k] */ if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch])) { return sbr->bs_add_harmonic[ch][current_band]; } } else { uint8_t b, lb, ub; /* in case of f_table_low we check if any of the HI_RES bands * within this LO_RES band has bs_add_harmonic[l][k] turned on * (note that borders in the LO_RES table are also present in * the HI_RES table) */ /* find first HI_RES band in current LO_RES band */ lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0); /* find first HI_RES band in next LO_RES band */ ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0); /* check all HI_RES bands in current LO_RES band for sinusoid */ for (b = lb; b < ub; b++) { if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch])) { if (sbr->bs_add_harmonic[ch][b] == 1) return 1; } } } return 0; } static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) { uint8_t m, l, j, k, k_l, k_h, p; real_t nrg, div; if (sbr->bs_interpol_freq == 1) { for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t i, l_i, u_i; l_i = sbr->t_E[ch][l]; u_i = sbr->t_E[ch][l+1]; div = (real_t)(u_i - l_i); if (div == 0) div = 1; for (m = 0; m < sbr->M; m++) { nrg = 0; for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) { #ifdef FIXED_POINT #ifdef SBR_LOW_POWER nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); #else nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) + ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); #endif #else nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx])) #ifndef SBR_LOW_POWER + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx])) #endif ; #endif } sbr->E_curr[ch][m][l] = nrg / div; #ifdef SBR_LOW_POWER #ifdef FIXED_POINT sbr->E_curr[ch][m][l] <<= 1; #else sbr->E_curr[ch][m][l] *= 2; #endif #endif } } } else { for (l = 0; l < sbr->L_E[ch]; l++) { for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++) { k_l = sbr->f_table_res[sbr->f[ch][l]][p]; k_h = sbr->f_table_res[sbr->f[ch][l]][p+1]; for (k = k_l; k < k_h; k++) { uint8_t i, l_i, u_i; nrg = 0; l_i = sbr->t_E[ch][l]; u_i = sbr->t_E[ch][l+1]; div = (real_t)((u_i - l_i)*(k_h - k_l)); if (div == 0) div = 1; for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) { for (j = k_l; j < k_h; j++) { #ifdef FIXED_POINT #ifdef SBR_LOW_POWER nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); #else nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) + ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); #endif #else nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j])) #ifndef SBR_LOW_POWER + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j])) #endif ; #endif } } sbr->E_curr[ch][k - sbr->kx][l] = nrg / div; #ifdef SBR_LOW_POWER #ifdef FIXED_POINT sbr->E_curr[ch][k - sbr->kx][l] <<= 1; #else sbr->E_curr[ch][k - sbr->kx][l] *= 2; #endif #endif } } } } return 0; } #ifdef FIXED_POINT #define EPS (1) /* smallest number available in fixed point */ #else #define EPS (1e-12) #endif #ifdef FIXED_POINT /* log2 values of [0..63] */ static const real_t log2_int_tab[] = { LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156), REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604), REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297), REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519), REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585), REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013), REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468), REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875), REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966), REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248), REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098), REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637), REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495), REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660), REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842), REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916) }; static const real_t pan_log2_tab[] = { REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667) }; static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0)); real_t pan; /* E[1] should always be even so shifting is OK */ uint8_t E = sbr->E[1][k][l] >> amp1; if (ch == 0) { if (E > 12) { /* negative */ pan = pan_log2_tab[-12 + E]; } else { /* positive */ pan = pan_log2_tab[12 - E] + ((12 - E)<amp_res[ch]) ? 0 : 1; return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp)); } } static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS); real_t pan; uint8_t Q = sbr->Q[1][k][l]; if (ch == 0) { if (Q > 12) { /* negative */ pan = pan_log2_tab[-12 + Q]; } else { /* positive */ pan = pan_log2_tab[12 - Q] + ((12 - Q)<Q[ch][k][l] << REAL_BITS); } } static const real_t log_Qplus1_pan[31][13] = { { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } }; static const real_t log_Qplus1[31] = { REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), REAL_CONST(0.000000000000000) }; static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) { if (ch == 0) { return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]; } else { return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]; } } else { return 0; } } else { if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) { return log_Qplus1[sbr->Q[ch][k][l]]; } else { return 0; } } } static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { /* log2 values of limiter gains */ static real_t limGain[] = { REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219) }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t Q_M = 0; real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t Q_M_size = 0; uint8_t ml1, ml2; /* bounds of current limiter bands */ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band_size++; } else { acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); current_res_band++; current_res_band_size = 1; } acc2 += sbr->E_curr[ch][m][l]; } acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); if (acc1 == 0) acc1 = LOG2_MIN_INF; else acc1 = log2_int(acc1); /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains]; G_max = min(G_max, limGain[3]); for (m = ml1; m < ml2; m++) { real_t G; real_t E_curr, E_orig; real_t Q_orig, Q_orig_plus1; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* accumulate a whole range of equal Q_Ms */ if (Q_M_size > 0) den += pow2_int(log2_int_tab[Q_M_size] + Q_M); Q_M_size = 0; /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* find bitstream parameters */ if (sbr->E_curr[ch][m][l] == 0) E_curr = LOG2_MIN_INF; else E_curr = log2_int(sbr->E_curr[ch][m][l]); E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch); Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current res band (HI or LO) */ Q_M = E_orig + Q_orig - Q_orig_plus1; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = LOG2_MIN_INF; /* -inf */ } else { S_M[m] = E_orig - Q_orig_plus1; /* accumulate sinusoid part of the total energy */ den += pow2_int(S_M[m]); } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ /* scaled by -10 */ G = E_orig - max(-REAL_CONST(10), E_curr); if ((S_mapped == 0) && (delta == 1)) { /* G = G * 1/(1+Q) */ G -= Q_orig_plus1; } else if (S_mapped == 1) { /* G = G * Q/(1+Q) */ G += Q_orig - Q_orig_plus1; } /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = Q_M; G_lim[m] = G; if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { Q_M_size++; } } else { /* G > G_max */ Q_M_lim[m] = Q_M + G_max - G; G_lim[m] = G_max; /* accumulate limited Q_M */ if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { den += pow2_int(Q_M_lim[m]); } } /* accumulate the total energy */ /* E_curr changes for every m so we do need to accumulate every m */ den += pow2_int(E_curr + G_lim[m]); } /* accumulate last range of equal Q_Ms */ if (Q_M_size > 0) { den += pow2_int(log2_int_tab[Q_M_size] + Q_M); } /* calculate the final gain */ /* G_boost: [0..2.51188643] */ G_boost = acc1 - log2_int(den /*+ EPS*/); G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost); #endif adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1); if (S_M[m] != LOG2_MIN_INF) { adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1); } else { adj->S_M_boost[l][m] = 0; } } } } } #else //#define LOG2_TEST #ifdef LOG2_TEST #define LOG2_MIN_INF -100000 __inline float pow2(float val) { return pow(2.0, val); } __inline float log2(float val) { return log(val)/log(2.0); } #define RB 14 float QUANTISE2REAL(float val) { __int32 ival = (__int32)(val * (1<bs_coupling == 1) { real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5; real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5; float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0); float pan; int E = (int)(sbr->E[1][k][l] * amp1); if (ch == 0) { if (E > 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-12 + E]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E)); } } else { if (E < 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-E + 12]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12)); } } /* tmp / pan in log2 */ return QUANTISE2REAL(tmp - pan); } else { real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5; return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp); } } static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]); float pan; int Q = (int)(sbr->Q[1][k][l]); if (ch == 0) { if (Q > 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q)); } } else { if (Q < 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12)); } } /* tmp / pan in log2 */ return QUANTISE2REAL(tmp - pan); } else { return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]); } } static const real_t log_Qplus1_pan[31][13] = { { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } }; static const real_t log_Qplus1[31] = { REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), REAL_CONST(0.000000000000000) }; static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) { if (ch == 0) { return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]); } else { return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]); } } else { return 0; } } else { if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) { return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]); } else { return 0; } } } static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { /* log2 values of limiter gains */ static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t Q_M = 0; real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t Q_M_size = 0; uint8_t ml1, ml2; /* bounds of current limiter bands */ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band_size++; } else { acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); current_res_band++; current_res_band_size = 1; } acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0); } acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); acc1 = QUANTISE2REAL( log2(EPS + acc1) ); /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]); G_max = min(G_max, QUANTISE2REAL(limGain[3])); for (m = ml1; m < ml2; m++) { real_t G; real_t E_curr, E_orig; real_t Q_orig, Q_orig_plus1; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* accumulate a whole range of equal Q_Ms */ if (Q_M_size > 0) den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); Q_M_size = 0; /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* find bitstream parameters */ if (sbr->E_curr[ch][m][l] == 0) E_curr = LOG2_MIN_INF; else E_curr = -10 + log2(sbr->E_curr[ch][m][l]); E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch); Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current res band (HI or LO) */ Q_M = E_orig + Q_orig - Q_orig_plus1; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = LOG2_MIN_INF; /* -inf */ } else { S_M[m] = E_orig - Q_orig_plus1; /* accumulate sinusoid part of the total energy */ den += pow2(S_M[m]); } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ /* scaled by -10 */ G = E_orig - max(-10, E_curr); if ((S_mapped == 0) && (delta == 1)) { /* G = G * 1/(1+Q) */ G -= Q_orig_plus1; } else if (S_mapped == 1) { /* G = G * Q/(1+Q) */ G += Q_orig - Q_orig_plus1; } /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = QUANTISE2REAL(Q_M); G_lim[m] = QUANTISE2REAL(G); if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { Q_M_size++; } } else { /* G > G_max */ Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G); G_lim[m] = G_max; /* accumulate limited Q_M */ if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { den += QUANTISE2INT(pow2(Q_M_lim[m])); } } /* accumulate the total energy */ /* E_curr changes for every m so we do need to accumulate every m */ den += QUANTISE2INT(pow2(E_curr + G_lim[m])); } /* accumulate last range of equal Q_Ms */ if (Q_M_size > 0) { den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); } /* calculate the final gain */ /* G_boost: [0..2.51188643] */ G_boost = acc1 - QUANTISE2REAL(log2(den + EPS)); G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0)); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost)); #endif adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0)); if (S_M[m] != LOG2_MIN_INF) { adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0)); } else { adj->S_M_boost[l][m] = 0; } } } } } #else static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t ml1, ml2; ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band++; } acc1 += sbr->E_orig[ch][current_res_band][l]; acc2 += sbr->E_curr[ch][m][l]; } /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains]; G_max = min(G_max, 1e10); for (m = ml1; m < ml2; m++) { real_t Q_M, G; real_t Q_div, Q_div2; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* Q_div: [0..1] (1/(1+Q_mapped)) */ Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band]; /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */ Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band]; /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current noise band */ Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = 0; } else { S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div; /* accumulate sinusoid part of the total energy */ den += S_M[m]; } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]); if ((S_mapped == 0) && (delta == 1)) G *= Q_div; else if (S_mapped == 1) G *= Q_div2; /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = Q_M; G_lim[m] = G; } else { Q_M_lim[m] = Q_M * G_max / G; G_lim[m] = G_max; } /* accumulate the total energy */ den += sbr->E_curr[ch][m][l] * G_lim[m]; if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) den += Q_M_lim[m]; } /* G_boost: [0..2.51188643] */ G_boost = (acc1 + EPS) / (den + EPS); G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = G_lim[m] * G_boost; #endif adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost); if (S_M[m] != 0) { adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost); } else { adj->S_M_boost[l][m] = 0; } } } } } #endif // log2_test #endif #ifdef SBR_LOW_POWER static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) { uint8_t l, k, i; uint8_t grouping; uint8_t S_mapped; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_res_band = 0; i = 0; grouping = 0; S_mapped = get_S_mapped(sbr, ch, l, current_res_band); for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++) { if (k == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { /* step to next resolution band */ current_res_band++; S_mapped = get_S_mapped(sbr, ch, l, current_res_band); } if (deg[k + 1] && S_mapped == 0) { if (grouping == 0) { sbr->f_group[l][i] = k; grouping = 1; i++; } } else { if (grouping) { if (S_mapped) { sbr->f_group[l][i] = k; } else { sbr->f_group[l][i] = k + 1; } grouping = 0; i++; } } } if (grouping) { sbr->f_group[l][i] = sbr->kx + sbr->M; i++; } sbr->N_G[l] = (uint8_t)(i >> 1); } } static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) { uint8_t l, k, m; real_t E_total, E_total_est, G_target, acc; for (l = 0; l < sbr->L_E[ch]; l++) { for (k = 0; k < sbr->N_G[l]; k++) { E_total_est = E_total = 0; for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++) { /* E_curr: integer */ /* G_lim_boost: fixed point */ /* E_total_est: integer */ /* E_total: integer */ E_total_est += sbr->E_curr[ch][m-sbr->kx][l]; #ifdef FIXED_POINT E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]); #else E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx]; #endif } /* G_target: fixed point */ if ((E_total_est + EPS) == 0) { G_target = 0; } else { #ifdef FIXED_POINT G_target = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) { real_t alpha; /* alpha: (COEF) fixed point */ if (m < sbr->kx + sbr->M - 1) { alpha = max(deg[m], deg[m + 1]); } else { alpha = deg[m]; } adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) + MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]); /* acc: integer */ #ifdef FIXED_POINT acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]); #else acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l]; #endif } /* acc: fixed point */ if (acc + EPS == 0) { acc = 0; } else { #ifdef FIXED_POINT acc = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) { #ifdef FIXED_POINT adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]); #else adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx]; #endif } } } for (l = 0; l < sbr->L_E[ch]; l++) { for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k]; m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++) { #ifdef FIXED_POINT adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]); #else adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]); #endif } } } } #endif static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) { static real_t h_smooth[] = { FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084), FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582), FRAC_CONST(0.33333333333333) }; static int8_t phi_re[] = { 1, 0, -1, 0 }; static int8_t phi_im[] = { 0, 1, 0, -1 }; uint8_t m, l, i, n; uint16_t fIndexNoise = 0; uint8_t fIndexSine = 0; uint8_t assembly_reset = 0; real_t G_filt, Q_filt; uint8_t h_SL; if (sbr->Reset == 1) { assembly_reset = 1; fIndexNoise = 0; } else { fIndexNoise = sbr->index_noise_prev[ch]; } fIndexSine = sbr->psi_is_prev[ch]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0; #ifdef SBR_LOW_POWER h_SL = 0; #else h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4; h_SL = (no_noise ? 0 : h_SL); #endif if (assembly_reset) { for (n = 0; n < 4; n++) { memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); } /* reset ringbuffer index */ sbr->GQ_ringbuf_index[ch] = 4; assembly_reset = 0; } for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++) { #ifdef SBR_LOW_POWER uint8_t i_min1, i_plus1; uint8_t sinusoids = 0; #endif /* load new values into ringbuffer */ memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); for (m = 0; m < sbr->M; m++) { qmf_t psi; G_filt = 0; Q_filt = 0; #ifndef SBR_LOW_POWER if (h_SL != 0) { uint8_t ri = sbr->GQ_ringbuf_index[ch]; for (n = 0; n <= 4; n++) { real_t curr_h_smooth = h_smooth[n]; ri++; if (ri >= 5) ri -= 5; G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth); Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth); } } else { #endif G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; #ifndef SBR_LOW_POWER } #endif Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt; /* add noise to the output */ fIndexNoise = (fIndexNoise + 1) & 511; /* the smoothed gain values are applied to Xsbr */ /* V is defined, not calculated */ #ifndef FIXED_POINT QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + MUL_F(Q_filt, RE(V[fIndexNoise])); #else //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) // + MUL_F(Q_filt, RE(V[fIndexNoise])); QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + MUL_F(Q_filt, RE(V[fIndexNoise])); #endif if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42) QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320; #ifndef SBR_LOW_POWER #ifndef FIXED_POINT QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + MUL_F(Q_filt, IM(V[fIndexNoise])); #else //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) // + MUL_F(Q_filt, IM(V[fIndexNoise])); QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + MUL_F(Q_filt, IM(V[fIndexNoise])); #endif #endif { int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; #ifdef FIXED_POINT QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS); #else QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi); #endif #ifndef SBR_LOW_POWER QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; #ifdef FIXED_POINT QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS); #else QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi); #endif #else i_min1 = (fIndexSine - 1) & 3; i_plus1 = (fIndexSine + 1) & 3; #ifndef FIXED_POINT if ((m == 0) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815))); if (sbr->M != 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815))); } } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815))); } if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { if (m > 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); } if (m + sbr->kx < 64) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815))); } } #else if ((m == 0) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<M != 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { if (m > 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<kx < 64) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<S_M_boost[l][m] != 0) sinusoids++; #endif } } fIndexSine = (fIndexSine + 1) & 3; /* update the ringbuffer index used for filtering G and Q with h_smooth */ sbr->GQ_ringbuf_index[ch]++; if (sbr->GQ_ringbuf_index[ch] >= 5) sbr->GQ_ringbuf_index[ch] = 0; } } sbr->index_noise_prev[ch] = fIndexNoise; sbr->psi_is_prev[ch] = fIndexSine; } #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_hfadj.h000066400000000000000000000033321357201522000212420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfadj.h,v 1.19 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HFADJ_H__ #define __SBR_HFADJ_H__ #ifdef __cplusplus extern "C" { #endif typedef struct { real_t G_lim_boost[MAX_L_E][MAX_M]; real_t Q_M_lim_boost[MAX_L_E][MAX_M]; real_t S_M_boost[MAX_L_E][MAX_M]; } sbr_hfadj_info; uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_hfgen.c000066400000000000000000000527061357201522000212610ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfgen.c,v 1.26 2007/11/01 12:33:35 menno Exp $ **/ /* High Frequency generation */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "sbr_hfgen.h" #include "sbr_fbt.h" /* static function declarations */ #ifdef SBR_LOW_POWER static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, real_t *rxx); static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg); #else static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, uint8_t k); #endif static void calc_chirp_factors(sbr_info *sbr, uint8_t ch); static void patch_construction(sbr_info *sbr); void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], qmf_t Xhigh[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch) { uint8_t l, i, x; ALIGN complex_t alpha_0[64], alpha_1[64]; #ifdef SBR_LOW_POWER ALIGN real_t rxx[64]; #endif uint8_t offset = sbr->tHFAdj; uint8_t first = sbr->t_E[ch][0]; uint8_t last = sbr->t_E[ch][sbr->L_E[ch]]; calc_chirp_factors(sbr, ch); #ifdef SBR_LOW_POWER memset(deg, 0, 64*sizeof(real_t)); #endif if ((ch == 0) && (sbr->Reset)) patch_construction(sbr); /* calculate the prediction coefficients */ #ifdef SBR_LOW_POWER calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx); calc_aliasing_degree(sbr, rxx, deg); #endif /* actual HF generation */ for (i = 0; i < sbr->noPatches; i++) { for (x = 0; x < sbr->patchNoSubbands[i]; x++) { real_t a0_r, a0_i, a1_r, a1_i; real_t bw, bw2; uint8_t q, p, k, g; /* find the low and high band for patching */ k = sbr->kx + x; for (q = 0; q < i; q++) { k += sbr->patchNoSubbands[q]; } p = sbr->patchStartSubband[i] + x; #ifdef SBR_LOW_POWER if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/) deg[k] = deg[p]; else deg[k] = 0; #endif g = sbr->table_map_k_to_g[k]; bw = sbr->bwArray[ch][g]; bw2 = MUL_C(bw, bw); /* do the patching */ /* with or without filtering */ if (bw2 > 0) { real_t temp1_r, temp2_r, temp3_r; #ifndef SBR_LOW_POWER real_t temp1_i, temp2_i, temp3_i; calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p); #endif a0_r = MUL_C(RE(alpha_0[p]), bw); a1_r = MUL_C(RE(alpha_1[p]), bw2); #ifndef SBR_LOW_POWER a0_i = MUL_C(IM(alpha_0[p]), bw); a1_i = MUL_C(IM(alpha_1[p]), bw2); #endif temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); #ifndef SBR_LOW_POWER temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); #endif for (l = first; l < last; l++) { temp1_r = temp2_r; temp2_r = temp3_r; temp3_r = QMF_RE(Xlow[l + offset][p]); #ifndef SBR_LOW_POWER temp1_i = temp2_i; temp2_i = temp3_i; temp3_i = QMF_IM(Xlow[l + offset][p]); #endif #ifdef SBR_LOW_POWER QMF_RE(Xhigh[l + offset][k]) = temp3_r +(MUL_R(a0_r, temp2_r) + MUL_R(a1_r, temp1_r)); #else QMF_RE(Xhigh[l + offset][k]) = temp3_r +(MUL_R(a0_r, temp2_r) - MUL_R(a0_i, temp2_i) + MUL_R(a1_r, temp1_r) - MUL_R(a1_i, temp1_i)); QMF_IM(Xhigh[l + offset][k]) = temp3_i +(MUL_R(a0_i, temp2_r) + MUL_R(a0_r, temp2_i) + MUL_R(a1_i, temp1_r) + MUL_R(a1_r, temp1_i)); #endif } } else { for (l = first; l < last; l++) { QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]); #ifndef SBR_LOW_POWER QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]); #endif } } } } if (sbr->Reset) { limiter_frequency_table(sbr); } } typedef struct { complex_t r01; complex_t r02; complex_t r11; complex_t r12; complex_t r22; real_t det; } acorr_coef; #ifdef SBR_LOW_POWER static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], uint8_t bd, uint8_t len) { real_t r01 = 0, r02 = 0, r11 = 0; int8_t j; uint8_t offset = sbr->tHFAdj; #ifdef FIXED_POINT const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); uint32_t maxi = 0; uint32_t pow2, exp; #else const real_t rel = 1 / (1 + 1e-6f); #endif #ifdef FIXED_POINT mask = 0; for (j = (offset-2); j < (len + offset); j++) { real_t x; x = QMF_RE(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); } exp = wl_min_lzc(mask); /* improves accuracy */ if (exp > 0) exp -= 1; for (j = offset; j < len + offset; j++) { real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp); real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp); real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp); /* normalisation with rounding */ r01 += MUL_R(buf_j, buf_j_1); r02 += MUL_R(buf_j, buf_j_2); r11 += MUL_R(buf_j_1, buf_j_1); } RE(ac->r12) = r01 - MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); RE(ac->r22) = r11 - MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); #else for (j = offset; j < len + offset; j++) { r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]); r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]); r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]); } RE(ac->r12) = r01 - QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]); RE(ac->r22) = r11 - QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]); #endif RE(ac->r01) = r01; RE(ac->r02) = r02; RE(ac->r11) = r11; ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel); } #else static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], uint8_t bd, uint8_t len) { real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0; real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i; #ifdef FIXED_POINT const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); uint32_t mask, exp; real_t pow2_to_exp; #else const real_t rel = 1 / (1 + 1e-6f); #endif int8_t j; uint8_t offset = sbr->tHFAdj; #ifdef FIXED_POINT mask = 0; for (j = (offset-2); j < (len + offset); j++) { real_t x; x = QMF_RE(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); x = QMF_IM(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); } exp = wl_min_lzc(mask); /* improves accuracy */ if (exp > 0) exp -= 1; pow2_to_exp = 1<<(exp-1); temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp; temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp; temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp; temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp; // Save these because they are needed after loop temp4_r = temp2_r; temp4_i = temp2_i; temp5_r = temp3_r; temp5_i = temp3_i; for (j = offset; j < len + offset; j++) { temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp; temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp; r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i); r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i); r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i); r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i); r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i); } // These are actual values in temporary variable at this point // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; RE(ac->r12) = r01r - (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) + (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i)); IM(ac->r12) = r01i - (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) + (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i)); RE(ac->r22) = r11r - (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) + (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i)); #else temp2_r = QMF_RE(buffer[offset-2][bd]); temp2_i = QMF_IM(buffer[offset-2][bd]); temp3_r = QMF_RE(buffer[offset-1][bd]); temp3_i = QMF_IM(buffer[offset-1][bd]); // Save these because they are needed after loop temp4_r = temp2_r; temp4_i = temp2_i; temp5_r = temp3_r; temp5_i = temp3_i; for (j = offset; j < len + offset; j++) { temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; temp3_r = QMF_RE(buffer[j][bd]); temp3_i = QMF_IM(buffer[j][bd]); r01r += temp3_r * temp2_r + temp3_i * temp2_i; r01i += temp3_i * temp2_r - temp3_r * temp2_i; r02r += temp3_r * temp1_r + temp3_i * temp1_i; r02i += temp3_i * temp1_r - temp3_r * temp1_i; r11r += temp2_r * temp2_r + temp2_i * temp2_i; } // These are actual values in temporary variable at this point // temp1_r = QMF_RE(buffer[len+offset-1-2][bd]; // temp1_i = QMF_IM(buffer[len+offset-1-2][bd]; // temp2_r = QMF_RE(buffer[len+offset-1-1][bd]; // temp2_i = QMF_IM(buffer[len+offset-1-1][bd]; // temp3_r = QMF_RE(buffer[len+offset-1][bd]); // temp3_i = QMF_IM(buffer[len+offset-1][bd]); // temp4_r = QMF_RE(buffer[offset-2][bd]); // temp4_i = QMF_IM(buffer[offset-2][bd]); // temp5_r = QMF_RE(buffer[offset-1][bd]); // temp5_i = QMF_IM(buffer[offset-1][bd]); RE(ac->r12) = r01r - (temp3_r * temp2_r + temp3_i * temp2_i) + (temp5_r * temp4_r + temp5_i * temp4_i); IM(ac->r12) = r01i - (temp3_i * temp2_r - temp3_r * temp2_i) + (temp5_i * temp4_r - temp5_r * temp4_i); RE(ac->r22) = r11r - (temp2_r * temp2_r + temp2_i * temp2_i) + (temp4_r * temp4_r + temp4_i * temp4_i); #endif RE(ac->r01) = r01r; IM(ac->r01) = r01i; RE(ac->r02) = r02r; IM(ac->r02) = r02i; RE(ac->r11) = r11r; ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12)))); } #endif /* calculate linear prediction coefficients using the covariance method */ #ifndef SBR_LOW_POWER static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, uint8_t k) { real_t tmp; acorr_coef ac; auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); if (ac.det == 0) { RE(alpha_1[k]) = 0; IM(alpha_1[k]) = 0; } else { #ifdef FIXED_POINT tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))); RE(alpha_1[k]) = DIV_R(tmp, ac.det); tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))); IM(alpha_1[k]) = DIV_R(tmp, ac.det); #else tmp = REAL_CONST(1.0) / ac.det; RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp; IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp; #endif } if (RE(ac.r11) == 0) { RE(alpha_0[k]) = 0; IM(alpha_0[k]) = 0; } else { #ifdef FIXED_POINT tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))); RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))); IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); #else tmp = 1.0f / RE(ac.r11); RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp; IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp; #endif } if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) || (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16))) { RE(alpha_0[k]) = 0; IM(alpha_0[k]) = 0; RE(alpha_1[k]) = 0; IM(alpha_1[k]) = 0; } } #else static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, real_t *rxx) { uint8_t k; real_t tmp; acorr_coef ac; for (k = 1; k < sbr->f_master[0]; k++) { auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); if (ac.det == 0) { RE(alpha_0[k]) = 0; RE(alpha_1[k]) = 0; } else { tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02)); RE(alpha_0[k]) = DIV_R(tmp, (-ac.det)); tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)); RE(alpha_1[k]) = DIV_R(tmp, ac.det); } if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4))) { RE(alpha_0[k]) = REAL_CONST(0); RE(alpha_1[k]) = REAL_CONST(0); } /* reflection coefficient */ if (RE(ac.r11) == 0) { rxx[k] = COEF_CONST(0.0); } else { rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11)); rxx[k] = -rxx[k]; if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0); if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0); } } } static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg) { uint8_t k; rxx[0] = COEF_CONST(0.0); deg[1] = COEF_CONST(0.0); for (k = 2; k < sbr->k0; k++) { deg[k] = 0.0; if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) { if (rxx[k-1] < 0.0) { deg[k] = COEF_CONST(1.0); if (rxx[k-2] > COEF_CONST(0.0)) { deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } else if (rxx[k-2] > COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0))) { if (rxx[k-1] > COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0); if (rxx[k-2] < COEF_CONST(0.0)) { deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } else if (rxx[k-2] < COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } } } #endif /* FIXED POINT: bwArray = COEF */ static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev) { switch (invf_mode) { case 1: /* LOW */ if (invf_mode_prev == 0) /* NONE */ return COEF_CONST(0.6); else return COEF_CONST(0.75); case 2: /* MID */ return COEF_CONST(0.9); case 3: /* HIGH */ return COEF_CONST(0.98); default: /* NONE */ if (invf_mode_prev == 1) /* LOW */ return COEF_CONST(0.6); else return COEF_CONST(0.0); } } /* FIXED POINT: bwArray = COEF */ static void calc_chirp_factors(sbr_info *sbr, uint8_t ch) { uint8_t i; for (i = 0; i < sbr->N_Q; i++) { sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]); if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i]) sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25)); else sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375)); if (sbr->bwArray[ch][i] < COEF_CONST(0.015625)) sbr->bwArray[ch][i] = COEF_CONST(0.0); if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375)) sbr->bwArray[ch][i] = COEF_CONST(0.99609375); sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i]; sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i]; } } static void patch_construction(sbr_info *sbr) { uint8_t i, k; uint8_t odd, sb; uint8_t msb = sbr->k0; uint8_t usb = sbr->kx; uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 }; /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */ uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)]; sbr->noPatches = 0; if (goalSb < (sbr->kx + sbr->M)) { for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++) k = i+1; } else { k = sbr->N_master; } if (sbr->N_master == 0) { sbr->noPatches = 0; sbr->patchNoSubbands[0] = 0; sbr->patchStartSubband[0] = 0; return; } do { uint8_t j = k + 1; do { j--; sb = sbr->f_master[j]; odd = (sb - 2 + sbr->k0) % 2; } while (sb > (sbr->k0 - 1 + msb - odd)); sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd - sbr->patchNoSubbands[sbr->noPatches]; if (sbr->patchNoSubbands[sbr->noPatches] > 0) { usb = sb; msb = sb; sbr->noPatches++; } else { msb = sbr->kx; } if (sbr->f_master[k] - sb < 3) k = sbr->N_master; } while (sb != (sbr->kx + sbr->M)); if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1)) { sbr->noPatches--; } sbr->noPatches = min(sbr->noPatches, 5); } #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_hfgen.h000066400000000000000000000031441357201522000212560ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfgen.h,v 1.20 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HFGEN_H__ #define __SBR_HFGEN_H__ #ifdef __cplusplus extern "C" { #endif void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], qmf_t Xhigh[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_huff.c000066400000000000000000000375161357201522000211240ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_huff.c,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "bits.h" #include "sbr_huff.h" #include "sbr_e_nf.h" typedef const int8_t (*sbr_huff_tab)[2]; static const int8_t t_huffman_env_1_5dB[120][2] = { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 }, {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 }, {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 }, {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 }, { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 }, { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 }, { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; static const int8_t f_huffman_env_1_5dB[120][2] = { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 }, {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 }, { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 }, {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 }, {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 }, {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 }, { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; static const int8_t t_huffman_env_bal_1_5dB[48][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } }; static const int8_t f_huffman_env_bal_1_5dB[48][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } }; static const int8_t t_huffman_env_3_0dB[62][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; static const int8_t f_huffman_env_3_0dB[62][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; static const int8_t t_huffman_env_bal_3_0dB[24][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } }; static const int8_t f_huffman_env_bal_3_0dB[24][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; static const int8_t t_huffman_noise_3_0dB[62][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, { -35, 61 }, { -34, -33 } }; static const int8_t t_huffman_noise_bal_3_0dB[24][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff) { uint8_t bit; int16_t index = 0; while (index >= 0) { bit = (uint8_t)faad_get1bit(ld); index = t_huff[index][bit]; } return index + 64; } /* table 10 */ void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t env, band; int8_t delta = 0; sbr_huff_tab t_huff, f_huff; if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX)) sbr->amp_res[ch] = 0; else sbr->amp_res[ch] = sbr->bs_amp_res; if ((sbr->bs_coupling) && (ch == 1)) { delta = 1; if (sbr->amp_res[ch]) { t_huff = t_huffman_env_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { t_huff = t_huffman_env_bal_1_5dB; f_huff = f_huffman_env_bal_1_5dB; } } else { delta = 0; if (sbr->amp_res[ch]) { t_huff = t_huffman_env_3_0dB; f_huff = f_huffman_env_3_0dB; } else { t_huff = t_huffman_env_1_5dB; f_huff = f_huffman_env_1_5dB; } } for (env = 0; env < sbr->L_E[ch]; env++) { if (sbr->bs_df_env[ch][env] == 0) { if ((sbr->bs_coupling == 1) && (ch == 1)) { if (sbr->amp_res[ch]) { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5 DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta); } else { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta); } } else { if (sbr->amp_res[ch]) { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta); } else { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7 DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta); } } for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++) { sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta); } } else { for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++) { sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta); } } } extract_envelope_data(sbr, ch); } /* table 11 */ void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t noise, band; int8_t delta = 0; sbr_huff_tab t_huff, f_huff; if ((sbr->bs_coupling == 1) && (ch == 1)) { delta = 1; t_huff = t_huffman_noise_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { delta = 0; t_huff = t_huffman_noise_3_0dB; f_huff = f_huffman_env_3_0dB; } for (noise = 0; noise < sbr->L_Q[ch]; noise++) { if(sbr->bs_df_noise[ch][noise] == 0) { if ((sbr->bs_coupling == 1) && (ch == 1)) { sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta); } else { sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta); } for (band = 1; band < sbr->N_Q; band++) { sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta); } } else { for (band = 0; band < sbr->N_Q; band++) { sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta); } } } extract_noise_floor_data(sbr, ch); } #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_huff.h000066400000000000000000000030111357201522000211100ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_huff.h,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HUFF_H__ #define __SBR_HUFF_H__ #ifdef __cplusplus extern "C" { #endif void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch); void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_noise.h000066400000000000000000001100611357201522000213010ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_noise.h,v 1.17 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_NOISE_H__ #define __SBR_NOISE_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif /* Table 1.A.13 Noise table V */ ALIGN static const complex_t V[] = { { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) }, { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) }, { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) }, { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) }, { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) }, { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) }, { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) }, { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) }, { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) }, { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) }, { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) }, { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) }, { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) }, { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) }, { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) }, { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) }, { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) }, { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) }, { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) }, { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) }, { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) }, { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) }, { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) }, { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) }, { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) }, { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) }, { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) }, { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) }, { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) }, { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) }, { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) }, { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) }, { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) }, { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) }, { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) }, { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) }, { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) }, { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) }, { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) }, { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) }, { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) }, { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) }, { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) }, { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) }, { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) }, { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) }, { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) }, { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) }, { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) }, { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) }, { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) }, { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) }, { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) }, { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) }, { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) }, { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) }, { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) }, { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) }, { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) }, { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) }, { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) }, { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) }, { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) }, { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) }, { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) }, { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) }, { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) }, { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) }, { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) }, { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) }, { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) }, { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) }, { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) }, { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) }, { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) }, { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) }, { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) }, { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) }, { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) }, { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) }, { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) }, { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) }, { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) }, { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) }, { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) }, { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) }, { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) }, { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) }, { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) }, { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) }, { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) }, { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) }, { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) }, { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) }, { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) }, { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) }, { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) }, { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) }, { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) }, { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) }, { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) }, { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) }, { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) }, { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) }, { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) }, { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) }, { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) }, { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) }, { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) }, { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) }, { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) }, { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) }, { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) }, { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) }, { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) }, { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) }, { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) }, { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) }, { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) }, { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) }, { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) }, { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) }, { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) }, { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) }, { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) }, { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) }, { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) }, { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) }, { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) }, { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) }, { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) }, { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) }, { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) }, { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) }, { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) }, { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) }, { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) }, { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) }, { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) }, { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) }, { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) }, { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) }, { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) }, { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) }, { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) }, { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) }, { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) }, { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) }, { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) }, { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) }, { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) }, { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) }, { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) }, { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) }, { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) }, { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) }, { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) }, { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) }, { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) }, { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) }, { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) }, { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) }, { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) }, { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) }, { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) }, { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) }, { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) }, { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) }, { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) }, { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) }, { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) }, { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) }, { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) }, { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) }, { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) }, { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) }, { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) }, { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) }, { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) }, { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) }, { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) }, { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) }, { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) }, { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) }, { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) }, { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) }, { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) }, { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) }, { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) }, { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) }, { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) }, { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) }, { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) }, { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) }, { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) }, { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) }, { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) }, { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) }, { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) }, { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) }, { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) }, { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) }, { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) }, { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) }, { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) }, { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) }, { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) }, { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) }, { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) }, { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) }, { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) }, { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) }, { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) }, { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) }, { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) }, { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) }, { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) }, { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) }, { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) }, { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) }, { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) }, { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) }, { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) }, { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) }, { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) }, { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) }, { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) }, { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) }, { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) }, { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) }, { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) }, { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) }, { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) }, { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) }, { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) }, { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) }, { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) }, { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) }, { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) }, { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) }, { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) }, { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) }, { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) }, { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) }, { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) }, { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) }, { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) }, { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) }, { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) }, { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) }, { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) }, { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) }, { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) }, { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) }, { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) }, { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) }, { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) }, { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) }, { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) }, { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) }, { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) }, { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) }, { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) }, { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) }, { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) }, { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) }, { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) }, { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) }, { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) }, { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) }, { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) }, { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) }, { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) }, { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) }, { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) }, { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) }, { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) }, { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) }, { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) }, { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) }, { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) }, { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) }, { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) }, { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) }, { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) }, { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) }, { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) }, { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) }, { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) }, { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) }, { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) }, { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) }, { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) }, { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) }, { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) }, { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) }, { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) }, { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) }, { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) }, { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) }, { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) }, { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) }, { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) }, { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) }, { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) }, { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) }, { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) }, { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) }, { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) }, { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) }, { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) }, { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) }, { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) }, { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) }, { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) }, { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) }, { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) }, { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) }, { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) }, { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) }, { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) }, { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) }, { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) }, { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) }, { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) }, { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) }, { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) }, { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) }, { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) }, { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) }, { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) }, { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) }, { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) }, { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) }, { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) }, { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) }, { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) }, { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) }, { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) }, { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) }, { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) }, { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) }, { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) }, { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) }, { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) }, { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) }, { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) }, { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) }, { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) }, { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) }, { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) }, { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) }, { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) }, { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) }, { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) }, { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) }, { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) }, { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) }, { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) }, { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) }, { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) }, { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) }, { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) }, { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) }, { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) }, { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) }, { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) }, { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) }, { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) }, { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) }, { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) }, { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) }, { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) }, { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) }, { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) }, { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) }, { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) }, { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) }, { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) }, { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) }, { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) }, { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) }, { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) }, { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) }, { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) }, { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) }, { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) }, { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) }, { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) }, { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) }, { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) }, { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) }, { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) }, { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) }, { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) }, { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) }, { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) }, { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) }, { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) }, { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) }, { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) }, { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) }, { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) }, { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) }, { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) }, { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) }, { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) }, { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) }, { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) }, { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) }, { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) }, { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) }, { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) }, { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) }, { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) }, { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) }, { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) }, { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) }, { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) }, { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) }, { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) }, { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) }, { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) }, { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) }, { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) }, { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) }, { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) }, { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) }, { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) }, { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) }, { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) }, { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) }, { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) }, { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) }, { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) }, { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) }, { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) }, { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) }, { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) }, { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) }, { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) }, { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) }, { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) }, { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) }, { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) }, { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) }, { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) }, { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) }, { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) }, { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) }, { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) }, { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) }, { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) }, { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) }, { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) }, { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) }, { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) }, { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) }, { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) }, { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) }, { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) }, { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) }, { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) }, { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) }, { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) }, { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) }, { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) }, { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) }, { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) }, { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) }, { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) }, { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) }, { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) }, { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) }, { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) }, { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) }, { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) }, { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) }, { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) }, { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) }, { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) }, { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) }, { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) }, { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) }, { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) }, { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) }, { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) }, { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) }, { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) }, { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) }, { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) }, { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) }, { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) }, { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) }, { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) }, { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) }, { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) }, { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) }, { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) }, { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) }, { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) }, { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) }, { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) }, { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) }, { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) }, { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) }, { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) }, { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) }, { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) }, { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) }, { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) }, { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) } }; #ifdef __cplusplus #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_qmf.c000066400000000000000000000555141357201522000207550ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf.c,v 1.32 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include #include #include "sbr_dct.h" #include "sbr_qmf.h" #include "sbr_qmf_c.h" #include "sbr_syntax.h" qmfa_info *qmfa_init(uint8_t channels) { qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info)); /* x is implemented as double ringbuffer */ qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t)); memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t)); /* ringbuffer index */ qmfa->x_index = 0; qmfa->channels = channels; return qmfa; } void qmfa_end(qmfa_info *qmfa) { if (qmfa) { if (qmfa->x) faad_free(qmfa->x); faad_free(qmfa); } } void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx) { ALIGN real_t u[64]; #ifndef SBR_LOW_POWER ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32]; #else ALIGN real_t y[32]; #endif uint32_t in = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { int16_t n; /* shift input buffer x */ /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t)); /* add new samples to input buffer x */ for (n = 32 - 1; n >= 0; n--) { #ifdef FIXED_POINT qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4; #else qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++]; #endif } /* window and summation to create array u */ for (n = 0; n < 64; n++) { u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) + MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) + MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) + MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) + MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]); } /* update ringbuffer index */ qmfa->x_index -= 32; if (qmfa->x_index < 0) qmfa->x_index = (320-32); /* calculate 32 subband samples by introducing X */ #ifdef SBR_LOW_POWER y[0] = u[48]; for (n = 1; n < 16; n++) y[n] = u[n+48] + u[48-n]; for (n = 16; n < 32; n++) y[n] = -u[n-16] + u[48-n]; DCT3_32_unscaled(u, y); for (n = 0; n < 32; n++) { if (n < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/; #else QMF_RE(X[l + offset][n]) = 2. * u[n]; #endif } else { QMF_RE(X[l + offset][n]) = 0; } } #else // Reordering of data moved from DCT_IV to here in_imag[31] = u[1]; in_real[0] = u[0]; for (n = 1; n < 31; n++) { in_imag[31 - n] = u[n+1]; in_real[n] = -u[64-n]; } in_imag[0] = u[32]; in_real[31] = -u[33]; // dct4_kernel is DCT_IV without reordering which is done before and after FFT dct4_kernel(in_real, in_imag, out_real, out_imag); // Reordering of data moved from DCT_IV to here for (n = 0; n < 16; n++) { if (2*n+1 < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][2*n]) = out_real[n]; QMF_IM(X[l + offset][2*n]) = out_imag[n]; QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n]; QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n]; #else QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n]; QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n]; #endif } else { if (2*n < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][2*n]) = out_real[n]; QMF_IM(X[l + offset][2*n]) = out_imag[n]; #else QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; #endif } else { QMF_RE(X[l + offset][2*n]) = 0; QMF_IM(X[l + offset][2*n]) = 0; } QMF_RE(X[l + offset][2*n+1]) = 0; QMF_IM(X[l + offset][2*n+1]) = 0; } } #endif } } static const complex_t qmf32_pre_twiddle[] = { { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) }, { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) }, { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) }, { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) }, { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) }, { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) }, { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) }, { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) }, { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) }, { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) }, { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) }, { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) }, { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) }, { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) }, { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) }, { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) }, { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) }, { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) }, { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) }, { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) }, { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) }, { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) }, { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) }, { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) }, { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) }, { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) }, { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) }, { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) }, { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) }, { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) }, { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) }, { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) } }; qmfs_info *qmfs_init(uint8_t channels) { qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info)); /* v is a double ringbuffer */ qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t)); memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t)); qmfs->v_index = 0; qmfs->channels = channels; return qmfs; } void qmfs_end(qmfs_info *qmfs) { if (qmfs) { if (qmfs->v) faad_free(qmfs->v); faad_free(qmfs); } } #ifdef SBR_LOW_POWER void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x[16]; ALIGN real_t y[16]; int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffers */ /* we are not shifting v, it is a double ringbuffer */ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); /* calculate 64 samples */ for (k = 0; k < 16; k++) { #ifdef FIXED_POINT y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])); x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])); #else y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0; x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0; #endif } /* even n samples */ DCT2_16_unscaled(x, x); /* odd n samples */ DCT4_16(y, y); for (n = 8; n < 24; n++) { qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8]; qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8]; } for (n = 0; n < 16; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n]; } qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0; for (n = 1; n < 16; n++) { qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n]; } /* calculate 32 output samples and window */ for (k = 0; k < 32; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); } /* update the ringbuffer index */ qmfs->v_index -= 64; if (qmfs->v_index < 0) qmfs->v_index = (640-64); } } void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x[64]; ALIGN real_t y[64]; int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffers */ /* we are not shifting v, it is a double ringbuffer */ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); /* calculate 128 samples */ for (k = 0; k < 32; k++) { #ifdef FIXED_POINT y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])); x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])); #else y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0; x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0; #endif } /* even n samples */ DCT2_32_unscaled(x, x); /* odd n samples */ DCT4_32(y, y); for (n = 16; n < 48; n++) { qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16]; qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16]; } for (n = 0; n < 32; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n]; } qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0; for (n = 1; n < 32; n++) { qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n]; } /* calculate 64 output samples and window */ for (k = 0; k < 64; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) + MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) + MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) + MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]); } /* update the ringbuffer index */ qmfs->v_index -= 128; if (qmfs->v_index < 0) qmfs->v_index = (1280-128); } } #else void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x1[32], x2[32]; #ifndef FIXED_POINT real_t scale = 1.f/64.f; #endif int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffer v */ /* buffer is not shifted, we are using a ringbuffer */ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); /* calculate 64 samples */ /* complex pre-twiddle */ for (k = 0; k < 32; k++) { x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k])); x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k])); #ifndef FIXED_POINT x1[k] *= scale; x2[k] *= scale; #else x1[k] >>= 1; x2[k] >>= 1; #endif } /* transform */ DCT4_32(x1, x1); DST4_32(x2, x2); for (n = 0; n < 32; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n]; qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n]; } /* calculate 32 output samples and window */ for (k = 0; k < 32; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); } /* update ringbuffer index */ qmfs->v_index -= 64; if (qmfs->v_index < 0) qmfs->v_index = (640 - 64); } } void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { // ALIGN real_t x1[64], x2[64]; #ifndef SBR_LOW_POWER ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32]; ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32]; #endif qmf_t * pX; real_t * pring_buffer_1, * pring_buffer_3; // real_t * ptemp_1, * ptemp_2; #ifdef PREFER_POINTERS // These pointers are used if target platform has autoinc address generators real_t * pring_buffer_2, * pring_buffer_4; real_t * pring_buffer_5, * pring_buffer_6; real_t * pring_buffer_7, * pring_buffer_8; real_t * pring_buffer_9, * pring_buffer_10; const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4; const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8; const real_t * pqmf_c_9, * pqmf_c_10; #endif // #ifdef PREFER_POINTERS #ifndef FIXED_POINT real_t scale = 1.f/64.f; #endif int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffer v */ /* buffer is not shifted, we use double ringbuffer */ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); /* calculate 128 samples */ #ifndef FIXED_POINT pX = X[l]; in_imag1[31] = scale*QMF_RE(pX[1]); in_real1[0] = scale*QMF_RE(pX[0]); in_imag2[31] = scale*QMF_IM(pX[63-1]); in_real2[0] = scale*QMF_IM(pX[63-0]); for (k = 1; k < 31; k++) { in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]); in_real1[ k] = scale*QMF_RE(pX[2*k ]); in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]); in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]); } in_imag1[0] = scale*QMF_RE(pX[63]); in_real1[31] = scale*QMF_RE(pX[62]); in_imag2[0] = scale*QMF_IM(pX[63-63]); in_real2[31] = scale*QMF_IM(pX[63-62]); #else pX = X[l]; in_imag1[31] = QMF_RE(pX[1]) >> 1; in_real1[0] = QMF_RE(pX[0]) >> 1; in_imag2[31] = QMF_IM(pX[62]) >> 1; in_real2[0] = QMF_IM(pX[63]) >> 1; for (k = 1; k < 31; k++) { in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1; in_real1[ k] = QMF_RE(pX[2*k ]) >> 1; in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1; in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1; } in_imag1[0] = QMF_RE(pX[63]) >> 1; in_real1[31] = QMF_RE(pX[62]) >> 1; in_imag2[0] = QMF_IM(pX[0]) >> 1; in_real2[31] = QMF_IM(pX[1]) >> 1; #endif // dct4_kernel is DCT_IV without reordering which is done before and after FFT dct4_kernel(in_real1, in_imag1, out_real1, out_imag1); dct4_kernel(in_real2, in_imag2, out_real2, out_imag2); pring_buffer_1 = qmfs->v + qmfs->v_index; pring_buffer_3 = pring_buffer_1 + 1280; #ifdef PREFER_POINTERS pring_buffer_2 = pring_buffer_1 + 127; pring_buffer_4 = pring_buffer_1 + (1280 + 127); #endif // #ifdef PREFER_POINTERS // ptemp_1 = x1; // ptemp_2 = x2; #ifdef PREFER_POINTERS for (n = 0; n < 32; n ++) { //real_t x1 = *ptemp_1++; //real_t x2 = *ptemp_2++; // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n]; *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n]; //x1 = *ptemp_1++; //x2 = *ptemp_2++; *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n]; *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n]; } #else // #ifdef PREFER_POINTERS for (n = 0; n < 32; n++) { // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n]; pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n]; pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n]; pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n]; } #endif // #ifdef PREFER_POINTERS pring_buffer_1 = qmfs->v + qmfs->v_index; #ifdef PREFER_POINTERS pring_buffer_2 = pring_buffer_1 + 192; pring_buffer_3 = pring_buffer_1 + 256; pring_buffer_4 = pring_buffer_1 + (256 + 192); pring_buffer_5 = pring_buffer_1 + 512; pring_buffer_6 = pring_buffer_1 + (512 + 192); pring_buffer_7 = pring_buffer_1 + 768; pring_buffer_8 = pring_buffer_1 + (768 + 192); pring_buffer_9 = pring_buffer_1 + 1024; pring_buffer_10 = pring_buffer_1 + (1024 + 192); pqmf_c_1 = qmf_c; pqmf_c_2 = qmf_c + 64; pqmf_c_3 = qmf_c + 128; pqmf_c_4 = qmf_c + 192; pqmf_c_5 = qmf_c + 256; pqmf_c_6 = qmf_c + 320; pqmf_c_7 = qmf_c + 384; pqmf_c_8 = qmf_c + 448; pqmf_c_9 = qmf_c + 512; pqmf_c_10 = qmf_c + 576; #endif // #ifdef PREFER_POINTERS /* calculate 64 output samples and window */ for (k = 0; k < 64; k++) { #ifdef PREFER_POINTERS output[out++] = MUL_F(*pring_buffer_1++, *pqmf_c_1++) + MUL_F(*pring_buffer_2++, *pqmf_c_2++) + MUL_F(*pring_buffer_3++, *pqmf_c_3++) + MUL_F(*pring_buffer_4++, *pqmf_c_4++) + MUL_F(*pring_buffer_5++, *pqmf_c_5++) + MUL_F(*pring_buffer_6++, *pqmf_c_6++) + MUL_F(*pring_buffer_7++, *pqmf_c_7++) + MUL_F(*pring_buffer_8++, *pqmf_c_8++) + MUL_F(*pring_buffer_9++, *pqmf_c_9++) + MUL_F(*pring_buffer_10++, *pqmf_c_10++); #else // #ifdef PREFER_POINTERS output[out++] = MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) + MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) + MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) + MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) + MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) + MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) + MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) + MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) + MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) + MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]); #endif // #ifdef PREFER_POINTERS } /* update ringbuffer index */ qmfs->v_index -= 128; if (qmfs->v_index < 0) qmfs->v_index = (1280 - 128); } } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_qmf.h000066400000000000000000000037001357201522000207500ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf.h,v 1.25 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_QMF_H__ #define __SBR_QMF_H__ #ifdef __cplusplus extern "C" { #endif qmfa_info *qmfa_init(uint8_t channels); void qmfa_end(qmfa_info *qmfa); qmfs_info *qmfs_init(uint8_t channels); void qmfs_end(qmfs_info *qmfs); void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx); void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output); void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_qmf_c.h000066400000000000000000000531571357201522000212650ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf_c.h,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_QMF_C_H__ #define __SBR_QMF_C_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t qmf_c[640] = { FRAC_CONST(0), FRAC_CONST(-0.00055252865047), FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896), FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498), FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972), FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613), FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938), FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621), FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273), FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222), FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532), FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949), FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927), FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257), FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757), FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525), FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372), FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025), FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906), FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803), FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756), FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344), FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005), FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274), FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041), FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952), FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865), FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015), FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475), FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471), FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224), FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557), FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126), FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465), FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525), FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828), FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104), FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935), FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781), FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118), FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745), FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032), FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982), FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507), FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045), FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164), FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932), FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394), FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897), FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514), FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906), FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447), FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246), FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098), FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321), FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768), FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248), FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664), FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893), FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839), FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624), FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685), FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726), FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986), FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508), FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792), FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989), FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698), FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535), FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285), FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329), FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279), FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337), FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542), FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745), FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367), FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413), FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672), FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216), FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589), FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299), FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761), FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172), FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438), FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228), FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127), FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102), FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803), FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194), FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584), FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119), FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964), FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746), FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536), FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287), FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762), FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903), FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951), FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508), FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387), FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867), FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366), FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701), FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127), FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691), FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909), FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228), FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617), FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304), FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558), FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064), FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822), FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934), FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359), FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279), FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914), FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773), FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878), FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187), FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669), FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142), FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103), FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149), FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974), FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603), FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085), FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916), FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105), FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931), FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061), FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675), FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409), FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665), FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757), FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099), FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434), FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855), FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061), FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923), FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496), FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291), FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286), FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671), FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712), FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032), FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095), FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994), FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488), FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242), FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327), FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392), FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377), FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491), FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468), FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336), FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402), FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722), FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206), FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268), FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147), FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107), FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107), FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147), FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268), FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206), FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722), FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402), FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336), FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468), FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491), FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377), FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392), FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327), FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242), FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488), FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994), FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095), FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032), FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712), FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671), FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286), FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291), FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496), FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923), FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061), FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855), FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434), FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099), FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757), FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665), FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409), FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675), FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061), FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931), FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105), FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916), FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085), FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603), FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974), FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149), FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103), FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142), FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669), FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187), FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878), FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773), FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914), FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279), FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359), FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934), FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822), FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064), FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558), FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304), FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617), FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228), FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909), FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691), FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127), FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701), FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366), FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867), FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387), FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508), FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951), FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903), FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762), FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287), FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536), FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746), FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964), FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119), FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584), FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194), FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803), FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102), FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127), FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228), FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438), FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172), FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761), FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299), FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589), FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216), FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672), FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413), FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367), FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745), FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542), FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337), FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279), FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329), FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285), FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535), FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698), FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989), FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792), FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508), FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986), FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726), FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685), FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624), FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839), FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893), FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664), FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248), FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768), FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321), FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098), FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246), FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447), FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906), FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514), FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897), FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394), FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932), FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164), FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045), FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507), FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982), FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032), FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745), FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118), FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781), FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935), FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104), FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828), FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525), FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465), FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126), FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557), FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224), FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471), FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475), FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015), FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865), FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952), FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041), FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274), FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005), FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344), FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756), FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803), FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906), FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025), FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372), FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525), FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757), FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257), FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927), FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949), FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532), FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222), FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273), FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621), FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938), FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613), FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972), FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498), FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896), FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047) }; #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_syntax.c000066400000000000000000000702311357201522000215110ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_syntax.c,v 1.39 2009/01/26 22:32:31 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "syntax.h" #include "sbr_huff.h" #include "sbr_fbt.h" #include "sbr_tf_grid.h" #include "sbr_e_nf.h" #include "bits.h" #ifdef PS_DEC #include "ps_dec.h" #endif #ifdef DRM_PS #include "drm_dec.h" #endif #include "analysis.h" /* static function declarations */ /* static function declarations */ static void sbr_header(bitfile *ld, sbr_info *sbr); static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, uint8_t samplerate_mode, uint8_t freq_scale, uint8_t alter_scale, uint8_t xover_band); static uint8_t sbr_data(bitfile *ld, sbr_info *sbr); static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, uint8_t bs_extension_id, uint16_t num_bits_left); static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr); static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr); static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch); static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sbr_reset(sbr_info *sbr) { #if 0 printf("%d\n", sbr->bs_start_freq_prev); printf("%d\n", sbr->bs_stop_freq_prev); printf("%d\n", sbr->bs_freq_scale_prev); printf("%d\n", sbr->bs_alter_scale_prev); printf("%d\n", sbr->bs_xover_band_prev); printf("%d\n\n", sbr->bs_noise_bands_prev); #endif /* if these are different from the previous frame: Reset = 1 */ if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) || (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) || (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) || (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) || (sbr->bs_xover_band != sbr->bs_xover_band_prev) || (sbr->bs_noise_bands != sbr->bs_noise_bands_prev)) { sbr->Reset = 1; } else { sbr->Reset = 0; } sbr->bs_start_freq_prev = sbr->bs_start_freq; sbr->bs_stop_freq_prev = sbr->bs_stop_freq; sbr->bs_freq_scale_prev = sbr->bs_freq_scale; sbr->bs_alter_scale_prev = sbr->bs_alter_scale; sbr->bs_xover_band_prev = sbr->bs_xover_band; sbr->bs_noise_bands_prev = sbr->bs_noise_bands; } static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, uint8_t samplerate_mode, uint8_t freq_scale, uint8_t alter_scale, uint8_t xover_band) { uint8_t result = 0; uint8_t k2; /* calculate the Master Frequency Table */ sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate); k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0); /* check k0 and k2 */ if (sbr->sample_rate >= 48000) { if ((k2 - sbr->k0) > 32) result += 1; } else if (sbr->sample_rate <= 32000) { if ((k2 - sbr->k0) > 48) result += 1; } else { /* (sbr->sample_rate == 44100) */ if ((k2 - sbr->k0) > 45) result += 1; } if (freq_scale == 0) { result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale); } else { result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale); } result += derived_frequency_table(sbr, xover_band, k2); result = (result > 0) ? 1 : 0; return result; } /* table 2 */ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt, uint8_t psResetFlag) { uint8_t result = 0; uint16_t num_align_bits = 0; uint16_t num_sbr_bits1 = (uint16_t)faad_get_processed_bits(ld); uint16_t num_sbr_bits2; uint8_t saved_start_freq, saved_samplerate_mode; uint8_t saved_stop_freq, saved_freq_scale; uint8_t saved_alter_scale, saved_xover_band; #if (defined(PS_DEC) || defined(DRM_PS)) if (psResetFlag) sbr->psResetFlag = psResetFlag; #endif #ifdef DRM if (!sbr->Is_DRM_SBR) #endif { uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type")); if (bs_extension_type == EXT_SBR_DATA_CRC) { sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10 DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits")); } } /* save old header values, in case the new ones are corrupted */ saved_start_freq = sbr->bs_start_freq; saved_samplerate_mode = sbr->bs_samplerate_mode; saved_stop_freq = sbr->bs_stop_freq; saved_freq_scale = sbr->bs_freq_scale; saved_alter_scale = sbr->bs_alter_scale; saved_xover_band = sbr->bs_xover_band; sbr->bs_header_flag = faad_get1bit(ld DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag")); if (sbr->bs_header_flag) sbr_header(ld, sbr); /* Reset? */ sbr_reset(sbr); /* first frame should have a header */ //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0)) if (sbr->header_count != 0) { if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)) { uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq, sbr->bs_samplerate_mode, sbr->bs_freq_scale, sbr->bs_alter_scale, sbr->bs_xover_band); /* if an error occured with the new header values revert to the old ones */ if (rt > 0) { calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, saved_samplerate_mode, saved_freq_scale, saved_alter_scale, saved_xover_band); } } if (result == 0) { result = sbr_data(ld, sbr); /* sbr_data() returning an error means that there was an error in envelope_time_border_vector(). In this case the old time border vector is saved and all the previous data normally read after sbr_grid() is saved. */ /* to be on the safe side, calculate old sbr tables in case of error */ if ((result > 0) && (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))) { calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, saved_samplerate_mode, saved_freq_scale, saved_alter_scale, saved_xover_band); } /* we should be able to safely set result to 0 now, */ /* but practise indicates this doesn't work well */ } } else { result = 1; } num_sbr_bits2 = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits1; /* check if we read more bits then were available for sbr */ if (8*cnt < num_sbr_bits2) { faad_resetbits(ld, num_sbr_bits1 + 8*cnt); num_sbr_bits2 = 8*cnt; #ifdef PS_DEC /* turn off PS for the unfortunate case that we randomly read some * PS data that looks correct */ sbr->ps_used = 0; #endif /* Make sure it doesn't decode SBR in this frame, or we'll get glitches */ return 1; } #ifdef DRM if (!sbr->Is_DRM_SBR) #endif { /* -4 does not apply, bs_extension_type is re-read in this function */ num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits2; while (num_align_bits > 7) { faad_getbits(ld, 8 DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); num_align_bits -= 8; } faad_getbits(ld, num_align_bits DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); } return result; } /* table 3 */ static void sbr_header(bitfile *ld, sbr_info *sbr) { uint8_t bs_header_extra_1, bs_header_extra_2; sbr->header_count++; sbr->bs_amp_res = faad_get1bit(ld DEBUGVAR(1,203,"sbr_header(): bs_amp_res")); /* bs_start_freq and bs_stop_freq must define a fequency band that does not exceed 48 channels */ sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,204,"sbr_header(): bs_start_freq")); sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,205,"sbr_header(): bs_stop_freq")); sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,206,"sbr_header(): bs_xover_band")); faad_getbits(ld, 2 DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr")); bs_header_extra_1 = (uint8_t)faad_get1bit(ld DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1")); bs_header_extra_2 = (uint8_t)faad_get1bit(ld DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2")); if (bs_header_extra_1) { sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,211,"sbr_header(): bs_freq_scale")); sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld DEBUGVAR(1,212,"sbr_header(): bs_alter_scale")); sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,213,"sbr_header(): bs_noise_bands")); } else { /* Default values */ sbr->bs_freq_scale = 2; sbr->bs_alter_scale = 1; sbr->bs_noise_bands = 2; } if (bs_header_extra_2) { sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands")); sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains")); sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq")); sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode")); } else { /* Default values */ sbr->bs_limiter_bands = 2; sbr->bs_limiter_gains = 2; sbr->bs_interpol_freq = 1; sbr->bs_smoothing_mode = 1; } #if 0 /* print the header to screen */ printf("bs_amp_res: %d\n", sbr->bs_amp_res); printf("bs_start_freq: %d\n", sbr->bs_start_freq); printf("bs_stop_freq: %d\n", sbr->bs_stop_freq); printf("bs_xover_band: %d\n", sbr->bs_xover_band); if (bs_header_extra_1) { printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); printf("bs_alter_scale: %d\n", sbr->bs_alter_scale); printf("bs_noise_bands: %d\n", sbr->bs_noise_bands); } if (bs_header_extra_2) { printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains); printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq); printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode); } printf("\n"); #endif } /* table 4 */ static uint8_t sbr_data(bitfile *ld, sbr_info *sbr) { uint8_t result; #if 0 sbr->bs_samplerate_mode = faad_get1bit(ld DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode")); #endif sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1; switch (sbr->id_aac) { case ID_SCE: if ((result = sbr_single_channel_element(ld, sbr)) > 0) return result; break; case ID_CPE: if ((result = sbr_channel_pair_element(ld, sbr)) > 0) return result; break; } return 0; } /* table 5 */ static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr) { uint8_t result; if (faad_get1bit(ld DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra"))) { faad_getbits(ld, 4 DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data")); } #ifdef DRM /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */ if (sbr->Is_DRM_SBR) { faad_get1bit(ld); } #endif if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; sbr_dtdf(ld, sbr, 0); invf_mode(ld, sbr, 0); sbr_envelope(ld, sbr, 0); sbr_noise(ld, sbr, 0); #ifndef FIXED_POINT envelope_noise_dequantisation(sbr, 0); #endif memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_extended_data = faad_get1bit(ld DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]")); if (sbr->bs_extended_data) { uint16_t nr_bits_left; #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t ps_ext_read = 0; #endif uint16_t cnt = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size")); if (cnt == 15) { cnt += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count")); } nr_bits_left = 8 * cnt; while (nr_bits_left > 7) { uint16_t tmp_nr_bits = 0; sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id")); tmp_nr_bits += 2; /* allow only 1 PS extension element per extension data */ #if (defined(PS_DEC) || defined(DRM_PS)) #if (defined(PS_DEC) && defined(DRM_PS)) if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) #else #ifdef PS_DEC if (sbr->bs_extension_id == EXTENSION_ID_PS) #else #ifdef DRM_PS if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) #endif #endif #endif { if (ps_ext_read == 0) { ps_ext_read = 1; } else { /* to be safe make it 3, will switch to "default" * in sbr_extension() */ #ifdef DRM return 1; #else sbr->bs_extension_id = 3; #endif } } #endif tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); /* check if the data read is bigger than the number of available bits */ if (tmp_nr_bits > nr_bits_left) return 1; nr_bits_left -= tmp_nr_bits; } /* Corrigendum */ if (nr_bits_left > 0) { faad_getbits(ld, nr_bits_left DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left")); } } return 0; } /* table 6 */ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr) { uint8_t n, result; if (faad_get1bit(ld DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra"))) { faad_getbits(ld, 4 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); faad_getbits(ld, 4 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); } sbr->bs_coupling = faad_get1bit(ld DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling")); if (sbr->bs_coupling) { if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; /* need to copy some data from left to right */ sbr->bs_frame_class[1] = sbr->bs_frame_class[0]; sbr->L_E[1] = sbr->L_E[0]; sbr->L_Q[1] = sbr->L_Q[0]; sbr->bs_pointer[1] = sbr->bs_pointer[0]; for (n = 0; n <= sbr->L_E[0]; n++) { sbr->t_E[1][n] = sbr->t_E[0][n]; sbr->f[1][n] = sbr->f[0][n]; } for (n = 0; n <= sbr->L_Q[0]; n++) sbr->t_Q[1][n] = sbr->t_Q[0][n]; sbr_dtdf(ld, sbr, 0); sbr_dtdf(ld, sbr, 1); invf_mode(ld, sbr, 0); /* more copying */ for (n = 0; n < sbr->N_Q; n++) sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n]; sbr_envelope(ld, sbr, 0); sbr_noise(ld, sbr, 0); sbr_envelope(ld, sbr, 1); sbr_noise(ld, sbr, 1); memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); if (sbr->bs_add_harmonic_flag[1]) sinusoidal_coding(ld, sbr, 1); } else { uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0}; uint8_t saved_L_E = sbr->L_E[0]; uint8_t saved_L_Q = sbr->L_Q[0]; uint8_t saved_frame_class = sbr->bs_frame_class[0]; for (n = 0; n < saved_L_E; n++) saved_t_E[n] = sbr->t_E[0][n]; for (n = 0; n < saved_L_Q; n++) saved_t_Q[n] = sbr->t_Q[0][n]; if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; if ((result = sbr_grid(ld, sbr, 1)) > 0) { /* restore first channel data as well */ sbr->bs_frame_class[0] = saved_frame_class; sbr->L_E[0] = saved_L_E; sbr->L_Q[0] = saved_L_Q; for (n = 0; n < 6; n++) sbr->t_E[0][n] = saved_t_E[n]; for (n = 0; n < 3; n++) sbr->t_Q[0][n] = saved_t_Q[n]; return result; } sbr_dtdf(ld, sbr, 0); sbr_dtdf(ld, sbr, 1); invf_mode(ld, sbr, 0); invf_mode(ld, sbr, 1); sbr_envelope(ld, sbr, 0); sbr_envelope(ld, sbr, 1); sbr_noise(ld, sbr, 0); sbr_noise(ld, sbr, 1); memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); if (sbr->bs_add_harmonic_flag[1]) sinusoidal_coding(ld, sbr, 1); } #ifndef FIXED_POINT envelope_noise_dequantisation(sbr, 0); envelope_noise_dequantisation(sbr, 1); if (sbr->bs_coupling) unmap_envelope_noise(sbr); #endif sbr->bs_extended_data = faad_get1bit(ld DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]")); if (sbr->bs_extended_data) { uint16_t nr_bits_left; uint16_t cnt = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size")); if (cnt == 15) { cnt += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count")); } nr_bits_left = 8 * cnt; while (nr_bits_left > 7) { uint16_t tmp_nr_bits = 0; sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id")); tmp_nr_bits += 2; tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); /* check if the data read is bigger than the number of available bits */ if (tmp_nr_bits > nr_bits_left) return 1; nr_bits_left -= tmp_nr_bits; } /* Corrigendum */ if (nr_bits_left > 0) { faad_getbits(ld, nr_bits_left DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left")); } } return 0; } /* integer log[2](x): input range [0,10) */ static int8_t sbr_log2(const int8_t val) { int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 }; if (val < 10 && val >= 0) return log2tab[val]; else return 0; } /* table 7 */ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t i, env, rel, result; uint8_t bs_abs_bord, bs_abs_bord_1; uint8_t bs_num_env = 0; uint8_t saved_L_E = sbr->L_E[ch]; uint8_t saved_L_Q = sbr->L_Q[ch]; uint8_t saved_frame_class = sbr->bs_frame_class[ch]; sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,248,"sbr_grid(): bs_frame_class")); switch (sbr->bs_frame_class[ch]) { case FIXFIX: i = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw")); bs_num_env = min(1 << i, 5); i = (uint8_t)faad_get1bit(ld DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag")); for (env = 0; env < bs_num_env; env++) sbr->f[ch][env] = i; sbr->abs_bord_lead[ch] = 0; sbr->abs_bord_trail[ch] = sbr->numTimeSlots; sbr->n_rel_lead[ch] = bs_num_env - 1; sbr->n_rel_trail[ch] = 0; break; case FIXVAR: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots; bs_num_env = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1; for (rel = 0; rel < bs_num_env-1; rel++) { sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(bs_num_env + 1); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,254,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,255,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = 0; sbr->abs_bord_trail[ch] = bs_abs_bord; sbr->n_rel_lead[ch] = 0; sbr->n_rel_trail[ch] = bs_num_env - 1; break; case VARFIX: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord")); bs_num_env = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1; for (rel = 0; rel < bs_num_env-1; rel++) { sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(bs_num_env + 1); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,259,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][env] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,260,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = bs_abs_bord; sbr->abs_bord_trail[ch] = sbr->numTimeSlots; sbr->n_rel_lead[ch] = bs_num_env - 1; sbr->n_rel_trail[ch] = 0; break; case VARVAR: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0")); bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots; sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0")); sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1")); bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1); for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++) { sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2; } for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++) { sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,267,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][env] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,268,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = bs_abs_bord; sbr->abs_bord_trail[ch] = bs_abs_bord_1; sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch]; sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch]; break; } if (sbr->bs_frame_class[ch] == VARVAR) sbr->L_E[ch] = min(bs_num_env, 5); else sbr->L_E[ch] = min(bs_num_env, 4); if (sbr->L_E[ch] <= 0) return 1; if (sbr->L_E[ch] > 1) sbr->L_Q[ch] = 2; else sbr->L_Q[ch] = 1; /* TODO: this code can probably be integrated into the code above! */ if ((result = envelope_time_border_vector(sbr, ch)) > 0) { sbr->bs_frame_class[ch] = saved_frame_class; sbr->L_E[ch] = saved_L_E; sbr->L_Q[ch] = saved_L_Q; return result; } noise_floor_time_border_vector(sbr, ch); #if 0 for (env = 0; env < bs_num_env; env++) { printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]); } #endif return 0; } /* table 8 */ static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t i; for (i = 0; i < sbr->L_E[ch]; i++) { sbr->bs_df_env[ch][i] = faad_get1bit(ld DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env")); } for (i = 0; i < sbr->L_Q[ch]; i++) { sbr->bs_df_noise[ch][i] = faad_get1bit(ld DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise")); } } /* table 9 */ static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t n; for (n = 0; n < sbr->N_Q; n++) { sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,271,"invf_mode(): bs_invf_mode")); } } static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, uint8_t bs_extension_id, uint16_t num_bits_left) { #ifdef PS_DEC uint8_t header; uint16_t ret; #endif switch (bs_extension_id) { #ifdef PS_DEC case EXTENSION_ID_PS: if (!sbr->ps) { sbr->ps = ps_init(get_sr_index(sbr->sample_rate), sbr->numTimeSlotsRate); } if (sbr->psResetFlag) { sbr->ps->header_read = 0; } ret = ps_data(sbr->ps, ld, &header); /* enable PS if and only if: a header has been decoded */ if (sbr->ps_used == 0 && header == 1) { sbr->ps_used = 1; } if (header == 1) { sbr->psResetFlag = 0; } return ret; #endif #ifdef DRM_PS case DRM_PARAMETRIC_STEREO: sbr->ps_used = 1; if (!sbr->drm_ps) { sbr->drm_ps = drm_ps_init(); } return drm_ps_data(sbr->drm_ps, ld); #endif default: sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data")); return 6; } } /* table 12 */ static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t n; for (n = 0; n < sbr->N_high; n++) { sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic")); } } #endif /* SBR_DEC */ welle.io-2.1/src/libs/faad2/libfaad/sbr_syntax.h000066400000000000000000000035651357201522000215240ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_syntax.h,v 1.23 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_SYNTAX_H__ #define __SBR_SYNTAX_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define T_HFGEN 8 #define T_HFADJ 2 #define EXT_SBR_DATA 13 #define EXT_SBR_DATA_CRC 14 #define FIXFIX 0 #define FIXVAR 1 #define VARFIX 2 #define VARVAR 3 #define LO_RES 0 #define HI_RES 1 #define NO_TIME_SLOTS_960 15 #define NO_TIME_SLOTS 16 #define RATE 2 #define NOISE_FLOOR_OFFSET 6 uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt, uint8_t resetFlag); #ifdef __cplusplus } #endif #endif /* __SBR_SYNTAX_H__ */ welle.io-2.1/src/libs/faad2/libfaad/sbr_tf_grid.c000066400000000000000000000147301357201522000216030ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_tf_grid.c,v 1.20 2008/09/19 22:50:20 menno Exp $ **/ /* Time/Frequency grid */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include #include "sbr_syntax.h" #include "sbr_tf_grid.h" /* static function declarations */ #if 0 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l); static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l); #endif static uint8_t middleBorder(sbr_info *sbr, uint8_t ch); /* function constructs new time border vector */ /* first build into temp vector to be able to use previous vector on error */ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) { uint8_t l, border, temp; uint8_t t_E_temp[6] = {0}; t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch]; switch (sbr->bs_frame_class[ch]) { case FIXFIX: switch (sbr->L_E[ch]) { case 4: temp = (sbr->numTimeSlots / 4); t_E_temp[3] = sbr->rate * 3 * temp; t_E_temp[2] = sbr->rate * 2 * temp; t_E_temp[1] = sbr->rate * temp; break; case 2: t_E_temp[1] = sbr->rate * (sbr->numTimeSlots / 2); break; default: break; } break; case FIXVAR: if (sbr->L_E[ch] > 1) { int8_t i = sbr->L_E[ch]; border = sbr->abs_bord_trail[ch]; for (l = 0; l < (sbr->L_E[ch] - 1); l++) { if (border < sbr->bs_rel_bord[ch][l]) return 1; border -= sbr->bs_rel_bord[ch][l]; t_E_temp[--i] = sbr->rate * border; } } break; case VARFIX: if (sbr->L_E[ch] > 1) { int8_t i = 1; border = sbr->abs_bord_lead[ch]; for (l = 0; l < (sbr->L_E[ch] - 1); l++) { border += sbr->bs_rel_bord[ch][l]; if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) return 1; t_E_temp[i++] = sbr->rate * border; } } break; case VARVAR: if (sbr->bs_num_rel_0[ch]) { int8_t i = 1; border = sbr->abs_bord_lead[ch]; for (l = 0; l < sbr->bs_num_rel_0[ch]; l++) { border += sbr->bs_rel_bord_0[ch][l]; if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) return 1; t_E_temp[i++] = sbr->rate * border; } } if (sbr->bs_num_rel_1[ch]) { int8_t i = sbr->L_E[ch]; border = sbr->abs_bord_trail[ch]; for (l = 0; l < sbr->bs_num_rel_1[ch]; l++) { if (border < sbr->bs_rel_bord_1[ch][l]) return 1; border -= sbr->bs_rel_bord_1[ch][l]; t_E_temp[--i] = sbr->rate * border; } } break; } /* no error occured, we can safely use this t_E vector */ for (l = 0; l < 6; l++) { sbr->t_E[ch][l] = t_E_temp[l]; } return 0; } void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch) { sbr->t_Q[ch][0] = sbr->t_E[ch][0]; if (sbr->L_E[ch] == 1) { sbr->t_Q[ch][1] = sbr->t_E[ch][1]; sbr->t_Q[ch][2] = 0; } else { uint8_t index = middleBorder(sbr, ch); sbr->t_Q[ch][1] = sbr->t_E[ch][index]; sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]]; } } #if 0 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l) { uint8_t i; int16_t acc = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: return sbr->numTimeSlots/sbr->L_E[ch]; case FIXVAR: return 0; case VARFIX: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord[ch][i]; } return acc; case VARVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord_0[ch][i]; } return acc; } return 0; } static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l) { uint8_t i; int16_t acc = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: case VARFIX: return 0; case FIXVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord[ch][i]; } return acc; case VARVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord_1[ch][i]; } return acc; } return 0; } #endif static uint8_t middleBorder(sbr_info *sbr, uint8_t ch) { int8_t retval = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: retval = sbr->L_E[ch]/2; break; case VARFIX: if (sbr->bs_pointer[ch] == 0) retval = 1; else if (sbr->bs_pointer[ch] == 1) retval = sbr->L_E[ch] - 1; else retval = sbr->bs_pointer[ch] - 1; break; case FIXVAR: case VARVAR: if (sbr->bs_pointer[ch] > 1) retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; else retval = sbr->L_E[ch] - 1; break; } return (retval > 0) ? retval : 0; } #endif welle.io-2.1/src/libs/faad2/libfaad/sbr_tf_grid.h000066400000000000000000000030401357201522000216000ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_tf_grid.h,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_TF_GRID_H__ #define __SBR_TF_GRID_H__ #ifdef __cplusplus extern "C" { #endif uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch); void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/sine_win.h000066400000000000000000004322131357201522000211370ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sine_win.h,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SINE_WIN_H__ #define __SINE_WIN_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t sine_long_1024[] = { FRAC_CONST(0.00076699031874270449), FRAC_CONST(0.002300969151425805), FRAC_CONST(0.0038349425697062275), FRAC_CONST(0.0053689069639963425), FRAC_CONST(0.0069028587247297558), FRAC_CONST(0.0084367942423697988), FRAC_CONST(0.0099707099074180308), FRAC_CONST(0.011504602110422714), FRAC_CONST(0.013038467241987334), FRAC_CONST(0.014572301692779064), FRAC_CONST(0.016106101853537287), FRAC_CONST(0.017639864115082053), FRAC_CONST(0.019173584868322623), FRAC_CONST(0.020707260504265895), FRAC_CONST(0.022240887414024961), FRAC_CONST(0.023774461988827555), FRAC_CONST(0.025307980620024571), FRAC_CONST(0.026841439699098531), FRAC_CONST(0.028374835617672099), FRAC_CONST(0.029908164767516555), FRAC_CONST(0.031441423540560301), FRAC_CONST(0.032974608328897335), FRAC_CONST(0.03450771552479575), FRAC_CONST(0.036040741520706229), FRAC_CONST(0.037573682709270494), FRAC_CONST(0.039106535483329888), FRAC_CONST(0.040639296235933736), FRAC_CONST(0.042171961360347947), FRAC_CONST(0.043704527250063421), FRAC_CONST(0.04523699029880459), FRAC_CONST(0.046769346900537863), FRAC_CONST(0.048301593449480144), FRAC_CONST(0.049833726340107277), FRAC_CONST(0.051365741967162593), FRAC_CONST(0.052897636725665324), FRAC_CONST(0.054429407010919133), FRAC_CONST(0.055961049218520569), FRAC_CONST(0.057492559744367566), FRAC_CONST(0.059023934984667931), FRAC_CONST(0.060555171335947788), FRAC_CONST(0.062086265195060088), FRAC_CONST(0.063617212959193106), FRAC_CONST(0.065148011025878833), FRAC_CONST(0.066678655793001557), FRAC_CONST(0.068209143658806329), FRAC_CONST(0.069739471021907307), FRAC_CONST(0.071269634281296401), FRAC_CONST(0.072799629836351673), FRAC_CONST(0.074329454086845756), FRAC_CONST(0.075859103432954447), FRAC_CONST(0.077388574275265049), FRAC_CONST(0.078917863014784942), FRAC_CONST(0.080446966052950014), FRAC_CONST(0.081975879791633066), FRAC_CONST(0.083504600633152432), FRAC_CONST(0.085033124980280275), FRAC_CONST(0.08656144923625117), FRAC_CONST(0.088089569804770507), FRAC_CONST(0.089617483090022959), FRAC_CONST(0.091145185496681005), FRAC_CONST(0.09267267342991331), FRAC_CONST(0.094199943295393204), FRAC_CONST(0.095726991499307162), FRAC_CONST(0.097253814448363271), FRAC_CONST(0.098780408549799623), FRAC_CONST(0.10030677021139286), FRAC_CONST(0.10183289584146653), FRAC_CONST(0.10335878184889961), FRAC_CONST(0.10488442464313497), FRAC_CONST(0.10640982063418768), FRAC_CONST(0.10793496623265365), FRAC_CONST(0.10945985784971798), FRAC_CONST(0.11098449189716339), FRAC_CONST(0.11250886478737869), FRAC_CONST(0.1140329729333672), FRAC_CONST(0.11555681274875526), FRAC_CONST(0.11708038064780059), FRAC_CONST(0.11860367304540072), FRAC_CONST(0.1201266863571015), FRAC_CONST(0.12164941699910553), FRAC_CONST(0.12317186138828048), FRAC_CONST(0.12469401594216764), FRAC_CONST(0.12621587707899035), FRAC_CONST(0.12773744121766231), FRAC_CONST(0.12925870477779614), FRAC_CONST(0.13077966417971171), FRAC_CONST(0.13230031584444465), FRAC_CONST(0.13382065619375472), FRAC_CONST(0.13534068165013421), FRAC_CONST(0.13686038863681638), FRAC_CONST(0.13837977357778389), FRAC_CONST(0.13989883289777721), FRAC_CONST(0.14141756302230302), FRAC_CONST(0.14293596037764267), FRAC_CONST(0.14445402139086047), FRAC_CONST(0.14597174248981221), FRAC_CONST(0.14748912010315357), FRAC_CONST(0.14900615066034845), FRAC_CONST(0.1505228305916774), FRAC_CONST(0.15203915632824605), FRAC_CONST(0.15355512430199345), FRAC_CONST(0.15507073094570051), FRAC_CONST(0.15658597269299843), FRAC_CONST(0.15810084597837698), FRAC_CONST(0.15961534723719306), FRAC_CONST(0.16112947290567881), FRAC_CONST(0.16264321942095031), FRAC_CONST(0.16415658322101581), FRAC_CONST(0.16566956074478412), FRAC_CONST(0.16718214843207294), FRAC_CONST(0.16869434272361733), FRAC_CONST(0.17020614006107807), FRAC_CONST(0.17171753688704997), FRAC_CONST(0.17322852964507032), FRAC_CONST(0.1747391147796272), FRAC_CONST(0.17624928873616788), FRAC_CONST(0.17775904796110717), FRAC_CONST(0.17926838890183575), FRAC_CONST(0.18077730800672859), FRAC_CONST(0.1822858017251533), FRAC_CONST(0.18379386650747845), FRAC_CONST(0.1853014988050819), FRAC_CONST(0.18680869507035927), FRAC_CONST(0.18831545175673212), FRAC_CONST(0.18982176531865641), FRAC_CONST(0.1913276322116309), FRAC_CONST(0.19283304889220523), FRAC_CONST(0.1943380118179886), FRAC_CONST(0.19584251744765785), FRAC_CONST(0.19734656224096592), FRAC_CONST(0.19885014265875009), FRAC_CONST(0.20035325516294045), FRAC_CONST(0.20185589621656805), FRAC_CONST(0.20335806228377332), FRAC_CONST(0.20485974982981442), FRAC_CONST(0.20636095532107551), FRAC_CONST(0.20786167522507507), FRAC_CONST(0.20936190601047416), FRAC_CONST(0.21086164414708486), FRAC_CONST(0.21236088610587842), FRAC_CONST(0.21385962835899375), FRAC_CONST(0.21535786737974555), FRAC_CONST(0.21685559964263262), FRAC_CONST(0.21835282162334632), FRAC_CONST(0.2198495297987787), FRAC_CONST(0.22134572064703081), FRAC_CONST(0.22284139064742112), FRAC_CONST(0.2243365362804936), FRAC_CONST(0.22583115402802617), FRAC_CONST(0.22732524037303886), FRAC_CONST(0.22881879179980222), FRAC_CONST(0.23031180479384544), FRAC_CONST(0.23180427584196478), FRAC_CONST(0.23329620143223159), FRAC_CONST(0.23478757805400097), FRAC_CONST(0.23627840219791957), FRAC_CONST(0.23776867035593419), FRAC_CONST(0.23925837902129998), FRAC_CONST(0.24074752468858843), FRAC_CONST(0.24223610385369601), FRAC_CONST(0.24372411301385216), FRAC_CONST(0.24521154866762754), FRAC_CONST(0.24669840731494241), FRAC_CONST(0.24818468545707478), FRAC_CONST(0.24967037959666857), FRAC_CONST(0.25115548623774192), FRAC_CONST(0.25264000188569552), FRAC_CONST(0.25412392304732062), FRAC_CONST(0.25560724623080738), FRAC_CONST(0.25708996794575312), FRAC_CONST(0.25857208470317034), FRAC_CONST(0.26005359301549519), FRAC_CONST(0.26153448939659552), FRAC_CONST(0.263014770361779), FRAC_CONST(0.26449443242780163), FRAC_CONST(0.26597347211287559), FRAC_CONST(0.26745188593667762), FRAC_CONST(0.26892967042035726), FRAC_CONST(0.27040682208654482), FRAC_CONST(0.27188333745935972), FRAC_CONST(0.27335921306441868), FRAC_CONST(0.27483444542884394), FRAC_CONST(0.27630903108127108), FRAC_CONST(0.27778296655185769), FRAC_CONST(0.27925624837229118), FRAC_CONST(0.28072887307579719), FRAC_CONST(0.28220083719714756), FRAC_CONST(0.28367213727266843), FRAC_CONST(0.28514276984024867), FRAC_CONST(0.28661273143934779), FRAC_CONST(0.28808201861100413), FRAC_CONST(0.28955062789784303), FRAC_CONST(0.29101855584408509), FRAC_CONST(0.29248579899555388), FRAC_CONST(0.29395235389968466), FRAC_CONST(0.29541821710553201), FRAC_CONST(0.29688338516377827), FRAC_CONST(0.2983478546267414), FRAC_CONST(0.29981162204838335), FRAC_CONST(0.30127468398431795), FRAC_CONST(0.30273703699181914), FRAC_CONST(0.30419867762982911), FRAC_CONST(0.30565960245896612), FRAC_CONST(0.3071198080415331), FRAC_CONST(0.30857929094152509), FRAC_CONST(0.31003804772463789), FRAC_CONST(0.31149607495827591), FRAC_CONST(0.3129533692115602), FRAC_CONST(0.31440992705533666), FRAC_CONST(0.31586574506218396), FRAC_CONST(0.31732081980642174), FRAC_CONST(0.31877514786411848), FRAC_CONST(0.32022872581309986), FRAC_CONST(0.32168155023295658), FRAC_CONST(0.32313361770505233), FRAC_CONST(0.32458492481253215), FRAC_CONST(0.32603546814033024), FRAC_CONST(0.327485244275178), FRAC_CONST(0.3289342498056122), FRAC_CONST(0.33038248132198278), FRAC_CONST(0.33182993541646111), FRAC_CONST(0.33327660868304793), FRAC_CONST(0.33472249771758122), FRAC_CONST(0.33616759911774452), FRAC_CONST(0.33761190948307462), FRAC_CONST(0.33905542541496964), FRAC_CONST(0.34049814351669716), FRAC_CONST(0.34194006039340219), FRAC_CONST(0.34338117265211504), FRAC_CONST(0.34482147690175929), FRAC_CONST(0.34626096975316001), FRAC_CONST(0.34769964781905138), FRAC_CONST(0.34913750771408497), FRAC_CONST(0.35057454605483751), FRAC_CONST(0.35201075945981908), FRAC_CONST(0.35344614454948081), FRAC_CONST(0.35488069794622279), FRAC_CONST(0.35631441627440241), FRAC_CONST(0.3577472961603419), FRAC_CONST(0.3591793342323365), FRAC_CONST(0.36061052712066227), FRAC_CONST(0.36204087145758418), FRAC_CONST(0.36347036387736376), FRAC_CONST(0.36489900101626732), FRAC_CONST(0.36632677951257359), FRAC_CONST(0.36775369600658198), FRAC_CONST(0.36917974714062002), FRAC_CONST(0.37060492955905167), FRAC_CONST(0.37202923990828501), FRAC_CONST(0.3734526748367803), FRAC_CONST(0.37487523099505754), FRAC_CONST(0.37629690503570479), FRAC_CONST(0.37771769361338564), FRAC_CONST(0.37913759338484732), FRAC_CONST(0.38055660100892852), FRAC_CONST(0.38197471314656722), FRAC_CONST(0.38339192646080866), FRAC_CONST(0.38480823761681288), FRAC_CONST(0.38622364328186298), FRAC_CONST(0.38763814012537273), FRAC_CONST(0.38905172481889438), FRAC_CONST(0.39046439403612659), FRAC_CONST(0.39187614445292235), FRAC_CONST(0.3932869727472964), FRAC_CONST(0.39469687559943356), FRAC_CONST(0.39610584969169627), FRAC_CONST(0.39751389170863233), FRAC_CONST(0.39892099833698291), FRAC_CONST(0.40032716626569009), FRAC_CONST(0.40173239218590501), FRAC_CONST(0.4031366727909953), FRAC_CONST(0.404540004776553), FRAC_CONST(0.40594238484040251), FRAC_CONST(0.40734380968260797), FRAC_CONST(0.40874427600548136), FRAC_CONST(0.41014378051359024), FRAC_CONST(0.41154231991376522), FRAC_CONST(0.41293989091510808), FRAC_CONST(0.4143364902289991), FRAC_CONST(0.41573211456910536), FRAC_CONST(0.41712676065138787), FRAC_CONST(0.4185204251941097), FRAC_CONST(0.41991310491784362), FRAC_CONST(0.42130479654547964), FRAC_CONST(0.42269549680223295), FRAC_CONST(0.42408520241565156), FRAC_CONST(0.4254739101156238), FRAC_CONST(0.42686161663438643), FRAC_CONST(0.42824831870653196), FRAC_CONST(0.42963401306901638), FRAC_CONST(0.43101869646116703), FRAC_CONST(0.43240236562469014), FRAC_CONST(0.43378501730367852), FRAC_CONST(0.43516664824461926), FRAC_CONST(0.4365472551964012), FRAC_CONST(0.43792683491032286), FRAC_CONST(0.43930538414009995), FRAC_CONST(0.4406828996418729), FRAC_CONST(0.4420593781742147), FRAC_CONST(0.44343481649813848), FRAC_CONST(0.44480921137710488), FRAC_CONST(0.44618255957703007), FRAC_CONST(0.44755485786629301), FRAC_CONST(0.44892610301574326), FRAC_CONST(0.45029629179870861), FRAC_CONST(0.45166542099100249), FRAC_CONST(0.45303348737093158), FRAC_CONST(0.45440048771930358), FRAC_CONST(0.45576641881943464), FRAC_CONST(0.45713127745715698), FRAC_CONST(0.45849506042082627), FRAC_CONST(0.45985776450132954), FRAC_CONST(0.46121938649209238), FRAC_CONST(0.46257992318908681), FRAC_CONST(0.46393937139083852), FRAC_CONST(0.4652977278984346), FRAC_CONST(0.46665498951553092), FRAC_CONST(0.46801115304835983), FRAC_CONST(0.46936621530573752), FRAC_CONST(0.4707201730990716), FRAC_CONST(0.47207302324236866), FRAC_CONST(0.47342476255224153), FRAC_CONST(0.47477538784791712), FRAC_CONST(0.47612489595124358), FRAC_CONST(0.47747328368669806), FRAC_CONST(0.47882054788139389), FRAC_CONST(0.48016668536508839), FRAC_CONST(0.48151169297018986), FRAC_CONST(0.48285556753176567), FRAC_CONST(0.48419830588754903), FRAC_CONST(0.48553990487794696), FRAC_CONST(0.48688036134604734), FRAC_CONST(0.48821967213762679), FRAC_CONST(0.48955783410115744), FRAC_CONST(0.49089484408781509), FRAC_CONST(0.49223069895148602), FRAC_CONST(0.49356539554877477), FRAC_CONST(0.49489893073901126), FRAC_CONST(0.49623130138425825), FRAC_CONST(0.49756250434931915), FRAC_CONST(0.49889253650174459), FRAC_CONST(0.50022139471184068), FRAC_CONST(0.50154907585267539), FRAC_CONST(0.50287557680008699), FRAC_CONST(0.50420089443269034), FRAC_CONST(0.50552502563188539), FRAC_CONST(0.50684796728186321), FRAC_CONST(0.5081697162696146), FRAC_CONST(0.50949026948493636), FRAC_CONST(0.51080962382043904), FRAC_CONST(0.51212777617155469), FRAC_CONST(0.51344472343654346), FRAC_CONST(0.5147604625165012), FRAC_CONST(0.51607499031536663), FRAC_CONST(0.51738830373992906), FRAC_CONST(0.51870039969983495), FRAC_CONST(0.52001127510759604), FRAC_CONST(0.52132092687859566), FRAC_CONST(0.52262935193109661), FRAC_CONST(0.5239365471862486), FRAC_CONST(0.52524250956809471), FRAC_CONST(0.52654723600357944), FRAC_CONST(0.52785072342255523), FRAC_CONST(0.52915296875779061), FRAC_CONST(0.53045396894497632), FRAC_CONST(0.53175372092273332), FRAC_CONST(0.53305222163261945), FRAC_CONST(0.53434946801913752), FRAC_CONST(0.53564545702974109), FRAC_CONST(0.53694018561484291), FRAC_CONST(0.5382336507278217), FRAC_CONST(0.53952584932502889), FRAC_CONST(0.54081677836579667), FRAC_CONST(0.54210643481244392), FRAC_CONST(0.5433948156302848), FRAC_CONST(0.54468191778763453), FRAC_CONST(0.54596773825581757), FRAC_CONST(0.54725227400917409), FRAC_CONST(0.54853552202506739), FRAC_CONST(0.54981747928389091), FRAC_CONST(0.55109814276907543), FRAC_CONST(0.55237750946709607), FRAC_CONST(0.55365557636747931), FRAC_CONST(0.55493234046281037), FRAC_CONST(0.55620779874873993), FRAC_CONST(0.55748194822399155), FRAC_CONST(0.55875478589036831), FRAC_CONST(0.56002630875276038), FRAC_CONST(0.56129651381915147), FRAC_CONST(0.56256539810062656), FRAC_CONST(0.56383295861137817), FRAC_CONST(0.56509919236871398), FRAC_CONST(0.56636409639306384), FRAC_CONST(0.56762766770798623), FRAC_CONST(0.56888990334017586), FRAC_CONST(0.5701508003194703), FRAC_CONST(0.57141035567885723), FRAC_CONST(0.57266856645448116), FRAC_CONST(0.57392542968565075), FRAC_CONST(0.57518094241484508), FRAC_CONST(0.57643510168772183), FRAC_CONST(0.5776879045531228), FRAC_CONST(0.57893934806308178), FRAC_CONST(0.58018942927283168), FRAC_CONST(0.58143814524081017), FRAC_CONST(0.58268549302866846), FRAC_CONST(0.58393146970127618), FRAC_CONST(0.58517607232673041), FRAC_CONST(0.5864192979763605), FRAC_CONST(0.58766114372473666), FRAC_CONST(0.58890160664967572), FRAC_CONST(0.59014068383224882), FRAC_CONST(0.59137837235678758), FRAC_CONST(0.59261466931089113), FRAC_CONST(0.59384957178543363), FRAC_CONST(0.59508307687456996), FRAC_CONST(0.59631518167574371), FRAC_CONST(0.59754588328969316), FRAC_CONST(0.59877517882045872), FRAC_CONST(0.60000306537538894), FRAC_CONST(0.6012295400651485), FRAC_CONST(0.60245460000372375), FRAC_CONST(0.60367824230843037), FRAC_CONST(0.60490046409991982), FRAC_CONST(0.60612126250218612), FRAC_CONST(0.60734063464257293), FRAC_CONST(0.60855857765177945), FRAC_CONST(0.60977508866386843), FRAC_CONST(0.61099016481627166), FRAC_CONST(0.61220380324979795), FRAC_CONST(0.61341600110863859), FRAC_CONST(0.61462675554037505), FRAC_CONST(0.61583606369598509), FRAC_CONST(0.61704392272984976), FRAC_CONST(0.61825032979976025), FRAC_CONST(0.61945528206692402), FRAC_CONST(0.62065877669597214), FRAC_CONST(0.62186081085496536), FRAC_CONST(0.62306138171540126), FRAC_CONST(0.62426048645222065), FRAC_CONST(0.62545812224381436), FRAC_CONST(0.62665428627202935), FRAC_CONST(0.62784897572217646), FRAC_CONST(0.629042187783036), FRAC_CONST(0.63023391964686437), FRAC_CONST(0.63142416850940186), FRAC_CONST(0.63261293156987741), FRAC_CONST(0.63380020603101728), FRAC_CONST(0.63498598909904946), FRAC_CONST(0.63617027798371217), FRAC_CONST(0.63735306989825913), FRAC_CONST(0.63853436205946679), FRAC_CONST(0.63971415168764045), FRAC_CONST(0.64089243600662138), FRAC_CONST(0.64206921224379254), FRAC_CONST(0.64324447763008585), FRAC_CONST(0.64441822939998838), FRAC_CONST(0.64559046479154869), FRAC_CONST(0.64676118104638392), FRAC_CONST(0.64793037540968534), FRAC_CONST(0.64909804513022595), FRAC_CONST(0.65026418746036585), FRAC_CONST(0.65142879965605982), FRAC_CONST(0.65259187897686244), FRAC_CONST(0.65375342268593606), FRAC_CONST(0.65491342805005603), FRAC_CONST(0.6560718923396176), FRAC_CONST(0.65722881282864254), FRAC_CONST(0.65838418679478505), FRAC_CONST(0.65953801151933866), FRAC_CONST(0.6606902842872423), FRAC_CONST(0.66184100238708687), FRAC_CONST(0.66299016311112147), FRAC_CONST(0.66413776375526001), FRAC_CONST(0.66528380161908718), FRAC_CONST(0.66642827400586524), FRAC_CONST(0.66757117822254031), FRAC_CONST(0.66871251157974798), FRAC_CONST(0.66985227139182102), FRAC_CONST(0.67099045497679422), FRAC_CONST(0.67212705965641173), FRAC_CONST(0.67326208275613297), FRAC_CONST(0.67439552160513905), FRAC_CONST(0.67552737353633852), FRAC_CONST(0.67665763588637495), FRAC_CONST(0.6777863059956315), FRAC_CONST(0.67891338120823841), FRAC_CONST(0.68003885887207893), FRAC_CONST(0.68116273633879543), FRAC_CONST(0.68228501096379557), FRAC_CONST(0.68340568010625868), FRAC_CONST(0.6845247411291423), FRAC_CONST(0.68564219139918747), FRAC_CONST(0.68675802828692589), FRAC_CONST(0.68787224916668555), FRAC_CONST(0.68898485141659704), FRAC_CONST(0.69009583241859995), FRAC_CONST(0.69120518955844845), FRAC_CONST(0.69231292022571822), FRAC_CONST(0.69341902181381176), FRAC_CONST(0.69452349171996552), FRAC_CONST(0.69562632734525487), FRAC_CONST(0.6967275260946012), FRAC_CONST(0.69782708537677729), FRAC_CONST(0.69892500260441415), FRAC_CONST(0.70002127519400625), FRAC_CONST(0.70111590056591866), FRAC_CONST(0.70220887614439187), FRAC_CONST(0.70330019935754873), FRAC_CONST(0.70438986763740041), FRAC_CONST(0.7054778784198521), FRAC_CONST(0.70656422914470951), FRAC_CONST(0.70764891725568435), FRAC_CONST(0.70873194020040065), FRAC_CONST(0.70981329543040084), FRAC_CONST(0.71089298040115168), FRAC_CONST(0.71197099257204999), FRAC_CONST(0.71304732940642923), FRAC_CONST(0.71412198837156471), FRAC_CONST(0.71519496693868001), FRAC_CONST(0.71626626258295312), FRAC_CONST(0.71733587278352173), FRAC_CONST(0.71840379502348972), FRAC_CONST(0.71947002678993299), FRAC_CONST(0.72053456557390527), FRAC_CONST(0.72159740887044366), FRAC_CONST(0.72265855417857561), FRAC_CONST(0.72371799900132339), FRAC_CONST(0.72477574084571128), FRAC_CONST(0.72583177722277037), FRAC_CONST(0.72688610564754497), FRAC_CONST(0.72793872363909862), FRAC_CONST(0.72898962872051931), FRAC_CONST(0.73003881841892615), FRAC_CONST(0.73108629026547423), FRAC_CONST(0.73213204179536129), FRAC_CONST(0.73317607054783274), FRAC_CONST(0.73421837406618817), FRAC_CONST(0.73525894989778673), FRAC_CONST(0.73629779559405306), FRAC_CONST(0.73733490871048279), FRAC_CONST(0.73837028680664851), FRAC_CONST(0.73940392744620576), FRAC_CONST(0.74043582819689802), FRAC_CONST(0.74146598663056329), FRAC_CONST(0.74249440032313918), FRAC_CONST(0.74352106685466912), FRAC_CONST(0.74454598380930725), FRAC_CONST(0.74556914877532543), FRAC_CONST(0.74659055934511731), FRAC_CONST(0.74761021311520515), FRAC_CONST(0.74862810768624533), FRAC_CONST(0.74964424066303348), FRAC_CONST(0.75065860965451059), FRAC_CONST(0.75167121227376843), FRAC_CONST(0.75268204613805523), FRAC_CONST(0.75369110886878121), FRAC_CONST(0.75469839809152439), FRAC_CONST(0.75570391143603588), FRAC_CONST(0.75670764653624567), FRAC_CONST(0.75770960103026808), FRAC_CONST(0.75870977256040739), FRAC_CONST(0.75970815877316344), FRAC_CONST(0.76070475731923692), FRAC_CONST(0.76169956585353527), FRAC_CONST(0.76269258203517787), FRAC_CONST(0.76368380352750187), FRAC_CONST(0.76467322799806714), FRAC_CONST(0.76566085311866239), FRAC_CONST(0.76664667656531038), FRAC_CONST(0.76763069601827327), FRAC_CONST(0.76861290916205827), FRAC_CONST(0.76959331368542294), FRAC_CONST(0.7705719072813807), FRAC_CONST(0.7715486876472063), FRAC_CONST(0.77252365248444133), FRAC_CONST(0.77349679949889905), FRAC_CONST(0.77446812640067086), FRAC_CONST(0.77543763090413043), FRAC_CONST(0.77640531072794039), FRAC_CONST(0.7773711635950562), FRAC_CONST(0.77833518723273309), FRAC_CONST(0.7792973793725303), FRAC_CONST(0.78025773775031659), FRAC_CONST(0.78121626010627609), FRAC_CONST(0.7821729441849129), FRAC_CONST(0.78312778773505731), FRAC_CONST(0.78408078850986995), FRAC_CONST(0.78503194426684808), FRAC_CONST(0.78598125276783015), FRAC_CONST(0.7869287117790017), FRAC_CONST(0.78787431907090011), FRAC_CONST(0.78881807241842017), FRAC_CONST(0.78975996960081907), FRAC_CONST(0.79070000840172161), FRAC_CONST(0.79163818660912577), FRAC_CONST(0.79257450201540758), FRAC_CONST(0.79350895241732666), FRAC_CONST(0.79444153561603059), FRAC_CONST(0.79537224941706119), FRAC_CONST(0.79630109163035911), FRAC_CONST(0.7972280600702687), FRAC_CONST(0.79815315255554375), FRAC_CONST(0.79907636690935235), FRAC_CONST(0.79999770095928191), FRAC_CONST(0.8009171525373443), FRAC_CONST(0.80183471947998131), FRAC_CONST(0.80275039962806916), FRAC_CONST(0.80366419082692409), FRAC_CONST(0.804576090926307), FRAC_CONST(0.80548609778042912), FRAC_CONST(0.80639420924795624), FRAC_CONST(0.80730042319201445), FRAC_CONST(0.80820473748019472), FRAC_CONST(0.80910714998455813), FRAC_CONST(0.81000765858164114), FRAC_CONST(0.81090626115245967), FRAC_CONST(0.81180295558251536), FRAC_CONST(0.81269773976179949), FRAC_CONST(0.81359061158479851), FRAC_CONST(0.81448156895049861), FRAC_CONST(0.81537060976239129), FRAC_CONST(0.81625773192847739), FRAC_CONST(0.81714293336127297), FRAC_CONST(0.81802621197781344), FRAC_CONST(0.81890756569965895), FRAC_CONST(0.81978699245289899), FRAC_CONST(0.82066449016815746), FRAC_CONST(0.82154005678059761), FRAC_CONST(0.82241369022992639), FRAC_CONST(0.82328538846040011), FRAC_CONST(0.82415514942082857), FRAC_CONST(0.82502297106458022), FRAC_CONST(0.82588885134958678), FRAC_CONST(0.82675278823834852), FRAC_CONST(0.8276147796979384), FRAC_CONST(0.82847482370000713), FRAC_CONST(0.82933291822078825), FRAC_CONST(0.83018906124110237), FRAC_CONST(0.83104325074636232), FRAC_CONST(0.83189548472657759), FRAC_CONST(0.83274576117635946), FRAC_CONST(0.83359407809492514), FRAC_CONST(0.83444043348610319), FRAC_CONST(0.83528482535833737), FRAC_CONST(0.83612725172469216), FRAC_CONST(0.83696771060285702), FRAC_CONST(0.83780620001515094), FRAC_CONST(0.8386427179885273), FRAC_CONST(0.83947726255457855), FRAC_CONST(0.84030983174954077), FRAC_CONST(0.84114042361429808), FRAC_CONST(0.84196903619438768), FRAC_CONST(0.84279566754000412), FRAC_CONST(0.84362031570600404), FRAC_CONST(0.84444297875191066), FRAC_CONST(0.84526365474191822), FRAC_CONST(0.84608234174489694), FRAC_CONST(0.84689903783439735), FRAC_CONST(0.84771374108865427), FRAC_CONST(0.84852644959059265), FRAC_CONST(0.84933716142783067), FRAC_CONST(0.85014587469268521), FRAC_CONST(0.85095258748217573), FRAC_CONST(0.85175729789802912), FRAC_CONST(0.85256000404668397), FRAC_CONST(0.85336070403929543), FRAC_CONST(0.85415939599173873), FRAC_CONST(0.85495607802461482), FRAC_CONST(0.85575074826325392), FRAC_CONST(0.85654340483771996), FRAC_CONST(0.85733404588281559), FRAC_CONST(0.85812266953808602), FRAC_CONST(0.8589092739478239), FRAC_CONST(0.85969385726107261), FRAC_CONST(0.86047641763163207), FRAC_CONST(0.86125695321806206), FRAC_CONST(0.86203546218368721), FRAC_CONST(0.86281194269660033), FRAC_CONST(0.86358639292966799), FRAC_CONST(0.86435881106053403), FRAC_CONST(0.86512919527162369), FRAC_CONST(0.86589754375014882), FRAC_CONST(0.86666385468811102), FRAC_CONST(0.86742812628230692), FRAC_CONST(0.86819035673433131), FRAC_CONST(0.86895054425058238), FRAC_CONST(0.86970868704226556), FRAC_CONST(0.87046478332539767), FRAC_CONST(0.8712188313208109), FRAC_CONST(0.8719708292541577), FRAC_CONST(0.8727207753559143), FRAC_CONST(0.87346866786138488), FRAC_CONST(0.8742145050107063), FRAC_CONST(0.87495828504885154), FRAC_CONST(0.8757000062256346), FRAC_CONST(0.87643966679571361), FRAC_CONST(0.87717726501859594), FRAC_CONST(0.87791279915864173), FRAC_CONST(0.87864626748506813), FRAC_CONST(0.87937766827195318), FRAC_CONST(0.88010699979824036), FRAC_CONST(0.88083426034774204), FRAC_CONST(0.88155944820914378), FRAC_CONST(0.8822825616760086), FRAC_CONST(0.88300359904678072), FRAC_CONST(0.88372255862478966), FRAC_CONST(0.8844394387182537), FRAC_CONST(0.88515423764028511), FRAC_CONST(0.88586695370889279), FRAC_CONST(0.88657758524698704), FRAC_CONST(0.88728613058238315), FRAC_CONST(0.88799258804780556), FRAC_CONST(0.88869695598089171), FRAC_CONST(0.88939923272419552), FRAC_CONST(0.89009941662519221), FRAC_CONST(0.89079750603628149), FRAC_CONST(0.89149349931479138), FRAC_CONST(0.89218739482298248), FRAC_CONST(0.89287919092805168), FRAC_CONST(0.89356888600213602), FRAC_CONST(0.89425647842231604), FRAC_CONST(0.89494196657062075), FRAC_CONST(0.89562534883403), FRAC_CONST(0.89630662360447966), FRAC_CONST(0.89698578927886397), FRAC_CONST(0.89766284425904075), FRAC_CONST(0.89833778695183419), FRAC_CONST(0.89901061576903907), FRAC_CONST(0.89968132912742393), FRAC_CONST(0.9003499254487356), FRAC_CONST(0.90101640315970233), FRAC_CONST(0.90168076069203773), FRAC_CONST(0.9023429964824442), FRAC_CONST(0.90300310897261704), FRAC_CONST(0.90366109660924798), FRAC_CONST(0.90431695784402832), FRAC_CONST(0.90497069113365325), FRAC_CONST(0.90562229493982516), FRAC_CONST(0.90627176772925766), FRAC_CONST(0.90691910797367803), FRAC_CONST(0.90756431414983252), FRAC_CONST(0.9082073847394887), FRAC_CONST(0.90884831822943912), FRAC_CONST(0.90948711311150543), FRAC_CONST(0.91012376788254157), FRAC_CONST(0.91075828104443757), FRAC_CONST(0.91139065110412232), FRAC_CONST(0.91202087657356823), FRAC_CONST(0.9126489559697939), FRAC_CONST(0.91327488781486776), FRAC_CONST(0.91389867063591168), FRAC_CONST(0.91452030296510445), FRAC_CONST(0.91513978333968526), FRAC_CONST(0.91575711030195672), FRAC_CONST(0.91637228239928914), FRAC_CONST(0.91698529818412289), FRAC_CONST(0.91759615621397295), FRAC_CONST(0.9182048550514309), FRAC_CONST(0.91881139326416994), FRAC_CONST(0.91941576942494696), FRAC_CONST(0.92001798211160657), FRAC_CONST(0.92061802990708386), FRAC_CONST(0.92121591139940873), FRAC_CONST(0.92181162518170812), FRAC_CONST(0.92240516985220988), FRAC_CONST(0.92299654401424625), FRAC_CONST(0.92358574627625656), FRAC_CONST(0.9241727752517912), FRAC_CONST(0.92475762955951391), FRAC_CONST(0.9253403078232062), FRAC_CONST(0.92592080867176996), FRAC_CONST(0.92649913073923051), FRAC_CONST(0.9270752726647401), FRAC_CONST(0.92764923309258118), FRAC_CONST(0.92822101067216944), FRAC_CONST(0.92879060405805702), FRAC_CONST(0.9293580119099355), FRAC_CONST(0.92992323289263956), FRAC_CONST(0.93048626567614978), FRAC_CONST(0.93104710893559517), FRAC_CONST(0.93160576135125783), FRAC_CONST(0.93216222160857432), FRAC_CONST(0.93271648839814025), FRAC_CONST(0.93326856041571205), FRAC_CONST(0.93381843636221096), FRAC_CONST(0.9343661149437259), FRAC_CONST(0.93491159487151609), FRAC_CONST(0.93545487486201462), FRAC_CONST(0.9359959536368313), FRAC_CONST(0.9365348299227555), FRAC_CONST(0.93707150245175919), FRAC_CONST(0.93760596996099999), FRAC_CONST(0.93813823119282436), FRAC_CONST(0.93866828489477017), FRAC_CONST(0.9391961298195699), FRAC_CONST(0.93972176472515334), FRAC_CONST(0.94024518837465088), FRAC_CONST(0.94076639953639607), FRAC_CONST(0.94128539698392866), FRAC_CONST(0.94180217949599765), FRAC_CONST(0.94231674585656378), FRAC_CONST(0.94282909485480271), FRAC_CONST(0.94333922528510772), FRAC_CONST(0.94384713594709269), FRAC_CONST(0.94435282564559475), FRAC_CONST(0.94485629319067721), FRAC_CONST(0.94535753739763229), FRAC_CONST(0.94585655708698391), FRAC_CONST(0.94635335108449059), FRAC_CONST(0.946847918221148), FRAC_CONST(0.94734025733319194), FRAC_CONST(0.94783036726210101), FRAC_CONST(0.94831824685459909), FRAC_CONST(0.94880389496265838), FRAC_CONST(0.94928731044350201), FRAC_CONST(0.94976849215960668), FRAC_CONST(0.95024743897870523), FRAC_CONST(0.95072414977378961), FRAC_CONST(0.95119862342311323), FRAC_CONST(0.95167085881019386), FRAC_CONST(0.95214085482381583), FRAC_CONST(0.95260861035803324), FRAC_CONST(0.9530741243121722), FRAC_CONST(0.95353739559083328), FRAC_CONST(0.95399842310389449), FRAC_CONST(0.95445720576651349), FRAC_CONST(0.95491374249913052), FRAC_CONST(0.95536803222747024), FRAC_CONST(0.95582007388254542), FRAC_CONST(0.95626986640065814), FRAC_CONST(0.95671740872340305), FRAC_CONST(0.9571626997976701), FRAC_CONST(0.95760573857564624), FRAC_CONST(0.9580465240148186), FRAC_CONST(0.9584850550779761), FRAC_CONST(0.95892133073321306), FRAC_CONST(0.95935534995393079), FRAC_CONST(0.9597871117188399), FRAC_CONST(0.96021661501196343), FRAC_CONST(0.96064385882263847), FRAC_CONST(0.96106884214551935), FRAC_CONST(0.961491563980579), FRAC_CONST(0.9619120233331121), FRAC_CONST(0.9623302192137374), FRAC_CONST(0.96274615063839941), FRAC_CONST(0.96315981662837136), FRAC_CONST(0.96357121621025721), FRAC_CONST(0.96398034841599411), FRAC_CONST(0.96438721228285429), FRAC_CONST(0.9647918068534479), FRAC_CONST(0.96519413117572472), FRAC_CONST(0.96559418430297683), FRAC_CONST(0.96599196529384057), FRAC_CONST(0.96638747321229879), FRAC_CONST(0.96678070712768327), FRAC_CONST(0.96717166611467664), FRAC_CONST(0.96756034925331436), FRAC_CONST(0.9679467556289878), FRAC_CONST(0.9683308843324453), FRAC_CONST(0.96871273445979478), FRAC_CONST(0.9690923051125061), FRAC_CONST(0.96946959539741295), FRAC_CONST(0.96984460442671483), FRAC_CONST(0.97021733131797916), FRAC_CONST(0.97058777519414363), FRAC_CONST(0.97095593518351797), FRAC_CONST(0.97132181041978616), FRAC_CONST(0.97168540004200854), FRAC_CONST(0.9720467031946235), FRAC_CONST(0.97240571902744977), FRAC_CONST(0.97276244669568857), FRAC_CONST(0.97311688535992513), FRAC_CONST(0.97346903418613095), FRAC_CONST(0.9738188923456661), FRAC_CONST(0.97416645901528032), FRAC_CONST(0.97451173337711572), FRAC_CONST(0.97485471461870843), FRAC_CONST(0.97519540193299037), FRAC_CONST(0.97553379451829136), FRAC_CONST(0.97586989157834103), FRAC_CONST(0.97620369232227056), FRAC_CONST(0.97653519596461447), FRAC_CONST(0.97686440172531264), FRAC_CONST(0.97719130882971228), FRAC_CONST(0.97751591650856928), FRAC_CONST(0.97783822399805043), FRAC_CONST(0.97815823053973505), FRAC_CONST(0.97847593538061683), FRAC_CONST(0.97879133777310567), FRAC_CONST(0.97910443697502925), FRAC_CONST(0.97941523224963478), FRAC_CONST(0.97972372286559117), FRAC_CONST(0.98002990809698998), FRAC_CONST(0.98033378722334796), FRAC_CONST(0.98063535952960812), FRAC_CONST(0.98093462430614164), FRAC_CONST(0.98123158084874973), FRAC_CONST(0.98152622845866466), FRAC_CONST(0.9818185664425525), FRAC_CONST(0.98210859411251361), FRAC_CONST(0.98239631078608469), FRAC_CONST(0.98268171578624086), FRAC_CONST(0.98296480844139644), FRAC_CONST(0.98324558808540707), FRAC_CONST(0.98352405405757126), FRAC_CONST(0.98380020570263149), FRAC_CONST(0.98407404237077645), FRAC_CONST(0.9843455634176419), FRAC_CONST(0.9846147682043126), FRAC_CONST(0.9848816560973237), FRAC_CONST(0.98514622646866223), FRAC_CONST(0.98540847869576842), FRAC_CONST(0.98566841216153755), FRAC_CONST(0.98592602625432113), FRAC_CONST(0.98618132036792827), FRAC_CONST(0.98643429390162707), FRAC_CONST(0.98668494626014669), FRAC_CONST(0.98693327685367771), FRAC_CONST(0.98717928509787434), FRAC_CONST(0.98742297041385541), FRAC_CONST(0.98766433222820571), FRAC_CONST(0.98790336997297779), FRAC_CONST(0.98814008308569257), FRAC_CONST(0.98837447100934128), FRAC_CONST(0.98860653319238645), FRAC_CONST(0.98883626908876354), FRAC_CONST(0.98906367815788154), FRAC_CONST(0.98928875986462517), FRAC_CONST(0.98951151367935519), FRAC_CONST(0.98973193907791057), FRAC_CONST(0.98995003554160899), FRAC_CONST(0.9901658025572484), FRAC_CONST(0.99037923961710816), FRAC_CONST(0.99059034621895015), FRAC_CONST(0.99079912186602037), FRAC_CONST(0.99100556606704937), FRAC_CONST(0.99120967833625406), FRAC_CONST(0.99141145819333854), FRAC_CONST(0.99161090516349537), FRAC_CONST(0.99180801877740643), FRAC_CONST(0.99200279857124452), FRAC_CONST(0.99219524408667392), FRAC_CONST(0.99238535487085167), FRAC_CONST(0.99257313047642881), FRAC_CONST(0.99275857046155114), FRAC_CONST(0.99294167438986047), FRAC_CONST(0.99312244183049558), FRAC_CONST(0.99330087235809328), FRAC_CONST(0.99347696555278919), FRAC_CONST(0.99365072100021912), FRAC_CONST(0.99382213829151966), FRAC_CONST(0.99399121702332938), FRAC_CONST(0.99415795679778973), FRAC_CONST(0.99432235722254581), FRAC_CONST(0.9944844179107476), FRAC_CONST(0.99464413848105071), FRAC_CONST(0.99480151855761711), FRAC_CONST(0.99495655777011638), FRAC_CONST(0.99510925575372611), FRAC_CONST(0.99525961214913339), FRAC_CONST(0.9954076266025349), FRAC_CONST(0.99555329876563847), FRAC_CONST(0.99569662829566352), FRAC_CONST(0.99583761485534161), FRAC_CONST(0.99597625811291779), FRAC_CONST(0.99611255774215113), FRAC_CONST(0.99624651342231552), FRAC_CONST(0.99637812483820021), FRAC_CONST(0.99650739168011082), FRAC_CONST(0.9966343136438699), FRAC_CONST(0.996758890430818), FRAC_CONST(0.99688112174781385), FRAC_CONST(0.99700100730723529), FRAC_CONST(0.99711854682697998), FRAC_CONST(0.99723374003046616), FRAC_CONST(0.99734658664663323), FRAC_CONST(0.99745708640994191), FRAC_CONST(0.99756523906037575), FRAC_CONST(0.997671044343441), FRAC_CONST(0.99777450201016782), FRAC_CONST(0.99787561181711015), FRAC_CONST(0.99797437352634699), FRAC_CONST(0.99807078690548234), FRAC_CONST(0.99816485172764624), FRAC_CONST(0.99825656777149518), FRAC_CONST(0.99834593482121237), FRAC_CONST(0.99843295266650844), FRAC_CONST(0.99851762110262221), FRAC_CONST(0.99859993993032037), FRAC_CONST(0.99867990895589909), FRAC_CONST(0.99875752799118334), FRAC_CONST(0.99883279685352799), FRAC_CONST(0.99890571536581829), FRAC_CONST(0.99897628335646982), FRAC_CONST(0.99904450065942929), FRAC_CONST(0.99911036711417489), FRAC_CONST(0.99917388256571638), FRAC_CONST(0.99923504686459585), FRAC_CONST(0.99929385986688779), FRAC_CONST(0.99935032143419944), FRAC_CONST(0.9994044314336713), FRAC_CONST(0.99945618973797734), FRAC_CONST(0.99950559622532531), FRAC_CONST(0.99955265077945699), FRAC_CONST(0.99959735328964838), FRAC_CONST(0.9996397036507102), FRAC_CONST(0.99967970176298793), FRAC_CONST(0.99971734753236219), FRAC_CONST(0.99975264087024884), FRAC_CONST(0.99978558169359921), FRAC_CONST(0.99981616992490041), FRAC_CONST(0.99984440549217524), FRAC_CONST(0.99987028832898295), FRAC_CONST(0.99989381837441849), FRAC_CONST(0.99991499557311347), FRAC_CONST(0.999933819875236), FRAC_CONST(0.99995029123649048), FRAC_CONST(0.99996440961811828), FRAC_CONST(0.99997617498689761), FRAC_CONST(0.9999855873151432), FRAC_CONST(0.99999264658070719), FRAC_CONST(0.99999735276697821), FRAC_CONST(0.99999970586288223) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_long_960[] = { FRAC_CONST(0.00081812299560725323), FRAC_CONST(0.0024543667964602917), FRAC_CONST(0.0040906040262347889), FRAC_CONST(0.0057268303042312674), FRAC_CONST(0.0073630412497795667), FRAC_CONST(0.0089992324822505774), FRAC_CONST(0.010635399621067975), FRAC_CONST(0.012271538285719924), FRAC_CONST(0.013907644095770845), FRAC_CONST(0.015543712670873098), FRAC_CONST(0.017179739630778748), FRAC_CONST(0.018815720595351273), FRAC_CONST(0.020451651184577292), FRAC_CONST(0.022087527018578291), FRAC_CONST(0.023723343717622358), FRAC_CONST(0.025359096902135895), FRAC_CONST(0.02699478219271537), FRAC_CONST(0.028630395210139003), FRAC_CONST(0.030265931575378519), FRAC_CONST(0.031901386909610863), FRAC_CONST(0.033536756834229922), FRAC_CONST(0.035172036970858266), FRAC_CONST(0.036807222941358832), FRAC_CONST(0.038442310367846677), FRAC_CONST(0.040077294872700696), FRAC_CONST(0.041712172078575326), FRAC_CONST(0.043346937608412288), FRAC_CONST(0.044981587085452281), FRAC_CONST(0.046616116133246711), FRAC_CONST(0.048250520375669431), FRAC_CONST(0.049884795436928406), FRAC_CONST(0.051518936941577477), FRAC_CONST(0.053152940514528055), FRAC_CONST(0.05478680178106083), FRAC_CONST(0.056420516366837495), FRAC_CONST(0.05805407989791244), FRAC_CONST(0.059687488000744485), FRAC_CONST(0.061320736302208578), FRAC_CONST(0.062953820429607482), FRAC_CONST(0.064586736010683557), FRAC_CONST(0.066219478673630344), FRAC_CONST(0.06785204404710439), FRAC_CONST(0.069484427760236861), FRAC_CONST(0.071116625442645326), FRAC_CONST(0.072748632724445372), FRAC_CONST(0.07438044523626236), FRAC_CONST(0.076012058609243122), FRAC_CONST(0.077643468475067631), FRAC_CONST(0.079274670465960706), FRAC_CONST(0.080905660214703745), FRAC_CONST(0.082536433354646319), FRAC_CONST(0.084166985519717977), FRAC_CONST(0.085797312344439894), FRAC_CONST(0.08742740946393647), FRAC_CONST(0.089057272513947183), FRAC_CONST(0.090686897130838162), FRAC_CONST(0.092316278951613845), FRAC_CONST(0.093945413613928788), FRAC_CONST(0.095574296756099186), FRAC_CONST(0.097202924017114667), FRAC_CONST(0.098831291036649963), FRAC_CONST(0.10045939345507648), FRAC_CONST(0.10208722691347409), FRAC_CONST(0.10371478705364276), FRAC_CONST(0.10534206951811415), FRAC_CONST(0.10696906995016341), FRAC_CONST(0.10859578399382072), FRAC_CONST(0.11022220729388306), FRAC_CONST(0.11184833549592579), FRAC_CONST(0.11347416424631435), FRAC_CONST(0.11509968919221586), FRAC_CONST(0.11672490598161089), FRAC_CONST(0.11834981026330495), FRAC_CONST(0.11997439768694031), FRAC_CONST(0.12159866390300751), FRAC_CONST(0.12322260456285709), FRAC_CONST(0.12484621531871121), FRAC_CONST(0.12646949182367517), FRAC_CONST(0.12809242973174936), FRAC_CONST(0.12971502469784052), FRAC_CONST(0.13133727237777362), FRAC_CONST(0.13295916842830346), FRAC_CONST(0.13458070850712617), FRAC_CONST(0.13620188827289101), FRAC_CONST(0.1378227033852118), FRAC_CONST(0.13944314950467873), FRAC_CONST(0.14106322229286994), FRAC_CONST(0.14268291741236291), FRAC_CONST(0.14430223052674654), FRAC_CONST(0.1459211573006321), FRAC_CONST(0.14753969339966552), FRAC_CONST(0.14915783449053857), FRAC_CONST(0.15077557624100058), FRAC_CONST(0.15239291431987001), FRAC_CONST(0.1540098443970461), FRAC_CONST(0.15562636214352044), FRAC_CONST(0.15724246323138855), FRAC_CONST(0.15885814333386142), FRAC_CONST(0.16047339812527725), FRAC_CONST(0.16208822328111283), FRAC_CONST(0.16370261447799525), FRAC_CONST(0.16531656739371339), FRAC_CONST(0.16693007770722967), FRAC_CONST(0.16854314109869134), FRAC_CONST(0.17015575324944232), FRAC_CONST(0.17176790984203447), FRAC_CONST(0.17337960656023954), FRAC_CONST(0.1749908390890603), FRAC_CONST(0.17660160311474243), FRAC_CONST(0.17821189432478593), FRAC_CONST(0.17982170840795647), FRAC_CONST(0.18143104105429744), FRAC_CONST(0.18303988795514095), FRAC_CONST(0.1846482448031197), FRAC_CONST(0.18625610729217834), FRAC_CONST(0.1878634711175852), FRAC_CONST(0.18947033197594348), FRAC_CONST(0.19107668556520319), FRAC_CONST(0.19268252758467228), FRAC_CONST(0.19428785373502844), FRAC_CONST(0.19589265971833042), FRAC_CONST(0.19749694123802966), FRAC_CONST(0.19910069399898173), FRAC_CONST(0.20070391370745785), FRAC_CONST(0.20230659607115639), FRAC_CONST(0.20390873679921437), FRAC_CONST(0.20551033160221882), FRAC_CONST(0.20711137619221856), FRAC_CONST(0.2087118662827353), FRAC_CONST(0.21031179758877552), FRAC_CONST(0.21191116582684155), FRAC_CONST(0.21350996671494335), FRAC_CONST(0.21510819597260972), FRAC_CONST(0.21670584932089998), FRAC_CONST(0.2183029224824154), FRAC_CONST(0.21989941118131037), FRAC_CONST(0.22149531114330431), FRAC_CONST(0.22309061809569264), FRAC_CONST(0.22468532776735861), FRAC_CONST(0.22627943588878449), FRAC_CONST(0.22787293819206314), FRAC_CONST(0.22946583041090929), FRAC_CONST(0.23105810828067114), FRAC_CONST(0.23264976753834157), FRAC_CONST(0.23424080392256985), FRAC_CONST(0.2358312131736727), FRAC_CONST(0.23742099103364595), FRAC_CONST(0.23901013324617584), FRAC_CONST(0.24059863555665045), FRAC_CONST(0.24218649371217096), FRAC_CONST(0.24377370346156332), FRAC_CONST(0.24536026055538934), FRAC_CONST(0.24694616074595824), FRAC_CONST(0.24853139978733788), FRAC_CONST(0.25011597343536629), FRAC_CONST(0.25169987744766298), FRAC_CONST(0.25328310758364025), FRAC_CONST(0.25486565960451457), FRAC_CONST(0.25644752927331788), FRAC_CONST(0.25802871235490898), FRAC_CONST(0.25960920461598508), FRAC_CONST(0.26118900182509258), FRAC_CONST(0.26276809975263904), FRAC_CONST(0.264346494170904), FRAC_CONST(0.26592418085405067), FRAC_CONST(0.26750115557813692), FRAC_CONST(0.2690774141211269), FRAC_CONST(0.27065295226290209), FRAC_CONST(0.2722277657852728), FRAC_CONST(0.27380185047198918), FRAC_CONST(0.27537520210875299), FRAC_CONST(0.2769478164832283), FRAC_CONST(0.27851968938505312), FRAC_CONST(0.28009081660585067), FRAC_CONST(0.28166119393924061), FRAC_CONST(0.28323081718085019), FRAC_CONST(0.28479968212832563), FRAC_CONST(0.28636778458134327), FRAC_CONST(0.28793512034162105), FRAC_CONST(0.2895016852129294), FRAC_CONST(0.29106747500110264), FRAC_CONST(0.29263248551405047), FRAC_CONST(0.2941967125617686), FRAC_CONST(0.29576015195635058), FRAC_CONST(0.29732279951199847), FRAC_CONST(0.29888465104503475), FRAC_CONST(0.30044570237391266), FRAC_CONST(0.30200594931922808), FRAC_CONST(0.30356538770373032), FRAC_CONST(0.30512401335233358), FRAC_CONST(0.30668182209212791), FRAC_CONST(0.3082388097523906), FRAC_CONST(0.30979497216459695), FRAC_CONST(0.31135030516243201), FRAC_CONST(0.3129048045818012), FRAC_CONST(0.31445846626084178), FRAC_CONST(0.31601128603993378), FRAC_CONST(0.31756325976171151), FRAC_CONST(0.31911438327107416), FRAC_CONST(0.32066465241519732), FRAC_CONST(0.32221406304354389), FRAC_CONST(0.3237626110078754), FRAC_CONST(0.32531029216226293), FRAC_CONST(0.32685710236309828), FRAC_CONST(0.32840303746910487), FRAC_CONST(0.32994809334134939), FRAC_CONST(0.3314922658432522), FRAC_CONST(0.33303555084059877), FRAC_CONST(0.33457794420155085), FRAC_CONST(0.33611944179665709), FRAC_CONST(0.33766003949886464), FRAC_CONST(0.33919973318352969), FRAC_CONST(0.34073851872842903), FRAC_CONST(0.34227639201377064), FRAC_CONST(0.34381334892220483), FRAC_CONST(0.34534938533883547), FRAC_CONST(0.34688449715123082), FRAC_CONST(0.34841868024943456), FRAC_CONST(0.34995193052597684), FRAC_CONST(0.35148424387588523), FRAC_CONST(0.3530156161966958), FRAC_CONST(0.35454604338846402), FRAC_CONST(0.35607552135377557), FRAC_CONST(0.35760404599775775), FRAC_CONST(0.35913161322809023), FRAC_CONST(0.36065821895501554), FRAC_CONST(0.36218385909135092), FRAC_CONST(0.36370852955249849), FRAC_CONST(0.36523222625645668), FRAC_CONST(0.36675494512383078), FRAC_CONST(0.36827668207784414), FRAC_CONST(0.36979743304434909), FRAC_CONST(0.37131719395183754), FRAC_CONST(0.37283596073145214), FRAC_CONST(0.37435372931699717), FRAC_CONST(0.37587049564494951), FRAC_CONST(0.37738625565446909), FRAC_CONST(0.37890100528741022), FRAC_CONST(0.38041474048833229), FRAC_CONST(0.38192745720451066), FRAC_CONST(0.38343915138594736), FRAC_CONST(0.38494981898538222), FRAC_CONST(0.38645945595830333), FRAC_CONST(0.38796805826295838), FRAC_CONST(0.38947562186036483), FRAC_CONST(0.39098214271432141), FRAC_CONST(0.39248761679141814), FRAC_CONST(0.3939920400610481), FRAC_CONST(0.39549540849541737), FRAC_CONST(0.39699771806955625), FRAC_CONST(0.39849896476132979), FRAC_CONST(0.39999914455144892), FRAC_CONST(0.40149825342348083), FRAC_CONST(0.4029962873638599), FRAC_CONST(0.40449324236189854), FRAC_CONST(0.40598911440979762), FRAC_CONST(0.40748389950265762), FRAC_CONST(0.40897759363848879), FRAC_CONST(0.41047019281822261), FRAC_CONST(0.41196169304572178), FRAC_CONST(0.4134520903277914), FRAC_CONST(0.41494138067418929), FRAC_CONST(0.41642956009763715), FRAC_CONST(0.41791662461383078), FRAC_CONST(0.41940257024145089), FRAC_CONST(0.42088739300217382), FRAC_CONST(0.42237108892068231), FRAC_CONST(0.42385365402467584), FRAC_CONST(0.42533508434488143), FRAC_CONST(0.42681537591506419), FRAC_CONST(0.42829452477203828), FRAC_CONST(0.42977252695567697), FRAC_CONST(0.43124937850892364), FRAC_CONST(0.4327250754778022), FRAC_CONST(0.43419961391142781), FRAC_CONST(0.43567298986201736), FRAC_CONST(0.43714519938489987), FRAC_CONST(0.43861623853852766), FRAC_CONST(0.44008610338448595), FRAC_CONST(0.44155478998750436), FRAC_CONST(0.44302229441546676), FRAC_CONST(0.4444886127394222), FRAC_CONST(0.44595374103359531), FRAC_CONST(0.44741767537539667), FRAC_CONST(0.44888041184543348), FRAC_CONST(0.45034194652752002), FRAC_CONST(0.45180227550868812), FRAC_CONST(0.45326139487919759), FRAC_CONST(0.45471930073254679), FRAC_CONST(0.45617598916548296), FRAC_CONST(0.45763145627801283), FRAC_CONST(0.45908569817341294), FRAC_CONST(0.46053871095824001), FRAC_CONST(0.46199049074234161), FRAC_CONST(0.46344103363886635), FRAC_CONST(0.46489033576427435), FRAC_CONST(0.46633839323834758), FRAC_CONST(0.46778520218420055), FRAC_CONST(0.46923075872829029), FRAC_CONST(0.47067505900042683), FRAC_CONST(0.47211809913378361), FRAC_CONST(0.47355987526490806), FRAC_CONST(0.47500038353373153), FRAC_CONST(0.47643962008357982), FRAC_CONST(0.47787758106118372), FRAC_CONST(0.47931426261668875), FRAC_CONST(0.48074966090366611), FRAC_CONST(0.48218377207912272), FRAC_CONST(0.48361659230351117), FRAC_CONST(0.48504811774074069), FRAC_CONST(0.48647834455818684), FRAC_CONST(0.48790726892670194), FRAC_CONST(0.48933488702062544), FRAC_CONST(0.49076119501779414), FRAC_CONST(0.49218618909955225), FRAC_CONST(0.4936098654507618), FRAC_CONST(0.49503222025981269), FRAC_CONST(0.49645324971863303), FRAC_CONST(0.49787295002269943), FRAC_CONST(0.49929131737104687), FRAC_CONST(0.50070834796627917), FRAC_CONST(0.50212403801457872), FRAC_CONST(0.50353838372571758), FRAC_CONST(0.50495138131306638), FRAC_CONST(0.50636302699360547), FRAC_CONST(0.50777331698793449), FRAC_CONST(0.50918224752028263), FRAC_CONST(0.51058981481851906), FRAC_CONST(0.51199601511416237), FRAC_CONST(0.51340084464239111), FRAC_CONST(0.51480429964205421), FRAC_CONST(0.51620637635567967), FRAC_CONST(0.51760707102948678), FRAC_CONST(0.51900637991339404), FRAC_CONST(0.5204042992610306), FRAC_CONST(0.52180082532974559), FRAC_CONST(0.5231959543806185), FRAC_CONST(0.52458968267846895), FRAC_CONST(0.52598200649186677), FRAC_CONST(0.52737292209314235), FRAC_CONST(0.52876242575839572), FRAC_CONST(0.53015051376750777), FRAC_CONST(0.53153718240414882), FRAC_CONST(0.53292242795578992), FRAC_CONST(0.53430624671371152), FRAC_CONST(0.53568863497301467), FRAC_CONST(0.5370695890326298), FRAC_CONST(0.5384491051953274), FRAC_CONST(0.53982717976772743), FRAC_CONST(0.54120380906030963), FRAC_CONST(0.54257898938742311), FRAC_CONST(0.54395271706729609), FRAC_CONST(0.54532498842204646), FRAC_CONST(0.54669579977769045), FRAC_CONST(0.54806514746415402), FRAC_CONST(0.54943302781528081), FRAC_CONST(0.55079943716884383), FRAC_CONST(0.55216437186655387), FRAC_CONST(0.55352782825406999), FRAC_CONST(0.55488980268100907), FRAC_CONST(0.55625029150095584), FRAC_CONST(0.55760929107147217), FRAC_CONST(0.55896679775410718), FRAC_CONST(0.56032280791440714), FRAC_CONST(0.56167731792192455), FRAC_CONST(0.56303032415022869), FRAC_CONST(0.56438182297691453), FRAC_CONST(0.56573181078361312), FRAC_CONST(0.56708028395600085), FRAC_CONST(0.56842723888380908), FRAC_CONST(0.56977267196083425), FRAC_CONST(0.57111657958494688), FRAC_CONST(0.5724589581581021), FRAC_CONST(0.57379980408634845), FRAC_CONST(0.57513911377983773), FRAC_CONST(0.57647688365283478), FRAC_CONST(0.57781311012372738), FRAC_CONST(0.57914778961503466), FRAC_CONST(0.58048091855341843), FRAC_CONST(0.5818124933696911), FRAC_CONST(0.58314251049882604), FRAC_CONST(0.58447096637996743), FRAC_CONST(0.58579785745643886), FRAC_CONST(0.5871231801757536), FRAC_CONST(0.58844693098962408), FRAC_CONST(0.58976910635397084), FRAC_CONST(0.59108970272893235), FRAC_CONST(0.59240871657887517), FRAC_CONST(0.59372614437240179), FRAC_CONST(0.59504198258236196), FRAC_CONST(0.5963562276858605), FRAC_CONST(0.59766887616426767), FRAC_CONST(0.5989799245032289), FRAC_CONST(0.60028936919267273), FRAC_CONST(0.60159720672682204), FRAC_CONST(0.60290343360420195), FRAC_CONST(0.60420804632765002), FRAC_CONST(0.60551104140432543), FRAC_CONST(0.60681241534571839), FRAC_CONST(0.60811216466765883), FRAC_CONST(0.60941028589032709), FRAC_CONST(0.61070677553826169), FRAC_CONST(0.61200163014036979), FRAC_CONST(0.61329484622993602), FRAC_CONST(0.6145864203446314), FRAC_CONST(0.61587634902652377), FRAC_CONST(0.61716462882208556), FRAC_CONST(0.61845125628220421), FRAC_CONST(0.61973622796219074), FRAC_CONST(0.6210195404217892), FRAC_CONST(0.62230119022518593), FRAC_CONST(0.62358117394101897), FRAC_CONST(0.62485948814238634), FRAC_CONST(0.62613612940685637), FRAC_CONST(0.62741109431647646), FRAC_CONST(0.62868437945778133), FRAC_CONST(0.62995598142180387), FRAC_CONST(0.6312258968040827), FRAC_CONST(0.63249412220467238), FRAC_CONST(0.63376065422815175), FRAC_CONST(0.63502548948363347), FRAC_CONST(0.63628862458477287), FRAC_CONST(0.63755005614977711), FRAC_CONST(0.63880978080141437), FRAC_CONST(0.6400677951670225), FRAC_CONST(0.6413240958785188), FRAC_CONST(0.64257867957240766), FRAC_CONST(0.6438315428897915), FRAC_CONST(0.64508268247637779), FRAC_CONST(0.64633209498248945), FRAC_CONST(0.64757977706307335), FRAC_CONST(0.64882572537770888), FRAC_CONST(0.65006993659061751), FRAC_CONST(0.65131240737067142), FRAC_CONST(0.65255313439140239), FRAC_CONST(0.65379211433101081), FRAC_CONST(0.65502934387237444), FRAC_CONST(0.6562648197030575), FRAC_CONST(0.65749853851531959), FRAC_CONST(0.65873049700612374), FRAC_CONST(0.65996069187714679), FRAC_CONST(0.66118911983478657), FRAC_CONST(0.66241577759017178), FRAC_CONST(0.66364066185917048), FRAC_CONST(0.66486376936239888), FRAC_CONST(0.66608509682523009), FRAC_CONST(0.66730464097780284), FRAC_CONST(0.66852239855503071), FRAC_CONST(0.66973836629660977), FRAC_CONST(0.67095254094702894), FRAC_CONST(0.67216491925557675), FRAC_CONST(0.67337549797635199), FRAC_CONST(0.67458427386827102), FRAC_CONST(0.67579124369507693), FRAC_CONST(0.67699640422534846), FRAC_CONST(0.67819975223250772), FRAC_CONST(0.6794012844948305), FRAC_CONST(0.68060099779545302), FRAC_CONST(0.68179888892238183), FRAC_CONST(0.6829949546685018), FRAC_CONST(0.68418919183158522), FRAC_CONST(0.68538159721429948), FRAC_CONST(0.6865721676242168), FRAC_CONST(0.68776089987382172), FRAC_CONST(0.68894779078052026), FRAC_CONST(0.69013283716664853), FRAC_CONST(0.69131603585948032), FRAC_CONST(0.69249738369123692), FRAC_CONST(0.69367687749909468), FRAC_CONST(0.69485451412519361), FRAC_CONST(0.69603029041664599), FRAC_CONST(0.6972042032255451), FRAC_CONST(0.6983762494089728), FRAC_CONST(0.69954642582900894), FRAC_CONST(0.70071472935273893), FRAC_CONST(0.70188115685226271), FRAC_CONST(0.703045705204703), FRAC_CONST(0.70420837129221303), FRAC_CONST(0.70536915200198613), FRAC_CONST(0.70652804422626281), FRAC_CONST(0.70768504486233985), FRAC_CONST(0.70884015081257845), FRAC_CONST(0.70999335898441229), FRAC_CONST(0.711144666290356), FRAC_CONST(0.71229406964801356), FRAC_CONST(0.71344156598008623), FRAC_CONST(0.71458715221438096), FRAC_CONST(0.71573082528381871), FRAC_CONST(0.71687258212644234), FRAC_CONST(0.7180124196854254), FRAC_CONST(0.71915033490907943), FRAC_CONST(0.72028632475086318), FRAC_CONST(0.72142038616938997), FRAC_CONST(0.72255251612843596), FRAC_CONST(0.72368271159694852), FRAC_CONST(0.72481096954905444), FRAC_CONST(0.72593728696406756), FRAC_CONST(0.72706166082649704), FRAC_CONST(0.72818408812605595), FRAC_CONST(0.72930456585766834), FRAC_CONST(0.73042309102147851), FRAC_CONST(0.73153966062285747), FRAC_CONST(0.73265427167241282), FRAC_CONST(0.73376692118599507), FRAC_CONST(0.73487760618470677), FRAC_CONST(0.73598632369490979), FRAC_CONST(0.73709307074823405), FRAC_CONST(0.73819784438158409), FRAC_CONST(0.73930064163714881), FRAC_CONST(0.74040145956240788), FRAC_CONST(0.74150029521014049), FRAC_CONST(0.74259714563843304), FRAC_CONST(0.74369200791068657), FRAC_CONST(0.74478487909562552), FRAC_CONST(0.74587575626730485), FRAC_CONST(0.74696463650511791), FRAC_CONST(0.74805151689380456), FRAC_CONST(0.74913639452345926), FRAC_CONST(0.75021926648953785), FRAC_CONST(0.75130012989286621), FRAC_CONST(0.7523789818396478), FRAC_CONST(0.75345581944147111), FRAC_CONST(0.75453063981531809), FRAC_CONST(0.75560344008357094), FRAC_CONST(0.75667421737402052), FRAC_CONST(0.7577429688198738), FRAC_CONST(0.75880969155976163), FRAC_CONST(0.75987438273774599), FRAC_CONST(0.76093703950332836), FRAC_CONST(0.76199765901145666), FRAC_CONST(0.76305623842253345), FRAC_CONST(0.76411277490242291), FRAC_CONST(0.76516726562245885), FRAC_CONST(0.76621970775945258), FRAC_CONST(0.76727009849569949), FRAC_CONST(0.76831843501898767), FRAC_CONST(0.76936471452260458), FRAC_CONST(0.77040893420534517), FRAC_CONST(0.77145109127151923), FRAC_CONST(0.77249118293095853), FRAC_CONST(0.77352920639902467), FRAC_CONST(0.77456515889661659), FRAC_CONST(0.77559903765017746), FRAC_CONST(0.7766308398917029), FRAC_CONST(0.77766056285874774), FRAC_CONST(0.77868820379443371), FRAC_CONST(0.77971375994745684), FRAC_CONST(0.78073722857209438), FRAC_CONST(0.7817586069282132), FRAC_CONST(0.78277789228127592), FRAC_CONST(0.78379508190234881), FRAC_CONST(0.78481017306810918), FRAC_CONST(0.78582316306085265), FRAC_CONST(0.78683404916849986), FRAC_CONST(0.78784282868460476), FRAC_CONST(0.78884949890836087), FRAC_CONST(0.78985405714460888), FRAC_CONST(0.7908565007038445), FRAC_CONST(0.79185682690222425), FRAC_CONST(0.79285503306157412), FRAC_CONST(0.79385111650939566), FRAC_CONST(0.79484507457887377), FRAC_CONST(0.79583690460888357), FRAC_CONST(0.79682660394399751), FRAC_CONST(0.79781416993449272), FRAC_CONST(0.79879959993635785), FRAC_CONST(0.7997828913113002), FRAC_CONST(0.80076404142675273), FRAC_CONST(0.80174304765588156), FRAC_CONST(0.80271990737759213), FRAC_CONST(0.80369461797653707), FRAC_CONST(0.80466717684312306), FRAC_CONST(0.80563758137351682), FRAC_CONST(0.80660582896965372), FRAC_CONST(0.80757191703924336), FRAC_CONST(0.80853584299577752), FRAC_CONST(0.80949760425853612), FRAC_CONST(0.81045719825259477), FRAC_CONST(0.81141462240883167), FRAC_CONST(0.81236987416393436), FRAC_CONST(0.81332295096040608), FRAC_CONST(0.81427385024657373), FRAC_CONST(0.81522256947659355), FRAC_CONST(0.81616910611045879), FRAC_CONST(0.817113457614006), FRAC_CONST(0.81805562145892186), FRAC_CONST(0.81899559512275044), FRAC_CONST(0.81993337608889916), FRAC_CONST(0.82086896184664637), FRAC_CONST(0.8218023498911472), FRAC_CONST(0.82273353772344116), FRAC_CONST(0.82366252285045805), FRAC_CONST(0.82458930278502529), FRAC_CONST(0.82551387504587381), FRAC_CONST(0.82643623715764558), FRAC_CONST(0.82735638665089983), FRAC_CONST(0.82827432106211907), FRAC_CONST(0.82919003793371693), FRAC_CONST(0.83010353481404364), FRAC_CONST(0.83101480925739324), FRAC_CONST(0.83192385882400965), FRAC_CONST(0.83283068108009373), FRAC_CONST(0.8337352735978093), FRAC_CONST(0.83463763395529011), FRAC_CONST(0.83553775973664579), FRAC_CONST(0.83643564853196872), FRAC_CONST(0.83733129793734051), FRAC_CONST(0.83822470555483797), FRAC_CONST(0.83911586899254031), FRAC_CONST(0.84000478586453453), FRAC_CONST(0.84089145379092289), FRAC_CONST(0.84177587039782842), FRAC_CONST(0.84265803331740163), FRAC_CONST(0.84353794018782702), FRAC_CONST(0.844415588653329), FRAC_CONST(0.8452909763641786), FRAC_CONST(0.84616410097669936), FRAC_CONST(0.84703496015327406), FRAC_CONST(0.84790355156235053), FRAC_CONST(0.84876987287844818), FRAC_CONST(0.8496339217821639), FRAC_CONST(0.85049569596017938), FRAC_CONST(0.85135519310526508), FRAC_CONST(0.85221241091628896), FRAC_CONST(0.85306734709822085), FRAC_CONST(0.85391999936213903), FRAC_CONST(0.85477036542523732), FRAC_CONST(0.85561844301082923), FRAC_CONST(0.85646422984835635), FRAC_CONST(0.85730772367339259), FRAC_CONST(0.85814892222765116), FRAC_CONST(0.85898782325899026), FRAC_CONST(0.85982442452141961), FRAC_CONST(0.86065872377510555), FRAC_CONST(0.86149071878637817), FRAC_CONST(0.8623204073277364), FRAC_CONST(0.86314778717785412), FRAC_CONST(0.8639728561215867), FRAC_CONST(0.86479561194997623), FRAC_CONST(0.86561605246025763), FRAC_CONST(0.86643417545586487), FRAC_CONST(0.8672499787464365), FRAC_CONST(0.86806346014782154), FRAC_CONST(0.8688746174820855), FRAC_CONST(0.86968344857751589), FRAC_CONST(0.87048995126862883), FRAC_CONST(0.87129412339617363), FRAC_CONST(0.87209596280713941), FRAC_CONST(0.8728954673547612), FRAC_CONST(0.87369263489852422), FRAC_CONST(0.87448746330417149), FRAC_CONST(0.87527995044370765), FRAC_CONST(0.8760700941954066), FRAC_CONST(0.87685789244381551), FRAC_CONST(0.87764334307976144), FRAC_CONST(0.87842644400035663), FRAC_CONST(0.8792071931090043), FRAC_CONST(0.87998558831540408), FRAC_CONST(0.88076162753555787), FRAC_CONST(0.88153530869177488), FRAC_CONST(0.88230662971267804), FRAC_CONST(0.88307558853320878), FRAC_CONST(0.88384218309463292), FRAC_CONST(0.8846064113445461), FRAC_CONST(0.88536827123687933), FRAC_CONST(0.88612776073190425), FRAC_CONST(0.88688487779623937), FRAC_CONST(0.88763962040285393), FRAC_CONST(0.8883919865310751), FRAC_CONST(0.88914197416659235), FRAC_CONST(0.88988958130146301), FRAC_CONST(0.8906348059341177), FRAC_CONST(0.89137764606936609), FRAC_CONST(0.89211809971840139), FRAC_CONST(0.89285616489880615), FRAC_CONST(0.89359183963455813), FRAC_CONST(0.89432512195603453), FRAC_CONST(0.89505600990001799), FRAC_CONST(0.89578450150970124), FRAC_CONST(0.8965105948346932), FRAC_CONST(0.89723428793102367), FRAC_CONST(0.89795557886114807), FRAC_CONST(0.89867446569395382), FRAC_CONST(0.89939094650476448), FRAC_CONST(0.90010501937534515), FRAC_CONST(0.900816682393908), FRAC_CONST(0.90152593365511691), FRAC_CONST(0.90223277126009283), FRAC_CONST(0.90293719331641886), FRAC_CONST(0.90363919793814496), FRAC_CONST(0.90433878324579353), FRAC_CONST(0.90503594736636439), FRAC_CONST(0.90573068843333915), FRAC_CONST(0.90642300458668679), FRAC_CONST(0.90711289397286898), FRAC_CONST(0.90780035474484411), FRAC_CONST(0.90848538506207266), FRAC_CONST(0.90916798309052227), FRAC_CONST(0.90984814700267291), FRAC_CONST(0.9105258749775208), FRAC_CONST(0.91120116520058425), FRAC_CONST(0.91187401586390815), FRAC_CONST(0.91254442516606893), FRAC_CONST(0.9132123913121788), FRAC_CONST(0.91387791251389161), FRAC_CONST(0.91454098698940678), FRAC_CONST(0.91520161296347435), FRAC_CONST(0.91585978866739981), FRAC_CONST(0.91651551233904871), FRAC_CONST(0.91716878222285148), FRAC_CONST(0.91781959656980805), FRAC_CONST(0.91846795363749245), FRAC_CONST(0.91911385169005766), FRAC_CONST(0.9197572889982405), FRAC_CONST(0.9203982638393654), FRAC_CONST(0.92103677449734989), FRAC_CONST(0.92167281926270861), FRAC_CONST(0.92230639643255874), FRAC_CONST(0.92293750431062316), FRAC_CONST(0.92356614120723612), FRAC_CONST(0.92419230543934783), FRAC_CONST(0.92481599533052783), FRAC_CONST(0.92543720921097061), FRAC_CONST(0.92605594541749991), FRAC_CONST(0.92667220229357261), FRAC_CONST(0.92728597818928349), FRAC_CONST(0.9278972714613698), FRAC_CONST(0.92850608047321548), FRAC_CONST(0.9291124035948557), FRAC_CONST(0.92971623920298097), FRAC_CONST(0.93031758568094147), FRAC_CONST(0.93091644141875196), FRAC_CONST(0.93151280481309506), FRAC_CONST(0.93210667426732674), FRAC_CONST(0.93269804819147983), FRAC_CONST(0.93328692500226818), FRAC_CONST(0.93387330312309147), FRAC_CONST(0.93445718098403896), FRAC_CONST(0.93503855702189376), FRAC_CONST(0.9356174296801375), FRAC_CONST(0.93619379740895381), FRAC_CONST(0.93676765866523259), FRAC_CONST(0.93733901191257496), FRAC_CONST(0.93790785562129597), FRAC_CONST(0.93847418826842988), FRAC_CONST(0.93903800833773399), FRAC_CONST(0.93959931431969212), FRAC_CONST(0.94015810471151917), FRAC_CONST(0.94071437801716529), FRAC_CONST(0.94126813274731924), FRAC_CONST(0.94181936741941319), FRAC_CONST(0.94236808055762578), FRAC_CONST(0.94291427069288691), FRAC_CONST(0.94345793636288133), FRAC_CONST(0.94399907611205225), FRAC_CONST(0.9445376884916058), FRAC_CONST(0.94507377205951448), FRAC_CONST(0.94560732538052128), FRAC_CONST(0.94613834702614352), FRAC_CONST(0.94666683557467624), FRAC_CONST(0.94719278961119657), FRAC_CONST(0.94771620772756759), FRAC_CONST(0.94823708852244104), FRAC_CONST(0.94875543060126255), FRAC_CONST(0.94927123257627433), FRAC_CONST(0.94978449306651924), FRAC_CONST(0.95029521069784428), FRAC_CONST(0.9508033841029051), FRAC_CONST(0.95130901192116835), FRAC_CONST(0.9518120927989161), FRAC_CONST(0.95231262538924943), FRAC_CONST(0.95281060835209208), FRAC_CONST(0.95330604035419386), FRAC_CONST(0.95379892006913403), FRAC_CONST(0.95428924617732525), FRAC_CONST(0.95477701736601728), FRAC_CONST(0.95526223232929941), FRAC_CONST(0.95574488976810545), FRAC_CONST(0.95622498839021619), FRAC_CONST(0.95670252691026292), FRAC_CONST(0.95717750404973156), FRAC_CONST(0.95764991853696524), FRAC_CONST(0.95811976910716812), FRAC_CONST(0.95858705450240911), FRAC_CONST(0.95905177347162429), FRAC_CONST(0.95951392477062125), FRAC_CONST(0.95997350716208196), FRAC_CONST(0.96043051941556579), FRAC_CONST(0.96088496030751369), FRAC_CONST(0.96133682862125036), FRAC_CONST(0.96178612314698864), FRAC_CONST(0.96223284268183173), FRAC_CONST(0.9626769860297768), FRAC_CONST(0.96311855200171881), FRAC_CONST(0.96355753941545252), FRAC_CONST(0.96399394709567654), FRAC_CONST(0.96442777387399625), FRAC_CONST(0.96485901858892686), FRAC_CONST(0.96528768008589627), FRAC_CONST(0.96571375721724895), FRAC_CONST(0.96613724884224783), FRAC_CONST(0.96655815382707866), FRAC_CONST(0.96697647104485207), FRAC_CONST(0.96739219937560694), FRAC_CONST(0.96780533770631338), FRAC_CONST(0.96821588493087585), FRAC_CONST(0.9686238399501359), FRAC_CONST(0.96902920167187501), FRAC_CONST(0.96943196901081796), FRAC_CONST(0.96983214088863534), FRAC_CONST(0.9702297162339466), FRAC_CONST(0.97062469398232287), FRAC_CONST(0.97101707307629004), FRAC_CONST(0.97140685246533098), FRAC_CONST(0.97179403110588902), FRAC_CONST(0.97217860796137046), FRAC_CONST(0.97256058200214734), FRAC_CONST(0.97293995220556007), FRAC_CONST(0.97331671755592064), FRAC_CONST(0.97369087704451474), FRAC_CONST(0.97406242966960455), FRAC_CONST(0.97443137443643235), FRAC_CONST(0.97479771035722163), FRAC_CONST(0.97516143645118103), FRAC_CONST(0.97552255174450631), FRAC_CONST(0.97588105527038305), FRAC_CONST(0.97623694606898959), FRAC_CONST(0.97659022318749911), FRAC_CONST(0.97694088568008242), FRAC_CONST(0.97728893260791039), FRAC_CONST(0.97763436303915685), FRAC_CONST(0.97797717604900047), FRAC_CONST(0.97831737071962765), FRAC_CONST(0.97865494614023485), FRAC_CONST(0.97898990140703124), FRAC_CONST(0.97932223562324061), FRAC_CONST(0.97965194789910426), FRAC_CONST(0.9799790373518833), FRAC_CONST(0.98030350310586067), FRAC_CONST(0.98062534429234405), FRAC_CONST(0.98094456004966768), FRAC_CONST(0.98126114952319499), FRAC_CONST(0.98157511186532054), FRAC_CONST(0.98188644623547261), FRAC_CONST(0.98219515180011563), FRAC_CONST(0.98250122773275184), FRAC_CONST(0.98280467321392362), FRAC_CONST(0.98310548743121629), FRAC_CONST(0.98340366957925973), FRAC_CONST(0.98369921885973044), FRAC_CONST(0.98399213448135414), FRAC_CONST(0.98428241565990748), FRAC_CONST(0.98457006161822058), FRAC_CONST(0.98485507158617835), FRAC_CONST(0.98513744480072363), FRAC_CONST(0.98541718050585803), FRAC_CONST(0.98569427795264519), FRAC_CONST(0.98596873639921168), FRAC_CONST(0.98624055511074971), FRAC_CONST(0.98650973335951875), FRAC_CONST(0.98677627042484772), FRAC_CONST(0.98704016559313645), FRAC_CONST(0.98730141815785832), FRAC_CONST(0.98756002741956173), FRAC_CONST(0.9878159926858715), FRAC_CONST(0.98806931327149194), FRAC_CONST(0.98831998849820735), FRAC_CONST(0.98856801769488489), FRAC_CONST(0.98881340019747566), FRAC_CONST(0.98905613534901682), FRAC_CONST(0.98929622249963345), FRAC_CONST(0.98953366100653983), FRAC_CONST(0.98976845023404181), FRAC_CONST(0.99000058955353776), FRAC_CONST(0.99023007834352106), FRAC_CONST(0.99045691598958097), FRAC_CONST(0.99068110188440506), FRAC_CONST(0.99090263542778001), FRAC_CONST(0.99112151602659404), FRAC_CONST(0.99133774309483769), FRAC_CONST(0.99155131605360625), FRAC_CONST(0.99176223433110056), FRAC_CONST(0.99197049736262888), FRAC_CONST(0.99217610459060845), FRAC_CONST(0.99237905546456673), FRAC_CONST(0.99257934944114334), FRAC_CONST(0.99277698598409092), FRAC_CONST(0.99297196456427694), FRAC_CONST(0.99316428465968509), FRAC_CONST(0.99335394575541669), FRAC_CONST(0.99354094734369169), FRAC_CONST(0.99372528892385081), FRAC_CONST(0.99390697000235606), FRAC_CONST(0.99408599009279242), FRAC_CONST(0.99426234871586938), FRAC_CONST(0.99443604539942176), FRAC_CONST(0.99460707967841133), FRAC_CONST(0.99477545109492771), FRAC_CONST(0.99494115919819004), FRAC_CONST(0.99510420354454787), FRAC_CONST(0.99526458369748239), FRAC_CONST(0.99542229922760772), FRAC_CONST(0.99557734971267187), FRAC_CONST(0.9957297347375581), FRAC_CONST(0.99587945389428578), FRAC_CONST(0.99602650678201154), FRAC_CONST(0.99617089300703077), FRAC_CONST(0.996312612182778), FRAC_CONST(0.99645166392982831), FRAC_CONST(0.99658804787589839), FRAC_CONST(0.99672176365584741), FRAC_CONST(0.99685281091167788), FRAC_CONST(0.99698118929253687), FRAC_CONST(0.99710689845471678), FRAC_CONST(0.99722993806165661), FRAC_CONST(0.99735030778394196), FRAC_CONST(0.99746800729930707), FRAC_CONST(0.99758303629263489), FRAC_CONST(0.99769539445595812), FRAC_CONST(0.99780508148846014), FRAC_CONST(0.99791209709647588), FRAC_CONST(0.99801644099349218), FRAC_CONST(0.99811811290014918), FRAC_CONST(0.9982171125442405), FRAC_CONST(0.9983134396607144), FRAC_CONST(0.99840709399167404), FRAC_CONST(0.99849807528637868), FRAC_CONST(0.99858638330124405), FRAC_CONST(0.99867201779984294), FRAC_CONST(0.99875497855290607), FRAC_CONST(0.99883526533832245), FRAC_CONST(0.99891287794114036), FRAC_CONST(0.99898781615356746), FRAC_CONST(0.99906007977497147), FRAC_CONST(0.99912966861188113), FRAC_CONST(0.99919658247798593), FRAC_CONST(0.99926082119413751), FRAC_CONST(0.99932238458834954), FRAC_CONST(0.999381272495798), FRAC_CONST(0.99943748475882255), FRAC_CONST(0.9994910212269259), FRAC_CONST(0.99954188175677483), FRAC_CONST(0.99959006621220048), FRAC_CONST(0.99963557446419837), FRAC_CONST(0.99967840639092931), FRAC_CONST(0.99971856187771946), FRAC_CONST(0.99975604081706027), FRAC_CONST(0.99979084310860955), FRAC_CONST(0.99982296865919107), FRAC_CONST(0.99985241738279484), FRAC_CONST(0.99987918920057806), FRAC_CONST(0.99990328404086426), FRAC_CONST(0.9999247018391445), FRAC_CONST(0.99994344253807688), FRAC_CONST(0.99995950608748674), FRAC_CONST(0.99997289244436727), FRAC_CONST(0.99998360157287902), FRAC_CONST(0.9999916334443506), FRAC_CONST(0.99999698803727821), FRAC_CONST(0.99999966533732598) }; #endif ALIGN static const real_t sine_short_128[] = { FRAC_CONST(0.0061358846491544753), FRAC_CONST(0.01840672990580482), FRAC_CONST(0.030674803176636626), FRAC_CONST(0.04293825693494082), FRAC_CONST(0.055195244349689934), FRAC_CONST(0.067443919563664051), FRAC_CONST(0.079682437971430126), FRAC_CONST(0.091908956497132724), FRAC_CONST(0.10412163387205459), FRAC_CONST(0.11631863091190475), FRAC_CONST(0.12849811079379317), FRAC_CONST(0.14065823933284921), FRAC_CONST(0.15279718525844344), FRAC_CONST(0.16491312048996989), FRAC_CONST(0.17700422041214875), FRAC_CONST(0.18906866414980619), FRAC_CONST(0.2011046348420919), FRAC_CONST(0.21311031991609136), FRAC_CONST(0.22508391135979283), FRAC_CONST(0.2370236059943672), FRAC_CONST(0.24892760574572015), FRAC_CONST(0.26079411791527551), FRAC_CONST(0.27262135544994898), FRAC_CONST(0.28440753721127188), FRAC_CONST(0.29615088824362379), FRAC_CONST(0.30784964004153487), FRAC_CONST(0.31950203081601569), FRAC_CONST(0.33110630575987643), FRAC_CONST(0.34266071731199438), FRAC_CONST(0.35416352542049034), FRAC_CONST(0.36561299780477385), FRAC_CONST(0.37700741021641826), FRAC_CONST(0.38834504669882625), FRAC_CONST(0.39962419984564679), FRAC_CONST(0.41084317105790391), FRAC_CONST(0.42200027079979968), FRAC_CONST(0.43309381885315196), FRAC_CONST(0.4441221445704292), FRAC_CONST(0.45508358712634384), FRAC_CONST(0.46597649576796618), FRAC_CONST(0.47679923006332209), FRAC_CONST(0.487550160148436), FRAC_CONST(0.49822766697278187), FRAC_CONST(0.50883014254310699), FRAC_CONST(0.51935599016558964), FRAC_CONST(0.52980362468629461), FRAC_CONST(0.54017147272989285), FRAC_CONST(0.55045797293660481), FRAC_CONST(0.56066157619733603), FRAC_CONST(0.57078074588696726), FRAC_CONST(0.58081395809576453), FRAC_CONST(0.59075970185887416), FRAC_CONST(0.60061647938386897), FRAC_CONST(0.61038280627630948), FRAC_CONST(0.6200572117632891), FRAC_CONST(0.62963823891492698), FRAC_CONST(0.63912444486377573), FRAC_CONST(0.64851440102211244), FRAC_CONST(0.65780669329707864), FRAC_CONST(0.66699992230363747), FRAC_CONST(0.67609270357531592), FRAC_CONST(0.68508366777270036), FRAC_CONST(0.693971460889654), FRAC_CONST(0.7027547444572253), FRAC_CONST(0.71143219574521643), FRAC_CONST(0.72000250796138165), FRAC_CONST(0.7284643904482252), FRAC_CONST(0.73681656887736979), FRAC_CONST(0.74505778544146595), FRAC_CONST(0.75318679904361241), FRAC_CONST(0.76120238548426178), FRAC_CONST(0.76910333764557959), FRAC_CONST(0.77688846567323244), FRAC_CONST(0.78455659715557524), FRAC_CONST(0.79210657730021239), FRAC_CONST(0.79953726910790501), FRAC_CONST(0.80684755354379922), FRAC_CONST(0.8140363297059483), FRAC_CONST(0.82110251499110465), FRAC_CONST(0.8280450452577558), FRAC_CONST(0.83486287498638001), FRAC_CONST(0.84155497743689833), FRAC_CONST(0.84812034480329712), FRAC_CONST(0.85455798836540053), FRAC_CONST(0.86086693863776731), FRAC_CONST(0.86704624551569265), FRAC_CONST(0.87309497841829009), FRAC_CONST(0.87901222642863341), FRAC_CONST(0.88479709843093779), FRAC_CONST(0.89044872324475788), FRAC_CONST(0.89596624975618511), FRAC_CONST(0.90134884704602203), FRAC_CONST(0.90659570451491533), FRAC_CONST(0.91170603200542988), FRAC_CONST(0.9166790599210427), FRAC_CONST(0.9215140393420419), FRAC_CONST(0.92621024213831127), FRAC_CONST(0.93076696107898371), FRAC_CONST(0.9351835099389475), FRAC_CONST(0.93945922360218992), FRAC_CONST(0.94359345816196039), FRAC_CONST(0.94758559101774109), FRAC_CONST(0.95143502096900834), FRAC_CONST(0.95514116830577067), FRAC_CONST(0.9587034748958716), FRAC_CONST(0.96212140426904158), FRAC_CONST(0.9653944416976894), FRAC_CONST(0.96852209427441727), FRAC_CONST(0.97150389098625178), FRAC_CONST(0.97433938278557586), FRAC_CONST(0.97702814265775439), FRAC_CONST(0.97956976568544052), FRAC_CONST(0.98196386910955524), FRAC_CONST(0.98421009238692903), FRAC_CONST(0.98630809724459867), FRAC_CONST(0.98825756773074946), FRAC_CONST(0.99005821026229712), FRAC_CONST(0.99170975366909953), FRAC_CONST(0.9932119492347945), FRAC_CONST(0.99456457073425542), FRAC_CONST(0.99576741446765982), FRAC_CONST(0.99682029929116567), FRAC_CONST(0.99772306664419164), FRAC_CONST(0.99847558057329477), FRAC_CONST(0.99907772775264536), FRAC_CONST(0.99952941750109314), FRAC_CONST(0.9998305817958234), FRAC_CONST(0.99998117528260111) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_short_120[] = { FRAC_CONST(0.0065449379673518581), FRAC_CONST(0.019633692460628301), FRAC_CONST(0.032719082821776137), FRAC_CONST(0.045798866936520771), FRAC_CONST(0.058870803651189033), FRAC_CONST(0.071932653156719387), FRAC_CONST(0.084982177372441667), FRAC_CONST(0.09801714032956059), FRAC_CONST(0.11103530855427769), FRAC_CONST(0.12403445145048532), FRAC_CONST(0.13701234168196802), FRAC_CONST(0.14996675555404498), FRAC_CONST(0.16289547339458874), FRAC_CONST(0.17579627993435451), FRAC_CONST(0.18866696468655525), FRAC_CONST(0.2015053223256171), FRAC_CONST(0.21430915306505074), FRAC_CONST(0.2270762630343732), FRAC_CONST(0.23980446465501654), FRAC_CONST(0.25249157701515795), FRAC_CONST(0.26513542624340797), FRAC_CONST(0.27773384588129219), FRAC_CONST(0.29028467725446233), FRAC_CONST(0.3027857698425746), FRAC_CONST(0.31523498164776964), FRAC_CONST(0.32763017956169349), FRAC_CONST(0.33996923973099424), FRAC_CONST(0.35225004792123354), FRAC_CONST(0.36447049987914965), FRAC_CONST(0.37662850169321077), FRAC_CONST(0.38872197015239557), FRAC_CONST(0.40074883310314097), FRAC_CONST(0.41270702980439467), FRAC_CONST(0.42459451128071307), FRAC_CONST(0.43640924067334208), FRAC_CONST(0.44814919358922256), FRAC_CONST(0.45981235844785984), FRAC_CONST(0.47139673682599764), FRAC_CONST(0.48290034380003727), FRAC_CONST(0.49432120828614462), FRAC_CONST(0.50565737337798455), FRAC_CONST(0.51690689668202761), FRAC_CONST(0.52806785065036799), FRAC_CONST(0.53913832291100017), FRAC_CONST(0.55011641659549337), FRAC_CONST(0.56100025066400983), FRAC_CONST(0.57178796022761225), FRAC_CONST(0.58247769686780215), FRAC_CONST(0.59306762895323706), FRAC_CONST(0.60355594195357143), FRAC_CONST(0.61394083875036642), FRAC_CONST(0.62422053994501758), FRAC_CONST(0.63439328416364549), FRAC_CONST(0.64445732835889735), FRAC_CONST(0.65441094810861034), FRAC_CONST(0.66425243791128175), FRAC_CONST(0.67398011147829784), FRAC_CONST(0.68359230202287125), FRAC_CONST(0.69308736254563585), FRAC_CONST(0.70246366611685174), FRAC_CONST(0.71171960615517138), FRAC_CONST(0.72085359670291882), FRAC_CONST(0.7298640726978356), FRAC_CONST(0.73874949024124625), FRAC_CONST(0.74750832686259672), FRAC_CONST(0.75613908178032285), FRAC_CONST(0.76464027615900032), FRAC_CONST(0.77301045336273699), FRAC_CONST(0.78124817920475853), FRAC_CONST(0.78935204219315003), FRAC_CONST(0.79732065377270711), FRAC_CONST(0.80515264856285829), FRAC_CONST(0.81284668459161513), FRAC_CONST(0.82040144352551359), FRAC_CONST(0.82781563089550203), FRAC_CONST(0.83508797631874299), FRAC_CONST(0.84221723371628654), FRAC_CONST(0.84920218152657889), FRAC_CONST(0.85604162291477137), FRAC_CONST(0.86273438597779184), FRAC_CONST(0.86927932394514362), FRAC_CONST(0.87567531537539967), FRAC_CONST(0.88192126434835494), FRAC_CONST(0.88801610065280734), FRAC_CONST(0.89395877996993212), FRAC_CONST(0.8997482840522214), FRAC_CONST(0.90538362089795521), FRAC_CONST(0.91086382492117568), FRAC_CONST(0.91618795711713596), FRAC_CONST(0.92135510522319242), FRAC_CONST(0.9263643838751181), FRAC_CONST(0.93121493475880346), FRAC_CONST(0.93590592675732565), FRAC_CONST(0.94043655609335486), FRAC_CONST(0.94480604646687805), FRAC_CONST(0.94901364918821385), FRAC_CONST(0.95305864330629697), FRAC_CONST(0.95694033573220882), FRAC_CONST(0.9606580613579353), FRAC_CONST(0.96421118317032928), FRAC_CONST(0.96759909236025976), FRAC_CONST(0.9708212084269281), FRAC_CONST(0.97387697927733363), FRAC_CONST(0.97676588132087239), FRAC_CONST(0.97948741955905139), FRAC_CONST(0.98204112767030394), FRAC_CONST(0.98442656808989171), FRAC_CONST(0.98664333208487898), FRAC_CONST(0.98869103982416728), FRAC_CONST(0.99056934044357725), FRAC_CONST(0.99227791210596705), FRAC_CONST(0.99381646205637808), FRAC_CONST(0.99518472667219682), FRAC_CONST(0.99638247150832537), FRAC_CONST(0.99740949133735191), FRAC_CONST(0.99826561018471593), FRAC_CONST(0.99895068135886012), FRAC_CONST(0.99946458747636568), FRAC_CONST(0.99980724048206482), FRAC_CONST(0.99997858166412923) }; #endif #ifdef LD_DEC ALIGN static const real_t sine_mid_512[] = { FRAC_CONST(0.0015339801862847655), FRAC_CONST(0.0046019261204485705), FRAC_CONST(0.007669828739531097), FRAC_CONST(0.010737659167264491), FRAC_CONST(0.013805388528060391), FRAC_CONST(0.01687298794728171), FRAC_CONST(0.019940428551514441), FRAC_CONST(0.023007681468839369), FRAC_CONST(0.026074717829103901), FRAC_CONST(0.029141508764193722), FRAC_CONST(0.032208025408304586), FRAC_CONST(0.035274238898213947), FRAC_CONST(0.038340120373552694), FRAC_CONST(0.041405640977076739), FRAC_CONST(0.044470771854938668), FRAC_CONST(0.047535484156959303), FRAC_CONST(0.050599749036899282), FRAC_CONST(0.05366353765273052), FRAC_CONST(0.056726821166907748), FRAC_CONST(0.059789570746639868), FRAC_CONST(0.062851757564161406), FRAC_CONST(0.065913352797003805), FRAC_CONST(0.068974327628266746), FRAC_CONST(0.072034653246889332), FRAC_CONST(0.075094300847921305), FRAC_CONST(0.078153241632794232), FRAC_CONST(0.081211446809592441), FRAC_CONST(0.084268887593324071), FRAC_CONST(0.087325535206192059), FRAC_CONST(0.090381360877864983), FRAC_CONST(0.093436335845747787), FRAC_CONST(0.096490431355252593), FRAC_CONST(0.099543618660069319), FRAC_CONST(0.10259586902243628), FRAC_CONST(0.10564715371341062), FRAC_CONST(0.10869744401313872), FRAC_CONST(0.11174671121112659), FRAC_CONST(0.11479492660651008), FRAC_CONST(0.11784206150832498), FRAC_CONST(0.12088808723577708), FRAC_CONST(0.12393297511851216), FRAC_CONST(0.12697669649688587), FRAC_CONST(0.13001922272223335), FRAC_CONST(0.13306052515713906), FRAC_CONST(0.1361005751757062), FRAC_CONST(0.1391393441638262), FRAC_CONST(0.14217680351944803), FRAC_CONST(0.14521292465284746), FRAC_CONST(0.14824767898689603), FRAC_CONST(0.15128103795733022), FRAC_CONST(0.1543129730130201), FRAC_CONST(0.15734345561623825), FRAC_CONST(0.16037245724292828), FRAC_CONST(0.16339994938297323), FRAC_CONST(0.1664259035404641), FRAC_CONST(0.16945029123396796), FRAC_CONST(0.17247308399679595), FRAC_CONST(0.17549425337727143), FRAC_CONST(0.17851377093899751), FRAC_CONST(0.18153160826112497), FRAC_CONST(0.18454773693861962), FRAC_CONST(0.1875621285825296), FRAC_CONST(0.19057475482025274), FRAC_CONST(0.19358558729580361), FRAC_CONST(0.19659459767008022), FRAC_CONST(0.19960175762113097), FRAC_CONST(0.20260703884442113), FRAC_CONST(0.20561041305309924), FRAC_CONST(0.20861185197826349), FRAC_CONST(0.21161132736922755), FRAC_CONST(0.21460881099378676), FRAC_CONST(0.21760427463848364), FRAC_CONST(0.22059769010887351), FRAC_CONST(0.22358902922978999), FRAC_CONST(0.22657826384561), FRAC_CONST(0.22956536582051887), FRAC_CONST(0.23255030703877524), FRAC_CONST(0.23553305940497549), FRAC_CONST(0.23851359484431842), FRAC_CONST(0.24149188530286933), FRAC_CONST(0.24446790274782415), FRAC_CONST(0.24744161916777327), FRAC_CONST(0.25041300657296522), FRAC_CONST(0.25338203699557016), FRAC_CONST(0.25634868248994291), FRAC_CONST(0.25931291513288623), FRAC_CONST(0.26227470702391359), FRAC_CONST(0.26523403028551179), FRAC_CONST(0.26819085706340318), FRAC_CONST(0.27114515952680801), FRAC_CONST(0.27409690986870638), FRAC_CONST(0.2770460803060999), FRAC_CONST(0.27999264308027322), FRAC_CONST(0.28293657045705539), FRAC_CONST(0.28587783472708062), FRAC_CONST(0.28881640820604948), FRAC_CONST(0.29175226323498926), FRAC_CONST(0.29468537218051433), FRAC_CONST(0.2976157074350862), FRAC_CONST(0.30054324141727345), FRAC_CONST(0.30346794657201132), FRAC_CONST(0.30638979537086092), FRAC_CONST(0.30930876031226873), FRAC_CONST(0.31222481392182488), FRAC_CONST(0.31513792875252244), FRAC_CONST(0.31804807738501495), FRAC_CONST(0.32095523242787521), FRAC_CONST(0.32385936651785285), FRAC_CONST(0.32676045232013173), FRAC_CONST(0.32965846252858749), FRAC_CONST(0.33255336986604422), FRAC_CONST(0.3354451470845316), FRAC_CONST(0.33833376696554113), FRAC_CONST(0.34121920232028236), FRAC_CONST(0.34410142598993881), FRAC_CONST(0.34698041084592368), FRAC_CONST(0.34985612979013492), FRAC_CONST(0.35272855575521073), FRAC_CONST(0.35559766170478385), FRAC_CONST(0.35846342063373654), FRAC_CONST(0.36132580556845428), FRAC_CONST(0.36418478956707989), FRAC_CONST(0.36704034571976718), FRAC_CONST(0.3698924471489341), FRAC_CONST(0.37274106700951576), FRAC_CONST(0.37558617848921722), FRAC_CONST(0.37842775480876556), FRAC_CONST(0.38126576922216238), FRAC_CONST(0.38410019501693504), FRAC_CONST(0.38693100551438858), FRAC_CONST(0.38975817406985641), FRAC_CONST(0.39258167407295147), FRAC_CONST(0.39540147894781635), FRAC_CONST(0.39821756215337356), FRAC_CONST(0.40102989718357562), FRAC_CONST(0.40383845756765407), FRAC_CONST(0.40664321687036903), FRAC_CONST(0.40944414869225759), FRAC_CONST(0.41224122666988289), FRAC_CONST(0.41503442447608163), FRAC_CONST(0.41782371582021227), FRAC_CONST(0.42060907444840251), FRAC_CONST(0.42339047414379605), FRAC_CONST(0.42616788872679962), FRAC_CONST(0.42894129205532949), FRAC_CONST(0.43171065802505726), FRAC_CONST(0.43447596056965565), FRAC_CONST(0.43723717366104409), FRAC_CONST(0.43999427130963326), FRAC_CONST(0.44274722756457002), FRAC_CONST(0.44549601651398174), FRAC_CONST(0.44824061228521989), FRAC_CONST(0.45098098904510386), FRAC_CONST(0.45371712100016387), FRAC_CONST(0.45644898239688392), FRAC_CONST(0.45917654752194409), FRAC_CONST(0.46189979070246273), FRAC_CONST(0.46461868630623782), FRAC_CONST(0.46733320874198842), FRAC_CONST(0.47004333245959562), FRAC_CONST(0.47274903195034279), FRAC_CONST(0.47545028174715587), FRAC_CONST(0.47814705642484301), FRAC_CONST(0.48083933060033396), FRAC_CONST(0.48352707893291874), FRAC_CONST(0.48621027612448642), FRAC_CONST(0.48888889691976317), FRAC_CONST(0.4915629161065499), FRAC_CONST(0.49423230851595967), FRAC_CONST(0.49689704902265447), FRAC_CONST(0.49955711254508184), FRAC_CONST(0.50221247404571079), FRAC_CONST(0.50486310853126759), FRAC_CONST(0.50750899105297087), FRAC_CONST(0.51015009670676681), FRAC_CONST(0.51278640063356296), FRAC_CONST(0.51541787801946293), FRAC_CONST(0.51804450409599934), FRAC_CONST(0.52066625414036716), FRAC_CONST(0.52328310347565643), FRAC_CONST(0.52589502747108463), FRAC_CONST(0.52850200154222848), FRAC_CONST(0.531104001151255), FRAC_CONST(0.53370100180715296), FRAC_CONST(0.53629297906596318), FRAC_CONST(0.53887990853100842), FRAC_CONST(0.54146176585312344), FRAC_CONST(0.54403852673088382), FRAC_CONST(0.54661016691083486), FRAC_CONST(0.54917666218771966), FRAC_CONST(0.55173798840470734), FRAC_CONST(0.55429412145362), FRAC_CONST(0.5568450372751601), FRAC_CONST(0.55939071185913614), FRAC_CONST(0.56193112124468947), FRAC_CONST(0.5644662415205195), FRAC_CONST(0.56699604882510868), FRAC_CONST(0.56952051934694714), FRAC_CONST(0.57203962932475705), FRAC_CONST(0.57455335504771576), FRAC_CONST(0.57706167285567944), FRAC_CONST(0.57956455913940563), FRAC_CONST(0.58206199034077544), FRAC_CONST(0.58455394295301533), FRAC_CONST(0.58704039352091797), FRAC_CONST(0.58952131864106394), FRAC_CONST(0.59199669496204099), FRAC_CONST(0.59446649918466443), FRAC_CONST(0.5969307080621965), FRAC_CONST(0.59938929840056454), FRAC_CONST(0.60184224705858003), FRAC_CONST(0.60428953094815596), FRAC_CONST(0.60673112703452448), FRAC_CONST(0.60916701233645321), FRAC_CONST(0.61159716392646191), FRAC_CONST(0.61402155893103838), FRAC_CONST(0.61644017453085365), FRAC_CONST(0.61885298796097632), FRAC_CONST(0.62125997651108755), FRAC_CONST(0.62366111752569453), FRAC_CONST(0.62605638840434352), FRAC_CONST(0.62844576660183271), FRAC_CONST(0.63082922962842447), FRAC_CONST(0.63320675505005719), FRAC_CONST(0.63557832048855611), FRAC_CONST(0.63794390362184406), FRAC_CONST(0.64030348218415167), FRAC_CONST(0.64265703396622686), FRAC_CONST(0.64500453681554393), FRAC_CONST(0.64734596863651206), FRAC_CONST(0.64968130739068319), FRAC_CONST(0.6520105310969595), FRAC_CONST(0.65433361783180044), FRAC_CONST(0.65665054572942894), FRAC_CONST(0.65896129298203732), FRAC_CONST(0.66126583783999227), FRAC_CONST(0.66356415861203977), FRAC_CONST(0.66585623366550972), FRAC_CONST(0.66814204142651845), FRAC_CONST(0.67042156038017309), FRAC_CONST(0.67269476907077286), FRAC_CONST(0.67496164610201193), FRAC_CONST(0.67722217013718033), FRAC_CONST(0.67947631989936497), FRAC_CONST(0.68172407417164971), FRAC_CONST(0.6839654117973154), FRAC_CONST(0.68620031168003859), FRAC_CONST(0.68842875278409044), FRAC_CONST(0.6906507141345346), FRAC_CONST(0.69286617481742463), FRAC_CONST(0.69507511398000088), FRAC_CONST(0.69727751083088652), FRAC_CONST(0.69947334464028377), FRAC_CONST(0.70166259474016845), FRAC_CONST(0.70384524052448494), FRAC_CONST(0.70602126144933974), FRAC_CONST(0.70819063703319529), FRAC_CONST(0.71035334685706231), FRAC_CONST(0.71250937056469232), FRAC_CONST(0.71465868786276898), FRAC_CONST(0.71680127852109954), FRAC_CONST(0.71893712237280438), FRAC_CONST(0.72106619931450811), FRAC_CONST(0.72318848930652735), FRAC_CONST(0.72530397237306066), FRAC_CONST(0.72741262860237577), FRAC_CONST(0.7295144381469969), FRAC_CONST(0.73160938122389252), FRAC_CONST(0.73369743811466026), FRAC_CONST(0.73577858916571348), FRAC_CONST(0.73785281478846598), FRAC_CONST(0.73992009545951609), FRAC_CONST(0.74198041172083096), FRAC_CONST(0.74403374417992918), FRAC_CONST(0.74608007351006378), FRAC_CONST(0.74811938045040349), FRAC_CONST(0.75015164580621496), FRAC_CONST(0.7521768504490427), FRAC_CONST(0.75419497531688917), FRAC_CONST(0.75620600141439454), FRAC_CONST(0.75820990981301528), FRAC_CONST(0.76020668165120242), FRAC_CONST(0.7621962981345789), FRAC_CONST(0.76417874053611667), FRAC_CONST(0.76615399019631281), FRAC_CONST(0.76812202852336531), FRAC_CONST(0.7700828369933479), FRAC_CONST(0.77203639715038441), FRAC_CONST(0.77398269060682279), FRAC_CONST(0.77592169904340758), FRAC_CONST(0.77785340420945304), FRAC_CONST(0.77977778792301444), FRAC_CONST(0.78169483207105939), FRAC_CONST(0.7836045186096382), FRAC_CONST(0.78550682956405393), FRAC_CONST(0.78740174702903132), FRAC_CONST(0.78928925316888565), FRAC_CONST(0.79116933021769009), FRAC_CONST(0.79304196047944364), FRAC_CONST(0.79490712632823701), FRAC_CONST(0.79676481020841872), FRAC_CONST(0.79861499463476082), FRAC_CONST(0.80045766219262271), FRAC_CONST(0.80229279553811572), FRAC_CONST(0.8041203773982657), FRAC_CONST(0.80594039057117628), FRAC_CONST(0.80775281792619036), FRAC_CONST(0.80955764240405126), FRAC_CONST(0.81135484701706373), FRAC_CONST(0.81314441484925359), FRAC_CONST(0.81492632905652662), FRAC_CONST(0.81670057286682785), FRAC_CONST(0.81846712958029866), FRAC_CONST(0.82022598256943469), FRAC_CONST(0.82197711527924155), FRAC_CONST(0.82372051122739132), FRAC_CONST(0.82545615400437744), FRAC_CONST(0.82718402727366902), FRAC_CONST(0.82890411477186487), FRAC_CONST(0.8306164003088462), FRAC_CONST(0.83232086776792968), FRAC_CONST(0.83401750110601813), FRAC_CONST(0.8357062843537526), FRAC_CONST(0.83738720161566194), FRAC_CONST(0.83906023707031263), FRAC_CONST(0.84072537497045807), FRAC_CONST(0.84238259964318596), FRAC_CONST(0.84403189549006641), FRAC_CONST(0.84567324698729907), FRAC_CONST(0.84730663868585832), FRAC_CONST(0.84893205521163961), FRAC_CONST(0.85054948126560337), FRAC_CONST(0.85215890162391983), FRAC_CONST(0.8537603011381113), FRAC_CONST(0.85535366473519603), FRAC_CONST(0.85693897741782865), FRAC_CONST(0.85851622426444274), FRAC_CONST(0.86008539042939014), FRAC_CONST(0.8616464611430813), FRAC_CONST(0.86319942171212416), FRAC_CONST(0.86474425751946238), FRAC_CONST(0.86628095402451299), FRAC_CONST(0.86780949676330321), FRAC_CONST(0.86932987134860673), FRAC_CONST(0.87084206347007886), FRAC_CONST(0.87234605889439154), FRAC_CONST(0.87384184346536675), FRAC_CONST(0.87532940310411078), FRAC_CONST(0.87680872380914576), FRAC_CONST(0.87827979165654146), FRAC_CONST(0.87974259280004741), FRAC_CONST(0.88119711347122198), FRAC_CONST(0.88264333997956279), FRAC_CONST(0.88408125871263499), FRAC_CONST(0.88551085613619995), FRAC_CONST(0.88693211879434208), FRAC_CONST(0.88834503330959624), FRAC_CONST(0.88974958638307289), FRAC_CONST(0.89114576479458318), FRAC_CONST(0.89253355540276469), FRAC_CONST(0.89391294514520325), FRAC_CONST(0.89528392103855758), FRAC_CONST(0.89664647017868015), FRAC_CONST(0.89800057974073988), FRAC_CONST(0.89934623697934146), FRAC_CONST(0.90068342922864686), FRAC_CONST(0.90201214390249307), FRAC_CONST(0.90333236849451182), FRAC_CONST(0.90464409057824624), FRAC_CONST(0.90594729780726846), FRAC_CONST(0.90724197791529593), FRAC_CONST(0.90852811871630612), FRAC_CONST(0.90980570810465222), FRAC_CONST(0.91107473405517625), FRAC_CONST(0.91233518462332275), FRAC_CONST(0.91358704794525081), FRAC_CONST(0.91483031223794609), FRAC_CONST(0.91606496579933161), FRAC_CONST(0.91729099700837791), FRAC_CONST(0.91850839432521225), FRAC_CONST(0.91971714629122736), FRAC_CONST(0.92091724152918952), FRAC_CONST(0.92210866874334507), FRAC_CONST(0.92329141671952764), FRAC_CONST(0.9244654743252626), FRAC_CONST(0.92563083050987272), FRAC_CONST(0.92678747430458175), FRAC_CONST(0.92793539482261789), FRAC_CONST(0.92907458125931575), FRAC_CONST(0.93020502289221907), FRAC_CONST(0.93132670908118043), FRAC_CONST(0.93243962926846236), FRAC_CONST(0.93354377297883617), FRAC_CONST(0.93463912981968078), FRAC_CONST(0.93572568948108037), FRAC_CONST(0.93680344173592156), FRAC_CONST(0.93787237643998989), FRAC_CONST(0.93893248353206449), FRAC_CONST(0.93998375303401394), FRAC_CONST(0.94102617505088926), FRAC_CONST(0.94205973977101731), FRAC_CONST(0.94308443746609349), FRAC_CONST(0.94410025849127266), FRAC_CONST(0.94510719328526061), FRAC_CONST(0.94610523237040334), FRAC_CONST(0.94709436635277722), FRAC_CONST(0.94807458592227623), FRAC_CONST(0.94904588185270056), FRAC_CONST(0.950008245001843), FRAC_CONST(0.95096166631157508), FRAC_CONST(0.95190613680793223), FRAC_CONST(0.95284164760119872), FRAC_CONST(0.95376818988599033), FRAC_CONST(0.95468575494133834), FRAC_CONST(0.95559433413077111), FRAC_CONST(0.95649391890239499), FRAC_CONST(0.95738450078897586), FRAC_CONST(0.95826607140801767), FRAC_CONST(0.95913862246184189), FRAC_CONST(0.96000214573766585), FRAC_CONST(0.96085663310767966), FRAC_CONST(0.96170207652912254), FRAC_CONST(0.96253846804435916), FRAC_CONST(0.96336579978095405), FRAC_CONST(0.96418406395174572), FRAC_CONST(0.96499325285492032), FRAC_CONST(0.96579335887408357), FRAC_CONST(0.96658437447833312), FRAC_CONST(0.96736629222232851), FRAC_CONST(0.96813910474636233), FRAC_CONST(0.96890280477642887), FRAC_CONST(0.96965738512429245), FRAC_CONST(0.9704028386875555), FRAC_CONST(0.97113915844972509), FRAC_CONST(0.9718663374802794), FRAC_CONST(0.97258436893473221), FRAC_CONST(0.97329324605469825), FRAC_CONST(0.97399296216795583), FRAC_CONST(0.97468351068851067), FRAC_CONST(0.97536488511665687), FRAC_CONST(0.97603707903903902), FRAC_CONST(0.97670008612871184), FRAC_CONST(0.97735390014519996), FRAC_CONST(0.97799851493455714), FRAC_CONST(0.9786339244294231), FRAC_CONST(0.97926012264908202), FRAC_CONST(0.97987710369951764), FRAC_CONST(0.98048486177346938), FRAC_CONST(0.98108339115048659), FRAC_CONST(0.98167268619698311), FRAC_CONST(0.98225274136628937), FRAC_CONST(0.98282355119870524), FRAC_CONST(0.98338511032155118), FRAC_CONST(0.98393741344921892), FRAC_CONST(0.98448045538322093), FRAC_CONST(0.98501423101223984), FRAC_CONST(0.98553873531217606), FRAC_CONST(0.98605396334619544), FRAC_CONST(0.98655991026477541), FRAC_CONST(0.98705657130575097), FRAC_CONST(0.98754394179435923), FRAC_CONST(0.98802201714328353), FRAC_CONST(0.98849079285269659), FRAC_CONST(0.98895026451030299), FRAC_CONST(0.98940042779138038), FRAC_CONST(0.98984127845882053), FRAC_CONST(0.99027281236316911), FRAC_CONST(0.99069502544266463), FRAC_CONST(0.99110791372327678), FRAC_CONST(0.9915114733187439), FRAC_CONST(0.99190570043060933), FRAC_CONST(0.99229059134825737), FRAC_CONST(0.99266614244894802), FRAC_CONST(0.99303235019785141), FRAC_CONST(0.99338921114808065), FRAC_CONST(0.9937367219407246), FRAC_CONST(0.99407487930487937), FRAC_CONST(0.9944036800576791), FRAC_CONST(0.9947231211043257), FRAC_CONST(0.99503319943811863), FRAC_CONST(0.99533391214048228), FRAC_CONST(0.99562525638099431), FRAC_CONST(0.99590722941741172), FRAC_CONST(0.99617982859569687), FRAC_CONST(0.99644305135004263), FRAC_CONST(0.99669689520289606), FRAC_CONST(0.99694135776498216), FRAC_CONST(0.99717643673532619), FRAC_CONST(0.9974021299012753), FRAC_CONST(0.99761843513851955), FRAC_CONST(0.99782535041111164), FRAC_CONST(0.99802287377148624), FRAC_CONST(0.99821100336047819), FRAC_CONST(0.99838973740734016), FRAC_CONST(0.99855907422975931), FRAC_CONST(0.99871901223387294), FRAC_CONST(0.99886954991428356), FRAC_CONST(0.99901068585407338), FRAC_CONST(0.99914241872481691), FRAC_CONST(0.99926474728659442), FRAC_CONST(0.99937767038800285), FRAC_CONST(0.99948118696616695), FRAC_CONST(0.99957529604674922), FRAC_CONST(0.99965999674395922), FRAC_CONST(0.99973528826056168), FRAC_CONST(0.99980116988788426), FRAC_CONST(0.99985764100582386), FRAC_CONST(0.9999047010828529), FRAC_CONST(0.99994234967602391), FRAC_CONST(0.99997058643097414), FRAC_CONST(0.9999894110819284), FRAC_CONST(0.99999882345170188) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_mid_480[] = { FRAC_CONST(0.0016362454436240478), FRAC_CONST(0.00490871880799799), FRAC_CONST(0.0081811396039371282), FRAC_CONST(0.011453472786443779), FRAC_CONST(0.014725683311458524), FRAC_CONST(0.017997736136235509), FRAC_CONST(0.021269596219717739), FRAC_CONST(0.024541228522912285), FRAC_CONST(0.027812598009265607), FRAC_CONST(0.03108366964503869), FRAC_CONST(0.034354408399682276), FRAC_CONST(0.037624779246211978), FRAC_CONST(0.04089474716158345), FRAC_CONST(0.044164277127067358), FRAC_CONST(0.047433334128624507), FRAC_CONST(0.050701883157280733), FRAC_CONST(0.053969889209501881), FRAC_CONST(0.057237317287568618), FRAC_CONST(0.060504132399951269), FRAC_CONST(0.063770299561684493), FRAC_CONST(0.06703578379474201), FRAC_CONST(0.070300550128411174), FRAC_CONST(0.073564563599667426), FRAC_CONST(0.076827789253548759), FRAC_CONST(0.080090192143530081), FRAC_CONST(0.083351737331897449), FRAC_CONST(0.086612389890122182), FRAC_CONST(0.089872114899234967), FRAC_CONST(0.093130877450199795), FRAC_CONST(0.096388642644287828), FRAC_CONST(0.09964537559345106), FRAC_CONST(0.1029010414206961), FRAC_CONST(0.10615560526045748), FRAC_CONST(0.10940903225897117), FRAC_CONST(0.11266128757464781), FRAC_CONST(0.11591233637844581), FRAC_CONST(0.11916214385424433), FRAC_CONST(0.1224106751992162), FRAC_CONST(0.12565789562420052), FRAC_CONST(0.12890377035407541), FRAC_CONST(0.13214826462813015), FRAC_CONST(0.13539134370043773), FRAC_CONST(0.13863297284022669), FRAC_CONST(0.14187311733225325), FRAC_CONST(0.14511174247717309), FRAC_CONST(0.14834881359191271), FRAC_CONST(0.15158429601004111), FRAC_CONST(0.15481815508214106), FRAC_CONST(0.1580503561761798), FRAC_CONST(0.16128086467788047), FRAC_CONST(0.16450964599109233), FRAC_CONST(0.16773666553816149), FRAC_CONST(0.17096188876030122), FRAC_CONST(0.17418528111796186), FRAC_CONST(0.17740680809120093), FRAC_CONST(0.18062643518005275), FRAC_CONST(0.18384412790489776), FRAC_CONST(0.18705985180683199), FRAC_CONST(0.19027357244803589), FRAC_CONST(0.19348525541214331), FRAC_CONST(0.19669486630460997), FRAC_CONST(0.19990237075308173), FRAC_CONST(0.20310773440776286), FRAC_CONST(0.20631092294178383), FRAC_CONST(0.20951190205156878), FRAC_CONST(0.21271063745720317), FRAC_CONST(0.21590709490280058), FRAC_CONST(0.2191012401568698), FRAC_CONST(0.22229303901268133), FRAC_CONST(0.22548245728863364), FRAC_CONST(0.22866946082861941), FRAC_CONST(0.23185401550239115), FRAC_CONST(0.23503608720592667), FRAC_CONST(0.23821564186179459), FRAC_CONST(0.24139264541951888), FRAC_CONST(0.24456706385594387), FRAC_CONST(0.24773886317559846), FRAC_CONST(0.25090800941106001), FRAC_CONST(0.25407446862331851), FRAC_CONST(0.25723820690213967), FRAC_CONST(0.26039919036642817), FRAC_CONST(0.26355738516459076), FRAC_CONST(0.26671275747489837), FRAC_CONST(0.2698652735058486), FRAC_CONST(0.27301489949652735), FRAC_CONST(0.27616160171697068), FRAC_CONST(0.27930534646852595), FRAC_CONST(0.28244610008421245), FRAC_CONST(0.2855838289290823), FRAC_CONST(0.28871849940058025), FRAC_CONST(0.29185007792890405), FRAC_CONST(0.29497853097736348), FRAC_CONST(0.2981038250427398), FRAC_CONST(0.30122592665564446), FRAC_CONST(0.30434480238087736), FRAC_CONST(0.30746041881778519), FRAC_CONST(0.31057274260061901), FRAC_CONST(0.31368174039889146), FRAC_CONST(0.31678737891773395), FRAC_CONST(0.31988962489825296), FRAC_CONST(0.32298844511788638), FRAC_CONST(0.32608380639075912), FRAC_CONST(0.32917567556803889), FRAC_CONST(0.33226401953829071), FRAC_CONST(0.33534880522783189), FRAC_CONST(0.33842999960108583), FRAC_CONST(0.34150756966093632), FRAC_CONST(0.34458148244908043), FRAC_CONST(0.34765170504638188), FRAC_CONST(0.35071820457322322), FRAC_CONST(0.35378094818985806), FRAC_CONST(0.35683990309676283), FRAC_CONST(0.35989503653498811), FRAC_CONST(0.36294631578650921), FRAC_CONST(0.36599370817457672), FRAC_CONST(0.36903718106406647), FRAC_CONST(0.37207670186182878), FRAC_CONST(0.37511223801703802), FRAC_CONST(0.37814375702154046), FRAC_CONST(0.38117122641020335), FRAC_CONST(0.38419461376126157), FRAC_CONST(0.38721388669666562), FRAC_CONST(0.39022901288242801), FRAC_CONST(0.39323996002896966), FRAC_CONST(0.39624669589146555), FRAC_CONST(0.39924918827019029), FRAC_CONST(0.40224740501086254), FRAC_CONST(0.40524131400498986), FRAC_CONST(0.40823088319021217), FRAC_CONST(0.41121608055064529), FRAC_CONST(0.41419687411722372), FRAC_CONST(0.41717323196804335), FRAC_CONST(0.42014512222870243), FRAC_CONST(0.42311251307264408), FRAC_CONST(0.42607537272149631), FRAC_CONST(0.4290336694454126), FRAC_CONST(0.43198737156341183), FRAC_CONST(0.43493644744371707), FRAC_CONST(0.43788086550409511), FRAC_CONST(0.44082059421219388), FRAC_CONST(0.44375560208588088), FRAC_CONST(0.44668585769357955), FRAC_CONST(0.4496113296546066), FRAC_CONST(0.45253198663950756), FRAC_CONST(0.45544779737039259), FRAC_CONST(0.45835873062127125), FRAC_CONST(0.46126475521838717), FRAC_CONST(0.46416584004055156), FRAC_CONST(0.46706195401947659), FRAC_CONST(0.46995306614010829), FRAC_CONST(0.47283914544095862), FRAC_CONST(0.47572016101443682), FRAC_CONST(0.47859608200718085), FRAC_CONST(0.4814668776203872), FRAC_CONST(0.48433251711014125), FRAC_CONST(0.4871929697877464), FRAC_CONST(0.49004820502005247), FRAC_CONST(0.49289819222978404), FRAC_CONST(0.49574290089586776), FRAC_CONST(0.49858230055375902), FRAC_CONST(0.50141636079576901), FRAC_CONST(0.50424505127138919), FRAC_CONST(0.50706834168761705), FRAC_CONST(0.50988620180928057), FRAC_CONST(0.51269860145936175), FRAC_CONST(0.51550551051931948), FRAC_CONST(0.51830689892941317), FRAC_CONST(0.5211027366890234), FRAC_CONST(0.52389299385697385), FRAC_CONST(0.52667764055185196), FRAC_CONST(0.52945664695232897), FRAC_CONST(0.53222998329747884), FRAC_CONST(0.53499761988709726), FRAC_CONST(0.53775952708201991), FRAC_CONST(0.54051567530443978), FRAC_CONST(0.54326603503822357), FRAC_CONST(0.54601057682922816), FRAC_CONST(0.54874927128561579), FRAC_CONST(0.55148208907816942), FRAC_CONST(0.55420900094060566), FRAC_CONST(0.55692997766988939), FRAC_CONST(0.559644990126546), FRAC_CONST(0.56235400923497314), FRAC_CONST(0.56505700598375252), FRAC_CONST(0.56775395142596052), FRAC_CONST(0.57044481667947822), FRAC_CONST(0.57312957292730071), FRAC_CONST(0.57580819141784534), FRAC_CONST(0.57848064346525996), FRAC_CONST(0.58114690044973039), FRAC_CONST(0.58380693381778626), FRAC_CONST(0.58646071508260733), FRAC_CONST(0.58910821582432815), FRAC_CONST(0.5917494076903429), FRAC_CONST(0.5943842623956086), FRAC_CONST(0.59701275172294799), FRAC_CONST(0.59963484752335228), FRAC_CONST(0.60225052171628191), FRAC_CONST(0.60485974628996786), FRAC_CONST(0.60746249330171098), FRAC_CONST(0.61005873487818185), FRAC_CONST(0.61264844321571899), FRAC_CONST(0.61523159058062682), FRAC_CONST(0.61780814930947225), FRAC_CONST(0.62037809180938108), FRAC_CONST(0.62294139055833397), FRAC_CONST(0.6254980181054608), FRAC_CONST(0.62804794707133416), FRAC_CONST(0.63059115014826372), FRAC_CONST(0.63312760010058777), FRAC_CONST(0.63565726976496484), FRAC_CONST(0.63818013205066515), FRAC_CONST(0.64069615993986073), FRAC_CONST(0.64320532648791406), FRAC_CONST(0.64570760482366729), FRAC_CONST(0.64820296814972966), FRAC_CONST(0.65069138974276486), FRAC_CONST(0.65317284295377676), FRAC_CONST(0.65564730120839498), FRAC_CONST(0.65811473800715958), FRAC_CONST(0.660575126925805), FRAC_CONST(0.66302844161554231), FRAC_CONST(0.6654746558033422), FRAC_CONST(0.66791374329221598), FRAC_CONST(0.67034567796149647), FRAC_CONST(0.67277043376711676), FRAC_CONST(0.67518798474189046), FRAC_CONST(0.67759830499578866), FRAC_CONST(0.68000136871621808), FRAC_CONST(0.68239715016829683), FRAC_CONST(0.6847856236951303), FRAC_CONST(0.68716676371808583), FRAC_CONST(0.68954054473706683), FRAC_CONST(0.69190694133078579), FRAC_CONST(0.69426592815703603), FRAC_CONST(0.69661747995296419), FRAC_CONST(0.69896157153533944), FRAC_CONST(0.70129817780082437), FRAC_CONST(0.7036272737262429), FRAC_CONST(0.70594883436884903), FRAC_CONST(0.70826283486659336), FRAC_CONST(0.71056925043838959), FRAC_CONST(0.71286805638437978), FRAC_CONST(0.71515922808619936), FRAC_CONST(0.71744274100723993), FRAC_CONST(0.71971857069291278), FRAC_CONST(0.7219866927709101), FRAC_CONST(0.72424708295146689), FRAC_CONST(0.72649971702762028), FRAC_CONST(0.72874457087546896), FRAC_CONST(0.73098162045443171), FRAC_CONST(0.73321084180750484), FRAC_CONST(0.73543221106151868), FRAC_CONST(0.73764570442739286), FRAC_CONST(0.73985129820039208), FRAC_CONST(0.74204896876037885), FRAC_CONST(0.7442386925720671), FRAC_CONST(0.74642044618527381), FRAC_CONST(0.74859420623517081), FRAC_CONST(0.75075994944253421), FRAC_CONST(0.75291765261399446), FRAC_CONST(0.75506729264228367), FRAC_CONST(0.75720884650648446), FRAC_CONST(0.75934229127227548), FRAC_CONST(0.76146760409217706), FRAC_CONST(0.76358476220579641), FRAC_CONST(0.7656937429400712), FRAC_CONST(0.76779452370951196), FRAC_CONST(0.76988708201644451), FRAC_CONST(0.77197139545125026), FRAC_CONST(0.7740474416926072), FRAC_CONST(0.77611519850772781), FRAC_CONST(0.77817464375259782), FRAC_CONST(0.78022575537221317), FRAC_CONST(0.78226851140081632), FRAC_CONST(0.78430288996213138), FRAC_CONST(0.78632886926959822), FRAC_CONST(0.78834642762660623), FRAC_CONST(0.79035554342672631), FRAC_CONST(0.79235619515394229), FRAC_CONST(0.79434836138288134), FRAC_CONST(0.79633202077904397), FRAC_CONST(0.79830715209903147), FRAC_CONST(0.8002737341907743), FRAC_CONST(0.80223174599375802), FRAC_CONST(0.80418116653924954), FRAC_CONST(0.80612197495052085), FRAC_CONST(0.80805415044307316), FRAC_CONST(0.80997767232485907), FRAC_CONST(0.81189251999650469), FRAC_CONST(0.81379867295152986), FRAC_CONST(0.81569611077656778), FRAC_CONST(0.81758481315158371), FRAC_CONST(0.81946475985009259), FRAC_CONST(0.82133593073937561), FRAC_CONST(0.82319830578069586), FRAC_CONST(0.82505186502951278), FRAC_CONST(0.82689658863569615), FRAC_CONST(0.82873245684373809), FRAC_CONST(0.83055944999296494), FRAC_CONST(0.83237754851774781), FRAC_CONST(0.83418673294771239), FRAC_CONST(0.83598698390794668), FRAC_CONST(0.83777828211920935), FRAC_CONST(0.83956060839813562), FRAC_CONST(0.84133394365744296), FRAC_CONST(0.84309826890613537), FRAC_CONST(0.84485356524970701), FRAC_CONST(0.84659981389034411), FRAC_CONST(0.84833699612712676), FRAC_CONST(0.85006509335622882), FRAC_CONST(0.8517840870711173), FRAC_CONST(0.85349395886275037), FRAC_CONST(0.85519469041977514), FRAC_CONST(0.85688626352872277), FRAC_CONST(0.85856866007420429), FRAC_CONST(0.86024186203910447), FRAC_CONST(0.86190585150477417), FRAC_CONST(0.86356061065122347), FRAC_CONST(0.86520612175731115), FRAC_CONST(0.86684236720093533), FRAC_CONST(0.86846932945922151), FRAC_CONST(0.87008699110871135), FRAC_CONST(0.87169533482554817), FRAC_CONST(0.87329434338566281), FRAC_CONST(0.87488399966495822), FRAC_CONST(0.87646428663949283), FRAC_CONST(0.87803518738566277), FRAC_CONST(0.87959668508038291), FRAC_CONST(0.88114876300126743), FRAC_CONST(0.88269140452680916), FRAC_CONST(0.8842245931365561), FRAC_CONST(0.88574831241129048), FRAC_CONST(0.88726254603320276), FRAC_CONST(0.88876727778606746), FRAC_CONST(0.89026249155541637), FRAC_CONST(0.8917481713287112), FRAC_CONST(0.89322430119551532), FRAC_CONST(0.89469086534766362), FRAC_CONST(0.89614784807943237), FRAC_CONST(0.89759523378770689), FRAC_CONST(0.89903300697214927), FRAC_CONST(0.9004611522353636), FRAC_CONST(0.90187965428306172), FRAC_CONST(0.90328849792422594), FRAC_CONST(0.90468766807127299), FRAC_CONST(0.90607714974021469), FRAC_CONST(0.90745692805081868), FRAC_CONST(0.90882698822676755), FRAC_CONST(0.91018731559581767), FRAC_CONST(0.91153789558995579), FRAC_CONST(0.91287871374555518), FRAC_CONST(0.91420975570353069), FRAC_CONST(0.9155310072094921), FRAC_CONST(0.91684245411389753), FRAC_CONST(0.91814408237220391), FRAC_CONST(0.91943587804501858), FRAC_CONST(0.92071782729824769), FRAC_CONST(0.92198991640324446), FRAC_CONST(0.92325213173695675), FRAC_CONST(0.92450445978207241), FRAC_CONST(0.92574688712716402), FRAC_CONST(0.92697940046683291), FRAC_CONST(0.92820198660185149), FRAC_CONST(0.92941463243930444), FRAC_CONST(0.93061732499272909), FRAC_CONST(0.93181005138225426), FRAC_CONST(0.93299279883473885), FRAC_CONST(0.93416555468390772), FRAC_CONST(0.93532830637048769), FRAC_CONST(0.93648104144234268), FRAC_CONST(0.93762374755460598), FRAC_CONST(0.93875641246981323), FRAC_CONST(0.93987902405803303), FRAC_CONST(0.94099157029699743), FRAC_CONST(0.94209403927222979), FRAC_CONST(0.94318641917717327), FRAC_CONST(0.9442686983133165), FRAC_CONST(0.94534086509031956), FRAC_CONST(0.9464029080261378), FRAC_CONST(0.94745481574714419), FRAC_CONST(0.94849657698825252), FRAC_CONST(0.94952818059303667), FRAC_CONST(0.95054961551385087), FRAC_CONST(0.95156087081194762), FRAC_CONST(0.95256193565759528), FRAC_CONST(0.95355279933019343), FRAC_CONST(0.9545334512183884), FRAC_CONST(0.95550388082018611), FRAC_CONST(0.95646407774306541), FRAC_CONST(0.95741403170408834), FRAC_CONST(0.95835373253001133), FRAC_CONST(0.95928317015739362), FRAC_CONST(0.96020233463270466), FRAC_CONST(0.96111121611243155), FRAC_CONST(0.96200980486318388), FRAC_CONST(0.96289809126179782), FRAC_CONST(0.96377606579543984), FRAC_CONST(0.96464371906170809), FRAC_CONST(0.96550104176873297), FRAC_CONST(0.96634802473527726), FRAC_CONST(0.96718465889083372), FRAC_CONST(0.96801093527572268), FRAC_CONST(0.96882684504118799), FRAC_CONST(0.96963237944949143), FRAC_CONST(0.97042752987400682), FRAC_CONST(0.97121228779931179), FRAC_CONST(0.97198664482127939), FRAC_CONST(0.97275059264716823), FRAC_CONST(0.97350412309571066), FRAC_CONST(0.97424722809720088), FRAC_CONST(0.97497989969358168), FRAC_CONST(0.97570213003852857), FRAC_CONST(0.97641391139753486), FRAC_CONST(0.97711523614799412), FRAC_CONST(0.97780609677928154), FRAC_CONST(0.97848648589283505), FRAC_CONST(0.97915639620223371), FRAC_CONST(0.9798158205332762), FRAC_CONST(0.98046475182405801), FRAC_CONST(0.98110318312504607), FRAC_CONST(0.98173110759915416), FRAC_CONST(0.98234851852181571), FRAC_CONST(0.98295540928105563), FRAC_CONST(0.9835517733775615), FRAC_CONST(0.98413760442475307), FRAC_CONST(0.98471289614885038), FRAC_CONST(0.98527764238894122), FRAC_CONST(0.98583183709704714), FRAC_CONST(0.98637547433818806), FRAC_CONST(0.98690854829044583), FRAC_CONST(0.98743105324502667), FRAC_CONST(0.98794298360632238), FRAC_CONST(0.98844433389196995), FRAC_CONST(0.98893509873291074), FRAC_CONST(0.98941527287344755), FRAC_CONST(0.98988485117130098), FRAC_CONST(0.99034382859766479), FRAC_CONST(0.99079220023725967), FRAC_CONST(0.99122996128838525), FRAC_CONST(0.9916571070629725), FRAC_CONST(0.99207363298663342), FRAC_CONST(0.99247953459870997), FRAC_CONST(0.99287480755232194), FRAC_CONST(0.99325944761441354), FRAC_CONST(0.99363345066579889), FRAC_CONST(0.99399681270120555), FRAC_CONST(0.99434952982931812), FRAC_CONST(0.9946915982728195), FRAC_CONST(0.99502301436843166), FRAC_CONST(0.99534377456695422), FRAC_CONST(0.9956538754333033), FRAC_CONST(0.99595331364654771), FRAC_CONST(0.99624208599994479), FRAC_CONST(0.99652018940097464), FRAC_CONST(0.99678762087137318), FRAC_CONST(0.99704437754716424), FRAC_CONST(0.99729045667869021), FRAC_CONST(0.99752585563064111), FRAC_CONST(0.99775057188208349), FRAC_CONST(0.9979646030264866), FRAC_CONST(0.99816794677174903), FRAC_CONST(0.9983606009402225), FRAC_CONST(0.99854256346873571), FRAC_CONST(0.99871383240861611), FRAC_CONST(0.99887440592571108), FRAC_CONST(0.99902428230040718), FRAC_CONST(0.99916345992764877), FRAC_CONST(0.99929193731695531), FRAC_CONST(0.99940971309243731), FRAC_CONST(0.99951678599281069), FRAC_CONST(0.99961315487141078), FRAC_CONST(0.99969881869620425), FRAC_CONST(0.99977377654980037), FRAC_CONST(0.99983802762946083), FRAC_CONST(0.99989157124710804), FRAC_CONST(0.9999344068293331), FRAC_CONST(0.99996653391740109), FRAC_CONST(0.99998795216725689), FRAC_CONST(0.99999866134952808) }; #endif ALIGN static const real_t ld_mid_512[] = { FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0.0061358846491544753), FRAC_CONST(0.01840672990580482), FRAC_CONST(0.030674803176636626), FRAC_CONST(0.04293825693494082), FRAC_CONST(0.055195244349689934), FRAC_CONST(0.067443919563664051), FRAC_CONST(0.079682437971430126), FRAC_CONST(0.091908956497132724), FRAC_CONST(0.10412163387205459), FRAC_CONST(0.11631863091190475), FRAC_CONST(0.12849811079379317), FRAC_CONST(0.14065823933284921), FRAC_CONST(0.15279718525844344), FRAC_CONST(0.16491312048996989), FRAC_CONST(0.17700422041214875), FRAC_CONST(0.18906866414980619), FRAC_CONST(0.2011046348420919), FRAC_CONST(0.21311031991609136), FRAC_CONST(0.22508391135979283), FRAC_CONST(0.2370236059943672), FRAC_CONST(0.24892760574572015), FRAC_CONST(0.26079411791527551), FRAC_CONST(0.27262135544994898), FRAC_CONST(0.28440753721127188), FRAC_CONST(0.29615088824362379), FRAC_CONST(0.30784964004153487), FRAC_CONST(0.31950203081601569), FRAC_CONST(0.33110630575987643), FRAC_CONST(0.34266071731199438), FRAC_CONST(0.35416352542049034), FRAC_CONST(0.36561299780477385), FRAC_CONST(0.37700741021641826), FRAC_CONST(0.38834504669882625), FRAC_CONST(0.39962419984564679), FRAC_CONST(0.41084317105790391), FRAC_CONST(0.42200027079979968), FRAC_CONST(0.43309381885315196), FRAC_CONST(0.4441221445704292), FRAC_CONST(0.45508358712634384), FRAC_CONST(0.46597649576796618), FRAC_CONST(0.47679923006332209), FRAC_CONST(0.487550160148436), FRAC_CONST(0.49822766697278187), FRAC_CONST(0.50883014254310699), FRAC_CONST(0.51935599016558964), FRAC_CONST(0.52980362468629461), FRAC_CONST(0.54017147272989285), FRAC_CONST(0.55045797293660481), FRAC_CONST(0.56066157619733603), FRAC_CONST(0.57078074588696726), FRAC_CONST(0.58081395809576453), FRAC_CONST(0.59075970185887416), FRAC_CONST(0.60061647938386897), FRAC_CONST(0.61038280627630948), FRAC_CONST(0.6200572117632891), FRAC_CONST(0.62963823891492698), FRAC_CONST(0.63912444486377573), FRAC_CONST(0.64851440102211244), FRAC_CONST(0.65780669329707864), FRAC_CONST(0.66699992230363747), FRAC_CONST(0.67609270357531592), FRAC_CONST(0.68508366777270036), FRAC_CONST(0.693971460889654), FRAC_CONST(0.7027547444572253), FRAC_CONST(0.71143219574521643), FRAC_CONST(0.72000250796138165), FRAC_CONST(0.7284643904482252), FRAC_CONST(0.73681656887736979), FRAC_CONST(0.74505778544146595), FRAC_CONST(0.75318679904361241), FRAC_CONST(0.76120238548426178), FRAC_CONST(0.76910333764557959), FRAC_CONST(0.77688846567323244), FRAC_CONST(0.78455659715557524), FRAC_CONST(0.79210657730021239), FRAC_CONST(0.79953726910790501), FRAC_CONST(0.80684755354379922), FRAC_CONST(0.8140363297059483), FRAC_CONST(0.82110251499110465), FRAC_CONST(0.8280450452577558), FRAC_CONST(0.83486287498638001), FRAC_CONST(0.84155497743689833), FRAC_CONST(0.84812034480329712), FRAC_CONST(0.85455798836540053), FRAC_CONST(0.86086693863776731), FRAC_CONST(0.86704624551569265), FRAC_CONST(0.87309497841829009), FRAC_CONST(0.87901222642863341), FRAC_CONST(0.88479709843093779), FRAC_CONST(0.89044872324475788), FRAC_CONST(0.89596624975618511), FRAC_CONST(0.90134884704602203), FRAC_CONST(0.90659570451491533), FRAC_CONST(0.91170603200542988), FRAC_CONST(0.9166790599210427), FRAC_CONST(0.9215140393420419), FRAC_CONST(0.92621024213831127), FRAC_CONST(0.93076696107898371), FRAC_CONST(0.9351835099389475), FRAC_CONST(0.93945922360218992), FRAC_CONST(0.94359345816196039), FRAC_CONST(0.94758559101774109), FRAC_CONST(0.95143502096900834), FRAC_CONST(0.95514116830577067), FRAC_CONST(0.9587034748958716), FRAC_CONST(0.96212140426904158), FRAC_CONST(0.9653944416976894), FRAC_CONST(0.96852209427441727), FRAC_CONST(0.97150389098625178), FRAC_CONST(0.97433938278557586), FRAC_CONST(0.97702814265775439), FRAC_CONST(0.97956976568544052), FRAC_CONST(0.98196386910955524), FRAC_CONST(0.98421009238692903), FRAC_CONST(0.98630809724459867), FRAC_CONST(0.98825756773074946), FRAC_CONST(0.99005821026229712), FRAC_CONST(0.99170975366909953), FRAC_CONST(0.9932119492347945), FRAC_CONST(0.99456457073425542), FRAC_CONST(0.99576741446765982), FRAC_CONST(0.99682029929116567), FRAC_CONST(0.99772306664419164), FRAC_CONST(0.99847558057329477), FRAC_CONST(0.99907772775264536), FRAC_CONST(0.99952941750109314), FRAC_CONST(0.9998305817958234), FRAC_CONST(0.99998117528260111), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t ld_mid_480[] = { FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0.0065449379673518581), FRAC_CONST(0.019633692460628301), FRAC_CONST(0.032719082821776137), FRAC_CONST(0.045798866936520771), FRAC_CONST(0.058870803651189033), FRAC_CONST(0.071932653156719387), FRAC_CONST(0.084982177372441667), FRAC_CONST(0.09801714032956059), FRAC_CONST(0.11103530855427769), FRAC_CONST(0.12403445145048532), FRAC_CONST(0.13701234168196802), FRAC_CONST(0.14996675555404498), FRAC_CONST(0.16289547339458874), FRAC_CONST(0.17579627993435451), FRAC_CONST(0.18866696468655525), FRAC_CONST(0.2015053223256171), FRAC_CONST(0.21430915306505074), FRAC_CONST(0.2270762630343732), FRAC_CONST(0.23980446465501654), FRAC_CONST(0.25249157701515795), FRAC_CONST(0.26513542624340797), FRAC_CONST(0.27773384588129219), FRAC_CONST(0.29028467725446233), FRAC_CONST(0.3027857698425746), FRAC_CONST(0.31523498164776964), FRAC_CONST(0.32763017956169349), FRAC_CONST(0.33996923973099424), FRAC_CONST(0.35225004792123354), FRAC_CONST(0.36447049987914965), FRAC_CONST(0.37662850169321077), FRAC_CONST(0.38872197015239557), FRAC_CONST(0.40074883310314097), FRAC_CONST(0.41270702980439467), FRAC_CONST(0.42459451128071307), FRAC_CONST(0.43640924067334208), FRAC_CONST(0.44814919358922256), FRAC_CONST(0.45981235844785984), FRAC_CONST(0.47139673682599764), FRAC_CONST(0.48290034380003727), FRAC_CONST(0.49432120828614462), FRAC_CONST(0.50565737337798455), FRAC_CONST(0.51690689668202761), FRAC_CONST(0.52806785065036799), FRAC_CONST(0.53913832291100017), FRAC_CONST(0.55011641659549337), FRAC_CONST(0.56100025066400983), FRAC_CONST(0.57178796022761225), FRAC_CONST(0.58247769686780215), FRAC_CONST(0.59306762895323706), FRAC_CONST(0.60355594195357143), FRAC_CONST(0.61394083875036642), FRAC_CONST(0.62422053994501758), FRAC_CONST(0.63439328416364549), FRAC_CONST(0.64445732835889735), FRAC_CONST(0.65441094810861034), FRAC_CONST(0.66425243791128175), FRAC_CONST(0.67398011147829784), FRAC_CONST(0.68359230202287125), FRAC_CONST(0.69308736254563585), FRAC_CONST(0.70246366611685174), FRAC_CONST(0.71171960615517138), FRAC_CONST(0.72085359670291882), FRAC_CONST(0.7298640726978356), FRAC_CONST(0.73874949024124625), FRAC_CONST(0.74750832686259672), FRAC_CONST(0.75613908178032285), FRAC_CONST(0.76464027615900032), FRAC_CONST(0.77301045336273699), FRAC_CONST(0.78124817920475853), FRAC_CONST(0.78935204219315003), FRAC_CONST(0.79732065377270711), FRAC_CONST(0.80515264856285829), FRAC_CONST(0.81284668459161513), FRAC_CONST(0.82040144352551359), FRAC_CONST(0.82781563089550203), FRAC_CONST(0.83508797631874299), FRAC_CONST(0.84221723371628654), FRAC_CONST(0.84920218152657889), FRAC_CONST(0.85604162291477137), FRAC_CONST(0.86273438597779184), FRAC_CONST(0.86927932394514362), FRAC_CONST(0.87567531537539967), FRAC_CONST(0.88192126434835494), FRAC_CONST(0.88801610065280734), FRAC_CONST(0.89395877996993212), FRAC_CONST(0.8997482840522214), FRAC_CONST(0.90538362089795521), FRAC_CONST(0.91086382492117568), FRAC_CONST(0.91618795711713596), FRAC_CONST(0.92135510522319242), FRAC_CONST(0.9263643838751181), FRAC_CONST(0.93121493475880346), FRAC_CONST(0.93590592675732565), FRAC_CONST(0.94043655609335486), FRAC_CONST(0.94480604646687805), FRAC_CONST(0.94901364918821385), FRAC_CONST(0.95305864330629697), FRAC_CONST(0.95694033573220882), FRAC_CONST(0.9606580613579353), FRAC_CONST(0.96421118317032928), FRAC_CONST(0.96759909236025976), FRAC_CONST(0.9708212084269281), FRAC_CONST(0.97387697927733363), FRAC_CONST(0.97676588132087239), FRAC_CONST(0.97948741955905139), FRAC_CONST(0.98204112767030394), FRAC_CONST(0.98442656808989171), FRAC_CONST(0.98664333208487898), FRAC_CONST(0.98869103982416728), FRAC_CONST(0.99056934044357725), FRAC_CONST(0.99227791210596705), FRAC_CONST(0.99381646205637808), FRAC_CONST(0.99518472667219682), FRAC_CONST(0.99638247150832537), FRAC_CONST(0.99740949133735191), FRAC_CONST(0.99826561018471593), FRAC_CONST(0.99895068135886012), FRAC_CONST(0.99946458747636568), FRAC_CONST(0.99980724048206482), FRAC_CONST(0.99997858166412923), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }; #endif #endif #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/specrec.c000066400000000000000000001317611357201522000207470ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: specrec.c,v 1.62 2009/01/26 23:51:15 menno Exp $ **/ /* Spectral reconstruction: - grouping/sectioning - inverse quantization - applying scalefactors */ #include "common.h" #include "structs.h" #include #include #include "specrec.h" #include "filtbank.h" #include "syntax.h" #include "iq_table.h" #include "ms.h" #include "is.h" #include "pns.h" #include "tns.h" #include "drc.h" #include "lt_predict.h" #include "ic_predict.h" #ifdef SSR_DEC #include "ssr.h" #include "ssr_fb.h" #endif /* static function declarations */ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len); #ifdef LD_DEC ALIGN static const uint8_t num_swb_512_window[] = { 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 }; ALIGN static const uint8_t num_swb_480_window[] = { 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 }; #endif ALIGN static const uint8_t num_swb_960_window[] = { 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40 }; ALIGN static const uint8_t num_swb_1024_window[] = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 }; ALIGN static const uint8_t num_swb_128_window[] = { 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 }; ALIGN static const uint16_t swb_offset_1024_96[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 }; ALIGN static const uint16_t swb_offset_128_96[] = { 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 }; ALIGN static const uint16_t swb_offset_1024_64[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 984, 1024 }; ALIGN static const uint16_t swb_offset_128_64[] = { 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 }; ALIGN static const uint16_t swb_offset_1024_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84, 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, 428, 460, 512 }; ALIGN static const uint16_t swb_offset_480_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400, 432, 480 }; #endif ALIGN static const uint16_t swb_offset_128_48[] = { 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 }; ALIGN static const uint16_t swb_offset_1024_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, 384, 416, 448, 480, 512 }; ALIGN static const uint16_t swb_offset_480_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; #endif ALIGN static const uint16_t swb_offset_1024_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, 768, 832, 896, 960, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480, 512 }; ALIGN static const uint16_t swb_offset_480_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; #endif ALIGN static const uint16_t swb_offset_128_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 }; ALIGN static const uint16_t swb_offset_1024_16[] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 }; ALIGN static const uint16_t swb_offset_128_16[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 }; ALIGN static const uint16_t swb_offset_1024_8[] = { 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 }; ALIGN static const uint16_t swb_offset_128_8[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 }; ALIGN static const uint16_t *swb_offset_1024_window[] = { swb_offset_1024_96, /* 96000 */ swb_offset_1024_96, /* 88200 */ swb_offset_1024_64, /* 64000 */ swb_offset_1024_48, /* 48000 */ swb_offset_1024_48, /* 44100 */ swb_offset_1024_32, /* 32000 */ swb_offset_1024_24, /* 24000 */ swb_offset_1024_24, /* 22050 */ swb_offset_1024_16, /* 16000 */ swb_offset_1024_16, /* 12000 */ swb_offset_1024_16, /* 11025 */ swb_offset_1024_8 /* 8000 */ }; #ifdef LD_DEC ALIGN static const uint16_t *swb_offset_512_window[] = { 0, /* 96000 */ 0, /* 88200 */ 0, /* 64000 */ swb_offset_512_48, /* 48000 */ swb_offset_512_48, /* 44100 */ swb_offset_512_32, /* 32000 */ swb_offset_512_24, /* 24000 */ swb_offset_512_24, /* 22050 */ 0, /* 16000 */ 0, /* 12000 */ 0, /* 11025 */ 0 /* 8000 */ }; ALIGN static const uint16_t *swb_offset_480_window[] = { 0, /* 96000 */ 0, /* 88200 */ 0, /* 64000 */ swb_offset_480_48, /* 48000 */ swb_offset_480_48, /* 44100 */ swb_offset_480_32, /* 32000 */ swb_offset_480_24, /* 24000 */ swb_offset_480_24, /* 22050 */ 0, /* 16000 */ 0, /* 12000 */ 0, /* 11025 */ 0 /* 8000 */ }; #endif ALIGN static const uint16_t *swb_offset_128_window[] = { swb_offset_128_96, /* 96000 */ swb_offset_128_96, /* 88200 */ swb_offset_128_64, /* 64000 */ swb_offset_128_48, /* 48000 */ swb_offset_128_48, /* 44100 */ swb_offset_128_48, /* 32000 */ swb_offset_128_24, /* 24000 */ swb_offset_128_24, /* 22050 */ swb_offset_128_16, /* 16000 */ swb_offset_128_16, /* 12000 */ swb_offset_128_16, /* 11025 */ swb_offset_128_8 /* 8000 */ }; #define bit_set(A, B) ((A) & (1<<(B))) /* 4.5.2.3.4 */ /* - determine the number of windows in a window_sequence named num_windows - determine the number of window_groups named num_window_groups - determine the number of windows in each group named window_group_length[g] - determine the total number of scalefactor window bands named num_swb for the actual window type - determine swb_offset[swb], the offset of the first coefficient in scalefactor window band named swb of the window actually used - determine sect_sfb_offset[g][section],the offset of the first coefficient in section named section. This offset depends on window_sequence and scale_factor_grouping and is needed to decode the spectral_data(). */ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics) { uint8_t i, g; uint8_t sf_index = hDecoder->sf_index; switch (ics->window_sequence) { case ONLY_LONG_SEQUENCE: case LONG_START_SEQUENCE: case LONG_STOP_SEQUENCE: ics->num_windows = 1; ics->num_window_groups = 1; ics->window_group_length[ics->num_window_groups-1] = 1; #ifdef LD_DEC if (hDecoder->object_type == LD) { if (hDecoder->frameLength == 512) ics->num_swb = num_swb_512_window[sf_index]; else /* if (hDecoder->frameLength == 480) */ ics->num_swb = num_swb_480_window[sf_index]; } else { #endif if (hDecoder->frameLength == 1024) ics->num_swb = num_swb_1024_window[sf_index]; else /* if (hDecoder->frameLength == 960) */ ics->num_swb = num_swb_960_window[sf_index]; #ifdef LD_DEC } #endif if (ics->max_sfb > ics->num_swb) { return 32; } /* preparation of sect_sfb_offset for long blocks */ /* also copy the last value! */ #ifdef LD_DEC if (hDecoder->object_type == LD) { if (hDecoder->frameLength == 512) { for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i]; ics->swb_offset[i] = swb_offset_512_window[sf_index][i]; } } else /* if (hDecoder->frameLength == 480) */ { for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i]; ics->swb_offset[i] = swb_offset_480_window[sf_index][i]; } } ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; ics->swb_offset[ics->num_swb] = hDecoder->frameLength; ics->swb_offset_max = hDecoder->frameLength; } else { #endif for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i]; ics->swb_offset[i] = swb_offset_1024_window[sf_index][i]; } ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; ics->swb_offset[ics->num_swb] = hDecoder->frameLength; ics->swb_offset_max = hDecoder->frameLength; #ifdef LD_DEC } #endif return 0; case EIGHT_SHORT_SEQUENCE: ics->num_windows = 8; ics->num_window_groups = 1; ics->window_group_length[ics->num_window_groups-1] = 1; ics->num_swb = num_swb_128_window[sf_index]; if (ics->max_sfb > ics->num_swb) { return 32; } for (i = 0; i < ics->num_swb; i++) ics->swb_offset[i] = swb_offset_128_window[sf_index][i]; ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8; ics->swb_offset_max = hDecoder->frameLength/8; for (i = 0; i < ics->num_windows-1; i++) { if (bit_set(ics->scale_factor_grouping, 6-i) == 0) { ics->num_window_groups += 1; ics->window_group_length[ics->num_window_groups-1] = 1; } else { ics->window_group_length[ics->num_window_groups-1] += 1; } } /* preparation of sect_sfb_offset for short blocks */ for (g = 0; g < ics->num_window_groups; g++) { uint16_t width; uint8_t sect_sfb = 0; uint16_t offset = 0; for (i = 0; i < ics->num_swb; i++) { if (i+1 == ics->num_swb) { width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i]; } else { width = swb_offset_128_window[sf_index][i+1] - swb_offset_128_window[sf_index][i]; } width *= ics->window_group_length[g]; ics->sect_sfb_offset[g][sect_sfb++] = offset; offset += width; } ics->sect_sfb_offset[g][sect_sfb] = offset; } return 0; default: return 32; } } /* iquant() * /* output = sign(input)*abs(input)^(4/3) */ /**/ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) { #ifdef FIXED_POINT /* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ /* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not * defined a 1026 value table and interpolation will be used */ #ifndef BIG_IQ_TABLE static const real_t errcorr[] = { REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), REAL_CONST(0) }; real_t x1, x2; #endif int16_t sgn = 1; if (q < 0) { q = -q; sgn = -1; } if (q < IQ_TABLE_SIZE) { //#define IQUANT_PRINT #ifdef IQUANT_PRINT //printf("0x%.8X\n", sgn * tab[q]); printf("%d\n", sgn * tab[q]); #endif return sgn * tab[q]; } #ifndef BIG_IQ_TABLE if (q >= 8192) { *error = 17; return 0; } /* linear interpolation */ x1 = tab[q>>3]; x2 = tab[(q>>3) + 1]; return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); #else *error = 17; return 0; #endif #else if (q < 0) { /* tab contains a value for all possible q [0,8192] */ if (-q < IQ_TABLE_SIZE) return -tab[-q]; *error = 17; return 0; } else { /* tab contains a value for all possible q [0,8192] */ if (q < IQ_TABLE_SIZE) return tab[q]; *error = 17; return 0; } #endif } #ifndef FIXED_POINT ALIGN static const real_t pow2sf_tab[] = { 2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007, 2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007, 1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006, 1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005, 0.0001220703125, 0.000244140625, 0.00048828125, 0.0009765625, 0.001953125, 0.00390625, 0.0078125, 0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0, 65536.0, 131072.0, 262144.0, 524288.0, 1048576.0, 2097152.0, 4194304.0, 8388608.0, 16777216.0, 33554432.0, 67108864.0, 134217728.0, 268435456.0, 536870912.0, 1073741824.0, 2147483648.0, 4294967296.0, 8589934592.0, 17179869184.0, 34359738368.0, 68719476736.0, 137438953472.0, 274877906944.0 }; #endif /* quant_to_spec: perform dequantisation and scaling * and in case of short block it also does the deinterleaving */ /* For ONLY_LONG_SEQUENCE windows (num_window_groups = 1, window_group_length[0] = 1) the spectral data is in ascending spectral order. For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the grouping in the following manner: - Groups are ordered sequentially - Within a group, a scalefactor band consists of the spectral data of all grouped SHORT_WINDOWs for the associated scalefactor window band. To clarify via example, the length of a group is in the range of one to eight SHORT_WINDOWs. - If there are eight groups each with length one (num_window_groups = 8, window_group_length[0..7] = 1), the result is a sequence of eight spectra, each in ascending spectral order. - If there is only one group with length eight (num_window_groups = 1, window_group_length[0] = 8), the result is that spectral data of all eight SHORT_WINDOWs is interleaved by scalefactor window bands. - Within a scalefactor window band, the coefficients are in ascending spectral order. */ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len) { ALIGN static const real_t pow2_table[] = { COEF_CONST(1.0), COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */ COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */ COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */ }; const real_t *tab = iq_table; uint8_t g, sfb, win; uint16_t width, bin, k, gindex, wa, wb; uint8_t error = 0; /* Init error flag */ #ifndef FIXED_POINT real_t scf; #endif k = 0; gindex = 0; for (g = 0; g < ics->num_window_groups; g++) { uint16_t j = 0; uint16_t gincrease = 0; uint16_t win_inc = ics->swb_offset[ics->num_swb]; for (sfb = 0; sfb < ics->num_swb; sfb++) { int32_t exp, frac; width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb]; /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */ /* just ignore them */ if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255) { exp = 0; frac = 0; } else { /* ics->scale_factors[g][sfb] must be between 0 and 255 */ exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2; /* frac must always be > 0 */ frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3; } #ifdef FIXED_POINT exp -= 25; /* IMDCT pre-scaling */ if (hDecoder->object_type == LD) { exp -= 6 /*9*/; } else { if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) exp -= 4 /*7*/; else exp -= 7 /*10*/; } #endif wa = gindex + j; #ifndef FIXED_POINT scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; #endif for (win = 0; win < ics->window_group_length[g]; win++) { for (bin = 0; bin < width; bin += 4) { #ifndef FIXED_POINT wb = wa + bin; spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf; spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf; spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf; spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; #else real_t iq0 = iquant(quant_data[k+0], tab, &error); real_t iq1 = iquant(quant_data[k+1], tab, &error); real_t iq2 = iquant(quant_data[k+2], tab, &error); real_t iq3 = iquant(quant_data[k+3], tab, &error); wb = wa + bin; if (exp < 0) { spec_data[wb+0] = iq0 >>= -exp; spec_data[wb+1] = iq1 >>= -exp; spec_data[wb+2] = iq2 >>= -exp; spec_data[wb+3] = iq3 >>= -exp; } else { spec_data[wb+0] = iq0 <<= exp; spec_data[wb+1] = iq1 <<= exp; spec_data[wb+2] = iq2 <<= exp; spec_data[wb+3] = iq3 <<= exp; } if (frac != 0) { spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]); spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]); spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]); spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]); } //#define SCFS_PRINT #ifdef SCFS_PRINT printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]); #endif #endif gincrease += 4; k += 4; } wa += win_inc; } j += width; } gindex += gincrease; } return error; } static uint8_t allocate_single_channel(NeAACDecStruct *hDecoder, uint8_t channel, uint8_t output_channels) { int mul = 1; #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* allocate the state only when needed */ if (hDecoder->pred_stat[channel] != NULL) { faad_free(hDecoder->pred_stat[channel]); hDecoder->pred_stat[channel] = NULL; } hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { /* allocate the state only when needed */ if (hDecoder->lt_pred_stat[channel] != NULL) { faad_free(hDecoder->lt_pred_stat[channel]); hDecoder->lt_pred_stat[channel] = NULL; } hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } #endif if (hDecoder->time_out[channel] != NULL) { faad_free(hDecoder->time_out[channel]); hDecoder->time_out[channel] = NULL; } { mul = 1; #ifdef SBR_DEC hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) { /* SBR requires 2 times as much output data */ mul = 2; hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; } #endif hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } #if (defined(PS_DEC) || defined(DRM_PS)) if (output_channels == 2) { if (hDecoder->time_out[channel+1] != NULL) { faad_free(hDecoder->time_out[channel+1]); hDecoder->time_out[channel+1] = NULL; } hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); } #endif if (hDecoder->fb_intermed[channel] != NULL) { faad_free(hDecoder->fb_intermed[channel]); hDecoder->fb_intermed[channel] = NULL; } hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); #ifdef SSR_DEC if (hDecoder->object_type == SSR) { if (hDecoder->ssr_overlap[channel] == NULL) { hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->prev_fmd[channel] == NULL) { uint16_t k; hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); } } #endif return 0; } static uint8_t allocate_channel_pair(NeAACDecStruct *hDecoder, uint8_t channel, uint8_t paired_channel) { int mul = 1; #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* allocate the state only when needed */ if (hDecoder->pred_stat[channel] == NULL) { hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); } if (hDecoder->pred_stat[paired_channel] == NULL) { hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength); } } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { /* allocate the state only when needed */ if (hDecoder->lt_pred_stat[channel] == NULL) { hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } if (hDecoder->lt_pred_stat[paired_channel] == NULL) { hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } } #endif if (hDecoder->time_out[channel] == NULL) { mul = 1; #ifdef SBR_DEC hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) { /* SBR requires 2 times as much output data */ mul = 2; hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; } #endif hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->time_out[paired_channel] == NULL) { hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->fb_intermed[channel] == NULL) { hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->fb_intermed[paired_channel] == NULL) { hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); } #ifdef SSR_DEC if (hDecoder->object_type == SSR) { if (hDecoder->ssr_overlap[cpe->channel] == NULL) { hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) { hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->prev_fmd[cpe->channel] == NULL) { uint16_t k; hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); } if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) { uint16_t k; hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); } } #endif return 0; } uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce, int16_t *spec_data) { uint8_t retval; int output_channels; ALIGN real_t spec_coef[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif /* always allocate 2 channels, PS can always "suddenly" turn up */ #if ( (defined(DRM) && defined(DRM_PS)) ) output_channels = 2; #elif defined(PS_DEC) if (hDecoder->ps_used[hDecoder->fr_ch_ele]) output_channels = 2; else output_channels = 1; #else output_channels = 1; #endif if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) { /* element_output_channels not set yet */ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { /* element inconsistency */ /* this only happens if PS is actually found but not in the first frame * this means that there is only 1 bitstream element! */ /* reset the allocation */ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0; hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; //return 21; } if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_single_channel(hDecoder, sce->channel, output_channels); if (retval > 0) return retval; hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; } /* dequantisation and scaling */ retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); if (retval > 0) return retval; #ifdef PROFILE count = faad_get_ts() - count; hDecoder->requant_cycles += count; #endif /* pns decoding */ pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { if (!hDecoder->pred_stat[sce->channel]) return 33; /* intra channel prediction */ ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, hDecoder->sf_index); /* In addition, for scalefactor bands coded by perceptual noise substitution the predictors belonging to the corresponding spectral coefficients are reset. */ pns_reset_pred_state(ics, hDecoder->pred_stat[sce->channel]); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { #ifdef LD_DEC if (hDecoder->object_type == LD) { if (ics->ltp.data_present) { if (ics->ltp.lag_update) hDecoder->ltp_lag[sce->channel] = ics->ltp.lag; } ics->ltp.lag = hDecoder->ltp_lag[sce->channel]; } #endif /* long term prediction */ lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, ics->window_shape, hDecoder->window_shape_prev[sce->channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); } #endif /* tns decoding */ tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef, hDecoder->frameLength); /* drc decoding */ if (hDecoder->drc->present) { if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef); } /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) { #endif ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape, hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC } else { ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], hDecoder->frameLength); } #endif /* save window shape for next frame */ hDecoder->window_shape_prev[sce->channel] = ics->window_shape; #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type); } #endif #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { int ele = hDecoder->fr_ch_ele; int ch = sce->channel; /* following case can happen when forceUpSampling == 1 */ if (hDecoder->sbr[ele] == NULL) { hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) hDecoder->sbr[ele]->maxAACLine = 8*min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max); else hDecoder->sbr[ele]->maxAACLine = min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max); /* check if any of the PS tools is used */ #if (defined(PS_DEC) || defined(DRM_PS)) if (hDecoder->ps_used[ele] == 0) { #endif retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); #if (defined(PS_DEC) || defined(DRM_PS)) } else { retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch], hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); } #endif if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { return 23; } #endif /* copy L to R when no PS is used */ #if (defined(PS_DEC) || defined(DRM_PS)) if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)) { int ele = hDecoder->fr_ch_ele; int ch = sce->channel; int frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1; frame_size *= hDecoder->frameLength*sizeof(real_t); memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); } #endif return 0; } uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2) { uint8_t retval; ALIGN real_t spec_coef1[1024]; ALIGN real_t spec_coef2[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); if (retval > 0) return retval; hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; } /* dequantisation and scaling */ retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); if (retval > 0) return retval; retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength); if (retval > 0) return retval; #ifdef PROFILE count = faad_get_ts() - count; hDecoder->requant_cycles += count; #endif /* pns decoding */ if (ics1->ms_mask_present) { pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); } else { pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); } /* mid/side decoding */ ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef1[i]); printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef2[i]); printf("0x%.8X\n", spec_coef2[i]); } } #endif /* intensity stereo decoding */ is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef1[i]); //printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef2[i]); //printf("0x%.8X\n", spec_coef2[i]); } } #endif #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* intra channel prediction */ ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, hDecoder->sf_index); ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength, hDecoder->sf_index); /* In addition, for scalefactor bands coded by perceptual noise substitution the predictors belonging to the corresponding spectral coefficients are reset. */ pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]); pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { ltp_info *ltp1 = &(ics1->ltp); ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp); #ifdef LD_DEC if (hDecoder->object_type == LD) { if (ltp1->data_present) { if (ltp1->lag_update) hDecoder->ltp_lag[cpe->channel] = ltp1->lag; } ltp1->lag = hDecoder->ltp_lag[cpe->channel]; if (ltp2->data_present) { if (ltp2->lag_update) hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag; } ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel]; } #endif /* long term prediction */ lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); } #endif /* tns decoding */ tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef1, hDecoder->frameLength); tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef2, hDecoder->frameLength); /* drc decoding */ if (hDecoder->drc->present) { if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef1); if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef2); } /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) { #endif ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->object_type, hDecoder->frameLength); ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC } else { ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength); ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel], hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength); } #endif /* save window shape for next frame */ hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape; hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape; #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type); lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type); } #endif #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { int ele = hDecoder->fr_ch_ele; int ch0 = cpe->channel; int ch1 = cpe->paired_channel; /* following case can happen when forceUpSampling == 1 */ if (hDecoder->sbr[ele] == NULL) { hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) hDecoder->sbr[ele]->maxAACLine = 8*min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max); else hDecoder->sbr[ele]->maxAACLine = min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max); retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch0], hDecoder->time_out[ch1], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { return 23; } #endif return 0; } welle.io-2.1/src/libs/faad2/libfaad/specrec.h000066400000000000000000000034651357201522000207530ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: specrec.h,v 1.33 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __SPECREC_H__ #define __SPECREC_H__ #ifdef __cplusplus extern "C" { #endif #include "syntax.h" uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics); uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2); uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce, int16_t *spec_data); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ssr.c000066400000000000000000000134471357201522000201320ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr.c,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include "syntax.h" #include "filtbank.h" #include "ssr.h" #include "ssr_fb.h" void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, real_t ipqf_buffer[SSR_BANDS][96/4], real_t *prev_fmd, uint16_t frame_len) { uint8_t band; uint16_t ssr_frame_len = frame_len/SSR_BANDS; real_t time_tmp[2048] = {0}; real_t output[1024] = {0}; for (band = 0; band < SSR_BANDS; band++) { int16_t j; /* uneven bands have inverted frequency scale */ if (band == 1 || band == 3) { for (j = 0; j < ssr_frame_len/2; j++) { real_t tmp; tmp = freq_in[j + ssr_frame_len*band]; freq_in[j + ssr_frame_len*band] = freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band]; freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp; } } /* non-overlapping inverse filterbank for SSR */ ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev, freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len, ssr_frame_len); /* gain control */ ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd, band, window_sequence, ssr_frame_len); } /* inverse pqf to bring subbands together again */ ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS); } static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, real_t *overlap, real_t *prev_fmd, uint8_t band, uint8_t window_sequence, uint16_t frame_len) { uint16_t i; real_t gc_function[2*1024/SSR_BANDS]; if (window_sequence != EIGHT_SHORT_SEQUENCE) { ssr_gc_function(ssr, &prev_fmd[band * frame_len*2], gc_function, window_sequence, band, frame_len); for (i = 0; i < frame_len*2; i++) data[band * frame_len*2 + i] *= gc_function[i]; for (i = 0; i < frame_len; i++) { output[band*frame_len + i] = overlap[band*frame_len + i] + data[band*frame_len*2 + i]; } for (i = 0; i < frame_len; i++) { overlap[band*frame_len + i] = data[band*frame_len*2 + frame_len + i]; } } else { uint8_t w; for (w = 0; w < 8; w++) { uint16_t frame_len8 = frame_len/8; uint16_t frame_len16 = frame_len/16; ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8], gc_function, window_sequence, frame_len); for (i = 0; i < frame_len8*2; i++) data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i]; for (i = 0; i < frame_len8; i++) { overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] += data[band*frame_len*2 + 2*w*frame_len8 + i]; } for (i = 0; i < frame_len8; i++) { overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] = data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i]; } } for (i = 0; i < frame_len; i++) output[band*frame_len + i] = overlap[band*frame_len + i]; for (i = 0; i < frame_len; i++) overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len]; } } static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, real_t *gc_function, uint8_t window_sequence, uint8_t band, uint16_t frame_len) { uint16_t i; uint16_t len_area1, len_area2; int32_t aloc[10]; real_t alev[10]; switch (window_sequence) { case ONLY_LONG_SEQUENCE: len_area1 = frame_len/SSR_BANDS; len_area2 = 0; break; case LONG_START_SEQUENCE: len_area1 = (frame_len/SSR_BANDS)*7/32; len_area2 = (frame_len/SSR_BANDS)/16; break; case EIGHT_SHORT_SEQUENCE: len_area1 = (frame_len/8)/SSR_BANDS; len_area2 = 0; break; case LONG_STOP_SEQUENCE: len_area1 = (frame_len/SSR_BANDS); len_area2 = 0; break; } /* decode bitstream information */ /* build array M */ for (i = 0; i < frame_len*2; i++) gc_function[i] = 1; } #endif welle.io-2.1/src/libs/faad2/libfaad/ssr.h000066400000000000000000000042011357201522000201230ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr.h,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SSR_H__ #define __SSR_H__ #ifdef __cplusplus extern "C" { #endif #define SSR_BANDS 4 #define PQFTAPS 96 void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, real_t ipqf_buffer[SSR_BANDS][96/4], real_t *prev_fmd, uint16_t frame_len); static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, real_t *overlap, real_t *prev_fmd, uint8_t band, uint8_t window_sequence, uint16_t frame_len); static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, real_t *gc_function, uint8_t window_sequence, uint16_t frame_len); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ssr_fb.c000066400000000000000000000152661357201522000206020ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_fb.c,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include #include #include "syntax.h" #include "filtbank.h" #include "mdct.h" #include "ssr_fb.h" #include "ssr_win.h" fb_info *ssr_filter_bank_init(uint16_t frame_len) { uint16_t nshort = frame_len/8; fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); memset(fb, 0, sizeof(fb_info)); /* normal */ fb->mdct256 = faad_mdct_init(2*nshort); fb->mdct2048 = faad_mdct_init(2*frame_len); fb->long_window[0] = sine_long_256; fb->short_window[0] = sine_short_32; fb->long_window[1] = kbd_long_256; fb->short_window[1] = kbd_short_32; return fb; } void ssr_filter_bank_end(fb_info *fb) { faad_mdct_end(fb->mdct256); faad_mdct_end(fb->mdct2048); if (fb) faad_free(fb); } static INLINE void imdct_ssr(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) { mdct_info *mdct; switch (len) { case 512: mdct = fb->mdct2048; break; case 64: mdct = fb->mdct256; break; } faad_imdct(mdct, in_data, out_data); } /* NON-overlapping inverse filterbank for use with SSR */ void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, uint16_t frame_len) { int16_t i; real_t *transf_buf; real_t *window_long; real_t *window_long_prev; real_t *window_short; real_t *window_short_prev; uint16_t nlong = frame_len; uint16_t nshort = frame_len/8; uint16_t trans = nshort/2; uint16_t nflat_ls = (nlong-nshort)/2; transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t)); window_long = fb->long_window[window_shape]; window_long_prev = fb->long_window[window_shape_prev]; window_short = fb->short_window[window_shape]; window_short_prev = fb->short_window[window_shape_prev]; switch (window_sequence) { case ONLY_LONG_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = nlong-1; i >= 0; i--) { time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); } break; case LONG_START_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = 0; i < nlong; i++) time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); for (i = 0; i < nflat_ls; i++) time_out[nlong+i] = transf_buf[nlong+i]; for (i = 0; i < nshort; i++) time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); for (i = 0; i < nflat_ls; i++) time_out[nlong+nflat_ls+nshort+i] = 0; break; case EIGHT_SHORT_SEQUENCE: imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort); imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort); imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort); imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort); imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort); imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort); imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort); imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort); for(i = nshort-1; i >= 0; i--) { time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]); time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]); time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]); time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]); time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]); time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]); time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]); time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]); time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]); time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]); time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]); time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]); time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]); time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]); time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]); time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]); } break; case LONG_STOP_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = 0; i < nflat_ls; i++) time_out[i] = 0; for (i = 0; i < nshort; i++) time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]); for (i = 0; i < nflat_ls; i++) time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i]; for (i = 0; i < nlong; i++) time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); break; } faad_free(transf_buf); } #endif welle.io-2.1/src/libs/faad2/libfaad/ssr_fb.h000066400000000000000000000035131357201522000205770ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_fb.h,v 1.16 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SSR_FB_H__ #define __SSR_FB_H__ #ifdef __cplusplus extern "C" { #endif fb_info *ssr_filter_bank_init(uint16_t frame_len); void ssr_filter_bank_end(fb_info *fb); /*non overlapping inverse filterbank */ void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, uint16_t frame_len); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ssr_ipqf.c000066400000000000000000000141061357201522000211420ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_ipqf.c,v 1.18 2007/11/01 12:33:39 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include "ssr.h" #include "ssr_ipqf.h" static real_t **app_pqfbuf; static real_t **pp_q0, **pp_t0, **pp_t1; void gc_set_protopqf(real_t *p_proto) { int j; static real_t a_half[48] = { 1.2206911375946939E-05, 1.7261986723798209E-05, 1.2300093657077942E-05, -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04, -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04, -2.6738519958452353E-04, -1.1949424681824722E-04, 1.3965139412648678E-04, 4.8864136409185725E-04, 8.7044629275148344E-04, 1.1949430269934793E-03, 1.3519708175026700E-03, 1.2346314373964412E-03, 7.6953209114159191E-04, -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03, -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03, -2.8321073426874310E-03, -8.5038892323704195E-04, 1.8856751185350931E-03, 4.9688741735340923E-03, 7.8056704536795926E-03, 9.7027909685901654E-03, 9.9960423120166159E-03, 8.2019366335594487E-03, 4.1642072876103365E-03, -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02, -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02, -1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02, 3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02, 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012 }; for (j = 0; j < 48; ++j) { p_proto[j] = p_proto[95-j] = a_half[j]; } } void gc_setcoef_eff_pqfsyn(int mm, int kk, real_t *p_proto, real_t ***ppp_q0, real_t ***ppp_t0, real_t ***ppp_t1) { int i, k, n; real_t w; /* Set 1st Mul&Acc Coef's */ *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *)); for (n = 0; n < mm; ++n) { (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t)); } for (n = 0; n < mm/2; ++n) { for (i = 0; i < mm; ++i) { w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm); (*ppp_q0)[n][i] = 2.0 * cos((real_t) w); w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm); (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w); } } /* Set 2nd Mul&Acc Coef's */ *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *)); *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *)); for (n = 0; n < mm; ++n) { (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t)); (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t)); } for (n = 0; n < mm; ++n) { for (k = 0; k < kk; ++k) { (*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n]; (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n]; if (k%2 != 0) { (*ppp_t0)[n][k] = -(*ppp_t0)[n][k]; (*ppp_t1)[n][k] = -(*ppp_t1)[n][k]; } } } } void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, real_t buffer[SSR_BANDS][96/4], uint16_t frame_len, uint8_t bands) { static int initFlag = 0; real_t a_pqfproto[PQFTAPS]; int i; if (initFlag == 0) { gc_set_protopqf(a_pqfproto); gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto, &pp_q0, &pp_t0, &pp_t1); initFlag = 1; } for (i = 0; i < frame_len / SSR_BANDS; i++) { int l, n, k; int mm = SSR_BANDS; int kk = PQFTAPS/(2*SSR_BANDS); for (n = 0; n < mm; n++) { for (k = 0; k < 2*kk-1; k++) { buffer[n][k] = buffer[n][k+1]; } } for (n = 0; n < mm; n++) { real_t acc = 0.0; for (l = 0; l < mm; l++) { acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i]; } buffer[n][2*kk-1] = acc; } for (n = 0; n < mm/2; n++) { real_t acc = 0.0; for (k = 0; k < kk; k++) { acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k]; } for (k = 0; k < kk; ++k) { acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k]; } out_data[i*SSR_BANDS + n] = acc; acc = 0.0; for (k = 0; k < kk; k++) { acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k]; } for (k = 0; k < kk; k++) { acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k]; } out_data[i*SSR_BANDS + mm-1-n] = acc; } } } #endif welle.io-2.1/src/libs/faad2/libfaad/ssr_ipqf.h000066400000000000000000000031061357201522000211450ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_ipqf.h,v 1.17 2007/11/01 12:33:39 menno Exp $ **/ #ifndef __SSR_IPQF_H__ #define __SSR_IPQF_H__ #ifdef __cplusplus extern "C" { #endif void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, real_t buffer[SSR_BANDS][96/4], uint16_t frame_len, uint8_t bands); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/ssr_win.h000066400000000000000000000327101357201522000210060ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_win.h,v 1.16 2007/11/01 12:33:39 menno Exp $ **/ #ifndef __SSR_WIN_H__ #define __SSR_WIN_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif static real_t sine_short_32[] = { 0.0245412290, 0.0735645667, 0.1224106774, 0.1709618866, 0.2191012502, 0.2667127550, 0.3136817515, 0.3598950505, 0.4052413106, 0.4496113360, 0.4928981960, 0.5349976420, 0.5758082271, 0.6152316332, 0.6531728506, 0.6895405650, 0.7242470980, 0.7572088838, 0.7883464694, 0.8175848126, 0.8448535800, 0.8700870275, 0.8932242990, 0.9142097831, 0.9329928160, 0.9495282173, 0.9637760520, 0.9757021666, 0.9852776527, 0.9924795628, 0.9972904325, 0.9996988177 }; static real_t sine_long_256[] = { 0.0030679568, 0.0092037553, 0.0153392069, 0.0214740802, 0.0276081469, 0.0337411724, 0.0398729295, 0.0460031852, 0.0521317050, 0.0582582653, 0.0643826351, 0.0705045760, 0.0766238645, 0.0827402696, 0.0888535529, 0.0949634984, 0.1010698676, 0.1071724296, 0.1132709533, 0.1193652153, 0.1254549921, 0.1315400302, 0.1376201212, 0.1436950415, 0.1497645378, 0.1558284014, 0.1618863940, 0.1679383069, 0.1739838719, 0.1800229102, 0.1860551536, 0.1920804083, 0.1980984211, 0.2041089684, 0.2101118416, 0.2161068022, 0.2220936269, 0.2280720919, 0.2340419590, 0.2400030345, 0.2459550500, 0.2518978119, 0.2578310966, 0.2637546957, 0.2696683407, 0.2755718231, 0.2814649343, 0.2873474658, 0.2932191789, 0.2990798354, 0.3049292266, 0.3107671738, 0.3165933788, 0.3224076927, 0.3282098472, 0.3339996636, 0.3397769034, 0.3455413282, 0.3512927592, 0.3570309579, 0.3627557456, 0.3684668541, 0.3741640747, 0.3798472285, 0.3855160773, 0.3911703825, 0.3968099952, 0.4024346471, 0.4080441594, 0.4136383235, 0.4192169011, 0.4247796834, 0.4303264916, 0.4358570874, 0.4413712919, 0.4468688369, 0.4523496032, 0.4578133225, 0.4632597864, 0.4686888456, 0.4741002321, 0.4794937670, 0.4848692715, 0.4902265072, 0.4955652654, 0.5008853674, 0.5061866641, 0.5114688873, 0.5167317986, 0.5219752789, 0.5271991491, 0.5324031115, 0.5375871062, 0.5427507758, 0.5478940606, 0.5530167222, 0.5581185222, 0.5631993413, 0.5682589412, 0.5732972026, 0.5783138275, 0.5833086967, 0.5882815719, 0.5932323337, 0.5981607437, 0.6030666232, 0.6079497933, 0.6128100753, 0.6176473498, 0.6224613190, 0.6272518039, 0.6320187449, 0.6367619038, 0.6414810419, 0.6461760402, 0.6508467197, 0.6554928422, 0.6601143479, 0.6647109985, 0.6692826152, 0.6738290191, 0.6783500314, 0.6828455329, 0.6873153448, 0.6917592883, 0.6961771250, 0.7005687952, 0.7049341202, 0.7092728615, 0.7135848999, 0.7178700566, 0.7221282125, 0.7263591886, 0.7305628061, 0.7347388864, 0.7388873696, 0.7430079579, 0.7471006513, 0.7511651516, 0.7552013993, 0.7592092156, 0.7631884217, 0.7671388984, 0.7710605264, 0.7749531269, 0.7788165212, 0.7826505899, 0.7864552140, 0.7902302146, 0.7939754725, 0.7976908684, 0.8013761640, 0.8050313592, 0.8086562157, 0.8122506142, 0.8158144355, 0.8193475604, 0.8228498101, 0.8263210654, 0.8297612667, 0.8331701756, 0.8365477324, 0.8398938179, 0.8432082534, 0.8464909792, 0.8497417569, 0.8529606462, 0.8561473489, 0.8593018055, 0.8624239564, 0.8655136228, 0.8685707450, 0.8715950847, 0.8745866418, 0.8775452971, 0.8804709315, 0.8833633661, 0.8862225413, 0.8890483975, 0.8918406963, 0.8945994973, 0.8973246217, 0.9000158906, 0.9026733041, 0.9052967429, 0.9078861475, 0.9104412794, 0.9129621983, 0.9154487252, 0.9179008007, 0.9203183055, 0.9227011204, 0.9250492454, 0.9273625612, 0.9296408892, 0.9318842888, 0.9340925813, 0.9362657070, 0.9384035468, 0.9405061007, 0.9425731897, 0.9446048737, 0.9466009140, 0.9485613704, 0.9504860640, 0.9523749948, 0.9542281032, 0.9560452700, 0.9578264356, 0.9595715404, 0.9612805247, 0.9629532695, 0.9645897746, 0.9661900401, 0.9677538276, 0.9692812562, 0.9707721472, 0.9722265005, 0.9736442566, 0.9750253558, 0.9763697386, 0.9776773453, 0.9789481759, 0.9801821709, 0.9813792109, 0.9825392962, 0.9836624265, 0.9847484827, 0.9857975245, 0.9868094325, 0.9877841473, 0.9887216687, 0.9896219969, 0.9904850721, 0.9913108945, 0.9920993447, 0.9928504229, 0.9935641289, 0.9942404628, 0.9948793054, 0.9954807758, 0.9960446954, 0.9965711236, 0.9970600605, 0.9975114465, 0.9979252815, 0.9983015656, 0.9986402392, 0.9989413023, 0.9992047548, 0.9994305968, 0.9996188283, 0.9997693896, 0.9998823404, 0.9999576211, 0.9999952912 }; static real_t kbd_short_32[] = { 0.0000875914060105, 0.0009321760265333, 0.0032114611466596, 0.0081009893216786, 0.0171240286619181, 0.0320720743527833, 0.0548307856028528, 0.0871361822564870, 0.1302923415174603, 0.1848955425508276, 0.2506163195331889, 0.3260874142923209, 0.4089316830907141, 0.4959414909423747, 0.5833939894958904, 0.6674601983218376, 0.7446454751465113, 0.8121892962974020, 0.8683559394406505, 0.9125649996381605, 0.9453396205809574, 0.9680864942677585, 0.9827581789763112, 0.9914756203467121, 0.9961964092194694, 0.9984956609571091, 0.9994855586984285, 0.9998533730714648, 0.9999671864476404, 0.9999948432453556, 0.9999995655238333, 0.9999999961638728 }; static real_t kbd_long_256[] = { 0.0005851230124487, 0.0009642149851497, 0.0013558207534965, 0.0017771849644394, 0.0022352533849672, 0.0027342299070304, 0.0032773001022195, 0.0038671998069216, 0.0045064443384152, 0.0051974336885144, 0.0059425050016407, 0.0067439602523141, 0.0076040812644888, 0.0085251378135895, 0.0095093917383048, 0.0105590986429280, 0.0116765080854300, 0.0128638627792770, 0.0141233971318631, 0.0154573353235409, 0.0168678890600951, 0.0183572550877256, 0.0199276125319803, 0.0215811201042484, 0.0233199132076965, 0.0251461009666641, 0.0270617631981826, 0.0290689473405856, 0.0311696653515848, 0.0333658905863535, 0.0356595546648444, 0.0380525443366107, 0.0405466983507029, 0.0431438043376910, 0.0458455957104702, 0.0486537485902075, 0.0515698787635492, 0.0545955386770205, 0.0577322144743916, 0.0609813230826460, 0.0643442093520723, 0.0678221432558827, 0.0714163171546603, 0.0751278431308314, 0.0789577503982528, 0.0829069827918993, 0.0869763963425241, 0.0911667569410503, 0.0954787380973307, 0.0999129187977865, 0.1044697814663005, 0.1091497100326053, 0.1139529881122542, 0.1188797973021148, 0.1239302155951605, 0.1291042159181728, 0.1344016647957880, 0.1398223211441467, 0.1453658351972151, 0.1510317475686540, 0.1568194884519144, 0.1627283769610327, 0.1687576206143887, 0.1749063149634756, 0.1811734433685097, 0.1875578769224857, 0.1940583745250518, 0.2006735831073503, 0.2074020380087318, 0.2142421635060113, 0.2211922734956977, 0.2282505723293797, 0.2354151558022098, 0.2426840122941792, 0.2500550240636293, 0.2575259686921987, 0.2650945206801527, 0.2727582531907993, 0.2805146399424422, 0.2883610572460804, 0.2962947861868143, 0.3043130149466800, 0.3124128412663888, 0.3205912750432127, 0.3288452410620226, 0.3371715818562547, 0.3455670606953511, 0.3540283646950029, 0.3625521080463003, 0.3711348353596863, 0.3797730251194006, 0.3884630932439016, 0.3972013967475546, 0.4059842374986933, 0.4148078660689724, 0.4236684856687616, 0.4325622561631607, 0.4414852981630577, 0.4504336971855032, 0.4594035078775303, 0.4683907582974173, 0.4773914542472655, 0.4864015836506502, 0.4954171209689973, 0.5044340316502417, 0.5134482766032377, 0.5224558166913167, 0.5314526172383208, 0.5404346525403849, 0.5493979103766972, 0.5583383965124314, 0.5672521391870222, 0.5761351935809411, 0.5849836462541291, 0.5937936195492526, 0.6025612759529649, 0.6112828224083939, 0.6199545145721097, 0.6285726610088878, 0.6371336273176413, 0.6456338401819751, 0.6540697913388968, 0.6624380414593221, 0.6707352239341151, 0.6789580485595255, 0.6871033051160131, 0.6951678668345944, 0.7031486937449871, 0.7110428359000029, 0.7188474364707993, 0.7265597347077880, 0.7341770687621900, 0.7416968783634273, 0.7491167073477523, 0.7564342060337386, 0.7636471334404891, 0.7707533593446514, 0.7777508661725849, 0.7846377507242818, 0.7914122257259034, 0.7980726212080798, 0.8046173857073919, 0.8110450872887550, 0.8173544143867162, 0.8235441764639875, 0.8296133044858474, 0.8355608512093652, 0.8413859912867303, 0.8470880211822968, 0.8526663589032990, 0.8581205435445334, 0.8634502346476508, 0.8686552113760616, 0.8737353715068081, 0.8786907302411250, 0.8835214188357692, 0.8882276830575707, 0.8928098814640207, 0.8972684835130879, 0.9016040675058185, 0.9058173183656508, 0.9099090252587376, 0.9138800790599416, 0.9177314696695282, 0.9214642831859411, 0.9250796989403991, 0.9285789863994010, 0.9319635019415643, 0.9352346855155568, 0.9383940571861993, 0.9414432135761304, 0.9443838242107182, 0.9472176277741918, 0.9499464282852282, 0.9525720912004834, 0.9550965394547873, 0.9575217494469370, 0.9598497469802043, 0.9620826031668507, 0.9642224303060783, 0.9662713777449607, 0.9682316277319895, 0.9701053912729269, 0.9718949039986892, 0.9736024220549734, 0.9752302180233160, 0.9767805768831932, 0.9782557920246753, 0.9796581613210076, 0.9809899832703159, 0.9822535532154261, 0.9834511596505429, 0.9845850806232530, 0.9856575802399989, 0.9866709052828243, 0.9876272819448033, 0.9885289126911557, 0.9893779732525968, 0.9901766097569984, 0.9909269360049311, 0.9916310308941294, 0.9922909359973702, 0.9929086532976777, 0.9934861430841844, 0.9940253220113651, 0.9945280613237534, 0.9949961852476154, 0.9954314695504363, 0.9958356402684387, 0.9962103726017252, 0.9965572899760172, 0.9968779632693499, 0.9971739102014799, 0.9974465948831872, 0.9976974275220812, 0.9979277642809907, 0.9981389072844972, 0.9983321047686901, 0.9985085513687731, 0.9986693885387259, 0.9988157050968516, 0.9989485378906924, 0.9990688725744943, 0.9991776444921379, 0.9992757396582338, 0.9993639958299003, 0.9994432036616085, 0.9995141079353859, 0.9995774088586188, 0.9996337634216871, 0.9996837868076957, 0.9997280538466377, 0.9997671005064359, 0.9998014254134544, 0.9998314913952471, 0.9998577270385304, 0.9998805282555989, 0.9999002598526793, 0.9999172570940037, 0.9999318272557038, 0.9999442511639580, 0.9999547847121726, 0.9999636603523446, 0.9999710885561258, 0.9999772592414866, 0.9999823431612708, 0.9999864932503106, 0.9999898459281599, 0.9999925223548691, 0.9999946296375997, 0.9999962619864214, 0.9999975018180320, 0.9999984208055542, 0.9999990808746198, 0.9999995351446231, 0.9999998288155155 }; #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/structs.h000066400000000000000000000244301357201522000210310ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: structs.h,v 1.49 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __STRUCTS_H__ #define __STRUCTS_H__ #ifdef __cplusplus extern "C" { #endif #include "cfft.h" #ifdef SBR_DEC #include "sbr_dec.h" #endif #define MAX_CHANNELS 64 #define MAX_SYNTAX_ELEMENTS 48 #define MAX_WINDOW_GROUPS 8 #define MAX_SFB 51 #define MAX_LTP_SFB 40 #define MAX_LTP_SFB_S 8 /* used to save the prediction state */ typedef struct { int16_t r[2]; int16_t COR[2]; int16_t VAR[2]; } pred_state; typedef struct { uint16_t N; cfft_info *cfft; complex_t *sincos; #ifdef PROFILE int64_t cycles; int64_t fft_cycles; #endif } mdct_info; typedef struct { const real_t *long_window[2]; const real_t *short_window[2]; #ifdef LD_DEC const real_t *ld_window[2]; #endif mdct_info *mdct256; #ifdef LD_DEC mdct_info *mdct1024; #endif mdct_info *mdct2048; #ifdef PROFILE int64_t cycles; #endif } fb_info; typedef struct { uint8_t present; uint8_t num_bands; uint8_t pce_instance_tag; uint8_t excluded_chns_present; uint8_t band_top[17]; uint8_t prog_ref_level; uint8_t dyn_rng_sgn[17]; uint8_t dyn_rng_ctl[17]; uint8_t exclude_mask[MAX_CHANNELS]; uint8_t additional_excluded_chns[MAX_CHANNELS]; real_t ctrl1; real_t ctrl2; } drc_info; typedef struct { uint8_t element_instance_tag; uint8_t object_type; uint8_t sf_index; uint8_t num_front_channel_elements; uint8_t num_side_channel_elements; uint8_t num_back_channel_elements; uint8_t num_lfe_channel_elements; uint8_t num_assoc_data_elements; uint8_t num_valid_cc_elements; uint8_t mono_mixdown_present; uint8_t mono_mixdown_element_number; uint8_t stereo_mixdown_present; uint8_t stereo_mixdown_element_number; uint8_t matrix_mixdown_idx_present; uint8_t pseudo_surround_enable; uint8_t matrix_mixdown_idx; uint8_t front_element_is_cpe[16]; uint8_t front_element_tag_select[16]; uint8_t side_element_is_cpe[16]; uint8_t side_element_tag_select[16]; uint8_t back_element_is_cpe[16]; uint8_t back_element_tag_select[16]; uint8_t lfe_element_tag_select[16]; uint8_t assoc_data_element_tag_select[16]; uint8_t cc_element_is_ind_sw[16]; uint8_t valid_cc_element_tag_select[16]; uint8_t channels; uint8_t comment_field_bytes; uint8_t comment_field_data[257]; /* extra added values */ uint8_t num_front_channels; uint8_t num_side_channels; uint8_t num_back_channels; uint8_t num_lfe_channels; uint8_t sce_channel[16]; uint8_t cpe_channel[16]; } program_config; typedef struct { uint16_t syncword; uint8_t id; uint8_t layer; uint8_t protection_absent; uint8_t profile; uint8_t sf_index; uint8_t private_bit; uint8_t channel_configuration; uint8_t original; uint8_t home; uint8_t emphasis; uint8_t copyright_identification_bit; uint8_t copyright_identification_start; uint16_t aac_frame_length; uint16_t adts_buffer_fullness; uint8_t no_raw_data_blocks_in_frame; uint16_t crc_check; /* control param */ uint8_t old_format; } adts_header; typedef struct { uint8_t copyright_id_present; int8_t copyright_id[10]; uint8_t original_copy; uint8_t home; uint8_t bitstream_type; uint32_t bitrate; uint8_t num_program_config_elements; uint32_t adif_buffer_fullness; /* maximum of 16 PCEs */ program_config pce[16]; } adif_header; #ifdef LTP_DEC typedef struct { uint8_t last_band; uint8_t data_present; uint16_t lag; uint8_t lag_update; uint8_t coef; uint8_t long_used[MAX_SFB]; uint8_t short_used[8]; uint8_t short_lag_present[8]; uint8_t short_lag[8]; } ltp_info; #endif #ifdef MAIN_DEC typedef struct { uint8_t limit; uint8_t predictor_reset; uint8_t predictor_reset_group_number; uint8_t prediction_used[MAX_SFB]; } pred_info; #endif typedef struct { uint8_t number_pulse; uint8_t pulse_start_sfb; uint8_t pulse_offset[4]; uint8_t pulse_amp[4]; } pulse_info; typedef struct { uint8_t n_filt[8]; uint8_t coef_res[8]; uint8_t length[8][4]; uint8_t order[8][4]; uint8_t direction[8][4]; uint8_t coef_compress[8][4]; uint8_t coef[8][4][32]; } tns_info; #ifdef SSR_DEC typedef struct { uint8_t max_band; uint8_t adjust_num[4][8]; uint8_t alevcode[4][8][8]; uint8_t aloccode[4][8][8]; } ssr_info; #endif typedef struct { uint8_t max_sfb; uint8_t num_swb; uint8_t num_window_groups; uint8_t num_windows; uint8_t window_sequence; uint8_t window_group_length[8]; uint8_t window_shape; uint8_t scale_factor_grouping; uint16_t sect_sfb_offset[8][15*8]; uint16_t swb_offset[52]; uint16_t swb_offset_max; uint8_t sect_cb[8][15*8]; uint16_t sect_start[8][15*8]; uint16_t sect_end[8][15*8]; uint8_t sfb_cb[8][8*15]; uint8_t num_sec[8]; /* number of sections in a group */ uint8_t global_gain; int16_t scale_factors[8][51]; /* [0..255] */ uint8_t ms_mask_present; uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; uint8_t noise_used; uint8_t is_used; uint8_t pulse_data_present; uint8_t tns_data_present; uint8_t gain_control_data_present; uint8_t predictor_data_present; pulse_info pul; tns_info tns; #ifdef MAIN_DEC pred_info pred; #endif #ifdef LTP_DEC ltp_info ltp; ltp_info ltp2; #endif #ifdef SSR_DEC ssr_info ssr; #endif #ifdef ERROR_RESILIENCE /* ER HCR data */ uint16_t length_of_reordered_spectral_data; uint8_t length_of_longest_codeword; /* ER RLVC data */ uint8_t sf_concealment; uint8_t rev_global_gain; uint16_t length_of_rvlc_sf; uint16_t dpcm_noise_nrg; uint8_t sf_escapes_present; uint8_t length_of_rvlc_escapes; uint16_t dpcm_noise_last_position; #endif } ic_stream; /* individual channel stream */ typedef struct { uint8_t channel; int16_t paired_channel; uint8_t element_instance_tag; uint8_t common_window; ic_stream ics1; ic_stream ics2; } element; /* syntax element (SCE, CPE, LFE) */ #define MAX_ASC_BYTES 64 typedef struct { int inited; int version, versionA; int framelen_type; int useSameStreamMux; int allStreamsSameTimeFraming; int numSubFrames; int numPrograms; int numLayers; int otherDataPresent; uint32_t otherDataLenBits; uint32_t frameLength; uint8_t ASC[MAX_ASC_BYTES]; uint32_t ASCbits; } latm_header; typedef struct { uint8_t adts_header_present; uint8_t adif_header_present; uint8_t latm_header_present; uint8_t sf_index; uint8_t object_type; uint8_t channelConfiguration; #ifdef ERROR_RESILIENCE uint8_t aacSectionDataResilienceFlag; uint8_t aacScalefactorDataResilienceFlag; uint8_t aacSpectralDataResilienceFlag; #endif uint16_t frameLength; uint8_t postSeekResetFlag; uint32_t frame; uint8_t downMatrix; uint8_t upMatrix; uint8_t first_syn_ele; uint8_t has_lfe; /* number of channels in current frame */ uint8_t fr_channels; /* number of elements in current frame */ uint8_t fr_ch_ele; /* element_output_channels: determines the number of channels the element will output */ uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; /* element_alloced: determines whether the data needed for the element is allocated or not */ uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; /* alloced_channels: determines the number of channels where output data is allocated for */ uint8_t alloced_channels; /* output data buffer */ void *sample_buffer; uint8_t window_shape_prev[MAX_CHANNELS]; #ifdef LTP_DEC uint16_t ltp_lag[MAX_CHANNELS]; #endif fb_info *fb; drc_info *drc; real_t *time_out[MAX_CHANNELS]; real_t *fb_intermed[MAX_CHANNELS]; #ifdef SBR_DEC int8_t sbr_present_flag; int8_t forceUpSampling; int8_t downSampledSBR; /* determines whether SBR data is allocated for the gives element */ uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; #endif #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; uint8_t ps_used_global; #endif #ifdef SSR_DEC real_t *ssr_overlap[MAX_CHANNELS]; real_t *prev_fmd[MAX_CHANNELS]; real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; #endif #ifdef MAIN_DEC pred_state *pred_stat[MAX_CHANNELS]; #endif #ifdef LTP_DEC int16_t *lt_pred_stat[MAX_CHANNELS]; #endif #ifdef DRM uint8_t error_state; #endif /* RNG states */ uint32_t __r1; uint32_t __r2; /* Program Config Element */ uint8_t pce_set; program_config pce; uint8_t element_id[MAX_CHANNELS]; uint8_t internal_channel[MAX_CHANNELS]; /* Configuration data */ NeAACDecConfiguration config; #ifdef PROFILE int64_t cycles; int64_t spectral_cycles; int64_t output_cycles; int64_t scalefac_cycles; int64_t requant_cycles; #endif latm_header latm_config; const unsigned char *cmes; } NeAACDecStruct; #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/syntax.c000066400000000000000000002417341357201522000206530ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: syntax.c,v 1.93 2009/01/26 23:51:15 menno Exp $ **/ /* Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio) */ #include "common.h" #include "structs.h" #include #include #include #include "syntax.h" #include "specrec.h" #include "huffman.h" #include "bits.h" #include "pulse.h" #include "analysis.h" #include "drc.h" #ifdef ERROR_RESILIENCE #include "rvlc.h" #endif #ifdef SBR_DEC #include "sbr_syntax.h" #endif #include "mp4.h" /* static function declarations */ static void decode_sce_lfe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele); static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele); static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag); static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag); #ifdef COUPLING_DEC static uint8_t coupling_channel_element(NeAACDecStruct *hDecoder, bitfile *ld); #endif static uint16_t data_stream_element(NeAACDecStruct *hDecoder, bitfile *ld); static uint8_t program_config_element(program_config *pce, bitfile *ld); static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc #ifdef SBR_DEC ,uint8_t sbr_ele #endif ); static uint8_t individual_channel_stream(NeAACDecStruct *hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag, int16_t *spec_data); static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, uint8_t common_window); static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld); static uint8_t scale_factor_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld); #ifdef SSR_DEC static void gain_control_data(bitfile *ld, ic_stream *ics); #endif static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data); static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); #ifdef LTP_DEC static uint8_t ltp_data(NeAACDecStruct *hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); #endif static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); static void adts_variable_header(adts_header *adts, bitfile *ld); static void adts_error_check(adts_header *adts, bitfile *ld); static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); static uint8_t excluded_channels(bitfile *ld, drc_info *drc); static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag); #ifdef DRM static int8_t DRM_aac_scalable_main_header(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, bitfile *ld, uint8_t this_layer_stereo); #endif /* Table 4.4.1 */ int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, program_config *pce_out) { program_config pce; /* 1024 or 960 */ mp4ASC->frameLengthFlag = faad_get1bit(ld DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag")); #ifndef ALLOW_SMALL_FRAMELENGTH if (mp4ASC->frameLengthFlag == 1) return -3; #endif mp4ASC->dependsOnCoreCoder = faad_get1bit(ld DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder")); if (mp4ASC->dependsOnCoreCoder == 1) { mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14 DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay")); } mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag")); if (mp4ASC->channelsConfiguration == 0) { if (program_config_element(&pce, ld)) return -3; //mp4ASC->channelsConfiguration = pce.channels; if (pce_out != NULL) memcpy(pce_out, &pce, sizeof(program_config)); /* if (pce.num_valid_cc_elements) return -3; */ } #ifdef ERROR_RESILIENCE if (mp4ASC->extensionFlag == 1) { /* Error resilience not supported yet */ if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag")); mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag")); mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag")); } /* 1 bit: extensionFlag3 */ faad_getbits(ld, 1); } #endif return 0; } /* Table 4.4.2 */ /* An MPEG-4 Audio decoder is only required to follow the Program Configuration Element in GASpecificConfig(). The decoder shall ignore any Program Configuration Elements that may occur in raw data blocks. PCEs transmitted in raw data blocks cannot be used to convey decoder configuration information. */ static uint8_t program_config_element(program_config *pce, bitfile *ld) { uint8_t i; memset(pce, 0, sizeof(program_config)); pce->channels = 0; pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,10,"program_config_element(): element_instance_tag")); pce->object_type = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,11,"program_config_element(): object_type")); pce->sf_index = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,12,"program_config_element(): sf_index")); pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements")); pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements")); pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements")); pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements")); pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements")); pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements")); pce->mono_mixdown_present = faad_get1bit(ld DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present")); if (pce->mono_mixdown_present == 1) { pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number")); } pce->stereo_mixdown_present = faad_get1bit(ld DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present")); if (pce->stereo_mixdown_present == 1) { pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number")); } pce->matrix_mixdown_idx_present = faad_get1bit(ld DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present")); if (pce->matrix_mixdown_idx_present == 1) { pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx")); pce->pseudo_surround_enable = faad_get1bit(ld DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable")); } for (i = 0; i < pce->num_front_channel_elements; i++) { pce->front_element_is_cpe[i] = faad_get1bit(ld DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe")); pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,27,"program_config_element(): front_element_tag_select")); if (pce->front_element_is_cpe[i] & 1) { pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels; pce->num_front_channels += 2; pce->channels += 2; } else { pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels; pce->num_front_channels++; pce->channels++; } } for (i = 0; i < pce->num_side_channel_elements; i++) { pce->side_element_is_cpe[i] = faad_get1bit(ld DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe")); pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,29,"program_config_element(): side_element_tag_select")); if (pce->side_element_is_cpe[i] & 1) { pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels; pce->num_side_channels += 2; pce->channels += 2; } else { pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels; pce->num_side_channels++; pce->channels++; } } for (i = 0; i < pce->num_back_channel_elements; i++) { pce->back_element_is_cpe[i] = faad_get1bit(ld DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe")); pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,31,"program_config_element(): back_element_tag_select")); if (pce->back_element_is_cpe[i] & 1) { pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels; pce->channels += 2; pce->num_back_channels += 2; } else { pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels; pce->num_back_channels++; pce->channels++; } } for (i = 0; i < pce->num_lfe_channel_elements; i++) { pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select")); pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels; pce->num_lfe_channels++; pce->channels++; } for (i = 0; i < pce->num_assoc_data_elements; i++) pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select")); for (i = 0; i < pce->num_valid_cc_elements; i++) { pce->cc_element_is_ind_sw[i] = faad_get1bit(ld DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw")); pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select")); } faad_byte_align(ld); pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,36,"program_config_element(): comment_field_bytes")); for (i = 0; i < pce->comment_field_bytes; i++) { pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,37,"program_config_element(): comment_field_data")); } pce->comment_field_data[i] = 0; if (pce->channels > MAX_CHANNELS) return 22; return 0; } static void decode_sce_lfe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; if (channels+1 > MAX_CHANNELS) { hInfo->error = 12; return; } if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) { hInfo->error = 13; return; } /* for SCE hDecoder->element_output_channels[] is not set here because this can become 2 when some form of Parametric Stereo coding is used */ /* save the syntax element id */ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; /* decode the element */ hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); /* map output channels position to internal data channels */ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) { /* this might be faulty when pce_set is true */ hDecoder->internal_channel[channels] = channels; hDecoder->internal_channel[channels+1] = channels+1; } else { if (hDecoder->pce_set) hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; else hDecoder->internal_channel[channels] = channels; } hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; hDecoder->fr_ch_ele++; } static void decode_cpe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; if (channels+2 > MAX_CHANNELS) { hInfo->error = 12; return; } if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) { hInfo->error = 13; return; } /* for CPE the number of output channels is always 2 */ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) { /* element_output_channels not set yet */ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) { /* element inconsistency */ hInfo->error = 21; return; } /* save the syntax element id */ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; /* decode the element */ hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); /* map output channel position to internal data channels */ if (hDecoder->pce_set) { hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1; } else { hDecoder->internal_channel[channels] = channels; hDecoder->internal_channel[channels+1] = channels+1; } hDecoder->fr_channels += 2; hDecoder->fr_ch_ele++; } void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) { uint8_t id_syn_ele; uint8_t ele_this_frame = 0; hDecoder->fr_channels = 0; hDecoder->fr_ch_ele = 0; hDecoder->first_syn_ele = 25; hDecoder->has_lfe = 0; #ifdef ERROR_RESILIENCE if (hDecoder->object_type < ER_OBJECT_START) { #endif /* Table 4.4.3: raw_data_block() */ while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END) { switch (id_syn_ele) { case ID_SCE: ele_this_frame++; if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); if (hInfo->error > 0) return; break; case ID_CPE: ele_this_frame++; if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; decode_cpe(hDecoder, hInfo, ld, id_syn_ele); if (hInfo->error > 0) return; break; case ID_LFE: #ifdef DRM hInfo->error = 32; #else ele_this_frame++; hDecoder->has_lfe++; decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); #endif if (hInfo->error > 0) return; break; case ID_CCE: /* not implemented yet, but skip the bits */ #ifdef DRM hInfo->error = 32; #else ele_this_frame++; #ifdef COUPLING_DEC hInfo->error = coupling_channel_element(hDecoder, ld); #else hInfo->error = 6; #endif #endif if (hInfo->error > 0) return; break; case ID_DSE: ele_this_frame++; data_stream_element(hDecoder, ld); break; case ID_PCE: if (ele_this_frame != 0) { hInfo->error = 31; return; } ele_this_frame++; /* 14496-4: 5.6.4.1.2.1.3: */ /* program_configuration_element()'s in access units shall be ignored */ program_config_element(pce, ld); //if ((hInfo->error = program_config_element(pce, ld)) > 0) // return; //hDecoder->pce_set = 1; break; case ID_FIL: ele_this_frame++; /* one sbr_info describes a channel_element not a channel! */ /* if we encounter SBR data here: error */ /* SBR data will be read directly in the SCE/LFE/CPE element */ if ((hInfo->error = fill_element(hDecoder, ld, drc #ifdef SBR_DEC , INVALID_SBR_ELEMENT #endif )) > 0) return; break; } } #ifdef ERROR_RESILIENCE } else { /* Table 262: er_raw_data_block() */ switch (hDecoder->channelConfiguration) { case 1: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); if (hInfo->error > 0) return; break; case 2: decode_cpe(hDecoder, hInfo, ld, ID_CPE); if (hInfo->error > 0) return; break; case 3: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); if (hInfo->error > 0) return; break; case 4: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); if (hInfo->error > 0) return; break; case 5: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); if (hInfo->error > 0) return; break; case 6: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); if (hInfo->error > 0) return; break; case 7: /* 8 channels */ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_cpe(hDecoder, hInfo, ld, ID_CPE); decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); if (hInfo->error > 0) return; break; default: hInfo->error = 7; return; } #if 0 cnt = bits_to_decode() / 8; while (cnt >= 1) { cnt -= extension_payload(cnt); } #endif } #endif /* new in corrigendum 14496-3:2002 */ #ifdef DRM if (hDecoder->object_type != DRM_ER_LC #if 0 && !hDecoder->latm_header_present #endif ) #endif { faad_byte_align(ld); } return; } /* Table 4.4.4 and */ /* Table 4.4.9 */ static uint8_t single_lfe_channel_element(NeAACDecStruct *hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag) { uint8_t retval = 0; element sce = {0}; ic_stream *ics = &(sce.ics1); ALIGN int16_t spec_data[1024] = {0}; sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); *tag = sce.element_instance_tag; sce.channel = channel; sce.paired_channel = -1; retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data); if (retval > 0) return retval; /* IS not allowed in single channel */ if (ics->is_used) return 32; #ifdef SBR_DEC /* check if next bitstream element is a fill element */ /* if so, read it now so SBR decoding can be done in case of a file with SBR */ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) { faad_flushbits(ld, LEN_SE_ID); /* one sbr_info describes a channel_element not a channel! */ if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) { return retval; } } #endif /* noiseless coding is done, spectral reconstruction is done now */ retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data); if (retval > 0) return retval; return 0; } /* Table 4.4.5 */ static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld, uint8_t channels, uint8_t *tag) { ALIGN int16_t spec_data1[1024] = {0}; ALIGN int16_t spec_data2[1024] = {0}; element cpe = {0}; ic_stream *ics1 = &(cpe.ics1); ic_stream *ics2 = &(cpe.ics2); uint8_t result; cpe.channel = channels; cpe.paired_channel = channels+1; cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag")); *tag = cpe.element_instance_tag; if ((cpe.common_window = faad_get1bit(ld DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1) { /* both channels have common ics information */ if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0) return result; ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present")); if (ics1->ms_mask_present == 3) { /* bitstream error */ return 32; } if (ics1->ms_mask_present == 1) { uint8_t g, sfb; for (g = 0; g < ics1->num_window_groups; g++) { for (sfb = 0; sfb < ics1->max_sfb; sfb++) { ics1->ms_used[g][sfb] = faad_get1bit(ld DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit")); } } } #ifdef ERROR_RESILIENCE if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) { if (( #ifdef LTP_DEC ics1->ltp.data_present = #endif faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) { #ifdef LTP_DEC if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) { return result; } #else return 26; #endif } } #endif memcpy(ics2, ics1, sizeof(ic_stream)); } else { ics1->ms_mask_present = 0; } if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1, 0, spec_data1)) > 0) { return result; } #ifdef ERROR_RESILIENCE if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) { if (( #ifdef LTP_DEC ics1->ltp2.data_present = #endif faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) { #ifdef LTP_DEC if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) { return result; } #else return 26; #endif } } #endif if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, 0, spec_data2)) > 0) { return result; } #ifdef SBR_DEC /* check if next bitstream element is a fill element */ /* if so, read it now so SBR decoding can be done in case of a file with SBR */ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) { faad_flushbits(ld, LEN_SE_ID); /* one sbr_info describes a channel_element not a channel! */ if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) { return result; } } #endif /* noiseless coding is done, spectral reconstruction is done now */ if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2)) > 0) { return result; } return 0; } /* Table 4.4.6 */ static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, uint8_t common_window) { uint8_t retval = 0; uint8_t ics_reserved_bit; ics_reserved_bit = faad_get1bit(ld DEBUGVAR(1,43,"ics_info(): ics_reserved_bit")); if (ics_reserved_bit != 0) return 32; ics->window_sequence = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,44,"ics_info(): window_sequence")); ics->window_shape = faad_get1bit(ld DEBUGVAR(1,45,"ics_info(): window_shape")); #ifdef LD_DEC /* No block switching in LD */ if ((hDecoder->object_type == LD) && (ics->window_sequence != ONLY_LONG_SEQUENCE)) return 32; #endif if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { ics->max_sfb = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,46,"ics_info(): max_sfb (short)")); ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 DEBUGVAR(1,47,"ics_info(): scale_factor_grouping")); } else { ics->max_sfb = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,48,"ics_info(): max_sfb (long)")); } /* get the grouping information */ if ((retval = window_grouping_info(hDecoder, ics)) > 0) return retval; /* should be an error */ /* check the range of max_sfb */ if (ics->max_sfb > ics->num_swb) return 16; if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) { if ((ics->predictor_data_present = faad_get1bit(ld DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1) { if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ { uint8_t sfb; uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); #ifdef MAIN_DEC ics->pred.limit = limit; #endif if (( #ifdef MAIN_DEC ics->pred.predictor_reset = #endif faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) { #ifdef MAIN_DEC ics->pred.predictor_reset_group_number = #endif (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); } for (sfb = 0; sfb < limit; sfb++) { #ifdef MAIN_DEC ics->pred.prediction_used[sfb] = #endif faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); } } #ifdef LTP_DEC else { /* Long Term Prediction */ if (hDecoder->object_type < ER_OBJECT_START) { if ((ics->ltp.data_present = faad_get1bit(ld DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) { if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) { return retval; } } if (common_window) { if ((ics->ltp2.data_present = faad_get1bit(ld DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) { if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0) { return retval; } } } } #ifdef ERROR_RESILIENCE if (!common_window && (hDecoder->object_type >= ER_OBJECT_START)) { if ((ics->ltp.data_present = faad_get1bit(ld DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) { ltp_data(hDecoder, ics, &(ics->ltp), ld); } } #endif } #endif } } return retval; } /* Table 4.4.7 */ static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld) { uint8_t i; pul->number_pulse = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,56,"pulse_data(): number_pulse")); pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb")); /* check the range of pulse_start_sfb */ if (pul->pulse_start_sfb > ics->num_swb) return 16; for (i = 0; i < pul->number_pulse+1; i++) { pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,58,"pulse_data(): pulse_offset")); #if 0 printf("%d\n", pul->pulse_offset[i]); #endif pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,59,"pulse_data(): pulse_amp")); #if 0 printf("%d\n", pul->pulse_amp[i]); #endif } return 0; } #ifdef COUPLING_DEC /* Table 4.4.8: Currently just for skipping the bits... */ static uint8_t coupling_channel_element(NeAACDecStruct *hDecoder, bitfile *ld) { uint8_t c, result = 0; uint8_t ind_sw_cce_flag = 0; uint8_t num_gain_element_lists = 0; uint8_t num_coupled_elements = 0; element el_empty = {0}; ic_stream ics_empty = {0}; int16_t sh_data[1024]; c = faad_getbits(ld, LEN_TAG DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag")); ind_sw_cce_flag = faad_get1bit(ld DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag")); num_coupled_elements = faad_getbits(ld, 3 DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements")); for (c = 0; c < num_coupled_elements + 1; c++) { uint8_t cc_target_is_cpe, cc_target_tag_select; num_gain_element_lists++; cc_target_is_cpe = faad_get1bit(ld DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe")); cc_target_tag_select = faad_getbits(ld, 4 DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select")); if (cc_target_is_cpe) { uint8_t cc_l = faad_get1bit(ld DEBUGVAR(1,905,"coupling_channel_element(): cc_l")); uint8_t cc_r = faad_get1bit(ld DEBUGVAR(1,906,"coupling_channel_element(): cc_r")); if (cc_l && cc_r) num_gain_element_lists++; } } faad_get1bit(ld DEBUGVAR(1,907,"coupling_channel_element(): cc_domain")); faad_get1bit(ld DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign")); faad_getbits(ld, 2 DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale")); if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty, 0, sh_data)) > 0) { return result; } /* IS not allowed in single channel */ if (ics->is_used) return 32; for (c = 1; c < num_gain_element_lists; c++) { uint8_t cge; if (ind_sw_cce_flag) { cge = 1; } else { cge = faad_get1bit(ld DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present")); } if (cge) { huffman_scale_factor(ld); } else { uint8_t g, sfb; for (g = 0; g < ics_empty.num_window_groups; g++) { for (sfb = 0; sfb < ics_empty.max_sfb; sfb++) { if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB) huffman_scale_factor(ld); } } } } return 0; } #endif /* Table 4.4.10 */ static uint16_t data_stream_element(NeAACDecStruct *hDecoder, bitfile *ld) { uint8_t byte_aligned; uint16_t i, count; /* element_instance_tag = */ faad_getbits(ld, LEN_TAG DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); byte_aligned = faad_get1bit(ld DEBUGVAR(1,61,"data_stream_element(): byte_aligned")); count = (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,62,"data_stream_element(): count")); if (count == 255) { count += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,63,"data_stream_element(): extra count")); } if (byte_aligned) faad_byte_align(ld); for (i = 0; i < count; i++) { faad_getbits(ld, LEN_BYTE DEBUGVAR(1,64,"data_stream_element(): data_stream_byte")); } return count; } /* Table 4.4.11 */ static uint8_t fill_element(NeAACDecStruct *hDecoder, bitfile *ld, drc_info *drc #ifdef SBR_DEC ,uint8_t sbr_ele #endif ) { uint16_t count; #ifdef SBR_DEC uint8_t bs_extension_type; #endif count = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,65,"fill_element(): count")); if (count == 15) { count += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,66,"fill_element(): extra count")) - 1; } if (count > 0) { #ifdef SBR_DEC bs_extension_type = (uint8_t)faad_showbits(ld, 4); if ((bs_extension_type == EXT_SBR_DATA) || (bs_extension_type == EXT_SBR_DATA_CRC)) { if (sbr_ele == INVALID_SBR_ELEMENT) return 24; if (!hDecoder->sbr[sbr_ele]) { hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } hDecoder->sbr_present_flag = 1; /* parse the SBR data */ hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count, hDecoder->postSeekResetFlag); #if 0 if (hDecoder->sbr[sbr_ele]->ret > 0) { printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret)); } #endif #if (defined(PS_DEC) || defined(DRM_PS)) if (hDecoder->sbr[sbr_ele]->ps_used) { hDecoder->ps_used[sbr_ele] = 1; /* set element independent flag to 1 as well */ hDecoder->ps_used_global = 1; } #endif } else { #endif #ifndef DRM while (count > 0) { count -= extension_payload(ld, drc, count); } #else return 30; #endif #ifdef SBR_DEC } #endif } return 0; } /* Table 4.4.12 */ #ifdef SSR_DEC static void gain_control_data(bitfile *ld, ic_stream *ics) { uint8_t bd, wd, ad; ssr_info *ssr = &(ics->ssr); ssr->max_band = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1000,"gain_control_data(): max_band")); if (ics->window_sequence == ONLY_LONG_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 1; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } else if (ics->window_sequence == LONG_START_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); if (wd == 0) { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } else { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 8; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } else if (ics->window_sequence == LONG_STOP_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); if (wd == 0) { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } else { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } } } #endif #ifdef DRM /* Table 4.4.13 ASME */ void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) { uint8_t retval = 0; uint8_t channels = hDecoder->fr_channels = 0; uint8_t ch; uint8_t this_layer_stereo = (hDecoder->channelConfiguration > 1) ? 1 : 0; element cpe = {0}; ic_stream *ics1 = &(cpe.ics1); ic_stream *ics2 = &(cpe.ics2); int16_t *spec_data; ALIGN int16_t spec_data1[1024] = {0}; ALIGN int16_t spec_data2[1024] = {0}; hDecoder->fr_ch_ele = 0; hInfo->error = DRM_aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); if (hInfo->error > 0) return; cpe.common_window = 1; if (this_layer_stereo) { hDecoder->element_id[0] = ID_CPE; if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; } else { hDecoder->element_id[0] = ID_SCE; } if (this_layer_stereo) { cpe.channel = 0; cpe.paired_channel = 1; } /* Stereo2 / Mono1 */ ics1->tns_data_present = faad_get1bit(ld); #if defined(LTP_DEC) ics1->ltp.data_present = faad_get1bit(ld); #elif defined (DRM) if(faad_get1bit(ld)) { hInfo->error = 26; return; } #else faad_get1bit(ld); #endif hInfo->error = side_info(hDecoder, &cpe, ld, ics1, 1); if (hInfo->error > 0) return; if (this_layer_stereo) { /* Stereo3 */ ics2->tns_data_present = faad_get1bit(ld); #ifdef LTP_DEC ics1->ltp.data_present = #endif faad_get1bit(ld); hInfo->error = side_info(hDecoder, &cpe, ld, ics2, 1); if (hInfo->error > 0) return; } /* Stereo4 / Mono2 */ if (ics1->tns_data_present) tns_data(ics1, &(ics1->tns), ld); if (this_layer_stereo) { /* Stereo5 */ if (ics2->tns_data_present) tns_data(ics2, &(ics2->tns), ld); } #ifdef DRM /* CRC check */ if (hDecoder->object_type == DRM_ER_LC) { if ((hInfo->error = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0) return; } #endif /* Stereo6 / Mono3 */ /* error resilient spectral data decoding */ if ((hInfo->error = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0) { return; } if (this_layer_stereo) { /* Stereo7 */ /* error resilient spectral data decoding */ if ((hInfo->error = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0) { return; } } #ifdef DRM #ifdef SBR_DEC /* In case of DRM we need to read the SBR info before channel reconstruction */ if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC)) { bitfile ld_sbr = {0}; uint32_t i; uint16_t count = 0; uint8_t *revbuffer; uint8_t *prevbufstart; uint8_t *pbufend; /* all forward bitreading should be finished at this point */ uint32_t bitsconsumed = faad_get_processed_bits(ld); uint32_t buffer_size = faad_origbitbuffer_size(ld); uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld); if (bitsconsumed + 8 > buffer_size*8) { hInfo->error = 14; return; } if (!hDecoder->sbr[0]) { hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0], 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1); } /* Reverse bit reading of SBR data in DRM audio frame */ revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); prevbufstart = revbuffer; pbufend = &buffer[buffer_size - 1]; for (i = 0; i < buffer_size; i++) *prevbufstart++ = tabFlipbits[*pbufend--]; /* Set SBR data */ /* consider 8 bits from AAC-CRC */ /* SBR buffer size is original buffer size minus AAC buffer size */ count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed); faad_initbits(&ld_sbr, revbuffer, count); hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index); hDecoder->sbr[0]->sample_rate *= 2; faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count, hDecoder->postSeekResetFlag); #if (defined(PS_DEC) || defined(DRM_PS)) if (hDecoder->sbr[0]->ps_used) { hDecoder->ps_used[0] = 1; hDecoder->ps_used_global = 1; } #endif if (ld_sbr.error) { hDecoder->sbr[0]->ret = 1; } /* check CRC */ /* no need to check it if there was already an error */ if (hDecoder->sbr[0]->ret == 0) hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8); /* SBR data was corrupted, disable it until the next header */ if (hDecoder->sbr[0]->ret != 0) { hDecoder->sbr[0]->header_count = 0; } faad_endbits(&ld_sbr); if (revbuffer) faad_free(revbuffer); } #endif #endif if (this_layer_stereo) { hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2); if (hInfo->error > 0) return; } else { hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1); if (hInfo->error > 0) return; } /* map output channels position to internal data channels */ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) { /* this might be faulty when pce_set is true */ hDecoder->internal_channel[channels] = channels; hDecoder->internal_channel[channels+1] = channels+1; } else { hDecoder->internal_channel[channels] = channels; } hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; hDecoder->fr_ch_ele++; return; } /* Table 4.4.15 */ static int8_t DRM_aac_scalable_main_header(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, bitfile *ld, uint8_t this_layer_stereo) { uint8_t retval = 0; uint8_t ch; ic_stream *ics; uint8_t ics_reserved_bit; ics_reserved_bit = faad_get1bit(ld DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits")); if (ics_reserved_bit != 0) return 32; ics1->window_sequence = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence")); ics1->window_shape = faad_get1bit(ld DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape")); if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE) { ics1->max_sfb = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)")); ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping")); } else { ics1->max_sfb = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)")); } /* get the grouping information */ if ((retval = window_grouping_info(hDecoder, ics1)) > 0) return retval; /* should be an error */ /* check the range of max_sfb */ if (ics1->max_sfb > ics1->num_swb) return 16; if (this_layer_stereo) { ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,306,"aac_scalable_main_header(): ms_mask_present")); if (ics1->ms_mask_present == 3) { /* bitstream error */ return 32; } if (ics1->ms_mask_present == 1) { uint8_t g, sfb; for (g = 0; g < ics1->num_window_groups; g++) { for (sfb = 0; sfb < ics1->max_sfb; sfb++) { ics1->ms_used[g][sfb] = faad_get1bit(ld DEBUGVAR(1,307,"aac_scalable_main_header(): faad_get1bit")); } } } memcpy(ics2, ics1, sizeof(ic_stream)); } else { ics1->ms_mask_present = 0; } return 0; } #endif static uint8_t side_info(NeAACDecStruct *hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag) { uint8_t result; ics->global_gain = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,67,"individual_channel_stream(): global_gain")); if (!ele->common_window && !scal_flag) { if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0) return result; } if ((result = section_data(hDecoder, ics, ld)) > 0) return result; if ((result = scale_factor_data(hDecoder, ics, ld)) > 0) return result; if (!scal_flag) { /** ** NOTE: It could be that pulse data is available in scalable AAC too, ** as said in Amendment 1, this could be only the case for ER AAC, ** though. (have to check this out later) **/ /* get pulse data */ if ((ics->pulse_data_present = faad_get1bit(ld DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1) { if ((result = pulse_data(ics, &(ics->pul), ld)) > 0) return result; } /* get tns data */ if ((ics->tns_data_present = faad_get1bit(ld DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1) { #ifdef ERROR_RESILIENCE if (hDecoder->object_type < ER_OBJECT_START) #endif tns_data(ics, &(ics->tns), ld); } /* get gain control data */ if ((ics->gain_control_data_present = faad_get1bit(ld DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1) { #ifdef SSR_DEC if (hDecoder->object_type != SSR) return 1; else gain_control_data(ld, ics); #else return 1; #endif } } #ifdef ERROR_RESILIENCE if (hDecoder->aacSpectralDataResilienceFlag) { ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14 DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data")); if (hDecoder->channelConfiguration == 2) { if (ics->length_of_reordered_spectral_data > 6144) ics->length_of_reordered_spectral_data = 6144; } else { if (ics->length_of_reordered_spectral_data > 12288) ics->length_of_reordered_spectral_data = 12288; } ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword")); if (ics->length_of_longest_codeword >= 49) ics->length_of_longest_codeword = 49; } /* RVLC spectral data is put here */ if (hDecoder->aacScalefactorDataResilienceFlag) { if ((result = rvlc_decode_scale_factors(ics, ld)) > 0) return result; } #endif return 0; } /* Table 4.4.24 */ static uint8_t individual_channel_stream(NeAACDecStruct *hDecoder, element *ele, bitfile *ld, ic_stream *ics, uint8_t scal_flag, int16_t *spec_data) { uint8_t result; result = side_info(hDecoder, ele, ld, ics, scal_flag); if (result > 0) return result; if (hDecoder->object_type >= ER_OBJECT_START) { if (ics->tns_data_present) tns_data(ics, &(ics->tns), ld); } #ifdef DRM /* CRC check */ if (hDecoder->object_type == DRM_ER_LC) { if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0) return result; } #endif #ifdef ERROR_RESILIENCE if (hDecoder->aacSpectralDataResilienceFlag) { /* error resilient spectral data decoding */ if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0) { return result; } } else { #endif /* decode the spectral data */ if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0) { return result; } #ifdef ERROR_RESILIENCE } #endif /* pulse coding reconstruction */ if (ics->pulse_data_present) { if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) { if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0) return result; } else { return 2; /* pulse coding not allowed for short blocks */ } } return 0; } /* Table 4.4.25 */ static uint8_t section_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld) { uint8_t g; uint8_t sect_esc_val, sect_bits; if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) sect_bits = 3; else sect_bits = 5; sect_esc_val = (1<max_sfb); printf(" sect top cb\n"); #endif for (g = 0; g < ics->num_window_groups; g++) { uint8_t k = 0; uint8_t i = 0; while (k < ics->max_sfb) { #ifdef ERROR_RESILIENCE uint8_t vcb11 = 0; #endif uint8_t sfb; uint8_t sect_len_incr; uint16_t sect_len = 0; uint8_t sect_cb_bits = 4; /* if "faad_getbits" detects error and returns "0", "k" is never incremented and we cannot leave the while loop */ if (ld->error != 0) return 14; #ifdef ERROR_RESILIENCE if (hDecoder->aacSectionDataResilienceFlag) sect_cb_bits = 5; #endif ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits DEBUGVAR(1,71,"section_data(): sect_cb")); if (ics->sect_cb[g][i] == 12) return 32; #if 0 printf("%d\n", ics->sect_cb[g][i]); #endif #ifndef DRM if (ics->sect_cb[g][i] == NOISE_HCB) ics->noise_used = 1; #else /* PNS not allowed in DRM */ if (ics->sect_cb[g][i] == NOISE_HCB) return 29; #endif if (ics->sect_cb[g][i] == INTENSITY_HCB2 || ics->sect_cb[g][i] == INTENSITY_HCB) ics->is_used = 1; #ifdef ERROR_RESILIENCE if (hDecoder->aacSectionDataResilienceFlag) { if ((ics->sect_cb[g][i] == 11) || ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32))) { vcb11 = 1; } } if (vcb11) { sect_len_incr = 1; } else { #endif sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits DEBUGVAR(1,72,"section_data(): sect_len_incr")); #ifdef ERROR_RESILIENCE } #endif while ((sect_len_incr == sect_esc_val) /* && (k+sect_len < ics->max_sfb)*/) { sect_len += sect_len_incr; sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits DEBUGVAR(1,72,"section_data(): sect_len_incr")); } sect_len += sect_len_incr; ics->sect_start[g][i] = k; ics->sect_end[g][i] = k + sect_len; #if 0 printf("%d\n", ics->sect_start[g][i]); #endif #if 0 printf("%d\n", ics->sect_end[g][i]); #endif if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { if (k + sect_len > 8*15) return 15; if (i >= 8*15) return 15; } else { if (k + sect_len > MAX_SFB) return 15; if (i >= MAX_SFB) return 15; } for (sfb = k; sfb < k + sect_len; sfb++) { ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; #if 0 printf("%d\n", ics->sfb_cb[g][sfb]); #endif } #if 0 printf(" %6d %6d %6d\n", i, ics->sect_end[g][i], ics->sect_cb[g][i]); #endif k += sect_len; i++; } ics->num_sec[g] = i; /* the sum of all sect_len_incr elements for a given window * group shall equal max_sfb */ if (k != ics->max_sfb) { return 32; } #if 0 printf("%d\n", ics->num_sec[g]); #endif } #if 0 printf("\n"); #endif return 0; } /* * decode_scale_factors() * decodes the scalefactors from the bitstream */ /* * All scalefactors (and also the stereo positions and pns energies) are * transmitted using Huffman coded DPCM relative to the previous active * scalefactor (respectively previous stereo position or previous pns energy, * see subclause 4.6.2 and 4.6.3). The first active scalefactor is * differentially coded relative to the global gain. */ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) { uint8_t g, sfb; int16_t t; int8_t noise_pcm_flag = 1; int16_t scale_factor = ics->global_gain; int16_t is_position = 0; int16_t noise_energy = ics->global_gain - 90; for (g = 0; g < ics->num_window_groups; g++) { for (sfb = 0; sfb < ics->max_sfb; sfb++) { switch (ics->sfb_cb[g][sfb]) { case ZERO_HCB: /* zero book */ ics->scale_factors[g][sfb] = 0; //#define SF_PRINT #ifdef SF_PRINT printf("%d\n", ics->scale_factors[g][sfb]); #endif break; case INTENSITY_HCB: /* intensity books */ case INTENSITY_HCB2: /* decode intensity position */ t = huffman_scale_factor(ld); is_position += (t - 60); ics->scale_factors[g][sfb] = is_position; #ifdef SF_PRINT printf("%d\n", ics->scale_factors[g][sfb]); #endif break; case NOISE_HCB: /* noise books */ #ifndef DRM /* decode noise energy */ if (noise_pcm_flag) { noise_pcm_flag = 0; t = (int16_t)faad_getbits(ld, 9 DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; } else { t = huffman_scale_factor(ld); t -= 60; } noise_energy += t; ics->scale_factors[g][sfb] = noise_energy; #ifdef SF_PRINT printf("%d\n", ics->scale_factors[g][sfb]); #endif #else /* PNS not allowed in DRM */ return 29; #endif break; default: /* spectral books */ /* ics->scale_factors[g][sfb] must be between 0 and 255 */ ics->scale_factors[g][sfb] = 0; /* decode scale factor */ t = huffman_scale_factor(ld); scale_factor += (t - 60); if (scale_factor < 0 || scale_factor > 255) return 4; ics->scale_factors[g][sfb] = scale_factor; #ifdef SF_PRINT printf("%d\n", ics->scale_factors[g][sfb]); #endif break; } } } return 0; } /* Table 4.4.26 */ static uint8_t scale_factor_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld) { uint8_t ret = 0; #ifdef PROFILE int64_t count = faad_get_ts(); #endif #ifdef ERROR_RESILIENCE if (!hDecoder->aacScalefactorDataResilienceFlag) { #endif ret = decode_scale_factors(ics, ld); #ifdef ERROR_RESILIENCE } else { /* In ER AAC the parameters for RVLC are seperated from the actual data that holds the scale_factors. Strangely enough, 2 parameters for HCR are put inbetween them. */ ret = rvlc_scale_factor_data(ics, ld); } #endif #ifdef PROFILE count = faad_get_ts() - count; hDecoder->scalefac_cycles += count; #endif return ret; } /* Table 4.4.27 */ static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) { uint8_t w, filt, i, start_coef_bits, coef_bits; uint8_t n_filt_bits = 2; uint8_t length_bits = 6; uint8_t order_bits = 5; if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { n_filt_bits = 1; length_bits = 4; order_bits = 3; } for (w = 0; w < ics->num_windows; w++) { tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits DEBUGVAR(1,74,"tns_data(): n_filt")); #if 0 printf("%d\n", tns->n_filt[w]); #endif if (tns->n_filt[w]) { if ((tns->coef_res[w] = faad_get1bit(ld DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1) { start_coef_bits = 4; } else { start_coef_bits = 3; } #if 0 printf("%d\n", tns->coef_res[w]); #endif } for (filt = 0; filt < tns->n_filt[w]; filt++) { tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits DEBUGVAR(1,76,"tns_data(): length")); #if 0 printf("%d\n", tns->length[w][filt]); #endif tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits DEBUGVAR(1,77,"tns_data(): order")); #if 0 printf("%d\n", tns->order[w][filt]); #endif if (tns->order[w][filt]) { tns->direction[w][filt] = faad_get1bit(ld DEBUGVAR(1,78,"tns_data(): direction")); #if 0 printf("%d\n", tns->direction[w][filt]); #endif tns->coef_compress[w][filt] = faad_get1bit(ld DEBUGVAR(1,79,"tns_data(): coef_compress")); #if 0 printf("%d\n", tns->coef_compress[w][filt]); #endif coef_bits = start_coef_bits - tns->coef_compress[w][filt]; for (i = 0; i < tns->order[w][filt]; i++) { tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits DEBUGVAR(1,80,"tns_data(): coef")); #if 0 printf("%d\n", tns->coef[w][filt][i]); #endif } } } } } #ifdef LTP_DEC /* Table 4.4.28 */ static uint8_t ltp_data(NeAACDecStruct *hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) { uint8_t sfb, w; ltp->lag = 0; #ifdef LD_DEC if (hDecoder->object_type == LD) { ltp->lag_update = (uint8_t)faad_getbits(ld, 1 DEBUGVAR(1,142,"ltp_data(): lag_update")); if (ltp->lag_update) { ltp->lag = (uint16_t)faad_getbits(ld, 10 DEBUGVAR(1,81,"ltp_data(): lag")); } } else { #endif ltp->lag = (uint16_t)faad_getbits(ld, 11 DEBUGVAR(1,81,"ltp_data(): lag")); #ifdef LD_DEC } #endif /* Check length of lag */ if (ltp->lag > (hDecoder->frameLength << 1)) return 18; ltp->coef = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,82,"ltp_data(): coef")); if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { for (w = 0; w < ics->num_windows; w++) { if ((ltp->short_used[w] = faad_get1bit(ld DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1) { ltp->short_lag_present[w] = faad_get1bit(ld DEBUGVAR(1,84,"ltp_data(): short_lag_present")); if (ltp->short_lag_present[w]) { ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,85,"ltp_data(): short_lag")); } } } } else { ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB); for (sfb = 0; sfb < ltp->last_band; sfb++) { ltp->long_used[sfb] = faad_get1bit(ld DEBUGVAR(1,86,"ltp_data(): long_used")); } } return 0; } #endif /* Table 4.4.29 */ static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data) { int8_t i; uint8_t g; uint16_t inc, k, p = 0; uint8_t groups = 0; uint8_t sect_cb; uint8_t result; uint16_t nshort = hDecoder->frameLength/8; #ifdef PROFILE int64_t count = faad_get_ts(); #endif for(g = 0; g < ics->num_window_groups; g++) { p = groups*nshort; for (i = 0; i < ics->num_sec[g]; i++) { sect_cb = ics->sect_cb[g][i]; inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4; switch (sect_cb) { case ZERO_HCB: case NOISE_HCB: case INTENSITY_HCB: case INTENSITY_HCB2: //#define SD_PRINT #ifdef SD_PRINT { int j; for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++) { printf("%d\n", 0); } } #endif //#define SFBO_PRINT #ifdef SFBO_PRINT printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); #endif p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - ics->sect_sfb_offset[g][ics->sect_start[g][i]]); break; default: #ifdef SFBO_PRINT printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); #endif for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc) { if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0) return result; #ifdef SD_PRINT { int j; for (j = p; j < p+inc; j++) { printf("%d\n", spectral_data[j]); } } #endif p += inc; } break; } } groups += ics->window_group_length[g]; } #ifdef PROFILE count = faad_get_ts() - count; hDecoder->spectral_cycles += count; #endif return 0; } /* Table 4.4.30 */ static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count) { uint16_t i, n, dataElementLength; uint8_t dataElementLengthPart; uint8_t align = 4, data_element_version, loopCounter; uint8_t extension_type = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,87,"extension_payload(): extension_type")); switch (extension_type) { case EXT_DYNAMIC_RANGE: drc->present = 1; n = dynamic_range_info(ld, drc); return n; case EXT_FILL_DATA: /* fill_nibble = */ faad_getbits(ld, 4 DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be 0000 */ for (i = 0; i < count-1; i++) { /* fill_byte[i] = */ faad_getbits(ld, 8 DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be 10100101 */ } return count; case EXT_DATA_ELEMENT: data_element_version = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,400,"extension_payload(): data_element_version")); switch (data_element_version) { case ANC_DATA: loopCounter = 0; dataElementLength = 0; do { dataElementLengthPart = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart")); dataElementLength += dataElementLengthPart; loopCounter++; } while (dataElementLengthPart == 255); for (i = 0; i < dataElementLength; i++) { /* data_element_byte[i] = */ faad_getbits(ld, 8 DEBUGVAR(1,402,"extension_payload(): data_element_byte")); return (dataElementLength+loopCounter+1); } default: align = 0; } case EXT_FIL: default: faad_getbits(ld, align DEBUGVAR(1,88,"extension_payload(): fill_nibble")); for (i = 0; i < count-1; i++) { /* other_bits[i] = */ faad_getbits(ld, 8 DEBUGVAR(1,89,"extension_payload(): fill_bit")); } return count; } } /* Table 4.4.31 */ static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc) { uint8_t i, n = 1; uint8_t band_incr; drc->num_bands = 1; if (faad_get1bit(ld DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1) { drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag")); /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4 DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits")); n++; } drc->excluded_chns_present = faad_get1bit(ld DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present")); if (drc->excluded_chns_present == 1) { n += excluded_channels(ld, drc); } if (faad_get1bit(ld DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1) { band_incr = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,95,"dynamic_range_info(): band_incr")); /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4 DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits")); n++; drc->num_bands += band_incr; for (i = 0; i < drc->num_bands; i++) { drc->band_top[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(1,97,"dynamic_range_info(): band_top")); n++; } } if (faad_get1bit(ld DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1) { drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7 DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level")); /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits")); n++; } for (i = 0; i < drc->num_bands; i++) { drc->dyn_rng_sgn[i] = faad_get1bit(ld DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn")); drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7 DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl")); n++; } return n; } /* Table 4.4.32 */ static uint8_t excluded_channels(bitfile *ld, drc_info *drc) { uint8_t i, n = 0; uint8_t num_excl_chan = 7; for (i = 0; i < 7; i++) { drc->exclude_mask[i] = faad_get1bit(ld DEBUGVAR(1,103,"excluded_channels(): exclude_mask")); } n++; while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1) { for (i = num_excl_chan; i < num_excl_chan+7; i++) { drc->exclude_mask[i] = faad_get1bit(ld DEBUGVAR(1,105,"excluded_channels(): exclude_mask")); } n++; num_excl_chan += 7; } return n; } /* Annex A: Audio Interchange Formats */ /* Table 1.A.2 */ void get_adif_header(adif_header *adif, bitfile *ld) { uint8_t i; /* adif_id[0] = */ faad_getbits(ld, 8 DEBUGVAR(1,106,"get_adif_header(): adif_id[0]")); /* adif_id[1] = */ faad_getbits(ld, 8 DEBUGVAR(1,107,"get_adif_header(): adif_id[1]")); /* adif_id[2] = */ faad_getbits(ld, 8 DEBUGVAR(1,108,"get_adif_header(): adif_id[2]")); /* adif_id[3] = */ faad_getbits(ld, 8 DEBUGVAR(1,109,"get_adif_header(): adif_id[3]")); adif->copyright_id_present = faad_get1bit(ld DEBUGVAR(1,110,"get_adif_header(): copyright_id_present")); if(adif->copyright_id_present) { for (i = 0; i < 72/8; i++) { adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8 DEBUGVAR(1,111,"get_adif_header(): copyright_id")); } adif->copyright_id[i] = 0; } adif->original_copy = faad_get1bit(ld DEBUGVAR(1,112,"get_adif_header(): original_copy")); adif->home = faad_get1bit(ld DEBUGVAR(1,113,"get_adif_header(): home")); adif->bitstream_type = faad_get1bit(ld DEBUGVAR(1,114,"get_adif_header(): bitstream_type")); adif->bitrate = faad_getbits(ld, 23 DEBUGVAR(1,115,"get_adif_header(): bitrate")); adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements")); for (i = 0; i < adif->num_program_config_elements + 1; i++) { if(adif->bitstream_type == 0) { adif->adif_buffer_fullness = faad_getbits(ld, 20 DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness")); } else { adif->adif_buffer_fullness = 0; } program_config_element(&adif->pce[i], ld); } } /* Table 1.A.5 */ uint8_t adts_frame(adts_header *adts, bitfile *ld) { /* faad_byte_align(ld); */ if (adts_fixed_header(adts, ld)) return 5; adts_variable_header(adts, ld); adts_error_check(adts, ld); return 0; } /* Table 1.A.6 */ static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld) { uint16_t i; uint8_t sync_err = 1; /* try to recover from sync errors */ for (i = 0; i < 768; i++) { adts->syncword = (uint16_t)faad_showbits(ld, 12); if (adts->syncword != 0xFFF) { faad_getbits(ld, 8 DEBUGVAR(0,0,"")); } else { sync_err = 0; faad_getbits(ld, 12 DEBUGVAR(1,118,"adts_fixed_header(): syncword")); break; } } if (sync_err) return 5; adts->id = faad_get1bit(ld DEBUGVAR(1,119,"adts_fixed_header(): id")); adts->layer = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,120,"adts_fixed_header(): layer")); adts->protection_absent = faad_get1bit(ld DEBUGVAR(1,121,"adts_fixed_header(): protection_absent")); adts->profile = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,122,"adts_fixed_header(): profile")); adts->sf_index = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,123,"adts_fixed_header(): sf_index")); adts->private_bit = faad_get1bit(ld DEBUGVAR(1,124,"adts_fixed_header(): private_bit")); adts->channel_configuration = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration")); adts->original = faad_get1bit(ld DEBUGVAR(1,126,"adts_fixed_header(): original")); adts->home = faad_get1bit(ld DEBUGVAR(1,127,"adts_fixed_header(): home")); if (adts->old_format == 1) { /* Removed in corrigendum 14496-3:2002 */ if (adts->id == 0) { adts->emphasis = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,128,"adts_fixed_header(): emphasis")); } } return 0; } /* Table 1.A.7 */ static void adts_variable_header(adts_header *adts, bitfile *ld) { adts->copyright_identification_bit = faad_get1bit(ld DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit")); adts->copyright_identification_start = faad_get1bit(ld DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start")); adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13 DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length")); adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11 DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness")); adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame")); } /* Table 1.A.8 */ static void adts_error_check(adts_header *adts, bitfile *ld) { if (adts->protection_absent == 0) { adts->crc_check = (uint16_t)faad_getbits(ld, 16 DEBUGVAR(1,134,"adts_error_check(): crc_check")); } } /* LATM parsing functions */ static uint32_t latm_get_value(bitfile *ld) { uint32_t l, value; uint8_t bytesForValue; bytesForValue = (uint8_t)faad_getbits(ld, 2); value = 0; for(l=0; lframelen_type==0) { do { tmp = (uint8_t)faad_getbits(ld, 8); framelen += tmp; } while(tmp==0xff); } else if(latm->framelen_type==1) framelen=latm->frameLength; return framelen; } static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld) { uint32_t ascLen, asc_bits=0; uint32_t x1, y1, m, n, i; program_config pce; mp4AudioSpecificConfig mp4ASC; latm->useSameStreamMux = (uint8_t)faad_getbits(ld, 1); if(!latm->useSameStreamMux) { //parseSameStreamMuxConfig latm->version = (uint8_t) faad_getbits(ld, 1); if(latm->version) latm->versionA = (uint8_t) faad_getbits(ld, 1); if(latm->versionA) { //dunno the payload format for versionA fprintf(stderr, "versionA not supported\n"); return 0; } if(latm->version) //read taraBufferFullness latm_get_value(ld); latm->allStreamsSameTimeFraming = (uint8_t)faad_getbits(ld, 1); latm->numSubFrames = (uint8_t)faad_getbits(ld, 6) + 1; latm->numPrograms = (uint8_t)faad_getbits(ld, 4) + 1; latm->numLayers = faad_getbits(ld, 3) + 1; if(latm->numPrograms>1 || !latm->allStreamsSameTimeFraming || latm->numSubFrames>1 || latm->numLayers>1) { fprintf(stderr, "\r\nUnsupported LATM configuration: %d programs/ %d subframes, %d layers, allstreams: %d\n", latm->numPrograms, latm->numSubFrames, latm->numLayers, latm->allStreamsSameTimeFraming); return 0; } ascLen = 0; if(latm->version) ascLen = latm_get_value(ld); x1 = faad_get_processed_bits(ld); if(AudioSpecificConfigFromBitfile(ld, &mp4ASC, &pce, 0, 1) < 0) return 0; //horrid hack to unread the ASC bits and store them in latm->ASC //the correct code would rely on an ideal faad_ungetbits() y1 = faad_get_processed_bits(ld); if((y1-x1) <= MAX_ASC_BYTES*8) { faad_rewindbits(ld); m = x1; while(m>0) { n = min(m, 32); faad_getbits(ld, n); m -= n; } i = 0; m = latm->ASCbits = y1 - x1; while(m > 0) { n = min(m, 8); latm->ASC[i++] = (uint8_t) faad_getbits(ld, n); m -= n; } } asc_bits = y1-x1; if(ascLen>asc_bits) faad_getbits(ld, ascLen-asc_bits); latm->framelen_type = (uint8_t) faad_getbits(ld, 3); if(latm->framelen_type == 0) { latm->frameLength = 0; faad_getbits(ld, 8); //buffer fullness for frame_len_type==0, useless } else if(latm->framelen_type == 1) { latm->frameLength = faad_getbits(ld, 9); if(latm->frameLength==0) { fprintf(stderr, "Invalid frameLength: 0\r\n"); return 0; } latm->frameLength = (latm->frameLength+20)*8; } else { //hellish CELP or HCVX stuff, discard fprintf(stderr, "Unsupported CELP/HCVX framelentype: %d\n", latm->framelen_type); return 0; } latm->otherDataLenBits = 0; if(faad_getbits(ld, 1)) { //other data present int esc, tmp; if(latm->version) latm->otherDataLenBits = latm_get_value(ld); else do { esc = faad_getbits(ld, 1); tmp = faad_getbits(ld, 8); latm->otherDataLenBits = (latm->otherDataLenBits << 8) + tmp; } while(esc); } if(faad_getbits(ld, 1)) //crc faad_getbits(ld, 8); latm->inited = 1; } //read payload if(latm->inited) return latmParsePayload(latm, ld); else return 0; } uint32_t faad_latm_frame(latm_header *latm, bitfile *ld) { uint16_t len; uint32_t initpos, endpos, firstpos, ret; firstpos = faad_get_processed_bits(ld); while (ld->bytes_left) { faad_byte_align(ld); if(faad_showbits(ld, 11) != 0x2B7) { faad_getbits(ld, 8); continue; } faad_getbits(ld, 11); len = faad_getbits(ld, 13); if(!len) continue; initpos = faad_get_processed_bits(ld); ret = latmAudioMuxElement(latm, ld); endpos = faad_get_processed_bits(ld); if(ret>0) return (len*8)-(endpos-initpos); //faad_getbits(ld, initpos-endpos); //go back to initpos, but is valid a getbits(-N) ? } return -1U; } welle.io-2.1/src/libs/faad2/libfaad/syntax.h000066400000000000000000000071271357201522000206540ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: syntax.h,v 1.60 2009/01/26 23:51:17 menno Exp $ **/ #ifndef __SYNTAX_H__ #define __SYNTAX_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define MAIN 1 #define LC 2 #define SSR 3 #define LTP 4 #define HE_AAC 5 #define LD 23 #define ER_LC 17 #define ER_LTP 19 #define DRM_ER_LC 27 /* special object type for DRM */ /* header types */ #define RAW 0 #define ADIF 1 #define ADTS 2 #define LATM 3 /* SBR signalling */ #define NO_SBR 0 #define SBR_UPSAMPLED 1 #define SBR_DOWNSAMPLED 2 #define NO_SBR_UPSAMPLED 3 /* DRM channel definitions */ #define DRMCH_MONO 1 #define DRMCH_STEREO 2 #define DRMCH_SBR_MONO 3 #define DRMCH_SBR_STEREO 4 #define DRMCH_SBR_PS_STEREO 5 /* First object type that has ER */ #define ER_OBJECT_START 17 /* Bitstream */ #define LEN_SE_ID 3 #define LEN_TAG 4 #define LEN_BYTE 8 #define EXT_FIL 0 #define EXT_FILL_DATA 1 #define EXT_DATA_ELEMENT 2 #define EXT_DYNAMIC_RANGE 11 #define ANC_DATA 0 /* Syntax elements */ #define ID_SCE 0x0 #define ID_CPE 0x1 #define ID_CCE 0x2 #define ID_LFE 0x3 #define ID_DSE 0x4 #define ID_PCE 0x5 #define ID_FIL 0x6 #define ID_END 0x7 #define ONLY_LONG_SEQUENCE 0x0 #define LONG_START_SEQUENCE 0x1 #define EIGHT_SHORT_SEQUENCE 0x2 #define LONG_STOP_SEQUENCE 0x3 #define ZERO_HCB 0 #define FIRST_PAIR_HCB 5 #define ESC_HCB 11 #define QUAD_LEN 4 #define PAIR_LEN 2 #define NOISE_HCB 13 #define INTENSITY_HCB2 14 #define INTENSITY_HCB 15 #define INVALID_SBR_ELEMENT 255 int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, program_config *pce); uint8_t adts_frame(adts_header *adts, bitfile *ld); void get_adif_header(adif_header *adif, bitfile *ld); void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data); #ifdef DRM void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); #endif uint32_t faad_latm_frame(latm_header *latm, bitfile *ld); #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/faad2/libfaad/tns.c000066400000000000000000000245611357201522000201260ustar00rootroot00000000000000/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: tns.c,v 1.40 2007/11/01 12:33:40 menno Exp $ **/ #include "common.h" #include "structs.h" #include "syntax.h" #include "tns.h" /* static function declarations */ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, uint8_t *coef, real_t *a); static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order); static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order); #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif static real_t tns_coef_0_3[] = { COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122), COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122), COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) }; static real_t tns_coef_0_4[] = { COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954), COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) }; static real_t tns_coef_1_3[] = { COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) }; static real_t tns_coef_1_4[] = { COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178), COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) }; /* TNS decoding for one channel and frame */ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len) { uint8_t w, f, tns_order; int8_t inc; int16_t size; uint16_t bottom, top, start, end; uint16_t nshort = frame_len/8; real_t lpc[TNS_MAX_ORDER+1]; if (!ics->tns_data_present) return; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; for (f = 0; f < tns->n_filt[w]; f++) { top = bottom; bottom = max(top - tns->length[w][f], 0); tns_order = min(tns->order[w][f], TNS_MAX_ORDER); if (!tns_order) continue; tns_decode_coef(tns_order, tns->coef_res[w]+3, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); start = min(start, ics->max_sfb); start = min(ics->swb_offset[start], ics->swb_offset_max); end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); end = min(end, ics->max_sfb); end = min(ics->swb_offset[end], ics->swb_offset_max); size = end - start; if (size <= 0) continue; if (tns->direction[w][f]) { inc = -1; start = end - 1; } else { inc = 1; } tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); } } } /* TNS encoding for one channel and frame */ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len) { uint8_t w, f, tns_order; int8_t inc; int16_t size; uint16_t bottom, top, start, end; uint16_t nshort = frame_len/8; real_t lpc[TNS_MAX_ORDER+1]; if (!ics->tns_data_present) return; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; for (f = 0; f < tns->n_filt[w]; f++) { top = bottom; bottom = max(top - tns->length[w][f], 0); tns_order = min(tns->order[w][f], TNS_MAX_ORDER); if (!tns_order) continue; tns_decode_coef(tns_order, tns->coef_res[w]+3, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); start = min(start, ics->max_sfb); start = min(ics->swb_offset[start], ics->swb_offset_max); end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); end = min(end, ics->max_sfb); end = min(ics->swb_offset[end], ics->swb_offset_max); size = end - start; if (size <= 0) continue; if (tns->direction[w][f]) { inc = -1; start = end - 1; } else { inc = 1; } tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); } } } /* Decoder transmitted coefficients for one TNS filter */ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, uint8_t *coef, real_t *a) { uint8_t i, m; real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1]; /* Conversion to signed integer */ for (i = 0; i < order; i++) { if (coef_compress == 0) { if (coef_res_bits == 3) { tmp2[i] = tns_coef_0_3[coef[i]]; } else { tmp2[i] = tns_coef_0_4[coef[i]]; } } else { if (coef_res_bits == 3) { tmp2[i] = tns_coef_1_3[coef[i]]; } else { tmp2[i] = tns_coef_1_4[coef[i]]; } } } /* Conversion to LPC coefficients */ a[0] = COEF_CONST(1.0); for (m = 1; m <= order; m++) { for (i = 1; i < m; i++) /* loop only while imm) #define NN (rs->nn) #define ALPHA_TO (rs->alpha_to) #define INDEX_OF (rs->index_of) #define GENPOLY (rs->genpoly) #define NROOTS (rs->nroots) #define FCR (rs->fcr) #define PRIM (rs->prim) #define IPRIM (rs->iprim) #define PAD (rs->pad) #define A0 (NN) welle.io-2.1/src/libs/fec/decode_rs.h000066400000000000000000000204631357201522000174510ustar00rootroot00000000000000/* The guts of the Reed-Solomon decoder, meant to be #included * into a function body with the following typedefs, macros and variables supplied * according to the code parameters: * data_t - a typedef for the data symbol * data_t data[] - array of NN data and parity symbols to be corrected in place * retval - an integer lvalue into which the decoder's return code is written * NROOTS - the number of roots in the RS code generator polynomial, * which is the same as the number of parity symbols in a block. Integer variable or literal. * NN - the total number of symbols in a RS block. Integer variable or literal. * PAD - the number of pad symbols in a block. Integer variable or literal. * ALPHA_TO - The address of an array of NN elements to convert Galois field * elements in index (log) form to polynomial form. Read only. * INDEX_OF - The address of an array of NN elements to convert Galois field * elements in polynomial form to index (log) form. Read only. * MODNN - a function to reduce its argument modulo NN. May be inline or a macro. * FCR - An integer literal or variable specifying the first consecutive root of the * Reed-Solomon generator polynomial. Integer variable or literal. * PRIM - The primitive root of the generator poly. Integer variable or literal. * DEBUG - If set to 1 or more, do various internal consistency checking. Leave this * undefined for production code * The memset(), memmove(), and memcpy() functions are used. The appropriate header * file declaring these functions (usually ) must be included by the calling * program. */ #if !defined(NROOTS) #error "NROOTS not defined" #endif #if !defined(NN) #error "NN not defined" #endif #if !defined(PAD) #error "PAD not defined" #endif #if !defined(ALPHA_TO) #error "ALPHA_TO not defined" #endif #if !defined(INDEX_OF) #error "INDEX_OF not defined" #endif #if !defined(MODNN) #error "MODNN not defined" #endif #if !defined(FCR) #error "FCR not defined" #endif #if !defined(PRIM) #error "PRIM not defined" #endif #if !defined(NULL) #define NULL ((void *)0) #endif #undef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #undef A0 #define A0 (NN) { int deg_lambda, el, deg_omega; int i, j, r,k; data_t u,q,tmp,num1,num2,den,discr_r; data_t lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly * and syndrome poly */ data_t b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; data_t root[NROOTS], reg[NROOTS+1], loc[NROOTS]; int syn_error, count; /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ for(i=0;i 0) { /* Init lambda to be the erasure locator polynomial */ lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))]; for (i = 1; i < no_eras; i++) { u = MODNN(PRIM*(NN-1-eras_pos[i])); for (j = i+1; j > 0; j--) { tmp = INDEX_OF[lambda[j - 1]]; if(tmp != A0) lambda[j] ^= ALPHA_TO[MODNN(u + tmp)]; } } #if DEBUG >= 1 /* Test code that verifies the erasure locator polynomial just constructed Needed only for decoder debugging. */ /* find roots of the erasure location polynomial */ for(i=1;i<=no_eras;i++) reg[i] = INDEX_OF[lambda[i]]; count = 0; for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) { q = 1; for (j = 1; j <= no_eras; j++) if (reg[j] != A0) { reg[j] = MODNN(reg[j] + j); q ^= ALPHA_TO[reg[j]]; } if (q != 0) continue; /* store root and error location number indices */ root[count] = i; loc[count] = k; count++; } if (count != no_eras) { fprintf(stderr, "count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras); count = -1; goto finish; } #if DEBUG >= 2 fprintf(stderr, "\n Erasure positions as determined by roots of Eras Loc Poly:\n"); for (i = 0; i < count; i++) fprintf(stderr, "%d ", loc[i]); fprintf(stderr, "\n"); #endif #endif } for(i=0;i 0; j--){ if (reg[j] != A0) { reg[j] = MODNN(reg[j] + j); q ^= ALPHA_TO[reg[j]]; } } if (q != 0) continue; /* Not a root */ /* store root (index-form) and error location number */ #if DEBUG>=2 fprintf(stderr, "count %d root %d loc %d\n",count,i,k); #endif root[count] = i; loc[count] = k; /* If we've already found max possible roots, * abort the search to save time */ if(++count == deg_lambda) break; } if (deg_lambda != count) { /* * deg(lambda) unequal to number of roots => uncorrectable * error detected */ count = -1; goto finish; } /* * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo * x**NROOTS). in index form. Also find deg(omega). */ deg_omega = deg_lambda-1; for (i = 0; i <= deg_omega;i++){ tmp = 0; for(j=i;j >= 0; j--){ if ((s[i - j] != A0) && (lambda[j] != A0)) tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])]; } omega[i] = INDEX_OF[tmp]; } /* * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form */ for (j = count-1; j >=0; j--) { num1 = 0; for (i = deg_omega; i >= 0; i--) { if (omega[i] != A0) num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])]; } num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)]; den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ for (i = MIN(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) { if(lambda[i+1] != A0) den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])]; } #if DEBUG >= 1 if (den == 0) { fprintf(stderr, "\n ERROR: denominator = 0\n"); count = -1; goto finish; } #endif /* Apply error to data */ if (num1 != 0 && loc[j] >= PAD) { data[loc[j]-PAD] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])]; } } finish: if(eras_pos != NULL){ for(i=0;i #endif #include #include "char.h" #include "rs-common.h" int decode_rs_char(void *p, data_t *data, int *eras_pos, int no_eras){ int retval; struct rs *rs = (struct rs *)p; #include "decode_rs.h" return retval; } welle.io-2.1/src/libs/fec/encode_rs.h000066400000000000000000000044511357201522000174620ustar00rootroot00000000000000/* The guts of the Reed-Solomon encoder, meant to be #included * into a function body with the following typedefs, macros and variables supplied * according to the code parameters: * data_t - a typedef for the data symbol * data_t data[] - array of NN-NROOTS-PAD and type data_t to be encoded * data_t parity[] - an array of NROOTS and type data_t to be written with parity symbols * NROOTS - the number of roots in the RS code generator polynomial, * which is the same as the number of parity symbols in a block. Integer variable or literal. * * NN - the total number of symbols in a RS block. Integer variable or literal. * PAD - the number of pad symbols in a block. Integer variable or literal. * ALPHA_TO - The address of an array of NN elements to convert Galois field * elements in index (log) form to polynomial form. Read only. * INDEX_OF - The address of an array of NN elements to convert Galois field * elements in polynomial form to index (log) form. Read only. * MODNN - a function to reduce its argument modulo NN. May be inline or a macro. * GENPOLY - an array of NROOTS+1 elements containing the generator polynomial in index form * The memset() and memmove() functions are used. The appropriate header * file declaring these functions (usually ) must be included by the calling * program. * Copyright 2004, Phil Karn, KA9Q * May be used under the terms of the GNU Lesser General Public License (LGPL) */ #undef A0 #define A0 (NN) /* Special reserved value encoding zero in index form */ { int i, j; data_t feedback; memset(parity,0,NROOTS*sizeof(data_t)); for(i=0;i #include "char.h" #include "rs-common.h" void encode_rs_char(void *p,data_t *data, data_t *parity){ struct rs *rs = (struct rs *)p; #include "encode_rs.h" } welle.io-2.1/src/libs/fec/fec.h000066400000000000000000000015451357201522000162570ustar00rootroot00000000000000/* Main header for reduced libfec. * * The FEC code in this folder is * Copyright 2003 Phil Karn, KA9Q * May be used under the terms of the GNU Lesser General Public License (LGPL) */ #pragma once #include #include "char.h" #include "rs-common.h" /* Initialize a Reed-Solomon codec * symsize = symbol size, bits * gfpoly = Field generator polynomial coefficients * fcr = first root of RS code generator polynomial, index form * prim = primitive element to generate polynomial roots * nroots = RS code generator polynomial degree (number of roots) * pad = padding bytes at front of shortened block */ void *init_rs_char(int symsize,int gfpoly,int fcr,int prim,int nroots,int pad); int decode_rs_char(void *p, data_t *data, int *eras_pos, int no_eras); void encode_rs_char(void *p,data_t *data, data_t *parity); void free_rs_char(void *p); welle.io-2.1/src/libs/fec/init_rs.h000066400000000000000000000051561357201522000171730ustar00rootroot00000000000000/* Common code for intializing a Reed-Solomon control block (char or int symbols) * Copyright 2004 Phil Karn, KA9Q * May be used under the terms of the GNU Lesser General Public License (LGPL) */ { int i, j, sr,root,iprim; rs = NULL; /* Check parameter ranges */ if(symsize < 0 || (size_t)symsize > 8*sizeof(data_t)){ goto done; } if(fcr < 0 || fcr >= (1<= (1<= (1<= ((1<mm = symsize; rs->nn = (1<pad = pad; rs->alpha_to = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); if(rs->alpha_to == NULL){ free(rs); rs = NULL; goto done; } rs->index_of = (data_t *)malloc(sizeof(data_t)*(rs->nn+1)); if(rs->index_of == NULL){ free(rs->alpha_to); free(rs); rs = NULL; goto done; } /* Generate Galois field lookup tables */ rs->index_of[0] = A0; /* log(zero) = -inf */ rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ sr = 1; for(i=0;inn;i++){ rs->index_of[sr] = i; rs->alpha_to[i] = sr; sr <<= 1; if(sr & (1<nn; } if(sr != 1){ /* field generator polynomial is not primitive! */ free(rs->alpha_to); free(rs->index_of); free(rs); rs = NULL; goto done; } /* Form RS code generator polynomial from its roots */ rs->genpoly = (data_t *)malloc(sizeof(data_t)*(nroots+1)); if(rs->genpoly == NULL){ free(rs->alpha_to); free(rs->index_of); free(rs); rs = NULL; goto done; } rs->fcr = fcr; rs->prim = prim; rs->nroots = nroots; /* Find prim-th root of 1, used in decoding */ for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) ; rs->iprim = iprim / prim; rs->genpoly[0] = 1; for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { rs->genpoly[i+1] = 1; /* Multiply rs->genpoly[] by @**(root + x) */ for (j = i; j > 0; j--){ if (rs->genpoly[j] != 0) rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; else rs->genpoly[j] = rs->genpoly[j-1]; } /* rs->genpoly[0] can never be zero */ rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; } /* convert rs->genpoly[] to index form for quicker encoding */ for (i = 0; i <= nroots; i++) rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; done:; } welle.io-2.1/src/libs/fec/init_rs_char.c000066400000000000000000000015201357201522000201520ustar00rootroot00000000000000/* Initialize a RS codec * * Copyright 2002 Phil Karn, KA9Q * May be used under the terms of the GNU Lesser General Public License (LGPL) */ #include #include "char.h" #include "rs-common.h" void free_rs_char(void *p){ struct rs *rs = (struct rs *)p; free(rs->alpha_to); free(rs->index_of); free(rs->genpoly); free(rs); } /* Initialize a Reed-Solomon codec * symsize = symbol size, bits * gfpoly = Field generator polynomial coefficients * fcr = first root of RS code generator polynomial, index form * prim = primitive element to generate polynomial roots * nroots = RS code generator polynomial degree (number of roots) * pad = padding bytes at front of shortened block */ void *init_rs_char(int symsize,int gfpoly,int fcr,int prim, int nroots,int pad){ struct rs *rs; #include "init_rs.h" return rs; } welle.io-2.1/src/libs/fec/rs-common.h000066400000000000000000000016471357201522000174370ustar00rootroot00000000000000/* Stuff common to all the general-purpose Reed-Solomon codecs * Copyright 2004 Phil Karn, KA9Q * May be used under the terms of the GNU Lesser General Public License (LGPL) */ /* Reed-Solomon codec control block */ struct rs { int mm; /* Bits per symbol */ int nn; /* Symbols per block (= (1<= rs->nn) { x -= rs->nn; x = (x >> rs->mm) + (x & rs->nn); } return x; } welle.io-2.1/src/libs/fec/test/000077500000000000000000000000001357201522000163235ustar00rootroot00000000000000welle.io-2.1/src/libs/fec/test/CMakeLists.txt000066400000000000000000000016711357201522000210700ustar00rootroot00000000000000######################################################################## # Checks for features. ######################################################################## include(CheckIncludeFile) check_include_file("stdio.h" HAVE_STDIO_H) check_include_file("stdlib.h" HAVE_STDLIB_H) check_include_file("memory.h" HAVE_MEMORY_H) check_include_file("time.h" HAVE_TIME_H) include(CheckFunctionExists) check_function_exists("memset" HAVE_MEMSET) ######################################################################## # Build the executables and set up the tests ######################################################################## include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}) add_executable(rs_speedtest rs_speedtest.c) target_link_libraries(rs_speedtest fec) add_test(rs_speedtest rs_speedtest) add_executable(rstest rstest.c) target_link_libraries(rstest fec) add_test(rstest rstest) welle.io-2.1/src/libs/fec/test/rs_speedtest.c000066400000000000000000000016471357201522000212030ustar00rootroot00000000000000#include #include #include #include #include #include #include "fec.h" int main(){ unsigned char block[255]; int i; void *rs; struct rusage start,finish; double extime; int trials = 10000; for(i=0;i<223;i++) block[i] = 0x01; rs = init_rs_char(8,0x187,112,11,32,0); encode_rs_char(rs,block,&block[223]); getrusage(RUSAGE_SELF,&start); for(i=0;i #include #include #include #include "fec.h" struct etab { int symsize; int genpoly; int fcs; int prim; int nroots; int ntrials; } Tab[] = { {2, 0x7, 1, 1, 1, 10 }, {3, 0xb, 1, 1, 2, 10 }, {4, 0x13, 1, 1, 4, 10 }, {5, 0x25, 1, 1, 6, 10 }, {6, 0x43, 1, 1, 8, 10 }, {7, 0x89, 1, 1, 10, 10 }, {8, 0x11d, 1, 1, 32, 10 }, {8, 0x187, 112,11, 32, 10 }, /* Duplicates CCSDS codec */ {0, 0, 0, 0, 0}, }; int exercise_char(struct etab *e); int main(){ int i; srandom(time(NULL)); for(i=0;Tab[i].symsize != 0;i++){ int nn,kk; nn = (1<symsize) - 1; unsigned char block[nn],tblock[nn]; int errlocs[nn],derrlocs[nn]; int i; int errors; int derrors,kk; int errval,errloc; int erasures; int decoder_errors = 0; void *rs; if(e->symsize > 8) return -1; /* Compute code parameters */ kk = nn - e->nroots; rs = init_rs_char(e->symsize,e->genpoly,e->fcs,e->prim,e->nroots,0); if(rs == NULL){ printf("init_rs_char failed!\n"); return -1; } /* Test up to the error correction capacity of the code */ for(errors=0;errors <= e->nroots/2;errors++){ /* Load block with random data and encode */ for(i=0;i. Copyright (c) 2013-2018 Niels Lohmann . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef NLOHMANN_JSON_HPP #define NLOHMANN_JSON_HPP #define NLOHMANN_JSON_VERSION_MAJOR 3 #define NLOHMANN_JSON_VERSION_MINOR 1 #define NLOHMANN_JSON_VERSION_PATCH 2 #include // all_of, find, for_each #include // assert #include // and, not, or #include // nullptr_t, ptrdiff_t, size_t #include // hash, less #include // initializer_list #include // istream, ostream #include // iterator_traits, random_access_iterator_tag #include // accumulate #include // string, stoi, to_string #include // declval, forward, move, pair, swap // #include #ifndef NLOHMANN_JSON_FWD_HPP #define NLOHMANN_JSON_FWD_HPP #include // int64_t, uint64_t #include // map #include // allocator #include // string #include // vector /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @since version 1.0.0 */ namespace nlohmann { /*! @brief default JSONSerializer template argument This serializer ignores the template arguments and uses ADL ([argument-dependent lookup](http://en.cppreference.com/w/cpp/language/adl)) for serialization. */ template struct adl_serializer; template class ObjectType = std::map, template class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template class AllocatorType = std::allocator, template class JSONSerializer = adl_serializer> class basic_json; /*! @brief JSON Pointer A JSON pointer defines a string syntax for identifying a specific value within a JSON document. It can be used with functions `at` and `operator[]`. Furthermore, JSON pointers are the base for JSON patches. @sa [RFC 6901](https://tools.ietf.org/html/rfc6901) @since version 2.0.0 */ template class json_pointer; /*! @brief default JSON class This type is the default specialization of the @ref basic_json class which uses the standard template types. @since version 1.0.0 */ using json = basic_json<>; } #endif // #include // This file contains all internal macro definitions // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them // exclude unsupported compilers #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" #endif // disable documentation warnings on clang #if defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdocumentation" #endif // allow for portable deprecation warnings #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #define JSON_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) #define JSON_DEPRECATED __declspec(deprecated) #else #define JSON_DEPRECATED #endif // allow to disable exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try #define JSON_CATCH(exception) catch(exception) #else #define JSON_THROW(exception) std::abort() #define JSON_TRY if(true) #define JSON_CATCH(exception) if(false) #endif // override exception macros #if defined(JSON_THROW_USER) #undef JSON_THROW #define JSON_THROW JSON_THROW_USER #endif #if defined(JSON_TRY_USER) #undef JSON_TRY #define JSON_TRY JSON_TRY_USER #endif #if defined(JSON_CATCH_USER) #undef JSON_CATCH #define JSON_CATCH JSON_CATCH_USER #endif // manual branch prediction #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #define JSON_LIKELY(x) __builtin_expect(!!(x), 1) #define JSON_UNLIKELY(x) __builtin_expect(!!(x), 0) #else #define JSON_LIKELY(x) x #define JSON_UNLIKELY(x) x #endif // C++ language standard detection #if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) #define JSON_HAS_CPP_14 #endif // Ugly macros to avoid uglier copy-paste when specializing basic_json. They // may be removed in the future once the class is split. #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ template class ObjectType, \ template class ArrayType, \ class StringType, class BooleanType, class NumberIntegerType, \ class NumberUnsignedType, class NumberFloatType, \ template class AllocatorType, \ template class JSONSerializer> #define NLOHMANN_BASIC_JSON_TPL \ basic_json /*! @brief Helper to determine whether there's a key_type for T. This helper is used to tell associative containers apart from other containers such as sequence containers. For instance, `std::map` passes the test as it contains a `mapped_type`, whereas `std::vector` fails the test. @sa http://stackoverflow.com/a/7728728/266378 @since version 1.0.0, overworked in version 2.0.6 */ #define NLOHMANN_JSON_HAS_HELPER(type) \ template struct has_##type { \ private: \ template \ static int detect(U &&); \ static void detect(...); \ public: \ static constexpr bool value = \ std::is_integral()))>::value; \ } // #include #include // not #include // size_t #include // numeric_limits #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type #include // declval // #include // #include namespace nlohmann { /*! @brief detail namespace with internal helper functions This namespace collects functions that should not be exposed, implementations of some @ref basic_json methods, and meta-programming helpers. @since version 2.1.0 */ namespace detail { ///////////// // helpers // ///////////// template struct is_basic_json : std::false_type {}; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct is_basic_json : std::true_type {}; // alias templates to reduce boilerplate template using enable_if_t = typename std::enable_if::type; template using uncvref_t = typename std::remove_cv::type>::type; // implementation of C++14 index_sequence and affiliates // source: https://stackoverflow.com/a/32223343 template struct index_sequence { using type = index_sequence; using value_type = std::size_t; static constexpr std::size_t size() noexcept { return sizeof...(Ints); } }; template struct merge_and_renumber; template struct merge_and_renumber, index_sequence> : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; template struct make_index_sequence : merge_and_renumber < typename make_index_sequence < N / 2 >::type, typename make_index_sequence < N - N / 2 >::type > {}; template<> struct make_index_sequence<0> : index_sequence<> {}; template<> struct make_index_sequence<1> : index_sequence<0> {}; template using index_sequence_for = make_index_sequence; /* Implementation of two C++17 constructs: conjunction, negation. This is needed to avoid evaluating all the traits in a condition For example: not std::is_same::value and has_value_type::value will not compile when T = void (on MSVC at least). Whereas conjunction>, has_value_type>::value will stop evaluating if negation<...>::value == false Please note that those constructs must be used with caution, since symbols can become very long quickly (which can slow down compilation and cause MSVC internal compiler errors). Only use it when you have to (see example ahead). */ template struct conjunction : std::true_type {}; template struct conjunction : B1 {}; template struct conjunction : std::conditional, B1>::type {}; template struct negation : std::integral_constant {}; // dispatch utility (taken from ranges-v3) template struct priority_tag : priority_tag < N - 1 > {}; template<> struct priority_tag<0> {}; //////////////////////// // has_/is_ functions // //////////////////////// // source: https://stackoverflow.com/a/37193089/4116453 template struct is_complete_type : std::false_type {}; template struct is_complete_type : std::true_type {}; NLOHMANN_JSON_HAS_HELPER(mapped_type); NLOHMANN_JSON_HAS_HELPER(key_type); NLOHMANN_JSON_HAS_HELPER(value_type); NLOHMANN_JSON_HAS_HELPER(iterator); template struct is_compatible_object_type_impl : std::false_type {}; template struct is_compatible_object_type_impl { static constexpr auto value = std::is_constructible::value and std::is_constructible::value; }; template struct is_compatible_object_type { static auto constexpr value = is_compatible_object_type_impl < conjunction>, has_mapped_type, has_key_type>::value, typename BasicJsonType::object_t, CompatibleObjectType >::value; }; template struct is_basic_json_nested_type { static auto constexpr value = std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value; }; template struct is_compatible_array_type { static auto constexpr value = conjunction>, negation>, negation>, negation>, has_value_type, has_iterator>::value; }; template struct is_compatible_integer_type_impl : std::false_type {}; template struct is_compatible_integer_type_impl { // is there an assert somewhere on overflows? using RealLimits = std::numeric_limits; using CompatibleLimits = std::numeric_limits; static constexpr auto value = std::is_constructible::value and CompatibleLimits::is_integer and RealLimits::is_signed == CompatibleLimits::is_signed; }; template struct is_compatible_integer_type { static constexpr auto value = is_compatible_integer_type_impl < std::is_integral::value and not std::is_same::value, RealIntegerType, CompatibleNumberIntegerType > ::value; }; // trait checking if JSONSerializer::from_json(json const&, udt&) exists template struct has_from_json { private: // also check the return type of from_json template::from_json( std::declval(), std::declval()))>::value>> static int detect(U&&); static void detect(...); public: static constexpr bool value = std::is_integral>()))>::value; }; // This trait checks if JSONSerializer::from_json(json const&) exists // this overload is used for non-default-constructible user-defined-types template struct has_non_default_from_json { private: template < typename U, typename = enable_if_t::from_json(std::declval()))>::value >> static int detect(U&&); static void detect(...); public: static constexpr bool value = std::is_integral>()))>::value; }; // This trait checks if BasicJsonType::json_serializer::to_json exists template struct has_to_json { private: template::to_json( std::declval(), std::declval()))> static int detect(U&&); static void detect(...); public: static constexpr bool value = std::is_integral>()))>::value; }; template struct is_compatible_complete_type { static constexpr bool value = not std::is_base_of::value and not is_basic_json::value and not is_basic_json_nested_type::value and has_to_json::value; }; template struct is_compatible_type : conjunction, is_compatible_complete_type> { }; // taken from ranges-v3 template struct static_const { static constexpr T value{}; }; template constexpr T static_const::value; } } // #include #include // exception #include // runtime_error #include // to_string namespace nlohmann { namespace detail { //////////////// // exceptions // //////////////// /*! @brief general exception of the @ref basic_json class This class is an extension of `std::exception` objects with a member @a id for exception ids. It is used as the base class for all exceptions thrown by the @ref basic_json class. This class can hence be used as "wildcard" to catch exceptions. Subclasses: - @ref parse_error for exceptions indicating a parse error - @ref invalid_iterator for exceptions indicating errors with iterators - @ref type_error for exceptions indicating executing a member function with a wrong type - @ref out_of_range for exceptions indicating access out of the defined range - @ref other_error for exceptions indicating other library errors @internal @note To have nothrow-copy-constructible exceptions, we internally use `std::runtime_error` which can cope with arbitrary-length error messages. Intermediate strings are built with static functions and then passed to the actual constructor. @endinternal @liveexample{The following code shows how arbitrary library exceptions can be caught.,exception} @since version 3.0.0 */ class exception : public std::exception { public: /// returns the explanatory string const char* what() const noexcept override { return m.what(); } /// the id of the exception const int id; protected: exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} static std::string name(const std::string& ename, int id_) { return "[json.exception." + ename + "." + std::to_string(id_) + "] "; } private: /// an exception object as storage for error messages std::runtime_error m; }; /*! @brief exception indicating a parse error This exception is thrown by the library when a parse error occurs. Parse errors can occur during the deserialization of JSON text, CBOR, MessagePack, as well as when using JSON Patch. Member @a byte holds the byte index of the last read character in the input file. Exceptions have ids 1xx. name / id | example message | description ------------------------------ | --------------- | ------------------------- json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). @liveexample{The following code shows how a `parse_error` exception can be caught.,parse_error} @sa @ref exception for the base class of the library exceptions @sa @ref invalid_iterator for exceptions indicating errors with iterators @sa @ref type_error for exceptions indicating executing a member function with a wrong type @sa @ref out_of_range for exceptions indicating access out of the defined range @sa @ref other_error for exceptions indicating other library errors @since version 3.0.0 */ class parse_error : public exception { public: /*! @brief create a parse error exception @param[in] id_ the id of the exception @param[in] byte_ the byte index where the error occurred (or 0 if the position cannot be determined) @param[in] what_arg the explanatory string @return parse_error object */ static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) { std::string w = exception::name("parse_error", id_) + "parse error" + (byte_ != 0 ? (" at " + std::to_string(byte_)) : "") + ": " + what_arg; return parse_error(id_, byte_, w.c_str()); } /*! @brief byte index of the parse error The byte index of the last read character in the input file. @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). */ const std::size_t byte; private: parse_error(int id_, std::size_t byte_, const char* what_arg) : exception(id_, what_arg), byte(byte_) {} }; /*! @brief exception indicating errors with iterators This exception is thrown if iterators passed to a library function do not match the expected semantics. Exceptions have ids 2xx. name / id | example message | description ----------------------------------- | --------------- | ------------------------- json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). @liveexample{The following code shows how an `invalid_iterator` exception can be caught.,invalid_iterator} @sa @ref exception for the base class of the library exceptions @sa @ref parse_error for exceptions indicating a parse error @sa @ref type_error for exceptions indicating executing a member function with a wrong type @sa @ref out_of_range for exceptions indicating access out of the defined range @sa @ref other_error for exceptions indicating other library errors @since version 3.0.0 */ class invalid_iterator : public exception { public: static invalid_iterator create(int id_, const std::string& what_arg) { std::string w = exception::name("invalid_iterator", id_) + what_arg; return invalid_iterator(id_, w.c_str()); } private: invalid_iterator(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /*! @brief exception indicating executing a member function with a wrong type This exception is thrown in case of a type error; that is, a library function is executed on a JSON value whose type does not match the expected semantics. Exceptions have ids 3xx. name / id | example message | description ----------------------------- | --------------- | ------------------------- json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t&. json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | @liveexample{The following code shows how a `type_error` exception can be caught.,type_error} @sa @ref exception for the base class of the library exceptions @sa @ref parse_error for exceptions indicating a parse error @sa @ref invalid_iterator for exceptions indicating errors with iterators @sa @ref out_of_range for exceptions indicating access out of the defined range @sa @ref other_error for exceptions indicating other library errors @since version 3.0.0 */ class type_error : public exception { public: static type_error create(int id_, const std::string& what_arg) { std::string w = exception::name("type_error", id_) + what_arg; return type_error(id_, w.c_str()); } private: type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /*! @brief exception indicating access out of the defined range This exception is thrown in case a library function is called on an input parameter that exceeds the expected range, for instance in case of array indices or nonexisting object keys. Exceptions have ids 4xx. name / id | example message | description ------------------------------- | --------------- | ------------------------- json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON only supports integers numbers up to 9223372036854775807. | json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | @liveexample{The following code shows how an `out_of_range` exception can be caught.,out_of_range} @sa @ref exception for the base class of the library exceptions @sa @ref parse_error for exceptions indicating a parse error @sa @ref invalid_iterator for exceptions indicating errors with iterators @sa @ref type_error for exceptions indicating executing a member function with a wrong type @sa @ref other_error for exceptions indicating other library errors @since version 3.0.0 */ class out_of_range : public exception { public: static out_of_range create(int id_, const std::string& what_arg) { std::string w = exception::name("out_of_range", id_) + what_arg; return out_of_range(id_, w.c_str()); } private: out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /*! @brief exception indicating other library errors This exception is thrown in case of errors that cannot be classified with the other exception types. Exceptions have ids 5xx. name / id | example message | description ------------------------------ | --------------- | ------------------------- json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. @sa @ref exception for the base class of the library exceptions @sa @ref parse_error for exceptions indicating a parse error @sa @ref invalid_iterator for exceptions indicating errors with iterators @sa @ref type_error for exceptions indicating executing a member function with a wrong type @sa @ref out_of_range for exceptions indicating access out of the defined range @liveexample{The following code shows how an `other_error` exception can be caught.,other_error} @since version 3.0.0 */ class other_error : public exception { public: static other_error create(int id_, const std::string& what_arg) { std::string w = exception::name("other_error", id_) + what_arg; return other_error(id_, w.c_str()); } private: other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} }; } } // #include #include // array #include // and #include // size_t #include // uint8_t namespace nlohmann { namespace detail { /////////////////////////// // JSON type enumeration // /////////////////////////// /*! @brief the JSON type enumeration This enumeration collects the different JSON types. It is internally used to distinguish the stored values, and the functions @ref basic_json::is_null(), @ref basic_json::is_object(), @ref basic_json::is_array(), @ref basic_json::is_string(), @ref basic_json::is_boolean(), @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and @ref basic_json::is_structured() rely on it. @note There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library distinguishes these three types for numbers: @ref basic_json::number_unsigned_t is used for unsigned integers, @ref basic_json::number_integer_t is used for signed integers, and @ref basic_json::number_float_t is used for floating-point numbers or to approximate integers which do not fit in the limits of their respective type. @sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON value with the default value for a given type @since version 1.0.0 */ enum class value_t : std::uint8_t { null, ///< null value object, ///< object (unordered set of name/value pairs) array, ///< array (ordered collection of values) string, ///< string value boolean, ///< boolean value number_integer, ///< number value (signed integer) number_unsigned, ///< number value (unsigned integer) number_float, ///< number value (floating-point) discarded ///< discarded by the the parser callback function }; /*! @brief comparison operator for JSON types Returns an ordering that is similar to Python: - order: null < boolean < number < object < array < string - furthermore, each type is not smaller than itself - discarded values are not comparable @since version 1.0.0 */ inline bool operator<(const value_t lhs, const value_t rhs) noexcept { static constexpr std::array order = {{ 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */ } }; const auto l_index = static_cast(lhs); const auto r_index = static_cast(rhs); return l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index]; } } } // #include #include // transform #include // array #include // and, not #include // forward_list #include // inserter, front_inserter, end #include // string #include // tuple, make_tuple #include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible #include // pair, declval #include // valarray // #include // #include // #include // #include namespace nlohmann { namespace detail { // overloads for basic_json template parameters template::value and not std::is_same::value, int> = 0> void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) { switch (static_cast(j)) { case value_t::number_unsigned: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_integer: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_float: { val = static_cast(*j.template get_ptr()); break; } default: JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()))); } } template void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) { if (JSON_UNLIKELY(not j.is_boolean())) { JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name()))); } b = *j.template get_ptr(); } template void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) { if (JSON_UNLIKELY(not j.is_string())) { JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); } s = *j.template get_ptr(); } template void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val) { get_arithmetic_value(j, val); } template void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val) { get_arithmetic_value(j, val); } template void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val) { get_arithmetic_value(j, val); } template::value, int> = 0> void from_json(const BasicJsonType& j, EnumType& e) { typename std::underlying_type::type val; get_arithmetic_value(j, val); e = static_cast(val); } template void from_json(const BasicJsonType& j, typename BasicJsonType::array_t& arr) { if (JSON_UNLIKELY(not j.is_array())) { JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } arr = *j.template get_ptr(); } // forward_list doesn't have an insert method template::value, int> = 0> void from_json(const BasicJsonType& j, std::forward_list& l) { if (JSON_UNLIKELY(not j.is_array())) { JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } std::transform(j.rbegin(), j.rend(), std::front_inserter(l), [](const BasicJsonType & i) { return i.template get(); }); } // valarray doesn't have an insert method template::value, int> = 0> void from_json(const BasicJsonType& j, std::valarray& l) { if (JSON_UNLIKELY(not j.is_array())) { JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } l.resize(j.size()); std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l)); } template void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<0> /*unused*/) { using std::end; std::transform(j.begin(), j.end(), std::inserter(arr, end(arr)), [](const BasicJsonType & i) { // get() returns *this, this won't call a from_json // method when value_type is BasicJsonType return i.template get(); }); } template auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<1> /*unused*/) -> decltype( arr.reserve(std::declval()), void()) { using std::end; arr.reserve(j.size()); std::transform(j.begin(), j.end(), std::inserter(arr, end(arr)), [](const BasicJsonType & i) { // get() returns *this, this won't call a from_json // method when value_type is BasicJsonType return i.template get(); }); } template void from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) { for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); } } template < typename BasicJsonType, typename CompatibleArrayType, enable_if_t < is_compatible_array_type::value and not std::is_same::value and std::is_constructible < BasicJsonType, typename CompatibleArrayType::value_type >::value, int > = 0 > void from_json(const BasicJsonType& j, CompatibleArrayType& arr) { if (JSON_UNLIKELY(not j.is_array())) { JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); } from_json_array_impl(j, arr, priority_tag<2> {}); } template::value, int> = 0> void from_json(const BasicJsonType& j, CompatibleObjectType& obj) { if (JSON_UNLIKELY(not j.is_object())) { JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name()))); } auto inner_object = j.template get_ptr(); using value_type = typename CompatibleObjectType::value_type; std::transform( inner_object->begin(), inner_object->end(), std::inserter(obj, obj.begin()), [](typename BasicJsonType::object_t::value_type const & p) { return value_type(p.first, p.second.template get()); }); } // overload for arithmetic types, not chosen for basic_json template arguments // (BooleanType, etc..); note: Is it really necessary to provide explicit // overloads for boolean_t etc. in case of a custom BooleanType which is not // an arithmetic type? template::value and not std::is_same::value and not std::is_same::value and not std::is_same::value and not std::is_same::value, int> = 0> void from_json(const BasicJsonType& j, ArithmeticType& val) { switch (static_cast(j)) { case value_t::number_unsigned: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_integer: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_float: { val = static_cast(*j.template get_ptr()); break; } case value_t::boolean: { val = static_cast(*j.template get_ptr()); break; } default: JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()))); } } template void from_json(const BasicJsonType& j, std::pair& p) { p = {j.at(0).template get(), j.at(1).template get()}; } template void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence) { t = std::make_tuple(j.at(Idx).template get::type>()...); } template void from_json(const BasicJsonType& j, std::tuple& t) { from_json_tuple_impl(j, t, index_sequence_for {}); } struct from_json_fn { private: template auto call(const BasicJsonType& j, T& val, priority_tag<1> /*unused*/) const noexcept(noexcept(from_json(j, val))) -> decltype(from_json(j, val), void()) { return from_json(j, val); } template void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept { static_assert(sizeof(BasicJsonType) == 0, "could not find from_json() method in T's namespace"); #ifdef _MSC_VER // MSVC does not show a stacktrace for the above assert using decayed = uncvref_t; static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, "forcing MSVC stacktrace to show which T we're talking about."); #endif } public: template void operator()(const BasicJsonType& j, T& val) const noexcept(noexcept(std::declval().call(j, val, priority_tag<1> {}))) { return call(j, val, priority_tag<1> {}); } }; } /// namespace to hold default `from_json` function /// to see why this is required: /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html namespace { constexpr const auto& from_json = detail::static_const::value; } } // #include #include // or, and, not #include // begin, end #include // tuple, get #include // is_same, is_constructible, is_floating_point, is_enum, underlying_type #include // move, forward, declval, pair #include // valarray #include // vector // #include // #include namespace nlohmann { namespace detail { ////////////////// // constructors // ////////////////// template struct external_constructor; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept { j.m_type = value_t::boolean; j.m_value = b; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s) { j.m_type = value_t::string; j.m_value = s; j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s) { j.m_type = value_t::string; j.m_value = std::move(s); j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept { j.m_type = value_t::number_float; j.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept { j.m_type = value_t::number_unsigned; j.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept { j.m_type = value_t::number_integer; j.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr) { j.m_type = value_t::array; j.m_value = arr; j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr) { j.m_type = value_t::array; j.m_value = std::move(arr); j.assert_invariant(); } template::value, int> = 0> static void construct(BasicJsonType& j, const CompatibleArrayType& arr) { using std::begin; using std::end; j.m_type = value_t::array; j.m_value.array = j.template create(begin(arr), end(arr)); j.assert_invariant(); } template static void construct(BasicJsonType& j, const std::vector& arr) { j.m_type = value_t::array; j.m_value = value_t::array; j.m_value.array->reserve(arr.size()); for (const bool x : arr) { j.m_value.array->push_back(x); } j.assert_invariant(); } template::value, int> = 0> static void construct(BasicJsonType& j, const std::valarray& arr) { j.m_type = value_t::array; j.m_value = value_t::array; j.m_value.array->resize(arr.size()); std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin()); j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj) { j.m_type = value_t::object; j.m_value = obj; j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj) { j.m_type = value_t::object; j.m_value = std::move(obj); j.assert_invariant(); } template::value, int> = 0> static void construct(BasicJsonType& j, const CompatibleObjectType& obj) { using std::begin; using std::end; j.m_type = value_t::object; j.m_value.object = j.template create(begin(obj), end(obj)); j.assert_invariant(); } }; ///////////// // to_json // ///////////// template::value, int> = 0> void to_json(BasicJsonType& j, T b) noexcept { external_constructor::construct(j, b); } template::value, int> = 0> void to_json(BasicJsonType& j, const CompatibleString& s) { external_constructor::construct(j, s); } template void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s) { external_constructor::construct(j, std::move(s)); } template::value, int> = 0> void to_json(BasicJsonType& j, FloatType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> void to_json(BasicJsonType& j, EnumType e) noexcept { using underlying_type = typename std::underlying_type::type; external_constructor::construct(j, static_cast(e)); } template void to_json(BasicJsonType& j, const std::vector& e) { external_constructor::construct(j, e); } template::value or std::is_same::value, int> = 0> void to_json(BasicJsonType& j, const CompatibleArrayType& arr) { external_constructor::construct(j, arr); } template::value, int> = 0> void to_json(BasicJsonType& j, std::valarray arr) { external_constructor::construct(j, std::move(arr)); } template void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr) { external_constructor::construct(j, std::move(arr)); } template::value, int> = 0> void to_json(BasicJsonType& j, const CompatibleObjectType& obj) { external_constructor::construct(j, obj); } template void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) { external_constructor::construct(j, std::move(obj)); } template::value, int> = 0> void to_json(BasicJsonType& j, T (&arr)[N]) { external_constructor::construct(j, arr); } template void to_json(BasicJsonType& j, const std::pair& p) { j = {p.first, p.second}; } template void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence) { j = {std::get(t)...}; } template void to_json(BasicJsonType& j, const std::tuple& t) { to_json_tuple_impl(j, t, index_sequence_for {}); } struct to_json_fn { private: template auto call(BasicJsonType& j, T&& val, priority_tag<1> /*unused*/) const noexcept(noexcept(to_json(j, std::forward(val)))) -> decltype(to_json(j, std::forward(val)), void()) { return to_json(j, std::forward(val)); } template void call(BasicJsonType& /*unused*/, T&& /*unused*/, priority_tag<0> /*unused*/) const noexcept { static_assert(sizeof(BasicJsonType) == 0, "could not find to_json() method in T's namespace"); #ifdef _MSC_VER // MSVC does not show a stacktrace for the above assert using decayed = uncvref_t; static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, "forcing MSVC stacktrace to show which T we're talking about."); #endif } public: template void operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(std::declval().call(j, std::forward(val), priority_tag<1> {}))) { return call(j, std::forward(val), priority_tag<1> {}); } }; } /// namespace to hold default `to_json` function namespace { constexpr const auto& to_json = detail::static_const::value; } } // #include #include // min #include // array #include // assert #include // size_t #include // strlen #include // streamsize, streamoff, streampos #include // istream #include // begin, end, iterator_traits, random_access_iterator_tag, distance, next #include // shared_ptr, make_shared, addressof #include // accumulate #include // string, char_traits #include // enable_if, is_base_of, is_pointer, is_integral, remove_pointer #include // pair, declval // #include namespace nlohmann { namespace detail { //////////////////// // input adapters // //////////////////// /*! @brief abstract input adapter interface Produces a stream of std::char_traits::int_type characters from a std::istream, a buffer, or some other input type. Accepts the return of exactly one non-EOF character for future input. The int_type characters returned consist of all valid char values as positive values (typically unsigned char), plus an EOF value outside that range, specified by the value of the function std::char_traits::eof(). This value is typically -1, but could be any arbitrary value which is not a valid char value. */ struct input_adapter_protocol { /// get a character [0,255] or std::char_traits::eof(). virtual std::char_traits::int_type get_character() = 0; /// restore the last non-eof() character to input virtual void unget_character() = 0; virtual ~input_adapter_protocol() = default; }; /// a type to simplify interfaces using input_adapter_t = std::shared_ptr; /*! Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at beginning of input. Does not support changing the underlying std::streambuf in mid-input. Maintains underlying std::istream and std::streambuf to support subsequent use of standard std::istream operations to process any input characters following those used in parsing the JSON input. Clears the std::istream flags; any input errors (e.g., EOF) will be detected by the first subsequent call for input from the std::istream. */ class input_stream_adapter : public input_adapter_protocol { public: ~input_stream_adapter() override { // clear stream flags; we use underlying streambuf I/O, do not // maintain ifstream flags is.clear(); } explicit input_stream_adapter(std::istream& i) : is(i), sb(*i.rdbuf()) { // skip byte order mark std::char_traits::int_type c; if ((c = get_character()) == 0xEF) { if ((c = get_character()) == 0xBB) { if ((c = get_character()) == 0xBF) { return; // Ignore BOM } else if (c != std::char_traits::eof()) { is.unget(); } is.putback('\xBB'); } else if (c != std::char_traits::eof()) { is.unget(); } is.putback('\xEF'); } else if (c != std::char_traits::eof()) { is.unget(); // no byte order mark; process as usual } } // delete because of pointer members input_stream_adapter(const input_stream_adapter&) = delete; input_stream_adapter& operator=(input_stream_adapter&) = delete; // std::istream/std::streambuf use std::char_traits::to_int_type, to // ensure that std::char_traits::eof() and the character 0xFF do not // end up as the same value, eg. 0xFFFFFFFF. std::char_traits::int_type get_character() override { return sb.sbumpc(); } void unget_character() override { sb.sungetc(); // is.unget() avoided for performance } private: /// the associated input stream std::istream& is; std::streambuf& sb; }; /// input adapter for buffer input class input_buffer_adapter : public input_adapter_protocol { public: input_buffer_adapter(const char* b, const std::size_t l) : cursor(b), limit(b + l), start(b) { // skip byte order mark if (l >= 3 and b[0] == '\xEF' and b[1] == '\xBB' and b[2] == '\xBF') { cursor += 3; } } // delete because of pointer members input_buffer_adapter(const input_buffer_adapter&) = delete; input_buffer_adapter& operator=(input_buffer_adapter&) = delete; std::char_traits::int_type get_character() noexcept override { if (JSON_LIKELY(cursor < limit)) { return std::char_traits::to_int_type(*(cursor++)); } return std::char_traits::eof(); } void unget_character() noexcept override { if (JSON_LIKELY(cursor > start)) { --cursor; } } private: /// pointer to the current character const char* cursor; /// pointer past the last character const char* limit; /// pointer to the first character const char* start; }; class input_adapter { public: // native support /// input adapter for input stream input_adapter(std::istream& i) : ia(std::make_shared(i)) {} /// input adapter for input stream input_adapter(std::istream&& i) : ia(std::make_shared(i)) {} /// input adapter for buffer template::value and std::is_integral::type>::value and sizeof(typename std::remove_pointer::type) == 1, int>::type = 0> input_adapter(CharT b, std::size_t l) : ia(std::make_shared(reinterpret_cast(b), l)) {} // derived support /// input adapter for string literal template::value and std::is_integral::type>::value and sizeof(typename std::remove_pointer::type) == 1, int>::type = 0> input_adapter(CharT b) : input_adapter(reinterpret_cast(b), std::strlen(reinterpret_cast(b))) {} /// input adapter for iterator range with contiguous storage template::iterator_category, std::random_access_iterator_tag>::value, int>::type = 0> input_adapter(IteratorType first, IteratorType last) { // assertion to check that the iterator range is indeed contiguous, // see http://stackoverflow.com/a/35008842/266378 for more discussion assert(std::accumulate( first, last, std::pair(true, 0), [&first](std::pair res, decltype(*first) val) { res.first &= (val == *(std::next(std::addressof(*first), res.second++))); return res; }).first); // assertion to check that each element is 1 byte long static_assert( sizeof(typename std::iterator_traits::value_type) == 1, "each element in the iterator range must have the size of 1 byte"); const auto len = static_cast(std::distance(first, last)); if (JSON_LIKELY(len > 0)) { // there is at least one element: use the address of first ia = std::make_shared(reinterpret_cast(&(*first)), len); } else { // the address of first cannot be used: use nullptr ia = std::make_shared(nullptr, len); } } /// input adapter for array template input_adapter(T (&array)[N]) : input_adapter(std::begin(array), std::end(array)) {} /// input adapter for contiguous container template::value and std::is_base_of()))>::iterator_category>::value, int>::type = 0> input_adapter(const ContiguousContainer& c) : input_adapter(std::begin(c), std::end(c)) {} operator input_adapter_t() { return ia; } private: /// the actual adapter input_adapter_t ia = nullptr; }; } } // #include #include // localeconv #include // size_t #include // strtof, strtod, strtold, strtoll, strtoull #include // initializer_list #include // hex, uppercase #include // setw, setfill #include // stringstream #include // char_traits, string #include // vector // #include // #include namespace nlohmann { namespace detail { /////////// // lexer // /////////// /*! @brief lexical analysis This class organizes the lexical analysis during JSON deserialization. */ template class lexer { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; public: /// token types for the parser enum class token_type { uninitialized, ///< indicating the scanner is uninitialized literal_true, ///< the `true` literal literal_false, ///< the `false` literal literal_null, ///< the `null` literal value_string, ///< a string -- use get_string() for actual value value_unsigned, ///< an unsigned integer -- use get_number_unsigned() for actual value value_integer, ///< a signed integer -- use get_number_integer() for actual value value_float, ///< an floating point number -- use get_number_float() for actual value begin_array, ///< the character for array begin `[` begin_object, ///< the character for object begin `{` end_array, ///< the character for array end `]` end_object, ///< the character for object end `}` name_separator, ///< the name separator `:` value_separator, ///< the value separator `,` parse_error, ///< indicating a parse error end_of_input, ///< indicating the end of the input buffer literal_or_value ///< a literal or the begin of a value (only for diagnostics) }; /// return name of values of type token_type (only used for errors) static const char* token_type_name(const token_type t) noexcept { switch (t) { case token_type::uninitialized: return ""; case token_type::literal_true: return "true literal"; case token_type::literal_false: return "false literal"; case token_type::literal_null: return "null literal"; case token_type::value_string: return "string literal"; case lexer::token_type::value_unsigned: case lexer::token_type::value_integer: case lexer::token_type::value_float: return "number literal"; case token_type::begin_array: return "'['"; case token_type::begin_object: return "'{'"; case token_type::end_array: return "']'"; case token_type::end_object: return "'}'"; case token_type::name_separator: return "':'"; case token_type::value_separator: return "','"; case token_type::parse_error: return ""; case token_type::end_of_input: return "end of input"; case token_type::literal_or_value: return "'[', '{', or a literal"; default: // catch non-enum values return "unknown token"; // LCOV_EXCL_LINE } } explicit lexer(detail::input_adapter_t adapter) : ia(std::move(adapter)), decimal_point_char(get_decimal_point()) {} // delete because of pointer members lexer(const lexer&) = delete; lexer& operator=(lexer&) = delete; private: ///////////////////// // locales ///////////////////// /// return the locale-dependent decimal point static char get_decimal_point() noexcept { const auto loc = localeconv(); assert(loc != nullptr); return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point); } ///////////////////// // scan functions ///////////////////// /*! @brief get codepoint from 4 hex characters following `\u` For input "\u c1 c2 c3 c4" the codepoint is: (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4 = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0) Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f' must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The conversion is done by subtracting the offset (0x30, 0x37, and 0x57) between the ASCII value of the character and the desired integer value. @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or non-hex character) */ int get_codepoint() { // this function only makes sense after reading `\u` assert(current == 'u'); int codepoint = 0; const auto factors = { 12, 8, 4, 0 }; for (const auto factor : factors) { get(); if (current >= '0' and current <= '9') { codepoint += ((current - 0x30) << factor); } else if (current >= 'A' and current <= 'F') { codepoint += ((current - 0x37) << factor); } else if (current >= 'a' and current <= 'f') { codepoint += ((current - 0x57) << factor); } else { return -1; } } assert(0x0000 <= codepoint and codepoint <= 0xFFFF); return codepoint; } /*! @brief check if the next byte(s) are inside a given range Adds the current byte and, for each passed range, reads a new byte and checks if it is inside the range. If a violation was detected, set up an error message and return false. Otherwise, return true. @param[in] ranges list of integers; interpreted as list of pairs of inclusive lower and upper bound, respectively @pre The passed list @a ranges must have 2, 4, or 6 elements; that is, 1, 2, or 3 pairs. This precondition is enforced by an assertion. @return true if and only if no range violation was detected */ bool next_byte_in_range(std::initializer_list ranges) { assert(ranges.size() == 2 or ranges.size() == 4 or ranges.size() == 6); add(current); for (auto range = ranges.begin(); range != ranges.end(); ++range) { get(); if (JSON_LIKELY(*range <= current and current <= *(++range))) { add(current); } else { error_message = "invalid string: ill-formed UTF-8 byte"; return false; } } return true; } /*! @brief scan a string literal This function scans a string according to Sect. 7 of RFC 7159. While scanning, bytes are escaped and copied into buffer token_buffer. Then the function returns successfully, token_buffer is *not* null-terminated (as it may contain \0 bytes), and token_buffer.size() is the number of bytes in the string. @return token_type::value_string if string could be successfully scanned, token_type::parse_error otherwise @note In case of errors, variable error_message contains a textual description. */ token_type scan_string() { // reset token_buffer (ignore opening quote) reset(); // we entered the function by reading an open quote assert(current == '\"'); while (true) { // get next character switch (get()) { // end of file while parsing string case std::char_traits::eof(): { error_message = "invalid string: missing closing quote"; return token_type::parse_error; } // closing quote case '\"': { return token_type::value_string; } // escapes case '\\': { switch (get()) { // quotation mark case '\"': add('\"'); break; // reverse solidus case '\\': add('\\'); break; // solidus case '/': add('/'); break; // backspace case 'b': add('\b'); break; // form feed case 'f': add('\f'); break; // line feed case 'n': add('\n'); break; // carriage return case 'r': add('\r'); break; // tab case 't': add('\t'); break; // unicode escapes case 'u': { const int codepoint1 = get_codepoint(); int codepoint = codepoint1; // start with codepoint1 if (JSON_UNLIKELY(codepoint1 == -1)) { error_message = "invalid string: '\\u' must be followed by 4 hex digits"; return token_type::parse_error; } // check if code point is a high surrogate if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF) { // expect next \uxxxx entry if (JSON_LIKELY(get() == '\\' and get() == 'u')) { const int codepoint2 = get_codepoint(); if (JSON_UNLIKELY(codepoint2 == -1)) { error_message = "invalid string: '\\u' must be followed by 4 hex digits"; return token_type::parse_error; } // check if codepoint2 is a low surrogate if (JSON_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF)) { // overwrite codepoint codepoint = // high surrogate occupies the most significant 22 bits (codepoint1 << 10) // low surrogate occupies the least significant 15 bits + codepoint2 // there is still the 0xD800, 0xDC00 and 0x10000 noise // in the result so we have to subtract with: // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 - 0x35FDC00; } else { error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } else { error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } else { if (JSON_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF)) { error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; return token_type::parse_error; } } // result of the above calculation yields a proper codepoint assert(0x00 <= codepoint and codepoint <= 0x10FFFF); // translate codepoint into bytes if (codepoint < 0x80) { // 1-byte characters: 0xxxxxxx (ASCII) add(codepoint); } else if (codepoint <= 0x7FF) { // 2-byte characters: 110xxxxx 10xxxxxx add(0xC0 | (codepoint >> 6)); add(0x80 | (codepoint & 0x3F)); } else if (codepoint <= 0xFFFF) { // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx add(0xE0 | (codepoint >> 12)); add(0x80 | ((codepoint >> 6) & 0x3F)); add(0x80 | (codepoint & 0x3F)); } else { // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx add(0xF0 | (codepoint >> 18)); add(0x80 | ((codepoint >> 12) & 0x3F)); add(0x80 | ((codepoint >> 6) & 0x3F)); add(0x80 | (codepoint & 0x3F)); } break; } // other characters after escape default: error_message = "invalid string: forbidden character after backslash"; return token_type::parse_error; } break; } // invalid control characters case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1A: case 0x1B: case 0x1C: case 0x1D: case 0x1E: case 0x1F: { error_message = "invalid string: control character must be escaped"; return token_type::parse_error; } // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace)) case 0x20: case 0x21: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F: case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5A: case 0x5B: case 0x5D: case 0x5E: case 0x5F: case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7A: case 0x7B: case 0x7C: case 0x7D: case 0x7E: case 0x7F: { add(current); break; } // U+0080..U+07FF: bytes C2..DF 80..BF case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xD2: case 0xD3: case 0xD4: case 0xD5: case 0xD6: case 0xD7: case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDD: case 0xDE: case 0xDF: { if (JSON_UNLIKELY(not next_byte_in_range({0x80, 0xBF}))) { return token_type::parse_error; } break; } // U+0800..U+0FFF: bytes E0 A0..BF 80..BF case 0xE0: { if (JSON_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF case 0xE1: case 0xE2: case 0xE3: case 0xE4: case 0xE5: case 0xE6: case 0xE7: case 0xE8: case 0xE9: case 0xEA: case 0xEB: case 0xEC: case 0xEE: case 0xEF: { if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+D000..U+D7FF: bytes ED 80..9F 80..BF case 0xED: { if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF case 0xF0: { if (JSON_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF case 0xF1: case 0xF2: case 0xF3: { if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF case 0xF4: { if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // remaining bytes (80..C1 and F5..FF) are ill-formed default: { error_message = "invalid string: ill-formed UTF-8 byte"; return token_type::parse_error; } } } } static void strtof(float& f, const char* str, char** endptr) noexcept { f = std::strtof(str, endptr); } static void strtof(double& f, const char* str, char** endptr) noexcept { f = std::strtod(str, endptr); } static void strtof(long double& f, const char* str, char** endptr) noexcept { f = std::strtold(str, endptr); } /*! @brief scan a number literal This function scans a string according to Sect. 6 of RFC 7159. The function is realized with a deterministic finite state machine derived from the grammar described in RFC 7159. Starting in state "init", the input is read and used to determined the next state. Only state "done" accepts the number. State "error" is a trap state to model errors. In the table below, "anything" means any character but the ones listed before. state | 0 | 1-9 | e E | + | - | . | anything ---------|----------|----------|----------|---------|---------|----------|----------- init | zero | any1 | [error] | [error] | minus | [error] | [error] minus | zero | any1 | [error] | [error] | [error] | [error] | [error] zero | done | done | exponent | done | done | decimal1 | done any1 | any1 | any1 | exponent | done | done | decimal1 | done decimal1 | decimal2 | [error] | [error] | [error] | [error] | [error] | [error] decimal2 | decimal2 | decimal2 | exponent | done | done | done | done exponent | any2 | any2 | [error] | sign | sign | [error] | [error] sign | any2 | any2 | [error] | [error] | [error] | [error] | [error] any2 | any2 | any2 | done | done | done | done | done The state machine is realized with one label per state (prefixed with "scan_number_") and `goto` statements between them. The state machine contains cycles, but any cycle can be left when EOF is read. Therefore, the function is guaranteed to terminate. During scanning, the read bytes are stored in token_buffer. This string is then converted to a signed integer, an unsigned integer, or a floating-point number. @return token_type::value_unsigned, token_type::value_integer, or token_type::value_float if number could be successfully scanned, token_type::parse_error otherwise @note The scanner is independent of the current locale. Internally, the locale's decimal point is used instead of `.` to work with the locale-dependent converters. */ token_type scan_number() { // reset token_buffer to store the number's bytes reset(); // the type of the parsed number; initially set to unsigned; will be // changed if minus sign, decimal point or exponent is read token_type number_type = token_type::value_unsigned; // state (init): we just found out we need to scan a number switch (current) { case '-': { add(current); goto scan_number_minus; } case '0': { add(current); goto scan_number_zero; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } default: { // all other characters are rejected outside scan_number() assert(false); // LCOV_EXCL_LINE } } scan_number_minus: // state: we just parsed a leading minus sign number_type = token_type::value_integer; switch (get()) { case '0': { add(current); goto scan_number_zero; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } default: { error_message = "invalid number; expected digit after '-'"; return token_type::parse_error; } } scan_number_zero: // state: we just parse a zero (maybe with a leading minus sign) switch (get()) { case '.': { add(decimal_point_char); goto scan_number_decimal1; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_any1: // state: we just parsed a number 0-9 (maybe with a leading minus sign) switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } case '.': { add(decimal_point_char); goto scan_number_decimal1; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_decimal1: // state: we just parsed a decimal point number_type = token_type::value_float; switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_decimal2; } default: { error_message = "invalid number; expected digit after '.'"; return token_type::parse_error; } } scan_number_decimal2: // we just parsed at least one number after a decimal point switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_decimal2; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_exponent: // we just parsed an exponent number_type = token_type::value_float; switch (get()) { case '+': case '-': { add(current); goto scan_number_sign; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: { error_message = "invalid number; expected '+', '-', or digit after exponent"; return token_type::parse_error; } } scan_number_sign: // we just parsed an exponent sign switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: { error_message = "invalid number; expected digit after exponent sign"; return token_type::parse_error; } } scan_number_any2: // we just parsed a number after the exponent or exponent sign switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: goto scan_number_done; } scan_number_done: // unget the character after the number (we only read it to know that // we are done scanning a number) unget(); char* endptr = nullptr; errno = 0; // try to parse integers first and fall back to floats if (number_type == token_type::value_unsigned) { const auto x = std::strtoull(token_buffer.data(), &endptr, 10); // we checked the number format before assert(endptr == token_buffer.data() + token_buffer.size()); if (errno == 0) { value_unsigned = static_cast(x); if (value_unsigned == x) { return token_type::value_unsigned; } } } else if (number_type == token_type::value_integer) { const auto x = std::strtoll(token_buffer.data(), &endptr, 10); // we checked the number format before assert(endptr == token_buffer.data() + token_buffer.size()); if (errno == 0) { value_integer = static_cast(x); if (value_integer == x) { return token_type::value_integer; } } } // this code is reached if we parse a floating-point number or if an // integer conversion above failed strtof(value_float, token_buffer.data(), &endptr); // we checked the number format before assert(endptr == token_buffer.data() + token_buffer.size()); return token_type::value_float; } /*! @param[in] literal_text the literal text to expect @param[in] length the length of the passed literal text @param[in] return_type the token type to return on success */ token_type scan_literal(const char* literal_text, const std::size_t length, token_type return_type) { assert(current == literal_text[0]); for (std::size_t i = 1; i < length; ++i) { if (JSON_UNLIKELY(get() != literal_text[i])) { error_message = "invalid literal"; return token_type::parse_error; } } return return_type; } ///////////////////// // input management ///////////////////// /// reset token_buffer; current character is beginning of token void reset() noexcept { token_buffer.clear(); token_string.clear(); token_string.push_back(std::char_traits::to_char_type(current)); } /* @brief get next character from the input This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a `std::char_traits::eof()` in that case. Stores the scanned characters for use in error messages. @return character read from the input */ std::char_traits::int_type get() { ++chars_read; current = ia->get_character(); if (JSON_LIKELY(current != std::char_traits::eof())) { token_string.push_back(std::char_traits::to_char_type(current)); } return current; } /// unget current character (return it again on next get) void unget() { --chars_read; if (JSON_LIKELY(current != std::char_traits::eof())) { ia->unget_character(); assert(token_string.size() != 0); token_string.pop_back(); } } /// add a character to token_buffer void add(int c) { token_buffer.push_back(std::char_traits::to_char_type(c)); } public: ///////////////////// // value getters ///////////////////// /// return integer value constexpr number_integer_t get_number_integer() const noexcept { return value_integer; } /// return unsigned integer value constexpr number_unsigned_t get_number_unsigned() const noexcept { return value_unsigned; } /// return floating-point value constexpr number_float_t get_number_float() const noexcept { return value_float; } /// return current string value (implicitly resets the token; useful only once) string_t&& move_string() { return std::move(token_buffer); } ///////////////////// // diagnostics ///////////////////// /// return position of last read token constexpr std::size_t get_position() const noexcept { return chars_read; } /// return the last read token (for errors only). Will never contain EOF /// (an arbitrary value that is not a valid char value, often -1), because /// 255 may legitimately occur. May contain NUL, which should be escaped. std::string get_token_string() const { // escape control characters std::string result; for (const auto c : token_string) { if ('\x00' <= c and c <= '\x1F') { // escape control characters std::stringstream ss; ss << "(c) << ">"; result += ss.str(); } else { // add character as is result.push_back(c); } } return result; } /// return syntax error message constexpr const char* get_error_message() const noexcept { return error_message; } ///////////////////// // actual scanner ///////////////////// token_type scan() { // read next character and ignore whitespace do { get(); } while (current == ' ' or current == '\t' or current == '\n' or current == '\r'); switch (current) { // structural characters case '[': return token_type::begin_array; case ']': return token_type::end_array; case '{': return token_type::begin_object; case '}': return token_type::end_object; case ':': return token_type::name_separator; case ',': return token_type::value_separator; // literals case 't': return scan_literal("true", 4, token_type::literal_true); case 'f': return scan_literal("false", 5, token_type::literal_false); case 'n': return scan_literal("null", 4, token_type::literal_null); // string case '\"': return scan_string(); // number case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return scan_number(); // end of input (the null byte is needed when parsing from // string literals) case '\0': case std::char_traits::eof(): return token_type::end_of_input; // error default: error_message = "invalid literal"; return token_type::parse_error; } } private: /// input adapter detail::input_adapter_t ia = nullptr; /// the current character std::char_traits::int_type current = std::char_traits::eof(); /// the number of characters read std::size_t chars_read = 0; /// raw input token string (for error messages) std::vector token_string {}; /// buffer for variable-length tokens (numbers, strings) string_t token_buffer {}; /// a description of occurred lexer errors const char* error_message = ""; // number values number_integer_t value_integer = 0; number_unsigned_t value_unsigned = 0; number_float_t value_float = 0; /// the decimal point const char decimal_point_char = '.'; }; } } // #include #include // assert #include // isfinite #include // uint8_t #include // function #include // string #include // move // #include // #include // #include // #include // #include namespace nlohmann { namespace detail { //////////// // parser // //////////// /*! @brief syntax analysis This class implements a recursive decent parser. */ template class parser { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using lexer_t = lexer; using token_type = typename lexer_t::token_type; public: enum class parse_event_t : uint8_t { /// the parser read `{` and started to process a JSON object object_start, /// the parser read `}` and finished processing a JSON object object_end, /// the parser read `[` and started to process a JSON array array_start, /// the parser read `]` and finished processing a JSON array array_end, /// the parser read a key of a value in an object key, /// the parser finished reading a JSON value value }; using parser_callback_t = std::function; /// a parser reading from an input adapter explicit parser(detail::input_adapter_t adapter, const parser_callback_t cb = nullptr, const bool allow_exceptions_ = true) : callback(cb), m_lexer(adapter), allow_exceptions(allow_exceptions_) {} /*! @brief public parser interface @param[in] strict whether to expect the last token to be EOF @param[in,out] result parsed JSON value @throw parse_error.101 in case of an unexpected token @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails */ void parse(const bool strict, BasicJsonType& result) { // read first token get_token(); parse_internal(true, result); result.assert_invariant(); // in strict mode, input must be completely read if (strict) { get_token(); expect(token_type::end_of_input); } // in case of an error, return discarded value if (errored) { result = value_t::discarded; return; } // set top-level value to null if it was discarded by the callback // function if (result.is_discarded()) { result = nullptr; } } /*! @brief public accept interface @param[in] strict whether to expect the last token to be EOF @return whether the input is a proper JSON text */ bool accept(const bool strict = true) { // read first token get_token(); if (not accept_internal()) { return false; } // strict => last token must be EOF return not strict or (get_token() == token_type::end_of_input); } private: /*! @brief the actual parser @throw parse_error.101 in case of an unexpected token @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails */ void parse_internal(bool keep, BasicJsonType& result) { // never parse after a parse error was detected assert(not errored); // start with a discarded value if (not result.is_discarded()) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } switch (last_token) { case token_type::begin_object: { if (keep) { if (callback) { keep = callback(depth++, parse_event_t::object_start, result); } if (not callback or keep) { // explicitly set result to object to cope with {} result.m_type = value_t::object; result.m_value = value_t::object; } } // read next token get_token(); // closing } -> we are done if (last_token == token_type::end_object) { if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } break; } // parse values string_t key; BasicJsonType value; while (true) { // store key if (not expect(token_type::value_string)) { return; } key = m_lexer.move_string(); bool keep_tag = false; if (keep) { if (callback) { BasicJsonType k(key); keep_tag = callback(depth, parse_event_t::key, k); } else { keep_tag = true; } } // parse separator (:) get_token(); if (not expect(token_type::name_separator)) { return; } // parse and add value get_token(); value.m_value.destroy(value.m_type); value.m_type = value_t::discarded; parse_internal(keep, value); if (JSON_UNLIKELY(errored)) { return; } if (keep and keep_tag and not value.is_discarded()) { result.m_value.object->emplace(std::move(key), std::move(value)); } // comma -> next value get_token(); if (last_token == token_type::value_separator) { get_token(); continue; } // closing } if (not expect(token_type::end_object)) { return; } break; } if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } break; } case token_type::begin_array: { if (keep) { if (callback) { keep = callback(depth++, parse_event_t::array_start, result); } if (not callback or keep) { // explicitly set result to array to cope with [] result.m_type = value_t::array; result.m_value = value_t::array; } } // read next token get_token(); // closing ] -> we are done if (last_token == token_type::end_array) { if (callback and not callback(--depth, parse_event_t::array_end, result)) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } break; } // parse values BasicJsonType value; while (true) { // parse value value.m_value.destroy(value.m_type); value.m_type = value_t::discarded; parse_internal(keep, value); if (JSON_UNLIKELY(errored)) { return; } if (keep and not value.is_discarded()) { result.m_value.array->push_back(std::move(value)); } // comma -> next value get_token(); if (last_token == token_type::value_separator) { get_token(); continue; } // closing ] if (not expect(token_type::end_array)) { return; } break; } if (keep and callback and not callback(--depth, parse_event_t::array_end, result)) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } break; } case token_type::literal_null: { result.m_type = value_t::null; break; } case token_type::value_string: { result.m_type = value_t::string; result.m_value = m_lexer.move_string(); break; } case token_type::literal_true: { result.m_type = value_t::boolean; result.m_value = true; break; } case token_type::literal_false: { result.m_type = value_t::boolean; result.m_value = false; break; } case token_type::value_unsigned: { result.m_type = value_t::number_unsigned; result.m_value = m_lexer.get_number_unsigned(); break; } case token_type::value_integer: { result.m_type = value_t::number_integer; result.m_value = m_lexer.get_number_integer(); break; } case token_type::value_float: { result.m_type = value_t::number_float; result.m_value = m_lexer.get_number_float(); // throw in case of infinity or NAN if (JSON_UNLIKELY(not std::isfinite(result.m_value.number_float))) { if (allow_exceptions) { JSON_THROW(out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'")); } expect(token_type::uninitialized); } break; } case token_type::parse_error: { // using "uninitialized" to avoid "expected" message if (not expect(token_type::uninitialized)) { return; } break; // LCOV_EXCL_LINE } default: { // the last token was unexpected; we expected a value if (not expect(token_type::literal_or_value)) { return; } break; // LCOV_EXCL_LINE } } if (keep and callback and not callback(depth, parse_event_t::value, result)) { result.m_value.destroy(result.m_type); result.m_type = value_t::discarded; } } /*! @brief the actual acceptor @invariant 1. The last token is not yet processed. Therefore, the caller of this function must make sure a token has been read. 2. When this function returns, the last token is processed. That is, the last read character was already considered. This invariant makes sure that no token needs to be "unput". */ bool accept_internal() { switch (last_token) { case token_type::begin_object: { // read next token get_token(); // closing } -> we are done if (last_token == token_type::end_object) { return true; } // parse values while (true) { // parse key if (last_token != token_type::value_string) { return false; } // parse separator (:) get_token(); if (last_token != token_type::name_separator) { return false; } // parse value get_token(); if (not accept_internal()) { return false; } // comma -> next value get_token(); if (last_token == token_type::value_separator) { get_token(); continue; } // closing } return (last_token == token_type::end_object); } } case token_type::begin_array: { // read next token get_token(); // closing ] -> we are done if (last_token == token_type::end_array) { return true; } // parse values while (true) { // parse value if (not accept_internal()) { return false; } // comma -> next value get_token(); if (last_token == token_type::value_separator) { get_token(); continue; } // closing ] return (last_token == token_type::end_array); } } case token_type::value_float: { // reject infinity or NAN return std::isfinite(m_lexer.get_number_float()); } case token_type::literal_false: case token_type::literal_null: case token_type::literal_true: case token_type::value_integer: case token_type::value_string: case token_type::value_unsigned: return true; default: // the last token was unexpected return false; } } /// get next token from lexer token_type get_token() { return (last_token = m_lexer.scan()); } /*! @throw parse_error.101 if expected token did not occur */ bool expect(token_type t) { if (JSON_UNLIKELY(t != last_token)) { errored = true; expected = t; if (allow_exceptions) { throw_exception(); } else { return false; } } return true; } [[noreturn]] void throw_exception() const { std::string error_msg = "syntax error - "; if (last_token == token_type::parse_error) { error_msg += std::string(m_lexer.get_error_message()) + "; last read: '" + m_lexer.get_token_string() + "'"; } else { error_msg += "unexpected " + std::string(lexer_t::token_type_name(last_token)); } if (expected != token_type::uninitialized) { error_msg += "; expected " + std::string(lexer_t::token_type_name(expected)); } JSON_THROW(parse_error::create(101, m_lexer.get_position(), error_msg)); } private: /// current level of recursion int depth = 0; /// callback function const parser_callback_t callback = nullptr; /// the type of the last read token token_type last_token = token_type::uninitialized; /// the lexer lexer_t m_lexer; /// whether a syntax error occurred bool errored = false; /// possible reason for the syntax error token_type expected = token_type::uninitialized; /// whether to throw exceptions in case of errors const bool allow_exceptions = true; }; } } // #include #include // ptrdiff_t #include // numeric_limits namespace nlohmann { namespace detail { /* @brief an iterator for primitive JSON types This class models an iterator for primitive JSON types (boolean, number, string). It's only purpose is to allow the iterator/const_iterator classes to "iterate" over primitive values. Internally, the iterator is modeled by a `difference_type` variable. Value begin_value (`0`) models the begin, end_value (`1`) models past the end. */ class primitive_iterator_t { private: using difference_type = std::ptrdiff_t; static constexpr difference_type begin_value = 0; static constexpr difference_type end_value = begin_value + 1; /// iterator as signed integer type difference_type m_it = (std::numeric_limits::min)(); public: constexpr difference_type get_value() const noexcept { return m_it; } /// set iterator to a defined beginning void set_begin() noexcept { m_it = begin_value; } /// set iterator to a defined past the end void set_end() noexcept { m_it = end_value; } /// return whether the iterator can be dereferenced constexpr bool is_begin() const noexcept { return m_it == begin_value; } /// return whether the iterator is at end constexpr bool is_end() const noexcept { return m_it == end_value; } friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it == rhs.m_it; } friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it < rhs.m_it; } primitive_iterator_t operator+(difference_type n) noexcept { auto result = *this; result += n; return result; } friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it - rhs.m_it; } primitive_iterator_t& operator++() noexcept { ++m_it; return *this; } primitive_iterator_t const operator++(int) noexcept { auto result = *this; m_it++; return result; } primitive_iterator_t& operator--() noexcept { --m_it; return *this; } primitive_iterator_t const operator--(int) noexcept { auto result = *this; m_it--; return result; } primitive_iterator_t& operator+=(difference_type n) noexcept { m_it += n; return *this; } primitive_iterator_t& operator-=(difference_type n) noexcept { m_it -= n; return *this; } }; } } // #include // #include namespace nlohmann { namespace detail { /*! @brief an iterator value @note This structure could easily be a union, but MSVC currently does not allow unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. */ template struct internal_iterator { /// iterator for JSON objects typename BasicJsonType::object_t::iterator object_iterator {}; /// iterator for JSON arrays typename BasicJsonType::array_t::iterator array_iterator {}; /// generic iterator for all other types primitive_iterator_t primitive_iterator {}; }; } } // #include #include // not #include // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next #include // conditional, is_const, remove_const // #include // #include // #include // #include // #include // #include namespace nlohmann { namespace detail { // forward declare, to be able to friend it later on template class iteration_proxy; /*! @brief a template for a bidirectional iterator for the @ref basic_json class This class implements a both iterators (iterator and const_iterator) for the @ref basic_json class. @note An iterator is called *initialized* when a pointer to a JSON value has been set (e.g., by a constructor or a copy assignment). If the iterator is default-constructed, it is *uninitialized* and most methods are undefined. **The library uses assertions to detect calls on uninitialized iterators.** @requirement The class satisfies the following concept requirements: - [BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator): The iterator that can be moved can be moved in both directions (i.e. incremented and decremented). @since version 1.0.0, simplified in version 2.0.9, change to bidirectional iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593) */ template class iter_impl { /// allow basic_json to access private members friend iter_impl::value, typename std::remove_const::type, const BasicJsonType>::type>; friend BasicJsonType; friend iteration_proxy; using object_t = typename BasicJsonType::object_t; using array_t = typename BasicJsonType::array_t; // make sure BasicJsonType is basic_json or const basic_json static_assert(is_basic_json::type>::value, "iter_impl only accepts (const) basic_json"); public: /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. /// The C++ Standard has never required user-defined iterators to derive from std::iterator. /// A user-defined iterator should provide publicly accessible typedefs named /// iterator_category, value_type, difference_type, pointer, and reference. /// Note that value_type is required to be non-const, even for constant iterators. using iterator_category = std::bidirectional_iterator_tag; /// the type of the values when the iterator is dereferenced using value_type = typename BasicJsonType::value_type; /// a type to represent differences between iterators using difference_type = typename BasicJsonType::difference_type; /// defines a pointer to the type iterated over (value_type) using pointer = typename std::conditional::value, typename BasicJsonType::const_pointer, typename BasicJsonType::pointer>::type; /// defines a reference to the type iterated over (value_type) using reference = typename std::conditional::value, typename BasicJsonType::const_reference, typename BasicJsonType::reference>::type; /// default constructor iter_impl() = default; /*! @brief constructor for a given JSON instance @param[in] object pointer to a JSON object for this iterator @pre object != nullptr @post The iterator is initialized; i.e. `m_object != nullptr`. */ explicit iter_impl(pointer object) noexcept : m_object(object) { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { m_it.object_iterator = typename object_t::iterator(); break; } case value_t::array: { m_it.array_iterator = typename array_t::iterator(); break; } default: { m_it.primitive_iterator = primitive_iterator_t(); break; } } } /*! @note The conventional copy constructor and copy assignment are implicitly defined. Combined with the following converting constructor and assignment, they support: (1) copy from iterator to iterator, (2) copy from const iterator to const iterator, and (3) conversion from iterator to const iterator. However conversion from const iterator to iterator is not defined. */ /*! @brief converting constructor @param[in] other non-const iterator to copy from @note It is not checked whether @a other is initialized. */ iter_impl(const iter_impl::type>& other) noexcept : m_object(other.m_object), m_it(other.m_it) {} /*! @brief converting assignment @param[in,out] other non-const iterator to copy from @return const/non-const iterator @note It is not checked whether @a other is initialized. */ iter_impl& operator=(const iter_impl::type>& other) noexcept { m_object = other.m_object; m_it = other.m_it; return *this; } private: /*! @brief set the iterator to the first value @pre The iterator is initialized; i.e. `m_object != nullptr`. */ void set_begin() noexcept { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { m_it.object_iterator = m_object->m_value.object->begin(); break; } case value_t::array: { m_it.array_iterator = m_object->m_value.array->begin(); break; } case value_t::null: { // set to end so begin()==end() is true: null is empty m_it.primitive_iterator.set_end(); break; } default: { m_it.primitive_iterator.set_begin(); break; } } } /*! @brief set the iterator past the last value @pre The iterator is initialized; i.e. `m_object != nullptr`. */ void set_end() noexcept { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { m_it.object_iterator = m_object->m_value.object->end(); break; } case value_t::array: { m_it.array_iterator = m_object->m_value.array->end(); break; } default: { m_it.primitive_iterator.set_end(); break; } } } public: /*! @brief return a reference to the value pointed to by the iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference operator*() const { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { assert(m_it.object_iterator != m_object->m_value.object->end()); return m_it.object_iterator->second; } case value_t::array: { assert(m_it.array_iterator != m_object->m_value.array->end()); return *m_it.array_iterator; } case value_t::null: JSON_THROW(invalid_iterator::create(214, "cannot get value")); default: { if (JSON_LIKELY(m_it.primitive_iterator.is_begin())) { return *m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value")); } } } /*! @brief dereference the iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ pointer operator->() const { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { assert(m_it.object_iterator != m_object->m_value.object->end()); return &(m_it.object_iterator->second); } case value_t::array: { assert(m_it.array_iterator != m_object->m_value.array->end()); return &*m_it.array_iterator; } default: { if (JSON_LIKELY(m_it.primitive_iterator.is_begin())) { return m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value")); } } } /*! @brief post-increment (it++) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl const operator++(int) { auto result = *this; ++(*this); return result; } /*! @brief pre-increment (++it) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator++() { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { std::advance(m_it.object_iterator, 1); break; } case value_t::array: { std::advance(m_it.array_iterator, 1); break; } default: { ++m_it.primitive_iterator; break; } } return *this; } /*! @brief post-decrement (it--) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl const operator--(int) { auto result = *this; --(*this); return result; } /*! @brief pre-decrement (--it) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator--() { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: { std::advance(m_it.object_iterator, -1); break; } case value_t::array: { std::advance(m_it.array_iterator, -1); break; } default: { --m_it.primitive_iterator; break; } } return *this; } /*! @brief comparison: equal @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator==(const iter_impl& other) const { // if objects are not the same, the comparison is undefined if (JSON_UNLIKELY(m_object != other.m_object)) { JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); } assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: return (m_it.object_iterator == other.m_it.object_iterator); case value_t::array: return (m_it.array_iterator == other.m_it.array_iterator); default: return (m_it.primitive_iterator == other.m_it.primitive_iterator); } } /*! @brief comparison: not equal @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator!=(const iter_impl& other) const { return not operator==(other); } /*! @brief comparison: smaller @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator<(const iter_impl& other) const { // if objects are not the same, the comparison is undefined if (JSON_UNLIKELY(m_object != other.m_object)) { JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); } assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators")); case value_t::array: return (m_it.array_iterator < other.m_it.array_iterator); default: return (m_it.primitive_iterator < other.m_it.primitive_iterator); } } /*! @brief comparison: less than or equal @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator<=(const iter_impl& other) const { return not other.operator < (*this); } /*! @brief comparison: greater than @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator>(const iter_impl& other) const { return not operator<=(other); } /*! @brief comparison: greater than or equal @pre The iterator is initialized; i.e. `m_object != nullptr`. */ bool operator>=(const iter_impl& other) const { return not operator<(other); } /*! @brief add to iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator+=(difference_type i) { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators")); case value_t::array: { std::advance(m_it.array_iterator, i); break; } default: { m_it.primitive_iterator += i; break; } } return *this; } /*! @brief subtract from iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator-=(difference_type i) { return operator+=(-i); } /*! @brief add to iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator+(difference_type i) const { auto result = *this; result += i; return result; } /*! @brief addition of distance and iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ friend iter_impl operator+(difference_type i, const iter_impl& it) { auto result = it; result += i; return result; } /*! @brief subtract from iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator-(difference_type i) const { auto result = *this; result -= i; return result; } /*! @brief return difference @pre The iterator is initialized; i.e. `m_object != nullptr`. */ difference_type operator-(const iter_impl& other) const { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators")); case value_t::array: return m_it.array_iterator - other.m_it.array_iterator; default: return m_it.primitive_iterator - other.m_it.primitive_iterator; } } /*! @brief access to successor @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference operator[](difference_type n) const { assert(m_object != nullptr); switch (m_object->m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators")); case value_t::array: return *std::next(m_it.array_iterator, n); case value_t::null: JSON_THROW(invalid_iterator::create(214, "cannot get value")); default: { if (JSON_LIKELY(m_it.primitive_iterator.get_value() == -n)) { return *m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value")); } } } /*! @brief return the key of an object iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ typename object_t::key_type key() const { assert(m_object != nullptr); if (JSON_LIKELY(m_object->is_object())) { return m_it.object_iterator->first; } JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators")); } /*! @brief return the value of an iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference value() const { return operator*(); } private: /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance internal_iterator::type> m_it; }; } } // #include #include // size_t #include // string, to_string // #include namespace nlohmann { namespace detail { /// proxy class for the items() function template class iteration_proxy { private: /// helper class for iteration class iteration_proxy_internal { private: /// the iterator IteratorType anchor; /// an index for arrays (used to create key names) std::size_t array_index = 0; public: explicit iteration_proxy_internal(IteratorType it) noexcept : anchor(it) {} /// dereference operator (needed for range-based for) iteration_proxy_internal& operator*() { return *this; } /// increment operator (needed for range-based for) iteration_proxy_internal& operator++() { ++anchor; ++array_index; return *this; } /// inequality operator (needed for range-based for) bool operator!=(const iteration_proxy_internal& o) const noexcept { return anchor != o.anchor; } /// return key of the iterator std::string key() const { assert(anchor.m_object != nullptr); switch (anchor.m_object->type()) { // use integer array index as key case value_t::array: return std::to_string(array_index); // use key from the object case value_t::object: return anchor.key(); // use an empty key for all primitive types default: return ""; } } /// return value of the iterator typename IteratorType::reference value() const { return anchor.value(); } }; /// the container to iterate typename IteratorType::reference container; public: /// construct iteration proxy from a container explicit iteration_proxy(typename IteratorType::reference cont) noexcept : container(cont) {} /// return iterator begin (needed for range-based for) iteration_proxy_internal begin() noexcept { return iteration_proxy_internal(container.begin()); } /// return iterator end (needed for range-based for) iteration_proxy_internal end() noexcept { return iteration_proxy_internal(container.end()); } }; } } // #include #include // ptrdiff_t #include // reverse_iterator #include // declval namespace nlohmann { namespace detail { ////////////////////// // reverse_iterator // ////////////////////// /*! @brief a template for a reverse iterator class @tparam Base the base iterator type to reverse. Valid types are @ref iterator (to create @ref reverse_iterator) and @ref const_iterator (to create @ref const_reverse_iterator). @requirement The class satisfies the following concept requirements: - [BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator): The iterator that can be moved can be moved in both directions (i.e. incremented and decremented). - [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator): It is possible to write to the pointed-to element (only if @a Base is @ref iterator). @since version 1.0.0 */ template class json_reverse_iterator : public std::reverse_iterator { public: using difference_type = std::ptrdiff_t; /// shortcut to the reverse iterator adapter using base_iterator = std::reverse_iterator; /// the reference type for the pointed-to element using reference = typename Base::reference; /// create reverse iterator from iterator json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept : base_iterator(it) {} /// create reverse iterator from base class json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {} /// post-increment (it++) json_reverse_iterator const operator++(int) { return static_cast(base_iterator::operator++(1)); } /// pre-increment (++it) json_reverse_iterator& operator++() { return static_cast(base_iterator::operator++()); } /// post-decrement (it--) json_reverse_iterator const operator--(int) { return static_cast(base_iterator::operator--(1)); } /// pre-decrement (--it) json_reverse_iterator& operator--() { return static_cast(base_iterator::operator--()); } /// add to iterator json_reverse_iterator& operator+=(difference_type i) { return static_cast(base_iterator::operator+=(i)); } /// add to iterator json_reverse_iterator operator+(difference_type i) const { return static_cast(base_iterator::operator+(i)); } /// subtract from iterator json_reverse_iterator operator-(difference_type i) const { return static_cast(base_iterator::operator-(i)); } /// return difference difference_type operator-(const json_reverse_iterator& other) const { return base_iterator(*this) - base_iterator(other); } /// access to successor reference operator[](difference_type n) const { return *(this->operator+(n)); } /// return the key of an object iterator auto key() const -> decltype(std::declval().key()) { auto it = --this->base(); return it.key(); } /// return the value of an iterator reference value() const { auto it = --this->base(); return it.operator * (); } }; } } // #include #include // copy #include // size_t #include // streamsize #include // back_inserter #include // shared_ptr, make_shared #include // basic_ostream #include // basic_string #include // vector namespace nlohmann { namespace detail { /// abstract output adapter interface template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; virtual void write_characters(const CharType* s, std::size_t length) = 0; virtual ~output_adapter_protocol() = default; }; /// a type to simplify interfaces template using output_adapter_t = std::shared_ptr>; /// output adapter for byte vectors template class output_vector_adapter : public output_adapter_protocol { public: explicit output_vector_adapter(std::vector& vec) : v(vec) {} void write_character(CharType c) override { v.push_back(c); } void write_characters(const CharType* s, std::size_t length) override { std::copy(s, s + length, std::back_inserter(v)); } private: std::vector& v; }; /// output adapter for output streams template class output_stream_adapter : public output_adapter_protocol { public: explicit output_stream_adapter(std::basic_ostream& s) : stream(s) {} void write_character(CharType c) override { stream.put(c); } void write_characters(const CharType* s, std::size_t length) override { stream.write(s, static_cast(length)); } private: std::basic_ostream& stream; }; /// output adapter for basic_string template> class output_string_adapter : public output_adapter_protocol { public: explicit output_string_adapter(StringType& s) : str(s) {} void write_character(CharType c) override { str.push_back(c); } void write_characters(const CharType* s, std::size_t length) override { str.append(s, length); } private: StringType& str; }; template> class output_adapter { public: output_adapter(std::vector& vec) : oa(std::make_shared>(vec)) {} output_adapter(std::basic_ostream& s) : oa(std::make_shared>(s)) {} output_adapter(StringType& s) : oa(std::make_shared>(s)) {} operator output_adapter_t() { return oa; } private: output_adapter_t oa = nullptr; }; } } // #include #include // generate_n #include // array #include // assert #include // ldexp #include // size_t #include // uint8_t, uint16_t, uint32_t, uint64_t #include // memcpy #include // setw, setfill #include // hex #include // back_inserter #include // numeric_limits #include // stringstream #include // char_traits, string #include // make_pair, move // #include // #include // #include // #include namespace nlohmann { namespace detail { /////////////////// // binary reader // /////////////////// /*! @brief deserialization of CBOR and MessagePack values */ template class binary_reader { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using string_t = typename BasicJsonType::string_t; public: /*! @brief create a binary reader @param[in] adapter input adapter to read from */ explicit binary_reader(input_adapter_t adapter) : ia(std::move(adapter)) { assert(ia); } /*! @brief create a JSON value from CBOR input @param[in] strict whether to expect the input to be consumed completed @return JSON value created from CBOR input @throw parse_error.110 if input ended unexpectedly or the end of file was not reached when @a strict was set to true @throw parse_error.112 if unsupported byte was read */ BasicJsonType parse_cbor(const bool strict) { const auto res = parse_cbor_internal(); if (strict) { get(); expect_eof(); } return res; } /*! @brief create a JSON value from MessagePack input @param[in] strict whether to expect the input to be consumed completed @return JSON value created from MessagePack input @throw parse_error.110 if input ended unexpectedly or the end of file was not reached when @a strict was set to true @throw parse_error.112 if unsupported byte was read */ BasicJsonType parse_msgpack(const bool strict) { const auto res = parse_msgpack_internal(); if (strict) { get(); expect_eof(); } return res; } /*! @brief create a JSON value from UBJSON input @param[in] strict whether to expect the input to be consumed completed @return JSON value created from UBJSON input @throw parse_error.110 if input ended unexpectedly or the end of file was not reached when @a strict was set to true @throw parse_error.112 if unsupported byte was read */ BasicJsonType parse_ubjson(const bool strict) { const auto res = parse_ubjson_internal(); if (strict) { get_ignore_noop(); expect_eof(); } return res; } /*! @brief determine system byte order @return true if and only if system's byte order is little endian @note from http://stackoverflow.com/a/1001328/266378 */ static constexpr bool little_endianess(int num = 1) noexcept { return (*reinterpret_cast(&num) == 1); } private: /*! @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead */ BasicJsonType parse_cbor_internal(const bool get_char = true) { switch (get_char ? get() : current) { // EOF case std::char_traits::eof(): JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); // Integer 0x00..0x17 (0..23) case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: return static_cast(current); case 0x18: // Unsigned integer (one-byte uint8_t follows) return get_number(); case 0x19: // Unsigned integer (two-byte uint16_t follows) return get_number(); case 0x1A: // Unsigned integer (four-byte uint32_t follows) return get_number(); case 0x1B: // Unsigned integer (eight-byte uint64_t follows) return get_number(); // Negative integer -1-0x00..-1-0x17 (-1..-24) case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: return static_cast(0x20 - 1 - current); case 0x38: // Negative integer (one-byte uint8_t follows) { return static_cast(-1) - get_number(); } case 0x39: // Negative integer -1-n (two-byte uint16_t follows) { return static_cast(-1) - get_number(); } case 0x3A: // Negative integer -1-n (four-byte uint32_t follows) { return static_cast(-1) - get_number(); } case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows) { return static_cast(-1) - static_cast(get_number()); } // UTF-8 string (0x00..0x17 bytes follow) case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: // UTF-8 string (one-byte uint8_t for n follows) case 0x79: // UTF-8 string (two-byte uint16_t for n follow) case 0x7A: // UTF-8 string (four-byte uint32_t for n follow) case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow) case 0x7F: // UTF-8 string (indefinite length) { return get_cbor_string(); } // array (0x00..0x17 data items follow) case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: { return get_cbor_array(current & 0x1F); } case 0x98: // array (one-byte uint8_t for n follows) { return get_cbor_array(get_number()); } case 0x99: // array (two-byte uint16_t for n follow) { return get_cbor_array(get_number()); } case 0x9A: // array (four-byte uint32_t for n follow) { return get_cbor_array(get_number()); } case 0x9B: // array (eight-byte uint64_t for n follow) { return get_cbor_array(get_number()); } case 0x9F: // array (indefinite length) { BasicJsonType result = value_t::array; while (get() != 0xFF) { result.push_back(parse_cbor_internal(false)); } return result; } // map (0x00..0x17 pairs of data items follow) case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: { return get_cbor_object(current & 0x1F); } case 0xB8: // map (one-byte uint8_t for n follows) { return get_cbor_object(get_number()); } case 0xB9: // map (two-byte uint16_t for n follow) { return get_cbor_object(get_number()); } case 0xBA: // map (four-byte uint32_t for n follow) { return get_cbor_object(get_number()); } case 0xBB: // map (eight-byte uint64_t for n follow) { return get_cbor_object(get_number()); } case 0xBF: // map (indefinite length) { BasicJsonType result = value_t::object; while (get() != 0xFF) { auto key = get_cbor_string(); result[key] = parse_cbor_internal(); } return result; } case 0xF4: // false { return false; } case 0xF5: // true { return true; } case 0xF6: // null { return value_t::null; } case 0xF9: // Half-Precision Float (two-byte IEEE 754) { const int byte1 = get(); unexpect_eof(); const int byte2 = get(); unexpect_eof(); // code from RFC 7049, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very // easy to include at least decoding support for them even // without such support. An example of a small decoder for // half-precision floating-point numbers in the C language // is shown in Fig. 3. const int half = (byte1 << 8) + byte2; const int exp = (half >> 10) & 0x1F; const int mant = half & 0x3FF; double val; if (exp == 0) { val = std::ldexp(mant, -24); } else if (exp != 31) { val = std::ldexp(mant + 1024, exp - 25); } else { val = (mant == 0) ? std::numeric_limits::infinity() : std::numeric_limits::quiet_NaN(); } return (half & 0x8000) != 0 ? -val : val; } case 0xFA: // Single-Precision Float (four-byte IEEE 754) { return get_number(); } case 0xFB: // Double-Precision Float (eight-byte IEEE 754) { return get_number(); } default: // anything else (0xFF is handled inside the other types) { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(112, chars_read, "error reading CBOR; last byte: 0x" + ss.str())); } } } BasicJsonType parse_msgpack_internal() { switch (get()) { // EOF case std::char_traits::eof(): JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); // positive fixint case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1A: case 0x1B: case 0x1C: case 0x1D: case 0x1E: case 0x1F: case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F: case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5A: case 0x5B: case 0x5C: case 0x5D: case 0x5E: case 0x5F: case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7A: case 0x7B: case 0x7C: case 0x7D: case 0x7E: case 0x7F: return static_cast(current); // fixmap case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: { return get_msgpack_object(current & 0x0F); } // fixarray case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: case 0x98: case 0x99: case 0x9A: case 0x9B: case 0x9C: case 0x9D: case 0x9E: case 0x9F: { return get_msgpack_array(current & 0x0F); } // fixstr case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: return get_msgpack_string(); case 0xC0: // nil return value_t::null; case 0xC2: // false return false; case 0xC3: // true return true; case 0xCA: // float 32 return get_number(); case 0xCB: // float 64 return get_number(); case 0xCC: // uint 8 return get_number(); case 0xCD: // uint 16 return get_number(); case 0xCE: // uint 32 return get_number(); case 0xCF: // uint 64 return get_number(); case 0xD0: // int 8 return get_number(); case 0xD1: // int 16 return get_number(); case 0xD2: // int 32 return get_number(); case 0xD3: // int 64 return get_number(); case 0xD9: // str 8 case 0xDA: // str 16 case 0xDB: // str 32 return get_msgpack_string(); case 0xDC: // array 16 { return get_msgpack_array(get_number()); } case 0xDD: // array 32 { return get_msgpack_array(get_number()); } case 0xDE: // map 16 { return get_msgpack_object(get_number()); } case 0xDF: // map 32 { return get_msgpack_object(get_number()); } // positive fixint case 0xE0: case 0xE1: case 0xE2: case 0xE3: case 0xE4: case 0xE5: case 0xE6: case 0xE7: case 0xE8: case 0xE9: case 0xEA: case 0xEB: case 0xEC: case 0xED: case 0xEE: case 0xEF: case 0xF0: case 0xF1: case 0xF2: case 0xF3: case 0xF4: case 0xF5: case 0xF6: case 0xF7: case 0xF8: case 0xF9: case 0xFA: case 0xFB: case 0xFC: case 0xFD: case 0xFE: case 0xFF: return static_cast(current); default: // anything else { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(112, chars_read, "error reading MessagePack; last byte: 0x" + ss.str())); } } } /*! @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead */ BasicJsonType parse_ubjson_internal(const bool get_char = true) { return get_ubjson_value(get_char ? get_ignore_noop() : current); } /*! @brief get next character from the input This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a -'ve valued `std::char_traits::eof()` in that case. @return character read from the input */ int get() { ++chars_read; return (current = ia->get_character()); } /*! @return character read from the input after ignoring all 'N' entries */ int get_ignore_noop() { do { get(); } while (current == 'N'); return current; } /* @brief read a number from the input @tparam NumberType the type of the number @return number of type @a NumberType @note This function needs to respect the system's endianess, because bytes in CBOR and MessagePack are stored in network order (big endian) and therefore need reordering on little endian systems. @throw parse_error.110 if input has less than `sizeof(NumberType)` bytes */ template NumberType get_number() { // step 1: read input into array with system's byte order std::array vec; for (std::size_t i = 0; i < sizeof(NumberType); ++i) { get(); unexpect_eof(); // reverse byte order prior to conversion if necessary if (is_little_endian) { vec[sizeof(NumberType) - i - 1] = static_cast(current); } else { vec[i] = static_cast(current); // LCOV_EXCL_LINE } } // step 2: convert array into number of type T and return NumberType result; std::memcpy(&result, vec.data(), sizeof(NumberType)); return result; } /*! @brief create a string by reading characters from the input @param[in] len number of bytes to read @note We can not reserve @a len bytes for the result, because @a len may be too large. Usually, @ref unexpect_eof() detects the end of the input before we run out of string memory. @return string created by reading @a len bytes @throw parse_error.110 if input has less than @a len bytes */ template string_t get_string(const NumberType len) { string_t result; std::generate_n(std::back_inserter(result), len, [this]() { get(); unexpect_eof(); return static_cast(current); }); return result; } /*! @brief reads a CBOR string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. Additionally, CBOR's strings with indefinite lengths are supported. @return string @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */ string_t get_cbor_string() { unexpect_eof(); switch (current) { // UTF-8 string (0x00..0x17 bytes follow) case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: { return get_string(current & 0x1F); } case 0x78: // UTF-8 string (one-byte uint8_t for n follows) { return get_string(get_number()); } case 0x79: // UTF-8 string (two-byte uint16_t for n follow) { return get_string(get_number()); } case 0x7A: // UTF-8 string (four-byte uint32_t for n follow) { return get_string(get_number()); } case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow) { return get_string(get_number()); } case 0x7F: // UTF-8 string (indefinite length) { string_t result; while (get() != 0xFF) { result.append(get_cbor_string()); } return result; } default: { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(113, chars_read, "expected a CBOR string; last byte: 0x" + ss.str())); } } } template BasicJsonType get_cbor_array(const NumberType len) { BasicJsonType result = value_t::array; std::generate_n(std::back_inserter(*result.m_value.array), len, [this]() { return parse_cbor_internal(); }); return result; } template BasicJsonType get_cbor_object(const NumberType len) { BasicJsonType result = value_t::object; std::generate_n(std::inserter(*result.m_value.object, result.m_value.object->end()), len, [this]() { get(); auto key = get_cbor_string(); auto val = parse_cbor_internal(); return std::make_pair(std::move(key), std::move(val)); }); return result; } /*! @brief reads a MessagePack string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. @return string @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */ string_t get_msgpack_string() { unexpect_eof(); switch (current) { // fixstr case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: { return get_string(current & 0x1F); } case 0xD9: // str 8 { return get_string(get_number()); } case 0xDA: // str 16 { return get_string(get_number()); } case 0xDB: // str 32 { return get_string(get_number()); } default: { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(113, chars_read, "expected a MessagePack string; last byte: 0x" + ss.str())); } } } template BasicJsonType get_msgpack_array(const NumberType len) { BasicJsonType result = value_t::array; std::generate_n(std::back_inserter(*result.m_value.array), len, [this]() { return parse_msgpack_internal(); }); return result; } template BasicJsonType get_msgpack_object(const NumberType len) { BasicJsonType result = value_t::object; std::generate_n(std::inserter(*result.m_value.object, result.m_value.object->end()), len, [this]() { get(); auto key = get_msgpack_string(); auto val = parse_msgpack_internal(); return std::make_pair(std::move(key), std::move(val)); }); return result; } /*! @brief reads a UBJSON string This function is either called after reading the 'S' byte explicitly indicating a string, or in case of an object key where the 'S' byte can be left out. @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead @return string @throw parse_error.110 if input ended @throw parse_error.113 if an unexpected byte is read */ string_t get_ubjson_string(const bool get_char = true) { if (get_char) { get(); // TODO: may we ignore N here? } unexpect_eof(); switch (current) { case 'U': return get_string(get_number()); case 'i': return get_string(get_number()); case 'I': return get_string(get_number()); case 'l': return get_string(get_number()); case 'L': return get_string(get_number()); default: std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(113, chars_read, "expected a UBJSON string; last byte: 0x" + ss.str())); } } /*! @brief determine the type and size for a container In the optimized UBJSON format, a type and a size can be provided to allow for a more compact representation. @return pair of the size and the type */ std::pair get_ubjson_size_type() { std::size_t sz = string_t::npos; int tc = 0; get_ignore_noop(); if (current == '$') { tc = get(); // must not ignore 'N', because 'N' maybe the type unexpect_eof(); get_ignore_noop(); if (current != '#') { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(112, chars_read, "expected '#' after UBJSON type information; last byte: 0x" + ss.str())); } sz = parse_ubjson_internal(); } else if (current == '#') { sz = parse_ubjson_internal(); } return std::make_pair(sz, tc); } BasicJsonType get_ubjson_value(const int prefix) { switch (prefix) { case std::char_traits::eof(): // EOF JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); case 'T': // true return true; case 'F': // false return false; case 'Z': // null return nullptr; case 'U': return get_number(); case 'i': return get_number(); case 'I': return get_number(); case 'l': return get_number(); case 'L': return get_number(); case 'd': return get_number(); case 'D': return get_number(); case 'C': // char { get(); unexpect_eof(); if (JSON_UNLIKELY(current > 127)) { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(113, chars_read, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + ss.str())); } return string_t(1, static_cast(current)); } case 'S': // string return get_ubjson_string(); case '[': // array return get_ubjson_array(); case '{': // object return get_ubjson_object(); default: // anything else std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << current; JSON_THROW(parse_error::create(112, chars_read, "error reading UBJSON; last byte: 0x" + ss.str())); } } BasicJsonType get_ubjson_array() { BasicJsonType result = value_t::array; const auto size_and_type = get_ubjson_size_type(); if (size_and_type.first != string_t::npos) { if (JSON_UNLIKELY(size_and_type.first > result.max_size())) { JSON_THROW(out_of_range::create(408, "excessive array size: " + std::to_string(size_and_type.first))); } if (size_and_type.second != 0) { if (size_and_type.second != 'N') { std::generate_n(std::back_inserter(*result.m_value.array), size_and_type.first, [this, size_and_type]() { return get_ubjson_value(size_and_type.second); }); } } else { std::generate_n(std::back_inserter(*result.m_value.array), size_and_type.first, [this]() { return parse_ubjson_internal(); }); } } else { while (current != ']') { result.push_back(parse_ubjson_internal(false)); get_ignore_noop(); } } return result; } BasicJsonType get_ubjson_object() { BasicJsonType result = value_t::object; const auto size_and_type = get_ubjson_size_type(); if (size_and_type.first != string_t::npos) { if (JSON_UNLIKELY(size_and_type.first > result.max_size())) { JSON_THROW(out_of_range::create(408, "excessive object size: " + std::to_string(size_and_type.first))); } if (size_and_type.second != 0) { std::generate_n(std::inserter(*result.m_value.object, result.m_value.object->end()), size_and_type.first, [this, size_and_type]() { auto key = get_ubjson_string(); auto val = get_ubjson_value(size_and_type.second); return std::make_pair(std::move(key), std::move(val)); }); } else { std::generate_n(std::inserter(*result.m_value.object, result.m_value.object->end()), size_and_type.first, [this]() { auto key = get_ubjson_string(); auto val = parse_ubjson_internal(); return std::make_pair(std::move(key), std::move(val)); }); } } else { while (current != '}') { auto key = get_ubjson_string(false); result[std::move(key)] = parse_ubjson_internal(); get_ignore_noop(); } } return result; } /*! @brief throw if end of input is not reached @throw parse_error.110 if input not ended */ void expect_eof() const { if (JSON_UNLIKELY(current != std::char_traits::eof())) { JSON_THROW(parse_error::create(110, chars_read, "expected end of input")); } } /*! @briefthrow if end of input is reached @throw parse_error.110 if input ended */ void unexpect_eof() const { if (JSON_UNLIKELY(current == std::char_traits::eof())) { JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); } } private: /// input adapter input_adapter_t ia = nullptr; /// the current character int current = std::char_traits::eof(); /// the number of characters read std::size_t chars_read = 0; /// whether we can assume little endianess const bool is_little_endian = little_endianess(); }; } } // #include #include // reverse #include // array #include // uint8_t, uint16_t, uint32_t, uint64_t #include // memcpy #include // numeric_limits // #include // #include namespace nlohmann { namespace detail { /////////////////// // binary writer // /////////////////// /*! @brief serialization to CBOR and MessagePack values */ template class binary_writer { public: /*! @brief create a binary writer @param[in] adapter output adapter to write to */ explicit binary_writer(output_adapter_t adapter) : oa(adapter) { assert(oa); } /*! @brief[in] j JSON value to serialize */ void write_cbor(const BasicJsonType& j) { switch (j.type()) { case value_t::null: { oa->write_character(static_cast(0xF6)); break; } case value_t::boolean: { oa->write_character(j.m_value.boolean ? static_cast(0xF5) : static_cast(0xF4)); break; } case value_t::number_integer: { if (j.m_value.number_integer >= 0) { // CBOR does not differentiate between positive signed // integers and unsigned integers. Therefore, we used the // code from the value_t::number_unsigned case here. if (j.m_value.number_integer <= 0x17) { write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x18)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x19)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x1A)); write_number(static_cast(j.m_value.number_integer)); } else { oa->write_character(static_cast(0x1B)); write_number(static_cast(j.m_value.number_integer)); } } else { // The conversions below encode the sign in the first // byte, and the value is converted to a positive number. const auto positive_number = -1 - j.m_value.number_integer; if (j.m_value.number_integer >= -24) { write_number(static_cast(0x20 + positive_number)); } else if (positive_number <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x38)); write_number(static_cast(positive_number)); } else if (positive_number <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x39)); write_number(static_cast(positive_number)); } else if (positive_number <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x3A)); write_number(static_cast(positive_number)); } else { oa->write_character(static_cast(0x3B)); write_number(static_cast(positive_number)); } } break; } case value_t::number_unsigned: { if (j.m_value.number_unsigned <= 0x17) { write_number(static_cast(j.m_value.number_unsigned)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x18)); write_number(static_cast(j.m_value.number_unsigned)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x19)); write_number(static_cast(j.m_value.number_unsigned)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x1A)); write_number(static_cast(j.m_value.number_unsigned)); } else { oa->write_character(static_cast(0x1B)); write_number(static_cast(j.m_value.number_unsigned)); } break; } case value_t::number_float: // Double-Precision Float { oa->write_character(static_cast(0xFB)); write_number(j.m_value.number_float); break; } case value_t::string: { // step 1: write control byte and the string length const auto N = j.m_value.string->size(); if (N <= 0x17) { write_number(static_cast(0x60 + N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x78)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x79)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x7A)); write_number(static_cast(N)); } // LCOV_EXCL_START else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x7B)); write_number(static_cast(N)); } // LCOV_EXCL_STOP // step 2: write the string oa->write_characters( reinterpret_cast(j.m_value.string->c_str()), j.m_value.string->size()); break; } case value_t::array: { // step 1: write control byte and the array size const auto N = j.m_value.array->size(); if (N <= 0x17) { write_number(static_cast(0x80 + N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x98)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x99)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x9A)); write_number(static_cast(N)); } // LCOV_EXCL_START else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0x9B)); write_number(static_cast(N)); } // LCOV_EXCL_STOP // step 2: write each element for (const auto& el : *j.m_value.array) { write_cbor(el); } break; } case value_t::object: { // step 1: write control byte and the object size const auto N = j.m_value.object->size(); if (N <= 0x17) { write_number(static_cast(0xA0 + N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0xB8)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0xB9)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0xBA)); write_number(static_cast(N)); } // LCOV_EXCL_START else if (N <= (std::numeric_limits::max)()) { oa->write_character(static_cast(0xBB)); write_number(static_cast(N)); } // LCOV_EXCL_STOP // step 2: write each element for (const auto& el : *j.m_value.object) { write_cbor(el.first); write_cbor(el.second); } break; } default: break; } } /*! @brief[in] j JSON value to serialize */ void write_msgpack(const BasicJsonType& j) { switch (j.type()) { case value_t::null: // nil { oa->write_character(static_cast(0xC0)); break; } case value_t::boolean: // true and false { oa->write_character(j.m_value.boolean ? static_cast(0xC3) : static_cast(0xC2)); break; } case value_t::number_integer: { if (j.m_value.number_integer >= 0) { // MessagePack does not differentiate between positive // signed integers and unsigned integers. Therefore, we used // the code from the value_t::number_unsigned case here. if (j.m_value.number_unsigned < 128) { // positive fixnum write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 8 oa->write_character(static_cast(0xCC)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 16 oa->write_character(static_cast(0xCD)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 32 oa->write_character(static_cast(0xCE)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 64 oa->write_character(static_cast(0xCF)); write_number(static_cast(j.m_value.number_integer)); } } else { if (j.m_value.number_integer >= -32) { // negative fixnum write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() and j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 8 oa->write_character(static_cast(0xD0)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() and j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 16 oa->write_character(static_cast(0xD1)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() and j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 32 oa->write_character(static_cast(0xD2)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() and j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 64 oa->write_character(static_cast(0xD3)); write_number(static_cast(j.m_value.number_integer)); } } break; } case value_t::number_unsigned: { if (j.m_value.number_unsigned < 128) { // positive fixnum write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 8 oa->write_character(static_cast(0xCC)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 16 oa->write_character(static_cast(0xCD)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 32 oa->write_character(static_cast(0xCE)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { // uint 64 oa->write_character(static_cast(0xCF)); write_number(static_cast(j.m_value.number_integer)); } break; } case value_t::number_float: // float 64 { oa->write_character(static_cast(0xCB)); write_number(j.m_value.number_float); break; } case value_t::string: { // step 1: write control byte and the string length const auto N = j.m_value.string->size(); if (N <= 31) { // fixstr write_number(static_cast(0xA0 | N)); } else if (N <= (std::numeric_limits::max)()) { // str 8 oa->write_character(static_cast(0xD9)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { // str 16 oa->write_character(static_cast(0xDA)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { // str 32 oa->write_character(static_cast(0xDB)); write_number(static_cast(N)); } // step 2: write the string oa->write_characters( reinterpret_cast(j.m_value.string->c_str()), j.m_value.string->size()); break; } case value_t::array: { // step 1: write control byte and the array size const auto N = j.m_value.array->size(); if (N <= 15) { // fixarray write_number(static_cast(0x90 | N)); } else if (N <= (std::numeric_limits::max)()) { // array 16 oa->write_character(static_cast(0xDC)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { // array 32 oa->write_character(static_cast(0xDD)); write_number(static_cast(N)); } // step 2: write each element for (const auto& el : *j.m_value.array) { write_msgpack(el); } break; } case value_t::object: { // step 1: write control byte and the object size const auto N = j.m_value.object->size(); if (N <= 15) { // fixmap write_number(static_cast(0x80 | (N & 0xF))); } else if (N <= (std::numeric_limits::max)()) { // map 16 oa->write_character(static_cast(0xDE)); write_number(static_cast(N)); } else if (N <= (std::numeric_limits::max)()) { // map 32 oa->write_character(static_cast(0xDF)); write_number(static_cast(N)); } // step 2: write each element for (const auto& el : *j.m_value.object) { write_msgpack(el.first); write_msgpack(el.second); } break; } default: break; } } /*! @param[in] j JSON value to serialize @param[in] use_count whether to use '#' prefixes (optimized format) @param[in] use_type whether to use '$' prefixes (optimized format) @param[in] add_prefix whether prefixes need to be used for this value */ void write_ubjson(const BasicJsonType& j, const bool use_count, const bool use_type, const bool add_prefix = true) { switch (j.type()) { case value_t::null: { if (add_prefix) { oa->write_character(static_cast('Z')); } break; } case value_t::boolean: { if (add_prefix) oa->write_character(j.m_value.boolean ? static_cast('T') : static_cast('F')); break; } case value_t::number_integer: { write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix); break; } case value_t::number_unsigned: { write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix); break; } case value_t::number_float: { write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix); break; } case value_t::string: { if (add_prefix) { oa->write_character(static_cast('S')); } write_number_with_ubjson_prefix(j.m_value.string->size(), true); oa->write_characters( reinterpret_cast(j.m_value.string->c_str()), j.m_value.string->size()); break; } case value_t::array: { if (add_prefix) { oa->write_character(static_cast('[')); } bool prefix_required = true; if (use_type and not j.m_value.array->empty()) { assert(use_count); const char first_prefix = ubjson_prefix(j.front()); const bool same_prefix = std::all_of(j.begin() + 1, j.end(), [this, first_prefix](const BasicJsonType & v) { return ubjson_prefix(v) == first_prefix; }); if (same_prefix) { prefix_required = false; oa->write_character(static_cast('$')); oa->write_character(static_cast(first_prefix)); } } if (use_count) { oa->write_character(static_cast('#')); write_number_with_ubjson_prefix(j.m_value.array->size(), true); } for (const auto& el : *j.m_value.array) { write_ubjson(el, use_count, use_type, prefix_required); } if (not use_count) { oa->write_character(static_cast(']')); } break; } case value_t::object: { if (add_prefix) { oa->write_character(static_cast('{')); } bool prefix_required = true; if (use_type and not j.m_value.object->empty()) { assert(use_count); const char first_prefix = ubjson_prefix(j.front()); const bool same_prefix = std::all_of(j.begin(), j.end(), [this, first_prefix](const BasicJsonType & v) { return ubjson_prefix(v) == first_prefix; }); if (same_prefix) { prefix_required = false; oa->write_character(static_cast('$')); oa->write_character(static_cast(first_prefix)); } } if (use_count) { oa->write_character(static_cast('#')); write_number_with_ubjson_prefix(j.m_value.object->size(), true); } for (const auto& el : *j.m_value.object) { write_number_with_ubjson_prefix(el.first.size(), true); oa->write_characters( reinterpret_cast(el.first.c_str()), el.first.size()); write_ubjson(el.second, use_count, use_type, prefix_required); } if (not use_count) { oa->write_character(static_cast('}')); } break; } default: break; } } private: /* @brief write a number to output input @param[in] n number of type @a NumberType @tparam NumberType the type of the number @note This function needs to respect the system's endianess, because bytes in CBOR, MessagePack, and UBJSON are stored in network order (big endian) and therefore need reordering on little endian systems. */ template void write_number(const NumberType n) { // step 1: write number to array of length NumberType std::array vec; std::memcpy(vec.data(), &n, sizeof(NumberType)); // step 2: write array to output (with possible reordering) if (is_little_endian) { // reverse byte order prior to conversion if necessary std::reverse(vec.begin(), vec.end()); } oa->write_characters(vec.data(), sizeof(NumberType)); } // UBJSON: write number (floating point) template::value, int>::type = 0> void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix) { if (add_prefix) { oa->write_character(static_cast('D')); // float64 } write_number(n); } // UBJSON: write number (unsigned integer) template::value, int>::type = 0> void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix) { if (n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { oa->write_character(static_cast('i')); // int8 } write_number(static_cast(n)); } else if (n <= (std::numeric_limits::max)()) { if (add_prefix) { oa->write_character(static_cast('U')); // uint8 } write_number(static_cast(n)); } else if (n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { oa->write_character(static_cast('I')); // int16 } write_number(static_cast(n)); } else if (n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { oa->write_character(static_cast('l')); // int32 } write_number(static_cast(n)); } else if (n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { oa->write_character(static_cast('L')); // int64 } write_number(static_cast(n)); } else { JSON_THROW(out_of_range::create(407, "number overflow serializing " + std::to_string(n))); } } // UBJSON: write number (signed integer) template::value and not std::is_floating_point::value, int>::type = 0> void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix) { if ((std::numeric_limits::min)() <= n and n <= (std::numeric_limits::max)()) { if (add_prefix) { oa->write_character(static_cast('i')); // int8 } write_number(static_cast(n)); } else if (static_cast((std::numeric_limits::min)()) <= n and n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { oa->write_character(static_cast('U')); // uint8 } write_number(static_cast(n)); } else if ((std::numeric_limits::min)() <= n and n <= (std::numeric_limits::max)()) { if (add_prefix) { oa->write_character(static_cast('I')); // int16 } write_number(static_cast(n)); } else if ((std::numeric_limits::min)() <= n and n <= (std::numeric_limits::max)()) { if (add_prefix) { oa->write_character(static_cast('l')); // int32 } write_number(static_cast(n)); } else if ((std::numeric_limits::min)() <= n and n <= (std::numeric_limits::max)()) { if (add_prefix) { oa->write_character(static_cast('L')); // int64 } write_number(static_cast(n)); } // LCOV_EXCL_START else { JSON_THROW(out_of_range::create(407, "number overflow serializing " + std::to_string(n))); } // LCOV_EXCL_STOP } /*! @brief determine the type prefix of container values @note This function does not need to be 100% accurate when it comes to integer limits. In case a number exceeds the limits of int64_t, this will be detected by a later call to function write_number_with_ubjson_prefix. Therefore, we return 'L' for any value that does not fit the previous limits. */ char ubjson_prefix(const BasicJsonType& j) const noexcept { switch (j.type()) { case value_t::null: return 'Z'; case value_t::boolean: return j.m_value.boolean ? 'T' : 'F'; case value_t::number_integer: { if ((std::numeric_limits::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'i'; } else if ((std::numeric_limits::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'U'; } else if ((std::numeric_limits::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'I'; } else if ((std::numeric_limits::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'l'; } else // no check and assume int64_t (see note above) { return 'L'; } } case value_t::number_unsigned: { if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { return 'i'; } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { return 'U'; } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { return 'I'; } else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) { return 'l'; } else // no check and assume int64_t (see note above) { return 'L'; } } case value_t::number_float: return 'D'; case value_t::string: return 'S'; case value_t::array: return '['; case value_t::object: return '{'; default: // discarded values return 'N'; } } private: /// whether we can assume little endianess const bool is_little_endian = binary_reader::little_endianess(); /// the output output_adapter_t oa = nullptr; }; } } // #include #include // reverse, remove, fill, find, none_of #include // array #include // assert #include // and, or #include // localeconv, lconv #include // labs, isfinite, isnan, signbit #include // size_t, ptrdiff_t #include // uint8_t #include // snprintf #include // setfill #include // next #include // numeric_limits #include // string #include // stringstream #include // is_same // #include // #include #include // assert #include // or, and, not #include // signbit, isfinite #include // intN_t, uintN_t #include // memcpy, memmove namespace nlohmann { namespace detail { /*! @brief implements the Grisu2 algorithm for binary to decimal floating-point conversion. This implementation is a slightly modified version of the reference implementation which may be obtained from http://florian.loitsch.com/publications (bench.tar.gz). The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch. For a detailed description of the algorithm see: [1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with Integers", Proceedings of the ACM SIGPLAN 2010 Conference on Programming Language Design and Implementation, PLDI 2010 [2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately", Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, PLDI 1996 */ namespace dtoa_impl { template Target reinterpret_bits(const Source source) { static_assert(sizeof(Target) == sizeof(Source), "size mismatch"); Target target; std::memcpy(&target, &source, sizeof(Source)); return target; } struct diyfp // f * 2^e { static constexpr int kPrecision = 64; // = q uint64_t f; int e; constexpr diyfp() noexcept : f(0), e(0) {} constexpr diyfp(uint64_t f_, int e_) noexcept : f(f_), e(e_) {} /*! @brief returns x - y @pre x.e == y.e and x.f >= y.f */ static diyfp sub(const diyfp& x, const diyfp& y) noexcept { assert(x.e == y.e); assert(x.f >= y.f); return diyfp(x.f - y.f, x.e); } /*! @brief returns x * y @note The result is rounded. (Only the upper q bits are returned.) */ static diyfp mul(const diyfp& x, const diyfp& y) noexcept { static_assert(kPrecision == 64, "internal error"); // Computes: // f = round((x.f * y.f) / 2^q) // e = x.e + y.e + q // Emulate the 64-bit * 64-bit multiplication: // // p = u * v // = (u_lo + 2^32 u_hi) (v_lo + 2^32 v_hi) // = (u_lo v_lo ) + 2^32 ((u_lo v_hi ) + (u_hi v_lo )) + 2^64 (u_hi v_hi ) // = (p0 ) + 2^32 ((p1 ) + (p2 )) + 2^64 (p3 ) // = (p0_lo + 2^32 p0_hi) + 2^32 ((p1_lo + 2^32 p1_hi) + (p2_lo + 2^32 p2_hi)) + 2^64 (p3 ) // = (p0_lo ) + 2^32 (p0_hi + p1_lo + p2_lo ) + 2^64 (p1_hi + p2_hi + p3) // = (p0_lo ) + 2^32 (Q ) + 2^64 (H ) // = (p0_lo ) + 2^32 (Q_lo + 2^32 Q_hi ) + 2^64 (H ) // // (Since Q might be larger than 2^32 - 1) // // = (p0_lo + 2^32 Q_lo) + 2^64 (Q_hi + H) // // (Q_hi + H does not overflow a 64-bit int) // // = p_lo + 2^64 p_hi const uint64_t u_lo = x.f & 0xFFFFFFFF; const uint64_t u_hi = x.f >> 32; const uint64_t v_lo = y.f & 0xFFFFFFFF; const uint64_t v_hi = y.f >> 32; const uint64_t p0 = u_lo * v_lo; const uint64_t p1 = u_lo * v_hi; const uint64_t p2 = u_hi * v_lo; const uint64_t p3 = u_hi * v_hi; const uint64_t p0_hi = p0 >> 32; const uint64_t p1_lo = p1 & 0xFFFFFFFF; const uint64_t p1_hi = p1 >> 32; const uint64_t p2_lo = p2 & 0xFFFFFFFF; const uint64_t p2_hi = p2 >> 32; uint64_t Q = p0_hi + p1_lo + p2_lo; // The full product might now be computed as // // p_hi = p3 + p2_hi + p1_hi + (Q >> 32) // p_lo = p0_lo + (Q << 32) // // But in this particular case here, the full p_lo is not required. // Effectively we only need to add the highest bit in p_lo to p_hi (and // Q_hi + 1 does not overflow). Q += uint64_t{1} << (64 - 32 - 1); // round, ties up const uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32); return diyfp(h, x.e + y.e + 64); } /*! @brief normalize x such that the significand is >= 2^(q-1) @pre x.f != 0 */ static diyfp normalize(diyfp x) noexcept { assert(x.f != 0); while ((x.f >> 63) == 0) { x.f <<= 1; x.e--; } return x; } /*! @brief normalize x such that the result has the exponent E @pre e >= x.e and the upper e - x.e bits of x.f must be zero. */ static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept { const int delta = x.e - target_exponent; assert(delta >= 0); assert(((x.f << delta) >> delta) == x.f); return diyfp(x.f << delta, target_exponent); } }; struct boundaries { diyfp w; diyfp minus; diyfp plus; }; /*! Compute the (normalized) diyfp representing the input number 'value' and its boundaries. @pre value must be finite and positive */ template boundaries compute_boundaries(FloatType value) { assert(std::isfinite(value)); assert(value > 0); // Convert the IEEE representation into a diyfp. // // If v is denormal: // value = 0.F * 2^(1 - bias) = ( F) * 2^(1 - bias - (p-1)) // If v is normalized: // value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1)) static_assert(std::numeric_limits::is_iec559, "internal error: dtoa_short requires an IEEE-754 floating-point implementation"); constexpr int kPrecision = std::numeric_limits::digits; // = p (includes the hidden bit) constexpr int kBias = std::numeric_limits::max_exponent - 1 + (kPrecision - 1); constexpr int kMinExp = 1 - kBias; constexpr uint64_t kHiddenBit = uint64_t{1} << (kPrecision - 1); // = 2^(p-1) using bits_type = typename std::conditional< kPrecision == 24, uint32_t, uint64_t >::type; const uint64_t bits = reinterpret_bits(value); const uint64_t E = bits >> (kPrecision - 1); const uint64_t F = bits & (kHiddenBit - 1); const bool is_denormal = (E == 0); const diyfp v = is_denormal ? diyfp(F, kMinExp) : diyfp(F + kHiddenBit, static_cast(E) - kBias); // Compute the boundaries m- and m+ of the floating-point value // v = f * 2^e. // // Determine v- and v+, the floating-point predecessor and successor if v, // respectively. // // v- = v - 2^e if f != 2^(p-1) or e == e_min (A) // = v - 2^(e-1) if f == 2^(p-1) and e > e_min (B) // // v+ = v + 2^e // // Let m- = (v- + v) / 2 and m+ = (v + v+) / 2. All real numbers _strictly_ // between m- and m+ round to v, regardless of how the input rounding // algorithm breaks ties. // // ---+-------------+-------------+-------------+-------------+--- (A) // v- m- v m+ v+ // // -----------------+------+------+-------------+-------------+--- (B) // v- m- v m+ v+ const bool lower_boundary_is_closer = (F == 0 and E > 1); const diyfp m_plus = diyfp(2 * v.f + 1, v.e - 1); const diyfp m_minus = lower_boundary_is_closer ? diyfp(4 * v.f - 1, v.e - 2) // (B) : diyfp(2 * v.f - 1, v.e - 1); // (A) // Determine the normalized w+ = m+. const diyfp w_plus = diyfp::normalize(m_plus); // Determine w- = m- such that e_(w-) = e_(w+). const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.e); return {diyfp::normalize(v), w_minus, w_plus}; } // Given normalized diyfp w, Grisu needs to find a (normalized) cached // power-of-ten c, such that the exponent of the product c * w = f * 2^e lies // within a certain range [alpha, gamma] (Definition 3.2 from [1]) // // alpha <= e = e_c + e_w + q <= gamma // // or // // f_c * f_w * 2^alpha <= f_c 2^(e_c) * f_w 2^(e_w) * 2^q // <= f_c * f_w * 2^gamma // // Since c and w are normalized, i.e. 2^(q-1) <= f < 2^q, this implies // // 2^(q-1) * 2^(q-1) * 2^alpha <= c * w * 2^q < 2^q * 2^q * 2^gamma // // or // // 2^(q - 2 + alpha) <= c * w < 2^(q + gamma) // // The choice of (alpha,gamma) determines the size of the table and the form of // the digit generation procedure. Using (alpha,gamma)=(-60,-32) works out well // in practice: // // The idea is to cut the number c * w = f * 2^e into two parts, which can be // processed independently: An integral part p1, and a fractional part p2: // // f * 2^e = ( (f div 2^-e) * 2^-e + (f mod 2^-e) ) * 2^e // = (f div 2^-e) + (f mod 2^-e) * 2^e // = p1 + p2 * 2^e // // The conversion of p1 into decimal form requires a series of divisions and // modulos by (a power of) 10. These operations are faster for 32-bit than for // 64-bit integers, so p1 should ideally fit into a 32-bit integer. This can be // achieved by choosing // // -e >= 32 or e <= -32 := gamma // // In order to convert the fractional part // // p2 * 2^e = p2 / 2^-e = d[-1] / 10^1 + d[-2] / 10^2 + ... // // into decimal form, the fraction is repeatedly multiplied by 10 and the digits // d[-i] are extracted in order: // // (10 * p2) div 2^-e = d[-1] // (10 * p2) mod 2^-e = d[-2] / 10^1 + ... // // The multiplication by 10 must not overflow. It is sufficient to choose // // 10 * p2 < 16 * p2 = 2^4 * p2 <= 2^64. // // Since p2 = f mod 2^-e < 2^-e, // // -e <= 60 or e >= -60 := alpha constexpr int kAlpha = -60; constexpr int kGamma = -32; struct cached_power // c = f * 2^e ~= 10^k { uint64_t f; int e; int k; }; /*! For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c satisfies (Definition 3.2 from [1]) alpha <= e_c + e + q <= gamma. */ inline cached_power get_cached_power_for_binary_exponent(int e) { // Now // // alpha <= e_c + e + q <= gamma (1) // ==> f_c * 2^alpha <= c * 2^e * 2^q // // and since the c's are normalized, 2^(q-1) <= f_c, // // ==> 2^(q - 1 + alpha) <= c * 2^(e + q) // ==> 2^(alpha - e - 1) <= c // // If c were an exakt power of ten, i.e. c = 10^k, one may determine k as // // k = ceil( log_10( 2^(alpha - e - 1) ) ) // = ceil( (alpha - e - 1) * log_10(2) ) // // From the paper: // "In theory the result of the procedure could be wrong since c is rounded, // and the computation itself is approximated [...]. In practice, however, // this simple function is sufficient." // // For IEEE double precision floating-point numbers converted into // normalized diyfp's w = f * 2^e, with q = 64, // // e >= -1022 (min IEEE exponent) // -52 (p - 1) // -52 (p - 1, possibly normalize denormal IEEE numbers) // -11 (normalize the diyfp) // = -1137 // // and // // e <= +1023 (max IEEE exponent) // -52 (p - 1) // -11 (normalize the diyfp) // = 960 // // This binary exponent range [-1137,960] results in a decimal exponent // range [-307,324]. One does not need to store a cached power for each // k in this range. For each such k it suffices to find a cached power // such that the exponent of the product lies in [alpha,gamma]. // This implies that the difference of the decimal exponents of adjacent // table entries must be less than or equal to // // floor( (gamma - alpha) * log_10(2) ) = 8. // // (A smaller distance gamma-alpha would require a larger table.) // NB: // Actually this function returns c, such that -60 <= e_c + e + 64 <= -34. constexpr int kCachedPowersSize = 79; constexpr int kCachedPowersMinDecExp = -300; constexpr int kCachedPowersDecStep = 8; static constexpr cached_power kCachedPowers[] = { { 0xAB70FE17C79AC6CA, -1060, -300 }, { 0xFF77B1FCBEBCDC4F, -1034, -292 }, { 0xBE5691EF416BD60C, -1007, -284 }, { 0x8DD01FAD907FFC3C, -980, -276 }, { 0xD3515C2831559A83, -954, -268 }, { 0x9D71AC8FADA6C9B5, -927, -260 }, { 0xEA9C227723EE8BCB, -901, -252 }, { 0xAECC49914078536D, -874, -244 }, { 0x823C12795DB6CE57, -847, -236 }, { 0xC21094364DFB5637, -821, -228 }, { 0x9096EA6F3848984F, -794, -220 }, { 0xD77485CB25823AC7, -768, -212 }, { 0xA086CFCD97BF97F4, -741, -204 }, { 0xEF340A98172AACE5, -715, -196 }, { 0xB23867FB2A35B28E, -688, -188 }, { 0x84C8D4DFD2C63F3B, -661, -180 }, { 0xC5DD44271AD3CDBA, -635, -172 }, { 0x936B9FCEBB25C996, -608, -164 }, { 0xDBAC6C247D62A584, -582, -156 }, { 0xA3AB66580D5FDAF6, -555, -148 }, { 0xF3E2F893DEC3F126, -529, -140 }, { 0xB5B5ADA8AAFF80B8, -502, -132 }, { 0x87625F056C7C4A8B, -475, -124 }, { 0xC9BCFF6034C13053, -449, -116 }, { 0x964E858C91BA2655, -422, -108 }, { 0xDFF9772470297EBD, -396, -100 }, { 0xA6DFBD9FB8E5B88F, -369, -92 }, { 0xF8A95FCF88747D94, -343, -84 }, { 0xB94470938FA89BCF, -316, -76 }, { 0x8A08F0F8BF0F156B, -289, -68 }, { 0xCDB02555653131B6, -263, -60 }, { 0x993FE2C6D07B7FAC, -236, -52 }, { 0xE45C10C42A2B3B06, -210, -44 }, { 0xAA242499697392D3, -183, -36 }, { 0xFD87B5F28300CA0E, -157, -28 }, { 0xBCE5086492111AEB, -130, -20 }, { 0x8CBCCC096F5088CC, -103, -12 }, { 0xD1B71758E219652C, -77, -4 }, { 0x9C40000000000000, -50, 4 }, { 0xE8D4A51000000000, -24, 12 }, { 0xAD78EBC5AC620000, 3, 20 }, { 0x813F3978F8940984, 30, 28 }, { 0xC097CE7BC90715B3, 56, 36 }, { 0x8F7E32CE7BEA5C70, 83, 44 }, { 0xD5D238A4ABE98068, 109, 52 }, { 0x9F4F2726179A2245, 136, 60 }, { 0xED63A231D4C4FB27, 162, 68 }, { 0xB0DE65388CC8ADA8, 189, 76 }, { 0x83C7088E1AAB65DB, 216, 84 }, { 0xC45D1DF942711D9A, 242, 92 }, { 0x924D692CA61BE758, 269, 100 }, { 0xDA01EE641A708DEA, 295, 108 }, { 0xA26DA3999AEF774A, 322, 116 }, { 0xF209787BB47D6B85, 348, 124 }, { 0xB454E4A179DD1877, 375, 132 }, { 0x865B86925B9BC5C2, 402, 140 }, { 0xC83553C5C8965D3D, 428, 148 }, { 0x952AB45CFA97A0B3, 455, 156 }, { 0xDE469FBD99A05FE3, 481, 164 }, { 0xA59BC234DB398C25, 508, 172 }, { 0xF6C69A72A3989F5C, 534, 180 }, { 0xB7DCBF5354E9BECE, 561, 188 }, { 0x88FCF317F22241E2, 588, 196 }, { 0xCC20CE9BD35C78A5, 614, 204 }, { 0x98165AF37B2153DF, 641, 212 }, { 0xE2A0B5DC971F303A, 667, 220 }, { 0xA8D9D1535CE3B396, 694, 228 }, { 0xFB9B7CD9A4A7443C, 720, 236 }, { 0xBB764C4CA7A44410, 747, 244 }, { 0x8BAB8EEFB6409C1A, 774, 252 }, { 0xD01FEF10A657842C, 800, 260 }, { 0x9B10A4E5E9913129, 827, 268 }, { 0xE7109BFBA19C0C9D, 853, 276 }, { 0xAC2820D9623BF429, 880, 284 }, { 0x80444B5E7AA7CF85, 907, 292 }, { 0xBF21E44003ACDD2D, 933, 300 }, { 0x8E679C2F5E44FF8F, 960, 308 }, { 0xD433179D9C8CB841, 986, 316 }, { 0x9E19DB92B4E31BA9, 1013, 324 }, }; // This computation gives exactly the same results for k as // k = ceil((kAlpha - e - 1) * 0.30102999566398114) // for |e| <= 1500, but doesn't require floating-point operations. // NB: log_10(2) ~= 78913 / 2^18 assert(e >= -1500); assert(e <= 1500); const int f = kAlpha - e - 1; const int k = (f * 78913) / (1 << 18) + (f > 0); const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep; assert(index >= 0); assert(index < kCachedPowersSize); static_cast(kCachedPowersSize); // Fix warning. const cached_power cached = kCachedPowers[index]; assert(kAlpha <= cached.e + e + 64); assert(kGamma >= cached.e + e + 64); return cached; } /*! For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k. For n == 0, returns 1 and sets pow10 := 1. */ inline int find_largest_pow10(const uint32_t n, uint32_t& pow10) { // LCOV_EXCL_START if (n >= 1000000000) { pow10 = 1000000000; return 10; } // LCOV_EXCL_STOP else if (n >= 100000000) { pow10 = 100000000; return 9; } else if (n >= 10000000) { pow10 = 10000000; return 8; } else if (n >= 1000000) { pow10 = 1000000; return 7; } else if (n >= 100000) { pow10 = 100000; return 6; } else if (n >= 10000) { pow10 = 10000; return 5; } else if (n >= 1000) { pow10 = 1000; return 4; } else if (n >= 100) { pow10 = 100; return 3; } else if (n >= 10) { pow10 = 10; return 2; } else { pow10 = 1; return 1; } } inline void grisu2_round(char* buf, int len, uint64_t dist, uint64_t delta, uint64_t rest, uint64_t ten_k) { assert(len >= 1); assert(dist <= delta); assert(rest <= delta); assert(ten_k > 0); // <--------------------------- delta ----> // <---- dist ---------> // --------------[------------------+-------------------]-------------- // M- w M+ // // ten_k // <------> // <---- rest ----> // --------------[------------------+----+--------------]-------------- // w V // = buf * 10^k // // ten_k represents a unit-in-the-last-place in the decimal representation // stored in buf. // Decrement buf by ten_k while this takes buf closer to w. // The tests are written in this order to avoid overflow in unsigned // integer arithmetic. while (rest < dist and delta - rest >= ten_k and (rest + ten_k < dist or dist - rest > rest + ten_k - dist)) { assert(buf[len - 1] != '0'); buf[len - 1]--; rest += ten_k; } } /*! Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+. M- and M+ must be normalized and share the same exponent -60 <= e <= -32. */ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus) { static_assert(kAlpha >= -60, "internal error"); static_assert(kGamma <= -32, "internal error"); // Generates the digits (and the exponent) of a decimal floating-point // number V = buffer * 10^decimal_exponent in the range [M-, M+]. The diyfp's // w, M- and M+ share the same exponent e, which satisfies alpha <= e <= gamma. // // <--------------------------- delta ----> // <---- dist ---------> // --------------[------------------+-------------------]-------------- // M- w M+ // // Grisu2 generates the digits of M+ from left to right and stops as soon as // V is in [M-,M+]. assert(M_plus.e >= kAlpha); assert(M_plus.e <= kGamma); uint64_t delta = diyfp::sub(M_plus, M_minus).f; // (significand of (M+ - M-), implicit exponent is e) uint64_t dist = diyfp::sub(M_plus, w ).f; // (significand of (M+ - w ), implicit exponent is e) // Split M+ = f * 2^e into two parts p1 and p2 (note: e < 0): // // M+ = f * 2^e // = ((f div 2^-e) * 2^-e + (f mod 2^-e)) * 2^e // = ((p1 ) * 2^-e + (p2 )) * 2^e // = p1 + p2 * 2^e const diyfp one(uint64_t{1} << -M_plus.e, M_plus.e); uint32_t p1 = static_cast(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.) uint64_t p2 = M_plus.f & (one.f - 1); // p2 = f mod 2^-e // 1) // // Generate the digits of the integral part p1 = d[n-1]...d[1]d[0] assert(p1 > 0); uint32_t pow10; const int k = find_largest_pow10(p1, pow10); // 10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1) // // p1 = (p1 div 10^(k-1)) * 10^(k-1) + (p1 mod 10^(k-1)) // = (d[k-1] ) * 10^(k-1) + (p1 mod 10^(k-1)) // // M+ = p1 + p2 * 2^e // = d[k-1] * 10^(k-1) + (p1 mod 10^(k-1)) + p2 * 2^e // = d[k-1] * 10^(k-1) + ((p1 mod 10^(k-1)) * 2^-e + p2) * 2^e // = d[k-1] * 10^(k-1) + ( rest) * 2^e // // Now generate the digits d[n] of p1 from left to right (n = k-1,...,0) // // p1 = d[k-1]...d[n] * 10^n + d[n-1]...d[0] // // but stop as soon as // // rest * 2^e = (d[n-1]...d[0] * 2^-e + p2) * 2^e <= delta * 2^e int n = k; while (n > 0) { // Invariants: // M+ = buffer * 10^n + (p1 + p2 * 2^e) (buffer = 0 for n = k) // pow10 = 10^(n-1) <= p1 < 10^n // const uint32_t d = p1 / pow10; // d = p1 div 10^(n-1) const uint32_t r = p1 % pow10; // r = p1 mod 10^(n-1) // // M+ = buffer * 10^n + (d * 10^(n-1) + r) + p2 * 2^e // = (buffer * 10 + d) * 10^(n-1) + (r + p2 * 2^e) // assert(d <= 9); buffer[length++] = static_cast('0' + d); // buffer := buffer * 10 + d // // M+ = buffer * 10^(n-1) + (r + p2 * 2^e) // p1 = r; n--; // // M+ = buffer * 10^n + (p1 + p2 * 2^e) // pow10 = 10^n // // Now check if enough digits have been generated. // Compute // // p1 + p2 * 2^e = (p1 * 2^-e + p2) * 2^e = rest * 2^e // // Note: // Since rest and delta share the same exponent e, it suffices to // compare the significands. const uint64_t rest = (uint64_t{p1} << -one.e) + p2; if (rest <= delta) { // V = buffer * 10^n, with M- <= V <= M+. decimal_exponent += n; // We may now just stop. But instead look if the buffer could be // decremented to bring V closer to w. // // pow10 = 10^n is now 1 ulp in the decimal representation V. // The rounding procedure works with diyfp's with an implicit // exponent of e. // // 10^n = (10^n * 2^-e) * 2^e = ulp * 2^e // const uint64_t ten_n = uint64_t{pow10} << -one.e; grisu2_round(buffer, length, dist, delta, rest, ten_n); return; } pow10 /= 10; // // pow10 = 10^(n-1) <= p1 < 10^n // Invariants restored. } // 2) // // The digits of the integral part have been generated: // // M+ = d[k-1]...d[1]d[0] + p2 * 2^e // = buffer + p2 * 2^e // // Now generate the digits of the fractional part p2 * 2^e. // // Note: // No decimal point is generated: the exponent is adjusted instead. // // p2 actually represents the fraction // // p2 * 2^e // = p2 / 2^-e // = d[-1] / 10^1 + d[-2] / 10^2 + ... // // Now generate the digits d[-m] of p1 from left to right (m = 1,2,...) // // p2 * 2^e = d[-1]d[-2]...d[-m] * 10^-m // + 10^-m * (d[-m-1] / 10^1 + d[-m-2] / 10^2 + ...) // // using // // 10^m * p2 = ((10^m * p2) div 2^-e) * 2^-e + ((10^m * p2) mod 2^-e) // = ( d) * 2^-e + ( r) // // or // 10^m * p2 * 2^e = d + r * 2^e // // i.e. // // M+ = buffer + p2 * 2^e // = buffer + 10^-m * (d + r * 2^e) // = (buffer * 10^m + d) * 10^-m + 10^-m * r * 2^e // // and stop as soon as 10^-m * r * 2^e <= delta * 2^e assert(p2 > delta); int m = 0; for (;;) { // Invariant: // M+ = buffer * 10^-m + 10^-m * (d[-m-1] / 10 + d[-m-2] / 10^2 + ...) * 2^e // = buffer * 10^-m + 10^-m * (p2 ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e // assert(p2 <= UINT64_MAX / 10); p2 *= 10; const uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e const uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e // // M+ = buffer * 10^-m + 10^-m * (1/10 * (d * 2^-e + r) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * (d + r * 2^e)) // = (buffer * 10 + d) * 10^(-m-1) + 10^(-m-1) * r * 2^e // assert(d <= 9); buffer[length++] = static_cast('0' + d); // buffer := buffer * 10 + d // // M+ = buffer * 10^(-m-1) + 10^(-m-1) * r * 2^e // p2 = r; m++; // // M+ = buffer * 10^-m + 10^-m * p2 * 2^e // Invariant restored. // Check if enough digits have been generated. // // 10^-m * p2 * 2^e <= delta * 2^e // p2 * 2^e <= 10^m * delta * 2^e // p2 <= 10^m * delta delta *= 10; dist *= 10; if (p2 <= delta) { break; } } // V = buffer * 10^-m, with M- <= V <= M+. decimal_exponent -= m; // 1 ulp in the decimal representation is now 10^-m. // Since delta and dist are now scaled by 10^m, we need to do the // same with ulp in order to keep the units in sync. // // 10^m * 10^-m = 1 = 2^-e * 2^e = ten_m * 2^e // const uint64_t ten_m = one.f; grisu2_round(buffer, length, dist, delta, p2, ten_m); // By construction this algorithm generates the shortest possible decimal // number (Loitsch, Theorem 6.2) which rounds back to w. // For an input number of precision p, at least // // N = 1 + ceil(p * log_10(2)) // // decimal digits are sufficient to identify all binary floating-point // numbers (Matula, "In-and-Out conversions"). // This implies that the algorithm does not produce more than N decimal // digits. // // N = 17 for p = 53 (IEEE double precision) // N = 9 for p = 24 (IEEE single precision) } /*! v = buf * 10^decimal_exponent len is the length of the buffer (number of decimal digits) The buffer must be large enough, i.e. >= max_digits10. */ inline void grisu2(char* buf, int& len, int& decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus) { assert(m_plus.e == m_minus.e); assert(m_plus.e == v.e); // --------(-----------------------+-----------------------)-------- (A) // m- v m+ // // --------------------(-----------+-----------------------)-------- (B) // m- v m+ // // First scale v (and m- and m+) such that the exponent is in the range // [alpha, gamma]. const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e); const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma] const diyfp w = diyfp::mul(v, c_minus_k); const diyfp w_minus = diyfp::mul(m_minus, c_minus_k); const diyfp w_plus = diyfp::mul(m_plus, c_minus_k); // ----(---+---)---------------(---+---)---------------(---+---)---- // w- w w+ // = c*m- = c*v = c*m+ // // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and // w+ are now off by a small amount. // In fact: // // w - v * 10^k < 1 ulp // // To account for this inaccuracy, add resp. subtract 1 ulp. // // --------+---[---------------(---+---)---------------]---+-------- // w- M- w M+ w+ // // Now any number in [M-, M+] (bounds included) will round to w when input, // regardless of how the input rounding algorithm breaks ties. // // And digit_gen generates the shortest possible such number in [M-, M+]. // Note that this does not mean that Grisu2 always generates the shortest // possible number in the interval (m-, m+). const diyfp M_minus(w_minus.f + 1, w_minus.e); const diyfp M_plus (w_plus.f - 1, w_plus.e ); decimal_exponent = -cached.k; // = -(-k) = k grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus); } /*! v = buf * 10^decimal_exponent len is the length of the buffer (number of decimal digits) The buffer must be large enough, i.e. >= max_digits10. */ template void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value) { static_assert(diyfp::kPrecision >= std::numeric_limits::digits + 3, "internal error: not enough precision"); assert(std::isfinite(value)); assert(value > 0); // If the neighbors (and boundaries) of 'value' are always computed for double-precision // numbers, all float's can be recovered using strtod (and strtof). However, the resulting // decimal representations are not exactly "short". // // The documentation for 'std::to_chars' (http://en.cppreference.com/w/cpp/utility/to_chars) // says "value is converted to a string as if by std::sprintf in the default ("C") locale" // and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars' // does. // On the other hand, the documentation for 'std::to_chars' requires that "parsing the // representation using the corresponding std::from_chars function recovers value exactly". That // indicates that single precision floating-point numbers should be recovered using // 'std::strtof'. // // NB: If the neighbors are computed for single-precision numbers, there is a single float // (7.0385307e-26f) which can't be recovered using strtod. The resulting double precision // value is off by 1 ulp. #if 0 const boundaries w = compute_boundaries(static_cast(value)); #else const boundaries w = compute_boundaries(value); #endif grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus); } /*! @brief appends a decimal representation of e to buf @return a pointer to the element following the exponent. @pre -1000 < e < 1000 */ inline char* append_exponent(char* buf, int e) { assert(e > -1000); assert(e < 1000); if (e < 0) { e = -e; *buf++ = '-'; } else { *buf++ = '+'; } uint32_t k = static_cast(e); if (k < 10) { // Always print at least two digits in the exponent. // This is for compatibility with printf("%g"). *buf++ = '0'; *buf++ = static_cast('0' + k); } else if (k < 100) { *buf++ = static_cast('0' + k / 10); k %= 10; *buf++ = static_cast('0' + k); } else { *buf++ = static_cast('0' + k / 100); k %= 100; *buf++ = static_cast('0' + k / 10); k %= 10; *buf++ = static_cast('0' + k); } return buf; } /*! @brief prettify v = buf * 10^decimal_exponent If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point notation. Otherwise it will be printed in exponential notation. @pre min_exp < 0 @pre max_exp > 0 */ inline char* format_buffer(char* buf, int len, int decimal_exponent, int min_exp, int max_exp) { assert(min_exp < 0); assert(max_exp > 0); const int k = len; const int n = len + decimal_exponent; // v = buf * 10^(n-k) // k is the length of the buffer (number of decimal digits) // n is the position of the decimal point relative to the start of the buffer. if (k <= n and n <= max_exp) { // digits[000] // len <= max_exp + 2 std::memset(buf + k, '0', static_cast(n - k)); // Make it look like a floating-point number (#362, #378) buf[n + 0] = '.'; buf[n + 1] = '0'; return buf + (n + 2); } if (0 < n and n <= max_exp) { // dig.its // len <= max_digits10 + 1 assert(k > n); std::memmove(buf + (n + 1), buf + n, static_cast(k - n)); buf[n] = '.'; return buf + (k + 1); } if (min_exp < n and n <= 0) { // 0.[000]digits // len <= 2 + (-min_exp - 1) + max_digits10 std::memmove(buf + (2 + -n), buf, static_cast(k)); buf[0] = '0'; buf[1] = '.'; std::memset(buf + 2, '0', static_cast(-n)); return buf + (2 + (-n) + k); } if (k == 1) { // dE+123 // len <= 1 + 5 buf += 1; } else { // d.igitsE+123 // len <= max_digits10 + 1 + 5 std::memmove(buf + 2, buf + 1, static_cast(k - 1)); buf[1] = '.'; buf += 1 + k; } *buf++ = 'e'; return append_exponent(buf, n - 1); } } // namespace dtoa_impl /*! @brief generates a decimal representation of the floating-point number value in [first, last). The format of the resulting decimal representation is similar to printf's %g format. Returns an iterator pointing past-the-end of the decimal representation. @note The input number must be finite, i.e. NaN's and Inf's are not supported. @note The buffer must be large enough. @note The result is NOT null-terminated. */ template char* to_chars(char* first, char* last, FloatType value) { static_cast(last); // maybe unused - fix warning assert(std::isfinite(value)); // Use signbit(value) instead of (value < 0) since signbit works for -0. if (std::signbit(value)) { value = -value; *first++ = '-'; } if (value == 0) // +-0 { *first++ = '0'; // Make it look like a floating-point number (#362, #378) *first++ = '.'; *first++ = '0'; return first; } assert(last - first >= std::numeric_limits::max_digits10); // Compute v = buffer * 10^decimal_exponent. // The decimal digits are stored in the buffer, which needs to be interpreted // as an unsigned decimal integer. // len is the length of the buffer, i.e. the number of decimal digits. int len = 0; int decimal_exponent = 0; dtoa_impl::grisu2(first, len, decimal_exponent, value); assert(len <= std::numeric_limits::max_digits10); // Format the buffer like printf("%.*g", prec, value) constexpr int kMinExp = -4; // Use digits10 here to increase compatibility with version 2. constexpr int kMaxExp = std::numeric_limits::digits10; assert(last - first >= kMaxExp + 2); assert(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits::max_digits10); assert(last - first >= std::numeric_limits::max_digits10 + 6); return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp); } } // namespace detail } // namespace nlohmann // #include // #include // #include // #include namespace nlohmann { namespace detail { /////////////////// // serialization // /////////////////// template class serializer { using string_t = typename BasicJsonType::string_t; using number_float_t = typename BasicJsonType::number_float_t; using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; static constexpr uint8_t UTF8_ACCEPT = 0; static constexpr uint8_t UTF8_REJECT = 1; public: /*! @param[in] s output stream to serialize to @param[in] ichar indentation character to use */ serializer(output_adapter_t s, const char ichar) : o(std::move(s)), loc(std::localeconv()), thousands_sep(loc->thousands_sep == nullptr ? '\0' : * (loc->thousands_sep)), decimal_point(loc->decimal_point == nullptr ? '\0' : * (loc->decimal_point)), indent_char(ichar), indent_string(512, indent_char) {} // delete because of pointer members serializer(const serializer&) = delete; serializer& operator=(const serializer&) = delete; /*! @brief internal implementation of the serialization function This function is called by the public member function dump and organizes the serialization internally. The indentation level is propagated as additional parameter. In case of arrays and objects, the function is called recursively. - strings and object keys are escaped using `escape_string()` - integer numbers are converted implicitly via `operator<<` - floating-point numbers are converted to a string using `"%g"` format @param[in] val value to serialize @param[in] pretty_print whether the output shall be pretty-printed @param[in] indent_step the indent level @param[in] current_indent the current indent level (only used internally) */ void dump(const BasicJsonType& val, const bool pretty_print, const bool ensure_ascii, const unsigned int indent_step, const unsigned int current_indent = 0) { switch (val.m_type) { case value_t::object: { if (val.m_value.object->empty()) { o->write_characters("{}", 2); return; } if (pretty_print) { o->write_characters("{\n", 2); // variable to hold indentation for recursive calls const auto new_indent = current_indent + indent_step; if (JSON_UNLIKELY(indent_string.size() < new_indent)) { indent_string.resize(indent_string.size() * 2, ' '); } // first n-1 elements auto i = val.m_value.object->cbegin(); for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i) { o->write_characters(indent_string.c_str(), new_indent); o->write_character('\"'); dump_escaped(i->first, ensure_ascii); o->write_characters("\": ", 3); dump(i->second, true, ensure_ascii, indent_step, new_indent); o->write_characters(",\n", 2); } // last element assert(i != val.m_value.object->cend()); assert(std::next(i) == val.m_value.object->cend()); o->write_characters(indent_string.c_str(), new_indent); o->write_character('\"'); dump_escaped(i->first, ensure_ascii); o->write_characters("\": ", 3); dump(i->second, true, ensure_ascii, indent_step, new_indent); o->write_character('\n'); o->write_characters(indent_string.c_str(), current_indent); o->write_character('}'); } else { o->write_character('{'); // first n-1 elements auto i = val.m_value.object->cbegin(); for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i) { o->write_character('\"'); dump_escaped(i->first, ensure_ascii); o->write_characters("\":", 2); dump(i->second, false, ensure_ascii, indent_step, current_indent); o->write_character(','); } // last element assert(i != val.m_value.object->cend()); assert(std::next(i) == val.m_value.object->cend()); o->write_character('\"'); dump_escaped(i->first, ensure_ascii); o->write_characters("\":", 2); dump(i->second, false, ensure_ascii, indent_step, current_indent); o->write_character('}'); } return; } case value_t::array: { if (val.m_value.array->empty()) { o->write_characters("[]", 2); return; } if (pretty_print) { o->write_characters("[\n", 2); // variable to hold indentation for recursive calls const auto new_indent = current_indent + indent_step; if (JSON_UNLIKELY(indent_string.size() < new_indent)) { indent_string.resize(indent_string.size() * 2, ' '); } // first n-1 elements for (auto i = val.m_value.array->cbegin(); i != val.m_value.array->cend() - 1; ++i) { o->write_characters(indent_string.c_str(), new_indent); dump(*i, true, ensure_ascii, indent_step, new_indent); o->write_characters(",\n", 2); } // last element assert(not val.m_value.array->empty()); o->write_characters(indent_string.c_str(), new_indent); dump(val.m_value.array->back(), true, ensure_ascii, indent_step, new_indent); o->write_character('\n'); o->write_characters(indent_string.c_str(), current_indent); o->write_character(']'); } else { o->write_character('['); // first n-1 elements for (auto i = val.m_value.array->cbegin(); i != val.m_value.array->cend() - 1; ++i) { dump(*i, false, ensure_ascii, indent_step, current_indent); o->write_character(','); } // last element assert(not val.m_value.array->empty()); dump(val.m_value.array->back(), false, ensure_ascii, indent_step, current_indent); o->write_character(']'); } return; } case value_t::string: { o->write_character('\"'); dump_escaped(*val.m_value.string, ensure_ascii); o->write_character('\"'); return; } case value_t::boolean: { if (val.m_value.boolean) { o->write_characters("true", 4); } else { o->write_characters("false", 5); } return; } case value_t::number_integer: { dump_integer(val.m_value.number_integer); return; } case value_t::number_unsigned: { dump_integer(val.m_value.number_unsigned); return; } case value_t::number_float: { dump_float(val.m_value.number_float); return; } case value_t::discarded: { o->write_characters("", 11); return; } case value_t::null: { o->write_characters("null", 4); return; } } } private: /*! @brief dump escaped string Escape a string by replacing certain special characters by a sequence of an escape character (backslash) and another character and other control characters by a sequence of "\u" followed by a four-digit hex representation. The escaped string is written to output stream @a o. @param[in] s the string to escape @param[in] ensure_ascii whether to escape non-ASCII characters with \uXXXX sequences @complexity Linear in the length of string @a s. */ void dump_escaped(const string_t& s, const bool ensure_ascii) { uint32_t codepoint; uint8_t state = UTF8_ACCEPT; std::size_t bytes = 0; // number of bytes written to string_buffer for (std::size_t i = 0; i < s.size(); ++i) { const auto byte = static_cast(s[i]); switch (decode(state, codepoint, byte)) { case UTF8_ACCEPT: // decode found a new code point { switch (codepoint) { case 0x08: // backspace { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = 'b'; break; } case 0x09: // horizontal tab { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = 't'; break; } case 0x0A: // newline { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = 'n'; break; } case 0x0C: // formfeed { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = 'f'; break; } case 0x0D: // carriage return { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = 'r'; break; } case 0x22: // quotation mark { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = '\"'; break; } case 0x5C: // reverse solidus { string_buffer[bytes++] = '\\'; string_buffer[bytes++] = '\\'; break; } default: { // escape control characters (0x00..0x1F) or, if // ensure_ascii parameter is used, non-ASCII characters if ((codepoint <= 0x1F) or (ensure_ascii and (codepoint >= 0x7F))) { if (codepoint <= 0xFFFF) { std::snprintf(string_buffer.data() + bytes, 7, "\\u%04x", static_cast(codepoint)); bytes += 6; } else { std::snprintf(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x", static_cast(0xD7C0 + (codepoint >> 10)), static_cast(0xDC00 + (codepoint & 0x3FF))); bytes += 12; } } else { // copy byte to buffer (all previous bytes // been copied have in default case above) string_buffer[bytes++] = s[i]; } break; } } // write buffer and reset index; there must be 13 bytes // left, as this is the maximal number of bytes to be // written ("\uxxxx\uxxxx\0") for one code point if (string_buffer.size() - bytes < 13) { o->write_characters(string_buffer.data(), bytes); bytes = 0; } break; } case UTF8_REJECT: // decode found invalid UTF-8 byte { std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << static_cast(byte); JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + ss.str())); } default: // decode found yet incomplete multi-byte code point { if (not ensure_ascii) { // code point will not be escaped - copy byte to buffer string_buffer[bytes++] = s[i]; } break; } } } if (JSON_LIKELY(state == UTF8_ACCEPT)) { // write buffer if (bytes > 0) { o->write_characters(string_buffer.data(), bytes); } } else { // we finish reading, but do not accept: string was incomplete std::stringstream ss; ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << static_cast(static_cast(s.back())); JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + ss.str())); } } /*! @brief dump an integer Dump a given integer to output stream @a o. Works internally with @a number_buffer. @param[in] x integer number (signed or unsigned) to dump @tparam NumberType either @a number_integer_t or @a number_unsigned_t */ template::value or std::is_same::value, int> = 0> void dump_integer(NumberType x) { // special case for "0" if (x == 0) { o->write_character('0'); return; } const bool is_negative = (x <= 0) and (x != 0); // see issue #755 std::size_t i = 0; while (x != 0) { // spare 1 byte for '\0' assert(i < number_buffer.size() - 1); const auto digit = std::labs(static_cast(x % 10)); number_buffer[i++] = static_cast('0' + digit); x /= 10; } if (is_negative) { // make sure there is capacity for the '-' assert(i < number_buffer.size() - 2); number_buffer[i++] = '-'; } std::reverse(number_buffer.begin(), number_buffer.begin() + i); o->write_characters(number_buffer.data(), i); } /*! @brief dump a floating-point number Dump a given floating-point number to output stream @a o. Works internally with @a number_buffer. @param[in] x floating-point number to dump */ void dump_float(number_float_t x) { // NaN / inf if (not std::isfinite(x)) { o->write_characters("null", 4); return; } // If number_float_t is an IEEE-754 single or double precision number, // use the Grisu2 algorithm to produce short numbers which are // guaranteed to round-trip, using strtof and strtod, resp. // // NB: The test below works if == . static constexpr bool is_ieee_single_or_double = (std::numeric_limits::is_iec559 and std::numeric_limits::digits == 24 and std::numeric_limits::max_exponent == 128) or (std::numeric_limits::is_iec559 and std::numeric_limits::digits == 53 and std::numeric_limits::max_exponent == 1024); dump_float(x, std::integral_constant()); } void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/) { char* begin = number_buffer.data(); char* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x); o->write_characters(begin, static_cast(end - begin)); } void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/) { // get number of digits for a float -> text -> float round-trip static constexpr auto d = std::numeric_limits::max_digits10; // the actual conversion std::ptrdiff_t len = snprintf(number_buffer.data(), number_buffer.size(), "%.*g", d, x); // negative value indicates an error assert(len > 0); // check if buffer was large enough assert(static_cast(len) < number_buffer.size()); // erase thousands separator if (thousands_sep != '\0') { const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep); std::fill(end, number_buffer.end(), '\0'); assert((end - number_buffer.begin()) <= len); len = (end - number_buffer.begin()); } // convert decimal point to '.' if (decimal_point != '\0' and decimal_point != '.') { const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); if (dec_pos != number_buffer.end()) { *dec_pos = '.'; } } o->write_characters(number_buffer.data(), static_cast(len)); // determine if need to append ".0" const bool value_is_int_like = std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1, [](char c) { return (c == '.' or c == 'e'); }); if (value_is_int_like) { o->write_characters(".0", 2); } } /*! @brief check whether a string is UTF-8 encoded The function checks each byte of a string whether it is UTF-8 encoded. The result of the check is stored in the @a state parameter. The function must be called initially with state 0 (accept). State 1 means the string must be rejected, because the current byte is not allowed. If the string is completely processed, but the state is non-zero, the string ended prematurely; that is, the last byte indicated more bytes should have followed. @param[in,out] state the state of the decoding @param[in,out] codep codepoint (valid only if resulting state is UTF8_ACCEPT) @param[in] byte next byte to decode @return new state @note The function has been edited: a std::array is used. @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ */ static uint8_t decode(uint8_t& state, uint32_t& codep, const uint8_t byte) noexcept { static const std::array utf8d = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7F 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9F 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // A0..BF 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0..DF 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // E0..EF 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // F0..FF 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // s7..s8 } }; const uint8_t type = utf8d[byte]; codep = (state != UTF8_ACCEPT) ? (byte & 0x3fu) | (codep << 6) : static_cast(0xff >> type) & (byte); state = utf8d[256u + state * 16u + type]; return state; } private: /// the output of the serializer output_adapter_t o = nullptr; /// a (hopefully) large enough character buffer std::array number_buffer{{}}; /// the locale const std::lconv* loc = nullptr; /// the locale's thousand separator character const char thousands_sep = '\0'; /// the locale's decimal point character const char decimal_point = '\0'; /// string buffer std::array string_buffer{{}}; /// the indentation character const char indent_char; /// the indentation string string_t indent_string; }; } } // #include #include #include namespace nlohmann { namespace detail { template class json_ref { public: using value_type = BasicJsonType; json_ref(value_type&& value) : owned_value(std::move(value)), value_ref(&owned_value), is_rvalue(true) {} json_ref(const value_type& value) : value_ref(const_cast(&value)), is_rvalue(false) {} json_ref(std::initializer_list init) : owned_value(init), value_ref(&owned_value), is_rvalue(true) {} template json_ref(Args&& ... args) : owned_value(std::forward(args)...), value_ref(&owned_value), is_rvalue(true) {} // class should be movable only json_ref(json_ref&&) = default; json_ref(const json_ref&) = delete; json_ref& operator=(const json_ref&) = delete; value_type moved_or_copied() const { if (is_rvalue) { return std::move(*value_ref); } return *value_ref; } value_type const& operator*() const { return *static_cast(value_ref); } value_type const* operator->() const { return static_cast(value_ref); } private: mutable value_type owned_value = nullptr; value_type* value_ref = nullptr; const bool is_rvalue; }; } } // #include #include // assert #include // accumulate #include // string #include // vector // #include // #include // #include namespace nlohmann { template class json_pointer { // allow basic_json to access private members NLOHMANN_BASIC_JSON_TPL_DECLARATION friend class basic_json; public: /*! @brief create JSON pointer Create a JSON pointer according to the syntax described in [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3). @param[in] s string representing the JSON pointer; if omitted, the empty string is assumed which references the whole JSON value @throw parse_error.107 if the given JSON pointer @a s is nonempty and does not begin with a slash (`/`); see example below @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is not followed by `0` (representing `~`) or `1` (representing `/`); see example below @liveexample{The example shows the construction several valid JSON pointers as well as the exceptional behavior.,json_pointer} @since version 2.0.0 */ explicit json_pointer(const std::string& s = "") : reference_tokens(split(s)) {} /*! @brief return a string representation of the JSON pointer @invariant For each JSON pointer `ptr`, it holds: @code {.cpp} ptr == json_pointer(ptr.to_string()); @endcode @return a string representation of the JSON pointer @liveexample{The example shows the result of `to_string`., json_pointer__to_string} @since version 2.0.0 */ std::string to_string() const noexcept { return std::accumulate(reference_tokens.begin(), reference_tokens.end(), std::string{}, [](const std::string & a, const std::string & b) { return a + "/" + escape(b); }); } /// @copydoc to_string() operator std::string() const { return to_string(); } /*! @param[in] s reference token to be converted into an array index @return integer representation of @a s @throw out_of_range.404 if string @a s could not be converted to an integer */ static int array_index(const std::string& s) { std::size_t processed_chars = 0; const int res = std::stoi(s, &processed_chars); // check if the string was completely read if (JSON_UNLIKELY(processed_chars != s.size())) { JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'")); } return res; } private: /*! @brief remove and return last reference pointer @throw out_of_range.405 if JSON pointer has no parent */ std::string pop_back() { if (JSON_UNLIKELY(is_root())) { JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); } auto last = reference_tokens.back(); reference_tokens.pop_back(); return last; } /// return whether pointer points to the root document bool is_root() const { return reference_tokens.empty(); } json_pointer top() const { if (JSON_UNLIKELY(is_root())) { JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); } json_pointer result = *this; result.reference_tokens = {reference_tokens[0]}; return result; } /*! @brief create and return a reference to the pointed to value @complexity Linear in the number of reference tokens. @throw parse_error.109 if array index is not a number @throw type_error.313 if value cannot be unflattened */ BasicJsonType& get_and_create(BasicJsonType& j) const { using size_type = typename BasicJsonType::size_type; auto result = &j; // in case no reference tokens exist, return a reference to the JSON value // j which will be overwritten by a primitive value for (const auto& reference_token : reference_tokens) { switch (result->m_type) { case detail::value_t::null: { if (reference_token == "0") { // start a new array if reference token is 0 result = &result->operator[](0); } else { // start a new object otherwise result = &result->operator[](reference_token); } break; } case detail::value_t::object: { // create an entry in the object result = &result->operator[](reference_token); break; } case detail::value_t::array: { // create an entry in the array JSON_TRY { result = &result->operator[](static_cast(array_index(reference_token))); } JSON_CATCH(std::invalid_argument&) { JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); } break; } /* The following code is only reached if there exists a reference token _and_ the current value is primitive. In this case, we have an error situation, because primitive values may only occur as single value; that is, with an empty list of reference tokens. */ default: JSON_THROW(detail::type_error::create(313, "invalid value to unflatten")); } } return *result; } /*! @brief return a reference to the pointed to value @note This version does not throw if a value is not present, but tries to create nested values instead. For instance, calling this function with pointer `"/this/that"` on a null value is equivalent to calling `operator[]("this").operator[]("that")` on that value, effectively changing the null value to an object. @param[in] ptr a JSON value @return reference to the JSON value pointed to by the JSON pointer @complexity Linear in the length of the JSON pointer. @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.404 if the JSON pointer can not be resolved */ BasicJsonType& get_unchecked(BasicJsonType* ptr) const { using size_type = typename BasicJsonType::size_type; for (const auto& reference_token : reference_tokens) { // convert null values to arrays or objects before continuing if (ptr->m_type == detail::value_t::null) { // check if reference token is a number const bool nums = std::all_of(reference_token.begin(), reference_token.end(), [](const char x) { return (x >= '0' and x <= '9'); }); // change value to array for numbers or "-" or to object otherwise *ptr = (nums or reference_token == "-") ? detail::value_t::array : detail::value_t::object; } switch (ptr->m_type) { case detail::value_t::object: { // use unchecked object access ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { // error condition (cf. RFC 6901, Sect. 4) if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, "array index '" + reference_token + "' must not begin with '0'")); } if (reference_token == "-") { // explicitly treat "-" as index beyond the end ptr = &ptr->operator[](ptr->m_value.array->size()); } else { // convert array index to number; unchecked access JSON_TRY { ptr = &ptr->operator[]( static_cast(array_index(reference_token))); } JSON_CATCH(std::invalid_argument&) { JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); } } break; } default: JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); } } return *ptr; } /*! @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ BasicJsonType& get_checked(BasicJsonType* ptr) const { using size_type = typename BasicJsonType::size_type; for (const auto& reference_token : reference_tokens) { switch (ptr->m_type) { case detail::value_t::object: { // note: at performs range check ptr = &ptr->at(reference_token); break; } case detail::value_t::array: { if (JSON_UNLIKELY(reference_token == "-")) { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, "array index '-' (" + std::to_string(ptr->m_value.array->size()) + ") is out of range")); } // error condition (cf. RFC 6901, Sect. 4) if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, "array index '" + reference_token + "' must not begin with '0'")); } // note: at performs range check JSON_TRY { ptr = &ptr->at(static_cast(array_index(reference_token))); } JSON_CATCH(std::invalid_argument&) { JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); } break; } default: JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); } } return *ptr; } /*! @brief return a const reference to the pointed to value @param[in] ptr a JSON value @return const reference to the JSON value pointed to by the JSON pointer @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const { using size_type = typename BasicJsonType::size_type; for (const auto& reference_token : reference_tokens) { switch (ptr->m_type) { case detail::value_t::object: { // use unchecked object access ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { if (JSON_UNLIKELY(reference_token == "-")) { // "-" cannot be used for const access JSON_THROW(detail::out_of_range::create(402, "array index '-' (" + std::to_string(ptr->m_value.array->size()) + ") is out of range")); } // error condition (cf. RFC 6901, Sect. 4) if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, "array index '" + reference_token + "' must not begin with '0'")); } // use unchecked array access JSON_TRY { ptr = &ptr->operator[]( static_cast(array_index(reference_token))); } JSON_CATCH(std::invalid_argument&) { JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); } break; } default: JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); } } return *ptr; } /*! @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ const BasicJsonType& get_checked(const BasicJsonType* ptr) const { using size_type = typename BasicJsonType::size_type; for (const auto& reference_token : reference_tokens) { switch (ptr->m_type) { case detail::value_t::object: { // note: at performs range check ptr = &ptr->at(reference_token); break; } case detail::value_t::array: { if (JSON_UNLIKELY(reference_token == "-")) { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, "array index '-' (" + std::to_string(ptr->m_value.array->size()) + ") is out of range")); } // error condition (cf. RFC 6901, Sect. 4) if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, "array index '" + reference_token + "' must not begin with '0'")); } // note: at performs range check JSON_TRY { ptr = &ptr->at(static_cast(array_index(reference_token))); } JSON_CATCH(std::invalid_argument&) { JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); } break; } default: JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); } } return *ptr; } /*! @brief split the string input to reference tokens @note This function is only called by the json_pointer constructor. All exceptions below are documented there. @throw parse_error.107 if the pointer is not empty or begins with '/' @throw parse_error.108 if character '~' is not followed by '0' or '1' */ static std::vector split(const std::string& reference_string) { std::vector result; // special case: empty reference string -> no reference tokens if (reference_string.empty()) { return result; } // check if nonempty reference string begins with slash if (JSON_UNLIKELY(reference_string[0] != '/')) { JSON_THROW(detail::parse_error::create(107, 1, "JSON pointer must be empty or begin with '/' - was: '" + reference_string + "'")); } // extract the reference tokens: // - slash: position of the last read slash (or end of string) // - start: position after the previous slash for ( // search for the first slash after the first character std::size_t slash = reference_string.find_first_of('/', 1), // set the beginning of the first reference token start = 1; // we can stop if start == string::npos+1 = 0 start != 0; // set the beginning of the next reference token // (will eventually be 0 if slash == std::string::npos) start = slash + 1, // find next slash slash = reference_string.find_first_of('/', start)) { // use the text between the beginning of the reference token // (start) and the last slash (slash). auto reference_token = reference_string.substr(start, slash - start); // check reference tokens are properly escaped for (std::size_t pos = reference_token.find_first_of('~'); pos != std::string::npos; pos = reference_token.find_first_of('~', pos + 1)) { assert(reference_token[pos] == '~'); // ~ must be followed by 0 or 1 if (JSON_UNLIKELY(pos == reference_token.size() - 1 or (reference_token[pos + 1] != '0' and reference_token[pos + 1] != '1'))) { JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'")); } } // finally, store the reference token unescape(reference_token); result.push_back(reference_token); } return result; } /*! @brief replace all occurrences of a substring by another string @param[in,out] s the string to manipulate; changed so that all occurrences of @a f are replaced with @a t @param[in] f the substring to replace with @a t @param[in] t the string to replace @a f @pre The search string @a f must not be empty. **This precondition is enforced with an assertion.** @since version 2.0.0 */ static void replace_substring(std::string& s, const std::string& f, const std::string& t) { assert(not f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != std::string::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f {} } /// escape "~"" to "~0" and "/" to "~1" static std::string escape(std::string s) { replace_substring(s, "~", "~0"); replace_substring(s, "/", "~1"); return s; } /// unescape "~1" to tilde and "~0" to slash (order is important!) static void unescape(std::string& s) { replace_substring(s, "~1", "/"); replace_substring(s, "~0", "~"); } /*! @param[in] reference_string the reference string to the current value @param[in] value the value to consider @param[in,out] result the result object to insert values to @note Empty objects or arrays are flattened to `null`. */ static void flatten(const std::string& reference_string, const BasicJsonType& value, BasicJsonType& result) { switch (value.m_type) { case detail::value_t::array: { if (value.m_value.array->empty()) { // flatten empty array as null result[reference_string] = nullptr; } else { // iterate array and use index as reference string for (std::size_t i = 0; i < value.m_value.array->size(); ++i) { flatten(reference_string + "/" + std::to_string(i), value.m_value.array->operator[](i), result); } } break; } case detail::value_t::object: { if (value.m_value.object->empty()) { // flatten empty object as null result[reference_string] = nullptr; } else { // iterate object and use keys as reference string for (const auto& element : *value.m_value.object) { flatten(reference_string + "/" + escape(element.first), element.second, result); } } break; } default: { // add primitive value with its reference string result[reference_string] = value; break; } } } /*! @param[in] value flattened JSON @return unflattened JSON @throw parse_error.109 if array index is not a number @throw type_error.314 if value is not an object @throw type_error.315 if object values are not primitive @throw type_error.313 if value cannot be unflattened */ static BasicJsonType unflatten(const BasicJsonType& value) { if (JSON_UNLIKELY(not value.is_object())) { JSON_THROW(detail::type_error::create(314, "only objects can be unflattened")); } BasicJsonType result; // iterate the JSON object values for (const auto& element : *value.m_value.object) { if (JSON_UNLIKELY(not element.second.is_primitive())) { JSON_THROW(detail::type_error::create(315, "values in object must be primitive")); } // assign value to reference pointed to by JSON pointer; Note that if // the JSON pointer is "" (i.e., points to the whole value), function // get_and_create returns a reference to result itself. An assignment // will then create a primitive value. json_pointer(element.first).get_and_create(result) = element.second; } return result; } friend bool operator==(json_pointer const& lhs, json_pointer const& rhs) noexcept { return (lhs.reference_tokens == rhs.reference_tokens); } friend bool operator!=(json_pointer const& lhs, json_pointer const& rhs) noexcept { return not (lhs == rhs); } /// the reference tokens std::vector reference_tokens; }; } // #include #include // #include // #include namespace nlohmann { template struct adl_serializer { /*! @brief convert a JSON value to any value type This function is usually called by the `get()` function of the @ref basic_json class (either explicit or via conversion operators). @param[in] j JSON value to read from @param[in,out] val value to write to */ template static void from_json(BasicJsonType&& j, ValueType& val) noexcept( noexcept(::nlohmann::from_json(std::forward(j), val))) { ::nlohmann::from_json(std::forward(j), val); } /*! @brief convert any value type to a JSON value This function is usually called by the constructors of the @ref basic_json class. @param[in,out] j JSON value to write to @param[in] val value to read from */ template static void to_json(BasicJsonType& j, ValueType&& val) noexcept( noexcept(::nlohmann::to_json(j, std::forward(val)))) { ::nlohmann::to_json(j, std::forward(val)); } }; } /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @since version 1.0.0 */ namespace nlohmann { /*! @brief a class to store JSON values @tparam ObjectType type for JSON objects (`std::map` by default; will be used in @ref object_t) @tparam ArrayType type for JSON arrays (`std::vector` by default; will be used in @ref array_t) @tparam StringType type for JSON strings and object keys (`std::string` by default; will be used in @ref string_t) @tparam BooleanType type for JSON booleans (`bool` by default; will be used in @ref boolean_t) @tparam NumberIntegerType type for JSON integer numbers (`int64_t` by default; will be used in @ref number_integer_t) @tparam NumberUnsignedType type for JSON unsigned integer numbers (@c `uint64_t` by default; will be used in @ref number_unsigned_t) @tparam NumberFloatType type for JSON floating-point numbers (`double` by default; will be used in @ref number_float_t) @tparam AllocatorType type of the allocator to use (`std::allocator` by default) @tparam JSONSerializer the serializer to resolve internal calls to `to_json()` and `from_json()` (@ref adl_serializer by default) @requirement The class satisfies the following concept requirements: - Basic - [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible): JSON values can be default constructed. The result will be a JSON null value. - [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible): A JSON value can be constructed from an rvalue argument. - [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible): A JSON value can be copy-constructed from an lvalue expression. - [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable): A JSON value van be assigned from an rvalue argument. - [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable): A JSON value can be copy-assigned from an lvalue expression. - [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible): JSON values can be destructed. - Layout - [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType): JSON values have [standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout): All non-static data members are private and standard layout types, the class has no virtual functions or (virtual) base classes. - Library-wide - [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable): JSON values can be compared with `==`, see @ref operator==(const_reference,const_reference). - [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable): JSON values can be compared with `<`, see @ref operator<(const_reference,const_reference). - [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable): Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of other compatible types, using unqualified function call @ref swap(). - [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer): JSON values can be compared against `std::nullptr_t` objects which are used to model the `null` value. - Container - [Container](http://en.cppreference.com/w/cpp/concept/Container): JSON values can be used like STL containers and provide iterator access. - [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer); JSON values can be used like STL containers and provide reverse iterator access. @invariant The member variables @a m_value and @a m_type have the following relationship: - If `m_type == value_t::object`, then `m_value.object != nullptr`. - If `m_type == value_t::array`, then `m_value.array != nullptr`. - If `m_type == value_t::string`, then `m_value.string != nullptr`. The invariants are checked by member function assert_invariant(). @internal @note ObjectType trick from http://stackoverflow.com/a/9860911 @endinternal @see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format](http://rfc7159.net/rfc7159) @since version 1.0.0 @nosubgrouping */ NLOHMANN_BASIC_JSON_TPL_DECLARATION class basic_json { private: template friend struct detail::external_constructor; friend ::nlohmann::json_pointer; friend ::nlohmann::detail::parser; friend ::nlohmann::detail::serializer; template friend class ::nlohmann::detail::iter_impl; template friend class ::nlohmann::detail::binary_writer; template friend class ::nlohmann::detail::binary_reader; /// workaround type for MSVC using basic_json_t = NLOHMANN_BASIC_JSON_TPL; // convenience aliases for types residing in namespace detail; using lexer = ::nlohmann::detail::lexer; using parser = ::nlohmann::detail::parser; using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t; template using internal_iterator = ::nlohmann::detail::internal_iterator; template using iter_impl = ::nlohmann::detail::iter_impl; template using iteration_proxy = ::nlohmann::detail::iteration_proxy; template using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator; template using output_adapter_t = ::nlohmann::detail::output_adapter_t; using binary_reader = ::nlohmann::detail::binary_reader; template using binary_writer = ::nlohmann::detail::binary_writer; using serializer = ::nlohmann::detail::serializer; public: using value_t = detail::value_t; /// @copydoc nlohmann::json_pointer using json_pointer = ::nlohmann::json_pointer; template using json_serializer = JSONSerializer; /// helper type for initializer lists of basic_json values using initializer_list_t = std::initializer_list>; //////////////// // exceptions // //////////////// /// @name exceptions /// Classes to implement user-defined exceptions. /// @{ /// @copydoc detail::exception using exception = detail::exception; /// @copydoc detail::parse_error using parse_error = detail::parse_error; /// @copydoc detail::invalid_iterator using invalid_iterator = detail::invalid_iterator; /// @copydoc detail::type_error using type_error = detail::type_error; /// @copydoc detail::out_of_range using out_of_range = detail::out_of_range; /// @copydoc detail::other_error using other_error = detail::other_error; /// @} ///////////////////// // container types // ///////////////////// /// @name container types /// The canonic container types to use @ref basic_json like any other STL /// container. /// @{ /// the type of elements in a basic_json container using value_type = basic_json; /// the type of an element reference using reference = value_type&; /// the type of an element const reference using const_reference = const value_type&; /// a type to represent differences between iterators using difference_type = std::ptrdiff_t; /// a type to represent container sizes using size_type = std::size_t; /// the allocator type using allocator_type = AllocatorType; /// the type of an element pointer using pointer = typename std::allocator_traits::pointer; /// the type of an element const pointer using const_pointer = typename std::allocator_traits::const_pointer; /// an iterator for a basic_json container using iterator = iter_impl; /// a const iterator for a basic_json container using const_iterator = iter_impl; /// a reverse iterator for a basic_json container using reverse_iterator = json_reverse_iterator; /// a const reverse iterator for a basic_json container using const_reverse_iterator = json_reverse_iterator; /// @} /*! @brief returns the allocator associated with the container */ static allocator_type get_allocator() { return allocator_type(); } /*! @brief returns version information on the library This function returns a JSON object with information about the library, including the version number and information on the platform and compiler. @return JSON object holding version information key | description ----------- | --------------- `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version). `copyright` | The copyright line for the library as string. `name` | The name of the library as string. `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`. `url` | The URL of the project as string. `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string). @liveexample{The following code shows an example output of the `meta()` function.,meta} @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @complexity Constant. @since 2.1.0 */ static basic_json meta() { basic_json result; result["copyright"] = "(C) 2013-2017 Niels Lohmann"; result["name"] = "JSON for Modern C++"; result["url"] = "https://github.com/nlohmann/json"; result["version"]["string"] = std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." + std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." + std::to_string(NLOHMANN_JSON_VERSION_PATCH); result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR; result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR; result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH; #ifdef _WIN32 result["platform"] = "win32"; #elif defined __linux__ result["platform"] = "linux"; #elif defined __APPLE__ result["platform"] = "apple"; #elif defined __unix__ result["platform"] = "unix"; #else result["platform"] = "unknown"; #endif #if defined(__ICC) || defined(__INTEL_COMPILER) result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; #elif defined(__clang__) result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; #elif defined(__GNUC__) || defined(__GNUG__) result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; #elif defined(__HP_cc) || defined(__HP_aCC) result["compiler"] = "hp" #elif defined(__IBMCPP__) result["compiler"] = {{"family", "ilecpp"}, {"version", __IBMCPP__}}; #elif defined(_MSC_VER) result["compiler"] = {{"family", "msvc"}, {"version", _MSC_VER}}; #elif defined(__PGI) result["compiler"] = {{"family", "pgcpp"}, {"version", __PGI}}; #elif defined(__SUNPRO_CC) result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}}; #else result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}}; #endif #ifdef __cplusplus result["compiler"]["c++"] = std::to_string(__cplusplus); #else result["compiler"]["c++"] = "unknown"; #endif return result; } /////////////////////////// // JSON value data types // /////////////////////////// /// @name JSON value data types /// The data types to store a JSON value. These types are derived from /// the template arguments passed to class @ref basic_json. /// @{ #if defined(JSON_HAS_CPP_14) // Use transparent comparator if possible, combined with perfect forwarding // on find() and count() calls prevents unnecessary string construction. using object_comparator_t = std::less<>; #else using object_comparator_t = std::less; #endif /*! @brief a type for an object [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows: > An object is an unordered collection of zero or more name/value pairs, > where a name is a string and a value is a string, number, boolean, null, > object, or array. To store objects in C++, a type is defined by the template parameters described below. @tparam ObjectType the container to store objects (e.g., `std::map` or `std::unordered_map`) @tparam StringType the type of the keys or names (e.g., `std::string`). The comparison function `std::less` is used to order elements inside the container. @tparam AllocatorType the allocator to use for objects (e.g., `std::allocator`) #### Default type With the default values for @a ObjectType (`std::map`), @a StringType (`std::string`), and @a AllocatorType (`std::allocator`), the default value for @a object_t is: @code {.cpp} std::map< std::string, // key_type basic_json, // value_type std::less, // key_compare std::allocator> // allocator_type > @endcode #### Behavior The choice of @a object_t influences the behavior of the JSON class. With the default type, objects have the following behavior: - When all names are unique, objects will be interoperable in the sense that all software implementations receiving that object will agree on the name-value mappings. - When the names within an object are not unique, it is unspecified which one of the values for a given key will be chosen. For instance, `{"key": 2, "key": 1}` could be equal to either `{"key": 1}` or `{"key": 2}`. - Internally, name/value pairs are stored in lexicographical order of the names. Objects will also be serialized (see @ref dump) in this order. For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored and serialized as `{"a": 2, "b": 1}`. - When comparing objects, the order of the name/value pairs is irrelevant. This makes objects interoperable in the sense that they will not be affected by these differences. For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be treated as equal. #### Limits [RFC 7159](http://rfc7159.net/rfc7159) specifies: > An implementation may set limits on the maximum depth of nesting. In this class, the object's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the @ref max_size function of a JSON object. #### Storage Objects are stored as pointers in a @ref basic_json type. That is, for any access to object values, a pointer of type `object_t*` must be dereferenced. @sa @ref array_t -- type for an array value @since version 1.0.0 @note The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to [RFC 7159](http://rfc7159.net/rfc7159), because any order implements the specified "unordered" nature of JSON objects. */ using object_t = ObjectType>>; /*! @brief a type for an array [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows: > An array is an ordered sequence of zero or more values. To store objects in C++, a type is defined by the template parameters explained below. @tparam ArrayType container type to store arrays (e.g., `std::vector` or `std::list`) @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`) #### Default type With the default values for @a ArrayType (`std::vector`) and @a AllocatorType (`std::allocator`), the default value for @a array_t is: @code {.cpp} std::vector< basic_json, // value_type std::allocator // allocator_type > @endcode #### Limits [RFC 7159](http://rfc7159.net/rfc7159) specifies: > An implementation may set limits on the maximum depth of nesting. In this class, the array's limit of nesting is not explicitly constrained. However, a maximum depth of nesting may be introduced by the compiler or runtime environment. A theoretical limit can be queried by calling the @ref max_size function of a JSON array. #### Storage Arrays are stored as pointers in a @ref basic_json type. That is, for any access to array values, a pointer of type `array_t*` must be dereferenced. @sa @ref object_t -- type for an object value @since version 1.0.0 */ using array_t = ArrayType>; /*! @brief a type for a string [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows: > A string is a sequence of zero or more Unicode characters. To store objects in C++, a type is defined by the template parameter described below. Unicode values are split by the JSON class into byte-sized characters during deserialization. @tparam StringType the container to store strings (e.g., `std::string`). Note this container is used for keys/names in objects, see @ref object_t. #### Default type With the default values for @a StringType (`std::string`), the default value for @a string_t is: @code {.cpp} std::string @endcode #### Encoding Strings are stored in UTF-8 encoding. Therefore, functions like `std::string::size()` or `std::string::length()` return the number of bytes in the string rather than the number of characters or glyphs. #### String comparison [RFC 7159](http://rfc7159.net/rfc7159) states: > Software implementations are typically required to test names of object > members for equality. Implementations that transform the textual > representation into sequences of Unicode code units and then perform the > comparison numerically, code unit by code unit, are interoperable in the > sense that implementations will agree in all cases on equality or > inequality of two strings. For example, implementations that compare > strings with escaped characters unconverted may incorrectly find that > `"a\\b"` and `"a\u005Cb"` are not equal. This implementation is interoperable as it does compare strings code unit by code unit. #### Storage String values are stored as pointers in a @ref basic_json type. That is, for any access to string values, a pointer of type `string_t*` must be dereferenced. @since version 1.0.0 */ using string_t = StringType; /*! @brief a type for a boolean [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a type which differentiates the two literals `true` and `false`. To store objects in C++, a type is defined by the template parameter @a BooleanType which chooses the type to use. #### Default type With the default values for @a BooleanType (`bool`), the default value for @a boolean_t is: @code {.cpp} bool @endcode #### Storage Boolean values are stored directly inside a @ref basic_json type. @since version 1.0.0 */ using boolean_t = BooleanType; /*! @brief a type for a number (integer) [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: > The representation of numbers is similar to that used in most > programming languages. A number is represented in base 10 using decimal > digits. It contains an integer component that may be prefixed with an > optional minus sign, which may be followed by a fraction part and/or an > exponent part. Leading zeros are not allowed. (...) Numeric values that > cannot be represented in the grammar below (such as Infinity and NaN) > are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, @ref number_integer_t, @ref number_unsigned_t and @ref number_float_t are used. To store integer numbers in C++, a type is defined by the template parameter @a NumberIntegerType which chooses the type to use. #### Default type With the default values for @a NumberIntegerType (`int64_t`), the default value for @a number_integer_t is: @code {.cpp} int64_t @endcode #### Default behavior - The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits [RFC 7159](http://rfc7159.net/rfc7159) specifies: > An implementation may set limits on the range and precision of numbers. When the default type is used, the maximal integer number that can be stored is `9223372036854775807` (INT64_MAX) and the minimal integer number that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as @ref number_unsigned_t or @ref number_float_t. [RFC 7159](http://rfc7159.net/rfc7159) further states: > Note that when such software is used, numbers that are integers and are > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense > that implementations will agree exactly on their numeric values. As this range is a subrange of the exactly supported range [INT64_MIN, INT64_MAX], this class's integer type is interoperable. #### Storage Integer number values are stored directly inside a @ref basic_json type. @sa @ref number_float_t -- type for number values (floating-point) @sa @ref number_unsigned_t -- type for number values (unsigned integer) @since version 1.0.0 */ using number_integer_t = NumberIntegerType; /*! @brief a type for a number (unsigned) [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: > The representation of numbers is similar to that used in most > programming languages. A number is represented in base 10 using decimal > digits. It contains an integer component that may be prefixed with an > optional minus sign, which may be followed by a fraction part and/or an > exponent part. Leading zeros are not allowed. (...) Numeric values that > cannot be represented in the grammar below (such as Infinity and NaN) > are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, @ref number_integer_t, @ref number_unsigned_t and @ref number_float_t are used. To store unsigned integer numbers in C++, a type is defined by the template parameter @a NumberUnsignedType which chooses the type to use. #### Default type With the default values for @a NumberUnsignedType (`uint64_t`), the default value for @a number_unsigned_t is: @code {.cpp} uint64_t @endcode #### Default behavior - The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal `010` will be serialized to `8`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits [RFC 7159](http://rfc7159.net/rfc7159) specifies: > An implementation may set limits on the range and precision of numbers. When the default type is used, the maximal integer number that can be stored is `18446744073709551615` (UINT64_MAX) and the minimal integer number that can be stored is `0`. Integer numbers that are out of range will yield over/underflow when used in a constructor. During deserialization, too large or small integer numbers will be automatically be stored as @ref number_integer_t or @ref number_float_t. [RFC 7159](http://rfc7159.net/rfc7159) further states: > Note that when such software is used, numbers that are integers and are > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense > that implementations will agree exactly on their numeric values. As this range is a subrange (when considered in conjunction with the number_integer_t type) of the exactly supported range [0, UINT64_MAX], this class's integer type is interoperable. #### Storage Integer number values are stored directly inside a @ref basic_json type. @sa @ref number_float_t -- type for number values (floating-point) @sa @ref number_integer_t -- type for number values (integer) @since version 2.0.0 */ using number_unsigned_t = NumberUnsignedType; /*! @brief a type for a number (floating-point) [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: > The representation of numbers is similar to that used in most > programming languages. A number is represented in base 10 using decimal > digits. It contains an integer component that may be prefixed with an > optional minus sign, which may be followed by a fraction part and/or an > exponent part. Leading zeros are not allowed. (...) Numeric values that > cannot be represented in the grammar below (such as Infinity and NaN) > are not permitted. This description includes both integer and floating-point numbers. However, C++ allows more precise storage if it is known whether the number is a signed integer, an unsigned integer or a floating-point number. Therefore, three different types, @ref number_integer_t, @ref number_unsigned_t and @ref number_float_t are used. To store floating-point numbers in C++, a type is defined by the template parameter @a NumberFloatType which chooses the type to use. #### Default type With the default values for @a NumberFloatType (`double`), the default value for @a number_float_t is: @code {.cpp} double @endcode #### Default behavior - The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in floating-point literals will be ignored. Internally, the value will be stored as decimal number. For instance, the C++ floating-point literal `01.2` will be serialized to `1.2`. During deserialization, leading zeros yield an error. - Not-a-number (NaN) values will be serialized to `null`. #### Limits [RFC 7159](http://rfc7159.net/rfc7159) states: > This specification allows implementations to set limits on the range and > precision of numbers accepted. Since software that implements IEEE > 754-2008 binary64 (double precision) numbers is generally available and > widely used, good interoperability can be achieved by implementations > that expect no more precision or range than these provide, in the sense > that implementations will approximate JSON numbers within the expected > precision. This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` will be stored as NaN internally and be serialized to `null`. #### Storage Floating-point number values are stored directly inside a @ref basic_json type. @sa @ref number_integer_t -- type for number values (integer) @sa @ref number_unsigned_t -- type for number values (unsigned integer) @since version 1.0.0 */ using number_float_t = NumberFloatType; /// @} private: /// helper for exception-safe object creation template static T* create(Args&& ... args) { AllocatorType alloc; using AllocatorTraits = std::allocator_traits>; auto deleter = [&](T * object) { AllocatorTraits::deallocate(alloc, object, 1); }; std::unique_ptr object(AllocatorTraits::allocate(alloc, 1), deleter); AllocatorTraits::construct(alloc, object.get(), std::forward(args)...); assert(object != nullptr); return object.release(); } //////////////////////// // JSON value storage // //////////////////////// /*! @brief a JSON value The actual storage for a JSON value of the @ref basic_json class. This union combines the different storage types for the JSON value types defined in @ref value_t. JSON type | value_t type | used type --------- | --------------- | ------------------------ object | object | pointer to @ref object_t array | array | pointer to @ref array_t string | string | pointer to @ref string_t boolean | boolean | @ref boolean_t number | number_integer | @ref number_integer_t number | number_unsigned | @ref number_unsigned_t number | number_float | @ref number_float_t null | null | *no value is stored* @note Variable-length types (objects, arrays, and strings) are stored as pointers. The size of the union should not exceed 64 bits if the default value types are used. @since version 1.0.0 */ union json_value { /// object (stored with pointer to save storage) object_t* object; /// array (stored with pointer to save storage) array_t* array; /// string (stored with pointer to save storage) string_t* string; /// boolean boolean_t boolean; /// number (integer) number_integer_t number_integer; /// number (unsigned integer) number_unsigned_t number_unsigned; /// number (floating-point) number_float_t number_float; /// default constructor (for null values) json_value() = default; /// constructor for booleans json_value(boolean_t v) noexcept : boolean(v) {} /// constructor for numbers (integer) json_value(number_integer_t v) noexcept : number_integer(v) {} /// constructor for numbers (unsigned) json_value(number_unsigned_t v) noexcept : number_unsigned(v) {} /// constructor for numbers (floating-point) json_value(number_float_t v) noexcept : number_float(v) {} /// constructor for empty values of a given type json_value(value_t t) { switch (t) { case value_t::object: { object = create(); break; } case value_t::array: { array = create(); break; } case value_t::string: { string = create(""); break; } case value_t::boolean: { boolean = boolean_t(false); break; } case value_t::number_integer: { number_integer = number_integer_t(0); break; } case value_t::number_unsigned: { number_unsigned = number_unsigned_t(0); break; } case value_t::number_float: { number_float = number_float_t(0.0); break; } case value_t::null: { object = nullptr; // silence warning, see #821 break; } default: { object = nullptr; // silence warning, see #821 if (JSON_UNLIKELY(t == value_t::null)) { JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.1.2")); // LCOV_EXCL_LINE } break; } } } /// constructor for strings json_value(const string_t& value) { string = create(value); } /// constructor for rvalue strings json_value(string_t&& value) { string = create(std::move(value)); } /// constructor for objects json_value(const object_t& value) { object = create(value); } /// constructor for rvalue objects json_value(object_t&& value) { object = create(std::move(value)); } /// constructor for arrays json_value(const array_t& value) { array = create(value); } /// constructor for rvalue arrays json_value(array_t&& value) { array = create(std::move(value)); } void destroy(value_t t) noexcept { switch (t) { case value_t::object: { AllocatorType alloc; std::allocator_traits::destroy(alloc, object); std::allocator_traits::deallocate(alloc, object, 1); break; } case value_t::array: { AllocatorType alloc; std::allocator_traits::destroy(alloc, array); std::allocator_traits::deallocate(alloc, array, 1); break; } case value_t::string: { AllocatorType alloc; std::allocator_traits::destroy(alloc, string); std::allocator_traits::deallocate(alloc, string, 1); break; } default: { break; } } } }; /*! @brief checks the class invariants This function asserts the class invariants. It needs to be called at the end of every constructor to make sure that created objects respect the invariant. Furthermore, it has to be called each time the type of a JSON value is changed, because the invariant expresses a relationship between @a m_type and @a m_value. */ void assert_invariant() const noexcept { assert(m_type != value_t::object or m_value.object != nullptr); assert(m_type != value_t::array or m_value.array != nullptr); assert(m_type != value_t::string or m_value.string != nullptr); } public: ////////////////////////// // JSON parser callback // ////////////////////////// /*! @brief parser event types The parser callback distinguishes the following events: - `object_start`: the parser read `{` and started to process a JSON object - `key`: the parser read a key of a value in an object - `object_end`: the parser read `}` and finished processing a JSON object - `array_start`: the parser read `[` and started to process a JSON array - `array_end`: the parser read `]` and finished processing a JSON array - `value`: the parser finished reading a JSON value @image html callback_events.png "Example when certain parse events are triggered" @sa @ref parser_callback_t for more information and examples */ using parse_event_t = typename parser::parse_event_t; /*! @brief per-element parser callback type With a parser callback function, the result of parsing a JSON text can be influenced. When passed to @ref parse, it is called on certain events (passed as @ref parse_event_t via parameter @a event) with a set recursion depth @a depth and context JSON value @a parsed. The return value of the callback function is a boolean indicating whether the element that emitted the callback shall be kept or not. We distinguish six scenarios (determined by the event type) in which the callback function can be called. The following table describes the values of the parameters @a depth, @a event, and @a parsed. parameter @a event | description | parameter @a depth | parameter @a parsed ------------------ | ----------- | ------------------ | ------------------- parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value @image html callback_events.png "Example when certain parse events are triggered" Discarding a value (i.e., returning `false`) has different effects depending on the context in which function was called: - Discarded values in structured types are skipped. That is, the parser will behave as if the discarded value was never read. - In case a value outside a structured type is skipped, it is replaced with `null`. This case happens if the top-level element is skipped. @param[in] depth the depth of the recursion during parsing @param[in] event an event of type parse_event_t indicating the context in the callback function has been called @param[in,out] parsed the current intermediate parse result; note that writing to this value has no effect for parse_event_t::key events @return Whether the JSON value which called the function during parsing should be kept (`true`) or not (`false`). In the latter case, it is either skipped completely or replaced by an empty discarded object. @sa @ref parse for examples @since version 1.0.0 */ using parser_callback_t = typename parser::parser_callback_t; ////////////////// // constructors // ////////////////// /// @name constructors and destructors /// Constructors of class @ref basic_json, copy/move constructor, copy /// assignment, static functions creating objects, and the destructor. /// @{ /*! @brief create an empty value with a given type Create an empty JSON value with a given type. The value will be default initialized with an empty value which depends on the type: Value type | initial value ----------- | ------------- null | `null` boolean | `false` string | `""` number | `0` object | `{}` array | `[]` @param[in] v the type of the value to create @complexity Constant. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The following code shows the constructor for different @ref value_t values,basic_json__value_t} @sa @ref clear() -- restores the postcondition of this constructor @since version 1.0.0 */ basic_json(const value_t v) : m_type(v), m_value(v) { assert_invariant(); } /*! @brief create a null object Create a `null` JSON value. It either takes a null pointer as parameter (explicitly creating `null`) or no parameter (implicitly creating `null`). The passed null pointer itself is not read -- it is only used to choose the right constructor. @complexity Constant. @exceptionsafety No-throw guarantee: this constructor never throws exceptions. @liveexample{The following code shows the constructor with and without a null pointer parameter.,basic_json__nullptr_t} @since version 1.0.0 */ basic_json(std::nullptr_t = nullptr) noexcept : basic_json(value_t::null) { assert_invariant(); } /*! @brief create a JSON value This is a "catch all" constructor for all compatible JSON types; that is, types for which a `to_json()` method exists. The constructor forwards the parameter @a val to that method (to `json_serializer::to_json` method with `U = uncvref_t`, to be exact). Template type @a CompatibleType includes, but is not limited to, the following types: - **arrays**: @ref array_t and all kinds of compatible containers such as `std::vector`, `std::deque`, `std::list`, `std::forward_list`, `std::array`, `std::valarray`, `std::set`, `std::unordered_set`, `std::multiset`, and `std::unordered_multiset` with a `value_type` from which a @ref basic_json value can be constructed. - **objects**: @ref object_t and all kinds of compatible associative containers such as `std::map`, `std::unordered_map`, `std::multimap`, and `std::unordered_multimap` with a `key_type` compatible to @ref string_t and a `value_type` from which a @ref basic_json value can be constructed. - **strings**: @ref string_t, string literals, and all compatible string containers can be used. - **numbers**: @ref number_integer_t, @ref number_unsigned_t, @ref number_float_t, and all convertible number types such as `int`, `size_t`, `int64_t`, `float` or `double` can be used. - **boolean**: @ref boolean_t / `bool` can be used. See the examples below. @tparam CompatibleType a type such that: - @a CompatibleType is not derived from `std::istream`, - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move constructors), - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments) - @a CompatibleType is not a @ref basic_json nested type (e.g., @ref json_pointer, @ref iterator, etc ...) - @ref @ref json_serializer has a `to_json(basic_json_t&, CompatibleType&&)` method @tparam U = `uncvref_t` @param[in] val the value to be forwarded to the respective constructor @complexity Usually linear in the size of the passed @a val, also depending on the implementation of the called `to_json()` method. @exceptionsafety Depends on the called constructor. For types directly supported by the library (i.e., all types for which no `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any JSON value. @liveexample{The following code shows the constructor with several compatible types.,basic_json__CompatibleType} @since version 2.1.0 */ template , detail::enable_if_t< detail::is_compatible_type::value, int> = 0> basic_json(CompatibleType && val) noexcept(noexcept( JSONSerializer::to_json(std::declval(), std::forward(val)))) { JSONSerializer::to_json(*this, std::forward(val)); assert_invariant(); } /*! @brief create a JSON value from an existing one This is a constructor for existing @ref basic_json types. It does not hijack copy/move constructors, since the parameter has different template arguments than the current ones. The constructor tries to convert the internal @ref m_value of the parameter. @tparam BasicJsonType a type such that: - @a BasicJsonType is a @ref basic_json type. - @a BasicJsonType has different template arguments than @ref basic_json_t. @param[in] val the @ref basic_json value to be converted. @complexity Usually linear in the size of the passed @a val, also depending on the implementation of the called `to_json()` method. @exceptionsafety Depends on the called constructor. For types directly supported by the library (i.e., all types for which no `to_json()` function was provided), strong guarantee holds: if an exception is thrown, there are no changes to any JSON value. @since version 3.1.2 */ template ::value and not std::is_same::value, int> = 0> basic_json(const BasicJsonType& val) { using other_boolean_t = typename BasicJsonType::boolean_t; using other_number_float_t = typename BasicJsonType::number_float_t; using other_number_integer_t = typename BasicJsonType::number_integer_t; using other_number_unsigned_t = typename BasicJsonType::number_unsigned_t; using other_string_t = typename BasicJsonType::string_t; using other_object_t = typename BasicJsonType::object_t; using other_array_t = typename BasicJsonType::array_t; switch (val.type()) { case value_t::boolean: JSONSerializer::to_json(*this, val.template get()); break; case value_t::number_float: JSONSerializer::to_json(*this, val.template get()); break; case value_t::number_integer: JSONSerializer::to_json(*this, val.template get()); break; case value_t::number_unsigned: JSONSerializer::to_json(*this, val.template get()); break; case value_t::string: JSONSerializer::to_json(*this, val.template get_ref()); break; case value_t::object: JSONSerializer::to_json(*this, val.template get_ref()); break; case value_t::array: JSONSerializer::to_json(*this, val.template get_ref()); break; case value_t::null: *this = nullptr; break; case value_t::discarded: m_type = value_t::discarded; break; } assert_invariant(); } /*! @brief create a container (array or object) from an initializer list Creates a JSON value of type array or object from the passed initializer list @a init. In case @a type_deduction is `true` (default), the type of the JSON value to be created is deducted from the initializer list @a init according to the following rules: 1. If the list is empty, an empty JSON object value `{}` is created. 2. If the list consists of pairs whose first element is a string, a JSON object value is created where the first elements of the pairs are treated as keys and the second elements are as values. 3. In all other cases, an array is created. The rules aim to create the best fit between a C++ initializer list and JSON values. The rationale is as follows: 1. The empty initializer list is written as `{}` which is exactly an empty JSON object. 2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an object. 3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON array type is safe. With the rules described above, the following JSON values cannot be expressed by an initializer list: - the empty array (`[]`): use @ref array(initializer_list_t) with an empty initializer list in this case - arrays whose elements satisfy rule 2: use @ref array(initializer_list_t) with the same initializer list in this case @note When used without parentheses around an empty initializer list, @ref basic_json() is called instead of this function, yielding the JSON null value. @param[in] init initializer list with JSON values @param[in] type_deduction internal parameter; when set to `true`, the type of the JSON value is deducted from the initializer list @a init; when set to `false`, the type provided via @a manual_type is forced. This mode is used by the functions @ref array(initializer_list_t) and @ref object(initializer_list_t). @param[in] manual_type internal parameter; when @a type_deduction is set to `false`, the created JSON value will use the provided type (only @ref value_t::array and @ref value_t::object are valid); when @a type_deduction is set to `true`, this parameter has no effect @throw type_error.301 if @a type_deduction is `false`, @a manual_type is `value_t::object`, but @a init contains an element which is not a pair whose first element is a string. In this case, the constructor could not create an object. If @a type_deduction would have be `true`, an array would have been created. See @ref object(initializer_list_t) for an example. @complexity Linear in the size of the initializer list @a init. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The example below shows how JSON values are created from initializer lists.,basic_json__list_init_t} @sa @ref array(initializer_list_t) -- create a JSON array value from an initializer list @sa @ref object(initializer_list_t) -- create a JSON object value from an initializer list @since version 1.0.0 */ basic_json(initializer_list_t init, bool type_deduction = true, value_t manual_type = value_t::array) { // check if each element is an array with two elements whose first // element is a string bool is_an_object = std::all_of(init.begin(), init.end(), [](const detail::json_ref& element_ref) { return (element_ref->is_array() and element_ref->size() == 2 and (*element_ref)[0].is_string()); }); // adjust type if type deduction is not wanted if (not type_deduction) { // if array is wanted, do not create an object though possible if (manual_type == value_t::array) { is_an_object = false; } // if object is wanted but impossible, throw an exception if (JSON_UNLIKELY(manual_type == value_t::object and not is_an_object)) { JSON_THROW(type_error::create(301, "cannot create object from initializer list")); } } if (is_an_object) { // the initializer list is a list of pairs -> create object m_type = value_t::object; m_value = value_t::object; std::for_each(init.begin(), init.end(), [this](const detail::json_ref& element_ref) { auto element = element_ref.moved_or_copied(); m_value.object->emplace( std::move(*((*element.m_value.array)[0].m_value.string)), std::move((*element.m_value.array)[1])); }); } else { // the initializer list describes an array -> create array m_type = value_t::array; m_value.array = create(init.begin(), init.end()); } assert_invariant(); } /*! @brief explicitly create an array from an initializer list Creates a JSON array value from a given initializer list. That is, given a list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the initializer list is empty, the empty array `[]` is created. @note This function is only needed to express two edge cases that cannot be realized with the initializer list constructor (@ref basic_json(initializer_list_t, bool, value_t)). These cases are: 1. creating an array whose elements are all pairs whose first element is a string -- in this case, the initializer list constructor would create an object, taking the first elements as keys 2. creating an empty array -- passing the empty initializer list to the initializer list constructor yields an empty object @param[in] init initializer list with JSON values to create an array from (optional) @return JSON array value @complexity Linear in the size of @a init. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The following code shows an example for the `array` function.,array} @sa @ref basic_json(initializer_list_t, bool, value_t) -- create a JSON value from an initializer list @sa @ref object(initializer_list_t) -- create a JSON object value from an initializer list @since version 1.0.0 */ static basic_json array(initializer_list_t init = {}) { return basic_json(init, false, value_t::array); } /*! @brief explicitly create an object from an initializer list Creates a JSON object value from a given initializer list. The initializer lists elements must be pairs, and their first elements must be strings. If the initializer list is empty, the empty object `{}` is created. @note This function is only added for symmetry reasons. In contrast to the related function @ref array(initializer_list_t), there are no cases which can only be expressed by this function. That is, any initializer list @a init can also be passed to the initializer list constructor @ref basic_json(initializer_list_t, bool, value_t). @param[in] init initializer list to create an object from (optional) @return JSON object value @throw type_error.301 if @a init is not a list of pairs whose first elements are strings. In this case, no object can be created. When such a value is passed to @ref basic_json(initializer_list_t, bool, value_t), an array would have been created from the passed initializer list @a init. See example below. @complexity Linear in the size of @a init. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The following code shows an example for the `object` function.,object} @sa @ref basic_json(initializer_list_t, bool, value_t) -- create a JSON value from an initializer list @sa @ref array(initializer_list_t) -- create a JSON array value from an initializer list @since version 1.0.0 */ static basic_json object(initializer_list_t init = {}) { return basic_json(init, false, value_t::object); } /*! @brief construct an array with count copies of given value Constructs a JSON array value by creating @a cnt copies of a passed value. In case @a cnt is `0`, an empty array is created. @param[in] cnt the number of JSON copies of @a val to create @param[in] val the JSON value to copy @post `std::distance(begin(),end()) == cnt` holds. @complexity Linear in @a cnt. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The following code shows examples for the @ref basic_json(size_type\, const basic_json&) constructor.,basic_json__size_type_basic_json} @since version 1.0.0 */ basic_json(size_type cnt, const basic_json& val) : m_type(value_t::array) { m_value.array = create(cnt, val); assert_invariant(); } /*! @brief construct a JSON container given an iterator range Constructs the JSON value with the contents of the range `[first, last)`. The semantics depends on the different types a JSON value can have: - In case of a null type, invalid_iterator.206 is thrown. - In case of other primitive types (number, boolean, or string), @a first must be `begin()` and @a last must be `end()`. In this case, the value is copied. Otherwise, invalid_iterator.204 is thrown. - In case of structured types (array, object), the constructor behaves as similar versions for `std::vector` or `std::map`; that is, a JSON array or object is constructed from the values in the range. @tparam InputIT an input iterator type (@ref iterator or @ref const_iterator) @param[in] first begin of the range to copy from (included) @param[in] last end of the range to copy from (excluded) @pre Iterators @a first and @a last must be initialized. **This precondition is enforced with an assertion (see warning).** If assertions are switched off, a violation of this precondition yields undefined behavior. @pre Range `[first, last)` is valid. Usually, this precondition cannot be checked efficiently. Only certain edge cases are detected; see the description of the exceptions below. A violation of this precondition yields undefined behavior. @warning A precondition is enforced with a runtime assertion that will result in calling `std::abort` if this precondition is not met. Assertions can be disabled by defining `NDEBUG` at compile time. See http://en.cppreference.com/w/cpp/error/assert for more information. @throw invalid_iterator.201 if iterators @a first and @a last are not compatible (i.e., do not belong to the same JSON value). In this case, the range `[first, last)` is undefined. @throw invalid_iterator.204 if iterators @a first and @a last belong to a primitive type (number, boolean, or string), but @a first does not point to the first element any more. In this case, the range `[first, last)` is undefined. See example code below. @throw invalid_iterator.206 if iterators @a first and @a last belong to a null value. In this case, the range `[first, last)` is undefined. @complexity Linear in distance between @a first and @a last. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @liveexample{The example below shows several ways to create JSON values by specifying a subrange with iterators.,basic_json__InputIt_InputIt} @since version 1.0.0 */ template::value or std::is_same::value, int>::type = 0> basic_json(InputIT first, InputIT last) { assert(first.m_object != nullptr); assert(last.m_object != nullptr); // make sure iterator fits the current value if (JSON_UNLIKELY(first.m_object != last.m_object)) { JSON_THROW(invalid_iterator::create(201, "iterators are not compatible")); } // copy type from first iterator m_type = first.m_object->m_type; // check if iterator range is complete for primitive values switch (m_type) { case value_t::boolean: case value_t::number_float: case value_t::number_integer: case value_t::number_unsigned: case value_t::string: { if (JSON_UNLIKELY(not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())) { JSON_THROW(invalid_iterator::create(204, "iterators out of range")); } break; } default: break; } switch (m_type) { case value_t::number_integer: { m_value.number_integer = first.m_object->m_value.number_integer; break; } case value_t::number_unsigned: { m_value.number_unsigned = first.m_object->m_value.number_unsigned; break; } case value_t::number_float: { m_value.number_float = first.m_object->m_value.number_float; break; } case value_t::boolean: { m_value.boolean = first.m_object->m_value.boolean; break; } case value_t::string: { m_value = *first.m_object->m_value.string; break; } case value_t::object: { m_value.object = create(first.m_it.object_iterator, last.m_it.object_iterator); break; } case value_t::array: { m_value.array = create(first.m_it.array_iterator, last.m_it.array_iterator); break; } default: JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " + std::string(first.m_object->type_name()))); } assert_invariant(); } /////////////////////////////////////// // other constructors and destructor // /////////////////////////////////////// /// @private basic_json(const detail::json_ref& ref) : basic_json(ref.moved_or_copied()) {} /*! @brief copy constructor Creates a copy of a given JSON value. @param[in] other the JSON value to copy @post `*this == other` @complexity Linear in the size of @a other. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is linear. - As postcondition, it holds: `other == basic_json(other)`. @liveexample{The following code shows an example for the copy constructor.,basic_json__basic_json} @since version 1.0.0 */ basic_json(const basic_json& other) : m_type(other.m_type) { // check of passed value is valid other.assert_invariant(); switch (m_type) { case value_t::object: { m_value = *other.m_value.object; break; } case value_t::array: { m_value = *other.m_value.array; break; } case value_t::string: { m_value = *other.m_value.string; break; } case value_t::boolean: { m_value = other.m_value.boolean; break; } case value_t::number_integer: { m_value = other.m_value.number_integer; break; } case value_t::number_unsigned: { m_value = other.m_value.number_unsigned; break; } case value_t::number_float: { m_value = other.m_value.number_float; break; } default: break; } assert_invariant(); } /*! @brief move constructor Move constructor. Constructs a JSON value with the contents of the given value @a other using move semantics. It "steals" the resources from @a other and leaves it as JSON null value. @param[in,out] other value to move to this object @post `*this` has the same value as @a other before the call. @post @a other is a JSON null value. @complexity Constant. @exceptionsafety No-throw guarantee: this constructor never throws exceptions. @requirement This function helps `basic_json` satisfying the [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible) requirements. @liveexample{The code below shows the move constructor explicitly called via std::move.,basic_json__moveconstructor} @since version 1.0.0 */ basic_json(basic_json&& other) noexcept : m_type(std::move(other.m_type)), m_value(std::move(other.m_value)) { // check that passed value is valid other.assert_invariant(); // invalidate payload other.m_type = value_t::null; other.m_value = {}; assert_invariant(); } /*! @brief copy assignment Copy assignment operator. Copies a JSON value via the "copy and swap" strategy: It is expressed in terms of the copy constructor, destructor, and the `swap()` member function. @param[in] other value to copy from @complexity Linear. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is linear. @liveexample{The code below shows and example for the copy assignment. It creates a copy of value `a` which is then swapped with `b`. Finally\, the copy of `a` (which is the null value after the swap) is destroyed.,basic_json__copyassignment} @since version 1.0.0 */ reference& operator=(basic_json other) noexcept ( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value ) { // check that passed value is valid other.assert_invariant(); using std::swap; swap(m_type, other.m_type); swap(m_value, other.m_value); assert_invariant(); return *this; } /*! @brief destructor Destroys the JSON value and frees all allocated memory. @complexity Linear. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is linear. - All stored elements are destroyed and all memory is freed. @since version 1.0.0 */ ~basic_json() noexcept { assert_invariant(); m_value.destroy(m_type); } /// @} public: /////////////////////// // object inspection // /////////////////////// /// @name object inspection /// Functions to inspect the type of a JSON value. /// @{ /*! @brief serialization Serialization function for JSON values. The function tries to mimic Python's `json.dumps()` function, and currently supports its @a indent and @a ensure_ascii parameters. @param[in] indent If indent is nonnegative, then array elements and object members will be pretty-printed with that indent level. An indent level of `0` will only insert newlines. `-1` (the default) selects the most compact representation. @param[in] indent_char The character to use for indentation if @a indent is greater than `0`. The default is ` ` (space). @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters in the output are escaped with `\uXXXX` sequences, and the result consists of ASCII characters only. @return string containing the serialization of the JSON value @throw type_error.316 if a string stored inside the JSON value is not UTF-8 encoded @complexity Linear. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @liveexample{The following example shows the effect of different @a indent\, @a indent_char\, and @a ensure_ascii parameters to the result of the serialization.,dump} @see https://docs.python.org/2/library/json.html#json.dump @since version 1.0.0; indentation character @a indent_char, option @a ensure_ascii and exceptions added in version 3.0.0 */ string_t dump(const int indent = -1, const char indent_char = ' ', const bool ensure_ascii = false) const { string_t result; serializer s(detail::output_adapter(result), indent_char); if (indent >= 0) { s.dump(*this, true, ensure_ascii, static_cast(indent)); } else { s.dump(*this, false, ensure_ascii, 0); } return result; } /*! @brief return the type of the JSON value (explicit) Return the type of the JSON value as a value from the @ref value_t enumeration. @return the type of the JSON value Value type | return value ------------------------- | ------------------------- null | value_t::null boolean | value_t::boolean string | value_t::string number (integer) | value_t::number_integer number (unsigned integer) | value_t::number_unsigned number (floating-point) | value_t::number_float object | value_t::object array | value_t::array discarded | value_t::discarded @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `type()` for all JSON types.,type} @sa @ref operator value_t() -- return the type of the JSON value (implicit) @sa @ref type_name() -- return the type as string @since version 1.0.0 */ constexpr value_t type() const noexcept { return m_type; } /*! @brief return whether type is primitive This function returns true if and only if the JSON type is primitive (string, number, boolean, or null). @return `true` if type is primitive (string, number, boolean, or null), `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_primitive()` for all JSON types.,is_primitive} @sa @ref is_structured() -- returns whether JSON value is structured @sa @ref is_null() -- returns whether JSON value is `null` @sa @ref is_string() -- returns whether JSON value is a string @sa @ref is_boolean() -- returns whether JSON value is a boolean @sa @ref is_number() -- returns whether JSON value is a number @since version 1.0.0 */ constexpr bool is_primitive() const noexcept { return is_null() or is_string() or is_boolean() or is_number(); } /*! @brief return whether type is structured This function returns true if and only if the JSON type is structured (array or object). @return `true` if type is structured (array or object), `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_structured()` for all JSON types.,is_structured} @sa @ref is_primitive() -- returns whether value is primitive @sa @ref is_array() -- returns whether value is an array @sa @ref is_object() -- returns whether value is an object @since version 1.0.0 */ constexpr bool is_structured() const noexcept { return is_array() or is_object(); } /*! @brief return whether value is null This function returns true if and only if the JSON value is null. @return `true` if type is null, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_null()` for all JSON types.,is_null} @since version 1.0.0 */ constexpr bool is_null() const noexcept { return (m_type == value_t::null); } /*! @brief return whether value is a boolean This function returns true if and only if the JSON value is a boolean. @return `true` if type is boolean, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_boolean()` for all JSON types.,is_boolean} @since version 1.0.0 */ constexpr bool is_boolean() const noexcept { return (m_type == value_t::boolean); } /*! @brief return whether value is a number This function returns true if and only if the JSON value is a number. This includes both integer (signed and unsigned) and floating-point values. @return `true` if type is number (regardless whether integer, unsigned integer or floating-type), `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_number()` for all JSON types.,is_number} @sa @ref is_number_integer() -- check if value is an integer or unsigned integer number @sa @ref is_number_unsigned() -- check if value is an unsigned integer number @sa @ref is_number_float() -- check if value is a floating-point number @since version 1.0.0 */ constexpr bool is_number() const noexcept { return is_number_integer() or is_number_float(); } /*! @brief return whether value is an integer number This function returns true if and only if the JSON value is a signed or unsigned integer number. This excludes floating-point values. @return `true` if type is an integer or unsigned integer number, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_number_integer()` for all JSON types.,is_number_integer} @sa @ref is_number() -- check if value is a number @sa @ref is_number_unsigned() -- check if value is an unsigned integer number @sa @ref is_number_float() -- check if value is a floating-point number @since version 1.0.0 */ constexpr bool is_number_integer() const noexcept { return (m_type == value_t::number_integer or m_type == value_t::number_unsigned); } /*! @brief return whether value is an unsigned integer number This function returns true if and only if the JSON value is an unsigned integer number. This excludes floating-point and signed integer values. @return `true` if type is an unsigned integer number, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_number_unsigned()` for all JSON types.,is_number_unsigned} @sa @ref is_number() -- check if value is a number @sa @ref is_number_integer() -- check if value is an integer or unsigned integer number @sa @ref is_number_float() -- check if value is a floating-point number @since version 2.0.0 */ constexpr bool is_number_unsigned() const noexcept { return (m_type == value_t::number_unsigned); } /*! @brief return whether value is a floating-point number This function returns true if and only if the JSON value is a floating-point number. This excludes signed and unsigned integer values. @return `true` if type is a floating-point number, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_number_float()` for all JSON types.,is_number_float} @sa @ref is_number() -- check if value is number @sa @ref is_number_integer() -- check if value is an integer number @sa @ref is_number_unsigned() -- check if value is an unsigned integer number @since version 1.0.0 */ constexpr bool is_number_float() const noexcept { return (m_type == value_t::number_float); } /*! @brief return whether value is an object This function returns true if and only if the JSON value is an object. @return `true` if type is object, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_object()` for all JSON types.,is_object} @since version 1.0.0 */ constexpr bool is_object() const noexcept { return (m_type == value_t::object); } /*! @brief return whether value is an array This function returns true if and only if the JSON value is an array. @return `true` if type is array, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_array()` for all JSON types.,is_array} @since version 1.0.0 */ constexpr bool is_array() const noexcept { return (m_type == value_t::array); } /*! @brief return whether value is a string This function returns true if and only if the JSON value is a string. @return `true` if type is string, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_string()` for all JSON types.,is_string} @since version 1.0.0 */ constexpr bool is_string() const noexcept { return (m_type == value_t::string); } /*! @brief return whether value is discarded This function returns true if and only if the JSON value was discarded during parsing with a callback function (see @ref parser_callback_t). @note This function will always be `false` for JSON values after parsing. That is, discarded values can only occur during parsing, but will be removed when inside a structured value or replaced by null in other cases. @return `true` if type is discarded, `false` otherwise. @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies `is_discarded()` for all JSON types.,is_discarded} @since version 1.0.0 */ constexpr bool is_discarded() const noexcept { return (m_type == value_t::discarded); } /*! @brief return the type of the JSON value (implicit) Implicitly return the type of the JSON value as a value from the @ref value_t enumeration. @return the type of the JSON value @complexity Constant. @exceptionsafety No-throw guarantee: this member function never throws exceptions. @liveexample{The following code exemplifies the @ref value_t operator for all JSON types.,operator__value_t} @sa @ref type() -- return the type of the JSON value (explicit) @sa @ref type_name() -- return the type as string @since version 1.0.0 */ constexpr operator value_t() const noexcept { return m_type; } /// @} private: ////////////////// // value access // ////////////////// /// get a boolean (explicit) boolean_t get_impl(boolean_t* /*unused*/) const { if (JSON_LIKELY(is_boolean())) { return m_value.boolean; } JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(type_name()))); } /// get a pointer to the value (object) object_t* get_impl_ptr(object_t* /*unused*/) noexcept { return is_object() ? m_value.object : nullptr; } /// get a pointer to the value (object) constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept { return is_object() ? m_value.object : nullptr; } /// get a pointer to the value (array) array_t* get_impl_ptr(array_t* /*unused*/) noexcept { return is_array() ? m_value.array : nullptr; } /// get a pointer to the value (array) constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept { return is_array() ? m_value.array : nullptr; } /// get a pointer to the value (string) string_t* get_impl_ptr(string_t* /*unused*/) noexcept { return is_string() ? m_value.string : nullptr; } /// get a pointer to the value (string) constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept { return is_string() ? m_value.string : nullptr; } /// get a pointer to the value (boolean) boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept { return is_boolean() ? &m_value.boolean : nullptr; } /// get a pointer to the value (boolean) constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept { return is_boolean() ? &m_value.boolean : nullptr; } /// get a pointer to the value (integer number) number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept { return is_number_integer() ? &m_value.number_integer : nullptr; } /// get a pointer to the value (integer number) constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept { return is_number_integer() ? &m_value.number_integer : nullptr; } /// get a pointer to the value (unsigned number) number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept { return is_number_unsigned() ? &m_value.number_unsigned : nullptr; } /// get a pointer to the value (unsigned number) constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept { return is_number_unsigned() ? &m_value.number_unsigned : nullptr; } /// get a pointer to the value (floating-point number) number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept { return is_number_float() ? &m_value.number_float : nullptr; } /// get a pointer to the value (floating-point number) constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept { return is_number_float() ? &m_value.number_float : nullptr; } /*! @brief helper function to implement get_ref() This function helps to implement get_ref() without code duplication for const and non-const overloads @tparam ThisType will be deduced as `basic_json` or `const basic_json` @throw type_error.303 if ReferenceType does not match underlying value type of the current JSON */ template static ReferenceType get_ref_impl(ThisType& obj) { // delegate the call to get_ptr<>() auto ptr = obj.template get_ptr::type>(); if (JSON_LIKELY(ptr != nullptr)) { return *ptr; } JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name()))); } public: /// @name value access /// Direct access to the stored value of a JSON value. /// @{ /*! @brief get special-case overload This overloads avoids a lot of template boilerplate, it can be seen as the identity method @tparam BasicJsonType == @ref basic_json @return a copy of *this @complexity Constant. @since version 2.1.0 */ template::type, basic_json_t>::value, int> = 0> basic_json get() const { return *this; } /*! @brief get special-case overload This overloads converts the current @ref basic_json in a different @ref basic_json type @tparam BasicJsonType == @ref basic_json @return a copy of *this, converted into @tparam BasicJsonType @complexity Depending on the implementation of the called `from_json()` method. @since version 3.1.2 */ template::value and detail::is_basic_json::value, int> = 0> BasicJsonType get() const { return *this; } /*! @brief get a value (explicit) Explicit type conversion between the JSON value and a compatible value which is [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible) and [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). The value is converted by calling the @ref json_serializer `from_json()` method. The function is equivalent to executing @code {.cpp} ValueType ret; JSONSerializer::from_json(*this, ret); return ret; @endcode This overloads is chosen if: - @a ValueType is not @ref basic_json, - @ref json_serializer has a `from_json()` method of the form `void from_json(const basic_json&, ValueType&)`, and - @ref json_serializer does not have a `from_json()` method of the form `ValueType from_json(const basic_json&)` @tparam ValueTypeCV the provided value type @tparam ValueType the returned value type @return copy of the JSON value, converted to @a ValueType @throw what @ref json_serializer `from_json()` method throws @liveexample{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers\, (2) A JSON array can be converted to a standard `std::vector`\, (3) A JSON object can be converted to C++ associative containers such as `std::unordered_map`.,get__ValueType_const} @since version 2.1.0 */ template, detail::enable_if_t < not detail::is_basic_json::value and detail::has_from_json::value and not detail::has_non_default_from_json::value, int> = 0> ValueType get() const noexcept(noexcept( JSONSerializer::from_json(std::declval(), std::declval()))) { // we cannot static_assert on ValueTypeCV being non-const, because // there is support for get(), which is why we // still need the uncvref static_assert(not std::is_reference::value, "get() cannot be used with reference types, you might want to use get_ref()"); static_assert(std::is_default_constructible::value, "types must be DefaultConstructible when used with get()"); ValueType ret; JSONSerializer::from_json(*this, ret); return ret; } /*! @brief get a value (explicit); special case Explicit type conversion between the JSON value and a compatible value which is **not** [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible) and **not** [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). The value is converted by calling the @ref json_serializer `from_json()` method. The function is equivalent to executing @code {.cpp} return JSONSerializer::from_json(*this); @endcode This overloads is chosen if: - @a ValueType is not @ref basic_json and - @ref json_serializer has a `from_json()` method of the form `ValueType from_json(const basic_json&)` @note If @ref json_serializer has both overloads of `from_json()`, this one is chosen. @tparam ValueTypeCV the provided value type @tparam ValueType the returned value type @return copy of the JSON value, converted to @a ValueType @throw what @ref json_serializer `from_json()` method throws @since version 2.1.0 */ template, detail::enable_if_t::value and detail::has_non_default_from_json::value, int> = 0> ValueType get() const noexcept(noexcept( JSONSerializer::from_json(std::declval()))) { static_assert(not std::is_reference::value, "get() cannot be used with reference types, you might want to use get_ref()"); return JSONSerializer::from_json(*this); } /*! @brief get a pointer value (explicit) Explicit pointer access to the internally stored JSON value. No copies are made. @warning The pointer becomes invalid if the underlying JSON object changes. @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, @ref number_unsigned_t, or @ref number_float_t. @return pointer to the internally stored JSON value if the requested pointer type @a PointerType fits to the JSON value; `nullptr` otherwise @complexity Constant. @liveexample{The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a `nullptr` is returned if the value and the requested pointer type does not match.,get__PointerType} @sa @ref get_ptr() for explicit pointer-member access @since version 1.0.0 */ template::value, int>::type = 0> PointerType get() noexcept { // delegate the call to get_ptr return get_ptr(); } /*! @brief get a pointer value (explicit) @copydoc get() */ template::value, int>::type = 0> constexpr const PointerType get() const noexcept { // delegate the call to get_ptr return get_ptr(); } /*! @brief get a pointer value (implicit) Implicit pointer access to the internally stored JSON value. No copies are made. @warning Writing data to the pointee of the result yields an undefined state. @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, @ref number_unsigned_t, or @ref number_float_t. Enforced by a static assertion. @return pointer to the internally stored JSON value if the requested pointer type @a PointerType fits to the JSON value; `nullptr` otherwise @complexity Constant. @liveexample{The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a `nullptr` is returned if the value and the requested pointer type does not match.,get_ptr} @since version 1.0.0 */ template::value, int>::type = 0> PointerType get_ptr() noexcept { // get the type of the PointerType (remove pointer and const) using pointee_t = typename std::remove_const::type>::type>::type; // make sure the type matches the allowed types static_assert( std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value , "incompatible pointer type"); // delegate the call to get_impl_ptr<>() return get_impl_ptr(static_cast(nullptr)); } /*! @brief get a pointer value (implicit) @copydoc get_ptr() */ template::value and std::is_const::type>::value, int>::type = 0> constexpr const PointerType get_ptr() const noexcept { // get the type of the PointerType (remove pointer and const) using pointee_t = typename std::remove_const::type>::type>::type; // make sure the type matches the allowed types static_assert( std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value or std::is_same::value , "incompatible pointer type"); // delegate the call to get_impl_ptr<>() const return get_impl_ptr(static_cast(nullptr)); } /*! @brief get a reference value (implicit) Implicit reference access to the internally stored JSON value. No copies are made. @warning Writing data to the referee of the result yields an undefined state. @tparam ReferenceType reference type; must be a reference to @ref array_t, @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref number_float_t. Enforced by static assertion. @return reference to the internally stored JSON value if the requested reference type @a ReferenceType fits to the JSON value; throws type_error.303 otherwise @throw type_error.303 in case passed type @a ReferenceType is incompatible with the stored JSON value; see example below @complexity Constant. @liveexample{The example shows several calls to `get_ref()`.,get_ref} @since version 1.1.0 */ template::value, int>::type = 0> ReferenceType get_ref() { // delegate call to get_ref_impl return get_ref_impl(*this); } /*! @brief get a reference value (implicit) @copydoc get_ref() */ template::value and std::is_const::type>::value, int>::type = 0> ReferenceType get_ref() const { // delegate call to get_ref_impl return get_ref_impl(*this); } /*! @brief get a value (implicit) Implicit type conversion between the JSON value and a compatible value. The call is realized by calling @ref get() const. @tparam ValueType non-pointer type compatible to the JSON value, for instance `int` for JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for JSON arrays. The character type of @ref string_t as well as an initializer list of this type is excluded to avoid ambiguities as these types implicitly convert to `std::string`. @return copy of the JSON value, converted to type @a ValueType @throw type_error.302 in case passed type @a ValueType is incompatible to the JSON value type (e.g., the JSON value is of type boolean, but a string is requested); see example below @complexity Linear in the size of the JSON value. @liveexample{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers\, (2) A JSON array can be converted to a standard `std::vector`\, (3) A JSON object can be converted to C++ associative containers such as `std::unordered_map`.,operator__ValueType} @since version 1.0.0 */ template < typename ValueType, typename std::enable_if < not std::is_pointer::value and not std::is_same>::value and not std::is_same::value and not detail::is_basic_json::value #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value #endif #if defined(JSON_HAS_CPP_17) and not std::is_same::value #endif , int >::type = 0 > operator ValueType() const { // delegate the call to get<>() const return get(); } /// @} //////////////////// // element access // //////////////////// /// @name element access /// Access to the JSON value. /// @{ /*! @brief access specified array element with bounds checking Returns a reference to the element at specified location @a idx, with bounds checking. @param[in] idx index of the element to access @return reference to the element at index @a idx @throw type_error.304 if the JSON value is not an array; in this case, calling `at` with an index makes no sense. See example below. @throw out_of_range.401 if the index @a idx is out of range of the array; that is, `idx >= size()`. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @since version 1.0.0 @liveexample{The example below shows how array elements can be read and written using `at()`. It also demonstrates the different exceptions that can be thrown.,at__size_type} */ reference at(size_type idx) { // at only works for arrays if (JSON_LIKELY(is_array())) { JSON_TRY { return m_value.array->at(idx); } JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); } } else { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); } } /*! @brief access specified array element with bounds checking Returns a const reference to the element at specified location @a idx, with bounds checking. @param[in] idx index of the element to access @return const reference to the element at index @a idx @throw type_error.304 if the JSON value is not an array; in this case, calling `at` with an index makes no sense. See example below. @throw out_of_range.401 if the index @a idx is out of range of the array; that is, `idx >= size()`. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @since version 1.0.0 @liveexample{The example below shows how array elements can be read using `at()`. It also demonstrates the different exceptions that can be thrown., at__size_type_const} */ const_reference at(size_type idx) const { // at only works for arrays if (JSON_LIKELY(is_array())) { JSON_TRY { return m_value.array->at(idx); } JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); } } else { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); } } /*! @brief access specified object element with bounds checking Returns a reference to the element at with specified key @a key, with bounds checking. @param[in] key key of the element to access @return reference to the element at key @a key @throw type_error.304 if the JSON value is not an object; in this case, calling `at` with a key makes no sense. See example below. @throw out_of_range.403 if the key @a key is is not stored in the object; that is, `find(key) == end()`. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Logarithmic in the size of the container. @sa @ref operator[](const typename object_t::key_type&) for unchecked access by reference @sa @ref value() for access by value with a default value @since version 1.0.0 @liveexample{The example below shows how object elements can be read and written using `at()`. It also demonstrates the different exceptions that can be thrown.,at__object_t_key_type} */ reference at(const typename object_t::key_type& key) { // at only works for objects if (JSON_LIKELY(is_object())) { JSON_TRY { return m_value.object->at(key); } JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); } } else { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); } } /*! @brief access specified object element with bounds checking Returns a const reference to the element at with specified key @a key, with bounds checking. @param[in] key key of the element to access @return const reference to the element at key @a key @throw type_error.304 if the JSON value is not an object; in this case, calling `at` with a key makes no sense. See example below. @throw out_of_range.403 if the key @a key is is not stored in the object; that is, `find(key) == end()`. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Logarithmic in the size of the container. @sa @ref operator[](const typename object_t::key_type&) for unchecked access by reference @sa @ref value() for access by value with a default value @since version 1.0.0 @liveexample{The example below shows how object elements can be read using `at()`. It also demonstrates the different exceptions that can be thrown., at__object_t_key_type_const} */ const_reference at(const typename object_t::key_type& key) const { // at only works for objects if (JSON_LIKELY(is_object())) { JSON_TRY { return m_value.object->at(key); } JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); } } else { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); } } /*! @brief access specified array element Returns a reference to the element at specified location @a idx. @note If @a idx is beyond the range of the array (i.e., `idx >= size()`), then the array is silently filled up with `null` values to make `idx` a valid reference to the last stored element. @param[in] idx index of the element to access @return reference to the element at index @a idx @throw type_error.305 if the JSON value is not an array or null; in that cases, using the [] operator with an index makes no sense. @complexity Constant if @a idx is in the range of the array. Otherwise linear in `idx - size()`. @liveexample{The example below shows how array elements can be read and written using `[]` operator. Note the addition of `null` values.,operatorarray__size_type} @since version 1.0.0 */ reference operator[](size_type idx) { // implicitly convert null value to an empty array if (is_null()) { m_type = value_t::array; m_value.array = create(); assert_invariant(); } // operator[] only works for arrays if (JSON_LIKELY(is_array())) { // fill up array with null values if given idx is outside range if (idx >= m_value.array->size()) { m_value.array->insert(m_value.array->end(), idx - m_value.array->size() + 1, basic_json()); } return m_value.array->operator[](idx); } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief access specified array element Returns a const reference to the element at specified location @a idx. @param[in] idx index of the element to access @return const reference to the element at index @a idx @throw type_error.305 if the JSON value is not an array; in that case, using the [] operator with an index makes no sense. @complexity Constant. @liveexample{The example below shows how array elements can be read using the `[]` operator.,operatorarray__size_type_const} @since version 1.0.0 */ const_reference operator[](size_type idx) const { // const operator[] only works for arrays if (JSON_LIKELY(is_array())) { return m_value.array->operator[](idx); } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief access specified object element Returns a reference to the element at with specified key @a key. @note If @a key is not found in the object, then it is silently added to the object and filled with a `null` value to make `key` a valid reference. In case the value was `null` before, it is converted to an object. @param[in] key key of the element to access @return reference to the element at key @a key @throw type_error.305 if the JSON value is not an object or null; in that cases, using the [] operator with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be read and written using the `[]` operator.,operatorarray__key_type} @sa @ref at(const typename object_t::key_type&) for access by reference with range checking @sa @ref value() for access by value with a default value @since version 1.0.0 */ reference operator[](const typename object_t::key_type& key) { // implicitly convert null value to an empty object if (is_null()) { m_type = value_t::object; m_value.object = create(); assert_invariant(); } // operator[] only works for objects if (JSON_LIKELY(is_object())) { return m_value.object->operator[](key); } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief read-only access specified object element Returns a const reference to the element at with specified key @a key. No bounds checking is performed. @warning If the element with key @a key does not exist, the behavior is undefined. @param[in] key key of the element to access @return const reference to the element at key @a key @pre The element with key @a key must exist. **This precondition is enforced with an assertion.** @throw type_error.305 if the JSON value is not an object; in that case, using the [] operator with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be read using the `[]` operator.,operatorarray__key_type_const} @sa @ref at(const typename object_t::key_type&) for access by reference with range checking @sa @ref value() for access by value with a default value @since version 1.0.0 */ const_reference operator[](const typename object_t::key_type& key) const { // const operator[] only works for objects if (JSON_LIKELY(is_object())) { assert(m_value.object->find(key) != m_value.object->end()); return m_value.object->find(key)->second; } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief access specified object element Returns a reference to the element at with specified key @a key. @note If @a key is not found in the object, then it is silently added to the object and filled with a `null` value to make `key` a valid reference. In case the value was `null` before, it is converted to an object. @param[in] key key of the element to access @return reference to the element at key @a key @throw type_error.305 if the JSON value is not an object or null; in that cases, using the [] operator with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be read and written using the `[]` operator.,operatorarray__key_type} @sa @ref at(const typename object_t::key_type&) for access by reference with range checking @sa @ref value() for access by value with a default value @since version 1.1.0 */ template reference operator[](T* key) { // implicitly convert null to object if (is_null()) { m_type = value_t::object; m_value = value_t::object; assert_invariant(); } // at only works for objects if (JSON_LIKELY(is_object())) { return m_value.object->operator[](key); } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief read-only access specified object element Returns a const reference to the element at with specified key @a key. No bounds checking is performed. @warning If the element with key @a key does not exist, the behavior is undefined. @param[in] key key of the element to access @return const reference to the element at key @a key @pre The element with key @a key must exist. **This precondition is enforced with an assertion.** @throw type_error.305 if the JSON value is not an object; in that case, using the [] operator with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be read using the `[]` operator.,operatorarray__key_type_const} @sa @ref at(const typename object_t::key_type&) for access by reference with range checking @sa @ref value() for access by value with a default value @since version 1.1.0 */ template const_reference operator[](T* key) const { // at only works for objects if (JSON_LIKELY(is_object())) { assert(m_value.object->find(key) != m_value.object->end()); return m_value.object->find(key)->second; } JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); } /*! @brief access specified object element with default value Returns either a copy of an object's element at the specified key @a key or a given default value if no element with key @a key exists. The function is basically equivalent to executing @code {.cpp} try { return at(key); } catch(out_of_range) { return default_value; } @endcode @note Unlike @ref at(const typename object_t::key_type&), this function does not throw if the given key @a key was not found. @note Unlike @ref operator[](const typename object_t::key_type& key), this function does not implicitly add an element to the position defined by @a key. This function is furthermore also applicable to const objects. @param[in] key key of the element to access @param[in] default_value the value to return if @a key is not found @tparam ValueType type compatible to JSON values, for instance `int` for JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for JSON arrays. Note the type of the expected value at @a key and the default value @a default_value must be compatible. @return copy of the element at key @a key or @a default_value if @a key is not found @throw type_error.306 if the JSON value is not an object; in that case, using `value()` with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be queried with a default value.,basic_json__value} @sa @ref at(const typename object_t::key_type&) for access by reference with range checking @sa @ref operator[](const typename object_t::key_type&) for unchecked access by reference @since version 1.0.0 */ template::value, int>::type = 0> ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const { // at only works for objects if (JSON_LIKELY(is_object())) { // if key is found, return value and given default value otherwise const auto it = find(key); if (it != end()) { return *it; } return default_value; } JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()))); } /*! @brief overload for a default value of type const char* @copydoc basic_json::value(const typename object_t::key_type&, ValueType) const */ string_t value(const typename object_t::key_type& key, const char* default_value) const { return value(key, string_t(default_value)); } /*! @brief access specified object element via JSON Pointer with default value Returns either a copy of an object's element at the specified key @a key or a given default value if no element with key @a key exists. The function is basically equivalent to executing @code {.cpp} try { return at(ptr); } catch(out_of_range) { return default_value; } @endcode @note Unlike @ref at(const json_pointer&), this function does not throw if the given key @a key was not found. @param[in] ptr a JSON pointer to the element to access @param[in] default_value the value to return if @a ptr found no value @tparam ValueType type compatible to JSON values, for instance `int` for JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for JSON arrays. Note the type of the expected value at @a key and the default value @a default_value must be compatible. @return copy of the element at key @a key or @a default_value if @a key is not found @throw type_error.306 if the JSON value is not an objec; in that case, using `value()` with a key makes no sense. @complexity Logarithmic in the size of the container. @liveexample{The example below shows how object elements can be queried with a default value.,basic_json__value_ptr} @sa @ref operator[](const json_pointer&) for unchecked access by reference @since version 2.0.2 */ template::value, int>::type = 0> ValueType value(const json_pointer& ptr, const ValueType& default_value) const { // at only works for objects if (JSON_LIKELY(is_object())) { // if pointer resolves a value, return it or use default value JSON_TRY { return ptr.get_checked(this); } JSON_CATCH (out_of_range&) { return default_value; } } JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()))); } /*! @brief overload for a default value of type const char* @copydoc basic_json::value(const json_pointer&, ValueType) const */ string_t value(const json_pointer& ptr, const char* default_value) const { return value(ptr, string_t(default_value)); } /*! @brief access the first element Returns a reference to the first element in the container. For a JSON container `c`, the expression `c.front()` is equivalent to `*c.begin()`. @return In case of a structured type (array or object), a reference to the first element is returned. In case of number, string, or boolean values, a reference to the value is returned. @complexity Constant. @pre The JSON value must not be `null` (would throw `std::out_of_range`) or an empty array or object (undefined behavior, **guarded by assertions**). @post The JSON value remains unchanged. @throw invalid_iterator.214 when called on `null` value @liveexample{The following code shows an example for `front()`.,front} @sa @ref back() -- access the last element @since version 1.0.0 */ reference front() { return *begin(); } /*! @copydoc basic_json::front() */ const_reference front() const { return *cbegin(); } /*! @brief access the last element Returns a reference to the last element in the container. For a JSON container `c`, the expression `c.back()` is equivalent to @code {.cpp} auto tmp = c.end(); --tmp; return *tmp; @endcode @return In case of a structured type (array or object), a reference to the last element is returned. In case of number, string, or boolean values, a reference to the value is returned. @complexity Constant. @pre The JSON value must not be `null` (would throw `std::out_of_range`) or an empty array or object (undefined behavior, **guarded by assertions**). @post The JSON value remains unchanged. @throw invalid_iterator.214 when called on a `null` value. See example below. @liveexample{The following code shows an example for `back()`.,back} @sa @ref front() -- access the first element @since version 1.0.0 */ reference back() { auto tmp = end(); --tmp; return *tmp; } /*! @copydoc basic_json::back() */ const_reference back() const { auto tmp = cend(); --tmp; return *tmp; } /*! @brief remove element given an iterator Removes the element specified by iterator @a pos. The iterator @a pos must be valid and dereferenceable. Thus the `end()` iterator (which is valid, but is not dereferenceable) cannot be used as a value for @a pos. If called on a primitive type other than `null`, the resulting JSON value will be `null`. @param[in] pos iterator to the element to remove @return Iterator following the last removed element. If the iterator @a pos refers to the last element, the `end()` iterator is returned. @tparam IteratorType an @ref iterator or @ref const_iterator @post Invalidates iterators and references at or after the point of the erase, including the `end()` iterator. @throw type_error.307 if called on a `null` value; example: `"cannot use erase() with null"` @throw invalid_iterator.202 if called on an iterator which does not belong to the current JSON value; example: `"iterator does not fit current value"` @throw invalid_iterator.205 if called on a primitive type with invalid iterator (i.e., any iterator which is not `begin()`); example: `"iterator out of range"` @complexity The complexity depends on the type: - objects: amortized constant - arrays: linear in distance between @a pos and the end of the container - strings: linear in the length of the string - other types: constant @liveexample{The example shows the result of `erase()` for different JSON types.,erase__IteratorType} @sa @ref erase(IteratorType, IteratorType) -- removes the elements in the given range @sa @ref erase(const typename object_t::key_type&) -- removes the element from an object at the given key @sa @ref erase(const size_type) -- removes the element from an array at the given index @since version 1.0.0 */ template::value or std::is_same::value, int>::type = 0> IteratorType erase(IteratorType pos) { // make sure iterator fits the current value if (JSON_UNLIKELY(this != pos.m_object)) { JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); } IteratorType result = end(); switch (m_type) { case value_t::boolean: case value_t::number_float: case value_t::number_integer: case value_t::number_unsigned: case value_t::string: { if (JSON_UNLIKELY(not pos.m_it.primitive_iterator.is_begin())) { JSON_THROW(invalid_iterator::create(205, "iterator out of range")); } if (is_string()) { AllocatorType alloc; std::allocator_traits::destroy(alloc, m_value.string); std::allocator_traits::deallocate(alloc, m_value.string, 1); m_value.string = nullptr; } m_type = value_t::null; assert_invariant(); break; } case value_t::object: { result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator); break; } case value_t::array: { result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator); break; } default: JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); } return result; } /*! @brief remove elements given an iterator range Removes the element specified by the range `[first; last)`. The iterator @a first does not need to be dereferenceable if `first == last`: erasing an empty range is a no-op. If called on a primitive type other than `null`, the resulting JSON value will be `null`. @param[in] first iterator to the beginning of the range to remove @param[in] last iterator past the end of the range to remove @return Iterator following the last removed element. If the iterator @a second refers to the last element, the `end()` iterator is returned. @tparam IteratorType an @ref iterator or @ref const_iterator @post Invalidates iterators and references at or after the point of the erase, including the `end()` iterator. @throw type_error.307 if called on a `null` value; example: `"cannot use erase() with null"` @throw invalid_iterator.203 if called on iterators which does not belong to the current JSON value; example: `"iterators do not fit current value"` @throw invalid_iterator.204 if called on a primitive type with invalid iterators (i.e., if `first != begin()` and `last != end()`); example: `"iterators out of range"` @complexity The complexity depends on the type: - objects: `log(size()) + std::distance(first, last)` - arrays: linear in the distance between @a first and @a last, plus linear in the distance between @a last and end of the container - strings: linear in the length of the string - other types: constant @liveexample{The example shows the result of `erase()` for different JSON types.,erase__IteratorType_IteratorType} @sa @ref erase(IteratorType) -- removes the element at a given position @sa @ref erase(const typename object_t::key_type&) -- removes the element from an object at the given key @sa @ref erase(const size_type) -- removes the element from an array at the given index @since version 1.0.0 */ template::value or std::is_same::value, int>::type = 0> IteratorType erase(IteratorType first, IteratorType last) { // make sure iterator fits the current value if (JSON_UNLIKELY(this != first.m_object or this != last.m_object)) { JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value")); } IteratorType result = end(); switch (m_type) { case value_t::boolean: case value_t::number_float: case value_t::number_integer: case value_t::number_unsigned: case value_t::string: { if (JSON_LIKELY(not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())) { JSON_THROW(invalid_iterator::create(204, "iterators out of range")); } if (is_string()) { AllocatorType alloc; std::allocator_traits::destroy(alloc, m_value.string); std::allocator_traits::deallocate(alloc, m_value.string, 1); m_value.string = nullptr; } m_type = value_t::null; assert_invariant(); break; } case value_t::object: { result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator, last.m_it.object_iterator); break; } case value_t::array: { result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator, last.m_it.array_iterator); break; } default: JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); } return result; } /*! @brief remove element from a JSON object given a key Removes elements from a JSON object with the key value @a key. @param[in] key value of the elements to remove @return Number of elements removed. If @a ObjectType is the default `std::map` type, the return value will always be `0` (@a key was not found) or `1` (@a key was found). @post References and iterators to the erased elements are invalidated. Other references and iterators are not affected. @throw type_error.307 when called on a type other than JSON object; example: `"cannot use erase() with null"` @complexity `log(size()) + count(key)` @liveexample{The example shows the effect of `erase()`.,erase__key_type} @sa @ref erase(IteratorType) -- removes the element at a given position @sa @ref erase(IteratorType, IteratorType) -- removes the elements in the given range @sa @ref erase(const size_type) -- removes the element from an array at the given index @since version 1.0.0 */ size_type erase(const typename object_t::key_type& key) { // this erase only works for objects if (JSON_LIKELY(is_object())) { return m_value.object->erase(key); } JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); } /*! @brief remove element from a JSON array given an index Removes element from a JSON array at the index @a idx. @param[in] idx index of the element to remove @throw type_error.307 when called on a type other than JSON object; example: `"cannot use erase() with null"` @throw out_of_range.401 when `idx >= size()`; example: `"array index 17 is out of range"` @complexity Linear in distance between @a idx and the end of the container. @liveexample{The example shows the effect of `erase()`.,erase__size_type} @sa @ref erase(IteratorType) -- removes the element at a given position @sa @ref erase(IteratorType, IteratorType) -- removes the elements in the given range @sa @ref erase(const typename object_t::key_type&) -- removes the element from an object at the given key @since version 1.0.0 */ void erase(const size_type idx) { // this erase only works for arrays if (JSON_LIKELY(is_array())) { if (JSON_UNLIKELY(idx >= size())) { JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); } m_value.array->erase(m_value.array->begin() + static_cast(idx)); } else { JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); } } /// @} //////////// // lookup // //////////// /// @name lookup /// @{ /*! @brief find an element in a JSON object Finds an element in a JSON object with key equivalent to @a key. If the element is not found or the JSON value is not an object, end() is returned. @note This method always returns @ref end() when executed on a JSON type that is not an object. @param[in] key key value of the element to search for. @return Iterator to an element with key equivalent to @a key. If no such element is found or the JSON value is not an object, past-the-end (see @ref end()) iterator is returned. @complexity Logarithmic in the size of the JSON object. @liveexample{The example shows how `find()` is used.,find__key_type} @since version 1.0.0 */ template iterator find(KeyT&& key) { auto result = end(); if (is_object()) { result.m_it.object_iterator = m_value.object->find(std::forward(key)); } return result; } /*! @brief find an element in a JSON object @copydoc find(KeyT&&) */ template const_iterator find(KeyT&& key) const { auto result = cend(); if (is_object()) { result.m_it.object_iterator = m_value.object->find(std::forward(key)); } return result; } /*! @brief returns the number of occurrences of a key in a JSON object Returns the number of elements with key @a key. If ObjectType is the default `std::map` type, the return value will always be `0` (@a key was not found) or `1` (@a key was found). @note This method always returns `0` when executed on a JSON type that is not an object. @param[in] key key value of the element to count @return Number of elements with key @a key. If the JSON value is not an object, the return value will be `0`. @complexity Logarithmic in the size of the JSON object. @liveexample{The example shows how `count()` is used.,count} @since version 1.0.0 */ template size_type count(KeyT&& key) const { // return 0 for all nonobject types return is_object() ? m_value.object->count(std::forward(key)) : 0; } /// @} /////////////// // iterators // /////////////// /// @name iterators /// @{ /*! @brief returns an iterator to the first element Returns an iterator to the first element. @image html range-begin-end.svg "Illustration from cppreference.com" @return iterator to the first element @complexity Constant. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. @liveexample{The following code shows an example for `begin()`.,begin} @sa @ref cbegin() -- returns a const iterator to the beginning @sa @ref end() -- returns an iterator to the end @sa @ref cend() -- returns a const iterator to the end @since version 1.0.0 */ iterator begin() noexcept { iterator result(this); result.set_begin(); return result; } /*! @copydoc basic_json::cbegin() */ const_iterator begin() const noexcept { return cbegin(); } /*! @brief returns a const iterator to the first element Returns a const iterator to the first element. @image html range-begin-end.svg "Illustration from cppreference.com" @return const iterator to the first element @complexity Constant. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. - Has the semantics of `const_cast(*this).begin()`. @liveexample{The following code shows an example for `cbegin()`.,cbegin} @sa @ref begin() -- returns an iterator to the beginning @sa @ref end() -- returns an iterator to the end @sa @ref cend() -- returns a const iterator to the end @since version 1.0.0 */ const_iterator cbegin() const noexcept { const_iterator result(this); result.set_begin(); return result; } /*! @brief returns an iterator to one past the last element Returns an iterator to one past the last element. @image html range-begin-end.svg "Illustration from cppreference.com" @return iterator one past the last element @complexity Constant. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. @liveexample{The following code shows an example for `end()`.,end} @sa @ref cend() -- returns a const iterator to the end @sa @ref begin() -- returns an iterator to the beginning @sa @ref cbegin() -- returns a const iterator to the beginning @since version 1.0.0 */ iterator end() noexcept { iterator result(this); result.set_end(); return result; } /*! @copydoc basic_json::cend() */ const_iterator end() const noexcept { return cend(); } /*! @brief returns a const iterator to one past the last element Returns a const iterator to one past the last element. @image html range-begin-end.svg "Illustration from cppreference.com" @return const iterator one past the last element @complexity Constant. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. - Has the semantics of `const_cast(*this).end()`. @liveexample{The following code shows an example for `cend()`.,cend} @sa @ref end() -- returns an iterator to the end @sa @ref begin() -- returns an iterator to the beginning @sa @ref cbegin() -- returns a const iterator to the beginning @since version 1.0.0 */ const_iterator cend() const noexcept { const_iterator result(this); result.set_end(); return result; } /*! @brief returns an iterator to the reverse-beginning Returns an iterator to the reverse-beginning; that is, the last element. @image html range-rbegin-rend.svg "Illustration from cppreference.com" @complexity Constant. @requirement This function helps `basic_json` satisfying the [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirements: - The complexity is constant. - Has the semantics of `reverse_iterator(end())`. @liveexample{The following code shows an example for `rbegin()`.,rbegin} @sa @ref crbegin() -- returns a const reverse iterator to the beginning @sa @ref rend() -- returns a reverse iterator to the end @sa @ref crend() -- returns a const reverse iterator to the end @since version 1.0.0 */ reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } /*! @copydoc basic_json::crbegin() */ const_reverse_iterator rbegin() const noexcept { return crbegin(); } /*! @brief returns an iterator to the reverse-end Returns an iterator to the reverse-end; that is, one before the first element. @image html range-rbegin-rend.svg "Illustration from cppreference.com" @complexity Constant. @requirement This function helps `basic_json` satisfying the [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirements: - The complexity is constant. - Has the semantics of `reverse_iterator(begin())`. @liveexample{The following code shows an example for `rend()`.,rend} @sa @ref crend() -- returns a const reverse iterator to the end @sa @ref rbegin() -- returns a reverse iterator to the beginning @sa @ref crbegin() -- returns a const reverse iterator to the beginning @since version 1.0.0 */ reverse_iterator rend() noexcept { return reverse_iterator(begin()); } /*! @copydoc basic_json::crend() */ const_reverse_iterator rend() const noexcept { return crend(); } /*! @brief returns a const reverse iterator to the last element Returns a const iterator to the reverse-beginning; that is, the last element. @image html range-rbegin-rend.svg "Illustration from cppreference.com" @complexity Constant. @requirement This function helps `basic_json` satisfying the [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirements: - The complexity is constant. - Has the semantics of `const_cast(*this).rbegin()`. @liveexample{The following code shows an example for `crbegin()`.,crbegin} @sa @ref rbegin() -- returns a reverse iterator to the beginning @sa @ref rend() -- returns a reverse iterator to the end @sa @ref crend() -- returns a const reverse iterator to the end @since version 1.0.0 */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); } /*! @brief returns a const reverse iterator to one before the first Returns a const reverse iterator to the reverse-end; that is, one before the first element. @image html range-rbegin-rend.svg "Illustration from cppreference.com" @complexity Constant. @requirement This function helps `basic_json` satisfying the [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirements: - The complexity is constant. - Has the semantics of `const_cast(*this).rend()`. @liveexample{The following code shows an example for `crend()`.,crend} @sa @ref rend() -- returns a reverse iterator to the end @sa @ref rbegin() -- returns a reverse iterator to the beginning @sa @ref crbegin() -- returns a const reverse iterator to the beginning @since version 1.0.0 */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); } public: /*! @brief wrapper to access iterator member functions in range-based for This function allows to access @ref iterator::key() and @ref iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator. For loop without iterator_wrapper: @code{cpp} for (auto it = j_object.begin(); it != j_object.end(); ++it) { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; } @endcode Range-based for loop without iterator proxy: @code{cpp} for (auto it : j_object) { // "it" is of type json::reference and has no key() member std::cout << "value: " << it << '\n'; } @endcode Range-based for loop with iterator proxy: @code{cpp} for (auto it : json::iterator_wrapper(j_object)) { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; } @endcode @note When iterating over an array, `key()` will return the index of the element as string (see example). @param[in] ref reference to a JSON value @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops @liveexample{The following code shows how the wrapper is used,iterator_wrapper} @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @note The name of this function is not yet final and may change in the future. @deprecated This stream operator is deprecated and will be removed in future 4.0.0 of the library. Please use @ref items() instead; that is, replace `json::iterator_wrapper(j)` with `j.items()`. */ JSON_DEPRECATED static iteration_proxy iterator_wrapper(reference ref) noexcept { return ref.items(); } /*! @copydoc iterator_wrapper(reference) */ JSON_DEPRECATED static iteration_proxy iterator_wrapper(const_reference ref) noexcept { return ref.items(); } /*! @brief helper to access iterator member functions in range-based for This function allows to access @ref iterator::key() and @ref iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator. For loop without `items()` function: @code{cpp} for (auto it = j_object.begin(); it != j_object.end(); ++it) { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; } @endcode Range-based for loop without `items()` function: @code{cpp} for (auto it : j_object) { // "it" is of type json::reference and has no key() member std::cout << "value: " << it << '\n'; } @endcode Range-based for loop with `items()` function: @code{cpp} for (auto it : j_object.items()) { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; } @endcode @note When iterating over an array, `key()` will return the index of the element as string (see example). For primitive types (e.g., numbers), `key()` returns an empty string. @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops @liveexample{The following code shows how the function is used.,items} @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @since version 3.x.x. */ iteration_proxy items() noexcept { return iteration_proxy(*this); } /*! @copydoc items() */ iteration_proxy items() const noexcept { return iteration_proxy(*this); } /// @} ////////////// // capacity // ////////////// /// @name capacity /// @{ /*! @brief checks whether the container is empty. Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `true` boolean | `false` string | `false` number | `false` object | result of function `object_t::empty()` array | result of function `array_t::empty()` @liveexample{The following code uses `empty()` to check if a JSON object contains any elements.,empty} @complexity Constant, as long as @ref array_t and @ref object_t satisfy the Container concept; that is, their `empty()` functions have constant complexity. @iterators No changes. @exceptionsafety No-throw guarantee: this function never throws exceptions. @note This function does not return whether a string stored as JSON value is empty - it returns whether the JSON container itself is empty which is false in the case of a string. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. - Has the semantics of `begin() == end()`. @sa @ref size() -- returns the number of elements @since version 1.0.0 */ bool empty() const noexcept { switch (m_type) { case value_t::null: { // null values are empty return true; } case value_t::array: { // delegate call to array_t::empty() return m_value.array->empty(); } case value_t::object: { // delegate call to object_t::empty() return m_value.object->empty(); } default: { // all other types are nonempty return false; } } } /*! @brief returns the number of elements Returns the number of elements in a JSON value. @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `0` boolean | `1` string | `1` number | `1` object | result of function object_t::size() array | result of function array_t::size() @liveexample{The following code calls `size()` on the different value types.,size} @complexity Constant, as long as @ref array_t and @ref object_t satisfy the Container concept; that is, their size() functions have constant complexity. @iterators No changes. @exceptionsafety No-throw guarantee: this function never throws exceptions. @note This function does not return the length of a string stored as JSON value - it returns the number of elements in the JSON value which is 1 in the case of a string. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. - Has the semantics of `std::distance(begin(), end())`. @sa @ref empty() -- checks whether the container is empty @sa @ref max_size() -- returns the maximal number of elements @since version 1.0.0 */ size_type size() const noexcept { switch (m_type) { case value_t::null: { // null values are empty return 0; } case value_t::array: { // delegate call to array_t::size() return m_value.array->size(); } case value_t::object: { // delegate call to object_t::size() return m_value.object->size(); } default: { // all other types have size 1 return 1; } } } /*! @brief returns the maximum possible number of elements Returns the maximum number of elements a JSON value is able to hold due to system or library implementation limitations, i.e. `std::distance(begin(), end())` for the JSON value. @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- null | `0` (same as `size()`) boolean | `1` (same as `size()`) string | `1` (same as `size()`) number | `1` (same as `size()`) object | result of function `object_t::max_size()` array | result of function `array_t::max_size()` @liveexample{The following code calls `max_size()` on the different value types. Note the output is implementation specific.,max_size} @complexity Constant, as long as @ref array_t and @ref object_t satisfy the Container concept; that is, their `max_size()` functions have constant complexity. @iterators No changes. @exceptionsafety No-throw guarantee: this function never throws exceptions. @requirement This function helps `basic_json` satisfying the [Container](http://en.cppreference.com/w/cpp/concept/Container) requirements: - The complexity is constant. - Has the semantics of returning `b.size()` where `b` is the largest possible JSON value. @sa @ref size() -- returns the number of elements @since version 1.0.0 */ size_type max_size() const noexcept { switch (m_type) { case value_t::array: { // delegate call to array_t::max_size() return m_value.array->max_size(); } case value_t::object: { // delegate call to object_t::max_size() return m_value.object->max_size(); } default: { // all other types have max_size() == size() return size(); } } } /// @} /////////////// // modifiers // /////////////// /// @name modifiers /// @{ /*! @brief clears the contents Clears the content of a JSON value and resets it to the default value as if @ref basic_json(value_t) would have been called with the current value type from @ref type(): Value type | initial value ----------- | ------------- null | `null` boolean | `false` string | `""` number | `0` object | `{}` array | `[]` @post Has the same effect as calling @code {.cpp} *this = basic_json(type()); @endcode @liveexample{The example below shows the effect of `clear()` to different JSON types.,clear} @complexity Linear in the size of the JSON value. @iterators All iterators, pointers and references related to this container are invalidated. @exceptionsafety No-throw guarantee: this function never throws exceptions. @sa @ref basic_json(value_t) -- constructor that creates an object with the same value than calling `clear()` @since version 1.0.0 */ void clear() noexcept { switch (m_type) { case value_t::number_integer: { m_value.number_integer = 0; break; } case value_t::number_unsigned: { m_value.number_unsigned = 0; break; } case value_t::number_float: { m_value.number_float = 0.0; break; } case value_t::boolean: { m_value.boolean = false; break; } case value_t::string: { m_value.string->clear(); break; } case value_t::array: { m_value.array->clear(); break; } case value_t::object: { m_value.object->clear(); break; } default: break; } } /*! @brief add an object to an array Appends the given element @a val to the end of the JSON value. If the function is called on a JSON null value, an empty array is created before appending @a val. @param[in] val the value to add to the JSON array @throw type_error.308 when called on a type other than JSON array or null; example: `"cannot use push_back() with number"` @complexity Amortized constant. @liveexample{The example shows how `push_back()` and `+=` can be used to add elements to a JSON array. Note how the `null` value was silently converted to a JSON array.,push_back} @since version 1.0.0 */ void push_back(basic_json&& val) { // push_back only works for null objects or arrays if (JSON_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); } // transform null object into an array if (is_null()) { m_type = value_t::array; m_value = value_t::array; assert_invariant(); } // add element to array (move semantics) m_value.array->push_back(std::move(val)); // invalidate object val.m_type = value_t::null; } /*! @brief add an object to an array @copydoc push_back(basic_json&&) */ reference operator+=(basic_json&& val) { push_back(std::move(val)); return *this; } /*! @brief add an object to an array @copydoc push_back(basic_json&&) */ void push_back(const basic_json& val) { // push_back only works for null objects or arrays if (JSON_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); } // transform null object into an array if (is_null()) { m_type = value_t::array; m_value = value_t::array; assert_invariant(); } // add element to array m_value.array->push_back(val); } /*! @brief add an object to an array @copydoc push_back(basic_json&&) */ reference operator+=(const basic_json& val) { push_back(val); return *this; } /*! @brief add an object to an object Inserts the given element @a val to the JSON object. If the function is called on a JSON null value, an empty object is created before inserting @a val. @param[in] val the value to add to the JSON object @throw type_error.308 when called on a type other than JSON object or null; example: `"cannot use push_back() with number"` @complexity Logarithmic in the size of the container, O(log(`size()`)). @liveexample{The example shows how `push_back()` and `+=` can be used to add elements to a JSON object. Note how the `null` value was silently converted to a JSON object.,push_back__object_t__value} @since version 1.0.0 */ void push_back(const typename object_t::value_type& val) { // push_back only works for null objects or objects if (JSON_UNLIKELY(not(is_null() or is_object()))) { JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); } // transform null object into an object if (is_null()) { m_type = value_t::object; m_value = value_t::object; assert_invariant(); } // add element to array m_value.object->insert(val); } /*! @brief add an object to an object @copydoc push_back(const typename object_t::value_type&) */ reference operator+=(const typename object_t::value_type& val) { push_back(val); return *this; } /*! @brief add an object to an object This function allows to use `push_back` with an initializer list. In case 1. the current value is an object, 2. the initializer list @a init contains only two elements, and 3. the first element of @a init is a string, @a init is converted into an object element and added using @ref push_back(const typename object_t::value_type&). Otherwise, @a init is converted to a JSON value and added using @ref push_back(basic_json&&). @param[in] init an initializer list @complexity Linear in the size of the initializer list @a init. @note This function is required to resolve an ambiguous overload error, because pairs like `{"key", "value"}` can be both interpreted as `object_t::value_type` or `std::initializer_list`, see https://github.com/nlohmann/json/issues/235 for more information. @liveexample{The example shows how initializer lists are treated as objects when possible.,push_back__initializer_list} */ void push_back(initializer_list_t init) { if (is_object() and init.size() == 2 and (*init.begin())->is_string()) { basic_json&& key = init.begin()->moved_or_copied(); push_back(typename object_t::value_type( std::move(key.get_ref()), (init.begin() + 1)->moved_or_copied())); } else { push_back(basic_json(init)); } } /*! @brief add an object to an object @copydoc push_back(initializer_list_t) */ reference operator+=(initializer_list_t init) { push_back(init); return *this; } /*! @brief add an object to an array Creates a JSON value from the passed parameters @a args to the end of the JSON value. If the function is called on a JSON null value, an empty array is created before appending the value created from @a args. @param[in] args arguments to forward to a constructor of @ref basic_json @tparam Args compatible types to create a @ref basic_json object @throw type_error.311 when called on a type other than JSON array or null; example: `"cannot use emplace_back() with number"` @complexity Amortized constant. @liveexample{The example shows how `push_back()` can be used to add elements to a JSON array. Note how the `null` value was silently converted to a JSON array.,emplace_back} @since version 2.0.8 */ template void emplace_back(Args&& ... args) { // emplace_back only works for null objects or arrays if (JSON_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name()))); } // transform null object into an array if (is_null()) { m_type = value_t::array; m_value = value_t::array; assert_invariant(); } // add element to array (perfect forwarding) m_value.array->emplace_back(std::forward(args)...); } /*! @brief add an object to an object if key does not exist Inserts a new element into a JSON object constructed in-place with the given @a args if there is no element with the key in the container. If the function is called on a JSON null value, an empty object is created before appending the value created from @a args. @param[in] args arguments to forward to a constructor of @ref basic_json @tparam Args compatible types to create a @ref basic_json object @return a pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happened, and a bool denoting whether the insertion took place. @throw type_error.311 when called on a type other than JSON object or null; example: `"cannot use emplace() with number"` @complexity Logarithmic in the size of the container, O(log(`size()`)). @liveexample{The example shows how `emplace()` can be used to add elements to a JSON object. Note how the `null` value was silently converted to a JSON object. Further note how no value is added if there was already one value stored with the same key.,emplace} @since version 2.0.8 */ template std::pair emplace(Args&& ... args) { // emplace only works for null objects or arrays if (JSON_UNLIKELY(not(is_null() or is_object()))) { JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name()))); } // transform null object into an object if (is_null()) { m_type = value_t::object; m_value = value_t::object; assert_invariant(); } // add element to array (perfect forwarding) auto res = m_value.object->emplace(std::forward(args)...); // create result iterator and set iterator to the result of emplace auto it = begin(); it.m_it.object_iterator = res.first; // return pair of iterator and boolean return {it, res.second}; } /*! @brief inserts element Inserts element @a val before iterator @a pos. @param[in] pos iterator before which the content will be inserted; may be the end() iterator @param[in] val element to insert @return iterator pointing to the inserted @a val. @throw type_error.309 if called on JSON values other than arrays; example: `"cannot use insert() with string"` @throw invalid_iterator.202 if @a pos is not an iterator of *this; example: `"iterator does not fit current value"` @complexity Constant plus linear in the distance between @a pos and end of the container. @liveexample{The example shows how `insert()` is used.,insert} @since version 1.0.0 */ iterator insert(const_iterator pos, const basic_json& val) { // insert only works for arrays if (JSON_LIKELY(is_array())) { // check if iterator pos fits to this JSON value if (JSON_UNLIKELY(pos.m_object != this)) { JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); } // insert to array and return iterator iterator result(this); result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val); return result; } JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); } /*! @brief inserts element @copydoc insert(const_iterator, const basic_json&) */ iterator insert(const_iterator pos, basic_json&& val) { return insert(pos, val); } /*! @brief inserts elements Inserts @a cnt copies of @a val before iterator @a pos. @param[in] pos iterator before which the content will be inserted; may be the end() iterator @param[in] cnt number of copies of @a val to insert @param[in] val element to insert @return iterator pointing to the first element inserted, or @a pos if `cnt==0` @throw type_error.309 if called on JSON values other than arrays; example: `"cannot use insert() with string"` @throw invalid_iterator.202 if @a pos is not an iterator of *this; example: `"iterator does not fit current value"` @complexity Linear in @a cnt plus linear in the distance between @a pos and end of the container. @liveexample{The example shows how `insert()` is used.,insert__count} @since version 1.0.0 */ iterator insert(const_iterator pos, size_type cnt, const basic_json& val) { // insert only works for arrays if (JSON_LIKELY(is_array())) { // check if iterator pos fits to this JSON value if (JSON_UNLIKELY(pos.m_object != this)) { JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); } // insert to array and return iterator iterator result(this); result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val); return result; } JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); } /*! @brief inserts elements Inserts elements from range `[first, last)` before iterator @a pos. @param[in] pos iterator before which the content will be inserted; may be the end() iterator @param[in] first begin of the range of elements to insert @param[in] last end of the range of elements to insert @throw type_error.309 if called on JSON values other than arrays; example: `"cannot use insert() with string"` @throw invalid_iterator.202 if @a pos is not an iterator of *this; example: `"iterator does not fit current value"` @throw invalid_iterator.210 if @a first and @a last do not belong to the same JSON value; example: `"iterators do not fit"` @throw invalid_iterator.211 if @a first or @a last are iterators into container for which insert is called; example: `"passed iterators may not belong to container"` @return iterator pointing to the first element inserted, or @a pos if `first==last` @complexity Linear in `std::distance(first, last)` plus linear in the distance between @a pos and end of the container. @liveexample{The example shows how `insert()` is used.,insert__range} @since version 1.0.0 */ iterator insert(const_iterator pos, const_iterator first, const_iterator last) { // insert only works for arrays if (JSON_UNLIKELY(not is_array())) { JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); } // check if iterator pos fits to this JSON value if (JSON_UNLIKELY(pos.m_object != this)) { JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); } // check if range iterators belong to the same JSON object if (JSON_UNLIKELY(first.m_object != last.m_object)) { JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); } if (JSON_UNLIKELY(first.m_object == this)) { JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container")); } // insert to array and return iterator iterator result(this); result.m_it.array_iterator = m_value.array->insert( pos.m_it.array_iterator, first.m_it.array_iterator, last.m_it.array_iterator); return result; } /*! @brief inserts elements Inserts elements from initializer list @a ilist before iterator @a pos. @param[in] pos iterator before which the content will be inserted; may be the end() iterator @param[in] ilist initializer list to insert the values from @throw type_error.309 if called on JSON values other than arrays; example: `"cannot use insert() with string"` @throw invalid_iterator.202 if @a pos is not an iterator of *this; example: `"iterator does not fit current value"` @return iterator pointing to the first element inserted, or @a pos if `ilist` is empty @complexity Linear in `ilist.size()` plus linear in the distance between @a pos and end of the container. @liveexample{The example shows how `insert()` is used.,insert__ilist} @since version 1.0.0 */ iterator insert(const_iterator pos, initializer_list_t ilist) { // insert only works for arrays if (JSON_UNLIKELY(not is_array())) { JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); } // check if iterator pos fits to this JSON value if (JSON_UNLIKELY(pos.m_object != this)) { JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); } // insert to array and return iterator iterator result(this); result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist.begin(), ilist.end()); return result; } /*! @brief inserts elements Inserts elements from range `[first, last)`. @param[in] first begin of the range of elements to insert @param[in] last end of the range of elements to insert @throw type_error.309 if called on JSON values other than objects; example: `"cannot use insert() with string"` @throw invalid_iterator.202 if iterator @a first or @a last does does not point to an object; example: `"iterators first and last must point to objects"` @throw invalid_iterator.210 if @a first and @a last do not belong to the same JSON value; example: `"iterators do not fit"` @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number of elements to insert. @liveexample{The example shows how `insert()` is used.,insert__range_object} @since version 3.0.0 */ void insert(const_iterator first, const_iterator last) { // insert only works for objects if (JSON_UNLIKELY(not is_object())) { JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); } // check if range iterators belong to the same JSON object if (JSON_UNLIKELY(first.m_object != last.m_object)) { JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); } // passed iterators must belong to objects if (JSON_UNLIKELY(not first.m_object->is_object())) { JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); } m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator); } /*! @brief updates a JSON object from another object, overwriting existing keys Inserts all values from JSON object @a j and overwrites existing keys. @param[in] j JSON object to read values from @throw type_error.312 if called on JSON values other than objects; example: `"cannot use update() with string"` @complexity O(N*log(size() + N)), where N is the number of elements to insert. @liveexample{The example shows how `update()` is used.,update} @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update @since version 3.0.0 */ void update(const_reference j) { // implicitly convert null value to an empty object if (is_null()) { m_type = value_t::object; m_value.object = create(); assert_invariant(); } if (JSON_UNLIKELY(not is_object())) { JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); } if (JSON_UNLIKELY(not j.is_object())) { JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name()))); } for (auto it = j.cbegin(); it != j.cend(); ++it) { m_value.object->operator[](it.key()) = it.value(); } } /*! @brief updates a JSON object from another object, overwriting existing keys Inserts all values from from range `[first, last)` and overwrites existing keys. @param[in] first begin of the range of elements to insert @param[in] last end of the range of elements to insert @throw type_error.312 if called on JSON values other than objects; example: `"cannot use update() with string"` @throw invalid_iterator.202 if iterator @a first or @a last does does not point to an object; example: `"iterators first and last must point to objects"` @throw invalid_iterator.210 if @a first and @a last do not belong to the same JSON value; example: `"iterators do not fit"` @complexity O(N*log(size() + N)), where N is the number of elements to insert. @liveexample{The example shows how `update()` is used__range.,update} @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update @since version 3.0.0 */ void update(const_iterator first, const_iterator last) { // implicitly convert null value to an empty object if (is_null()) { m_type = value_t::object; m_value.object = create(); assert_invariant(); } if (JSON_UNLIKELY(not is_object())) { JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); } // check if range iterators belong to the same JSON object if (JSON_UNLIKELY(first.m_object != last.m_object)) { JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); } // passed iterators must belong to objects if (JSON_UNLIKELY(not first.m_object->is_object() or not last.m_object->is_object())) { JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); } for (auto it = first; it != last; ++it) { m_value.object->operator[](it.key()) = it.value(); } } /*! @brief exchanges the values Exchanges the contents of the JSON value with those of @a other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. @param[in,out] other JSON value to exchange the contents with @complexity Constant. @liveexample{The example below shows how JSON values can be swapped with `swap()`.,swap__reference} @since version 1.0.0 */ void swap(reference other) noexcept ( std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value and std::is_nothrow_move_constructible::value and std::is_nothrow_move_assignable::value ) { std::swap(m_type, other.m_type); std::swap(m_value, other.m_value); assert_invariant(); } /*! @brief exchanges the values Exchanges the contents of a JSON array with those of @a other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. @param[in,out] other array to exchange the contents with @throw type_error.310 when JSON value is not an array; example: `"cannot use swap() with string"` @complexity Constant. @liveexample{The example below shows how arrays can be swapped with `swap()`.,swap__array_t} @since version 1.0.0 */ void swap(array_t& other) { // swap only works for arrays if (JSON_LIKELY(is_array())) { std::swap(*(m_value.array), other); } else { JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); } } /*! @brief exchanges the values Exchanges the contents of a JSON object with those of @a other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. @param[in,out] other object to exchange the contents with @throw type_error.310 when JSON value is not an object; example: `"cannot use swap() with string"` @complexity Constant. @liveexample{The example below shows how objects can be swapped with `swap()`.,swap__object_t} @since version 1.0.0 */ void swap(object_t& other) { // swap only works for objects if (JSON_LIKELY(is_object())) { std::swap(*(m_value.object), other); } else { JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); } } /*! @brief exchanges the values Exchanges the contents of a JSON string with those of @a other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. @param[in,out] other string to exchange the contents with @throw type_error.310 when JSON value is not a string; example: `"cannot use swap() with boolean"` @complexity Constant. @liveexample{The example below shows how strings can be swapped with `swap()`.,swap__string_t} @since version 1.0.0 */ void swap(string_t& other) { // swap only works for strings if (JSON_LIKELY(is_string())) { std::swap(*(m_value.string), other); } else { JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); } } /// @} public: ////////////////////////////////////////// // lexicographical comparison operators // ////////////////////////////////////////// /// @name lexicographical comparison operators /// @{ /*! @brief comparison: equal Compares two JSON values for equality according to the following rules: - Two JSON values are equal if (1) they are from the same type and (2) their stored values are the same according to their respective `operator==`. - Integer and floating-point numbers are automatically converted before comparison. Note than two NaN values are always treated as unequal. - Two JSON null values are equal. @note Floating-point inside JSON values numbers are compared with `json::number_float_t::operator==` which is `double::operator==` by default. To compare floating-point while respecting an epsilon, an alternative [comparison function](https://github.com/mariokonrad/marnav/blob/master/src/marnav/math/floatingpoint.hpp#L34-#L39) could be used, for instance @code {.cpp} template::value, T>::type> inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept { return std::abs(a - b) <= epsilon; } @endcode @note NaN values never compare equal to themselves or to other NaN values. @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether the values @a lhs and @a rhs are equal @exceptionsafety No-throw guarantee: this function never throws exceptions. @complexity Linear. @liveexample{The example demonstrates comparing several JSON types.,operator__equal} @since version 1.0.0 */ friend bool operator==(const_reference lhs, const_reference rhs) noexcept { const auto lhs_type = lhs.type(); const auto rhs_type = rhs.type(); if (lhs_type == rhs_type) { switch (lhs_type) { case value_t::array: return (*lhs.m_value.array == *rhs.m_value.array); case value_t::object: return (*lhs.m_value.object == *rhs.m_value.object); case value_t::null: return true; case value_t::string: return (*lhs.m_value.string == *rhs.m_value.string); case value_t::boolean: return (lhs.m_value.boolean == rhs.m_value.boolean); case value_t::number_integer: return (lhs.m_value.number_integer == rhs.m_value.number_integer); case value_t::number_unsigned: return (lhs.m_value.number_unsigned == rhs.m_value.number_unsigned); case value_t::number_float: return (lhs.m_value.number_float == rhs.m_value.number_float); default: return false; } } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { return (static_cast(lhs.m_value.number_integer) == rhs.m_value.number_float); } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) { return (lhs.m_value.number_float == static_cast(rhs.m_value.number_integer)); } else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) { return (static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_float); } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) { return (lhs.m_value.number_float == static_cast(rhs.m_value.number_unsigned)); } else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) { return (static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_integer); } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) { return (lhs.m_value.number_integer == static_cast(rhs.m_value.number_unsigned)); } return false; } /*! @brief comparison: equal @copydoc operator==(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept { return (lhs == basic_json(rhs)); } /*! @brief comparison: equal @copydoc operator==(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) == rhs); } /*! @brief comparison: not equal Compares two JSON values for inequality by calculating `not (lhs == rhs)`. @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether the values @a lhs and @a rhs are not equal @complexity Linear. @exceptionsafety No-throw guarantee: this function never throws exceptions. @liveexample{The example demonstrates comparing several JSON types.,operator__notequal} @since version 1.0.0 */ friend bool operator!=(const_reference lhs, const_reference rhs) noexcept { return not (lhs == rhs); } /*! @brief comparison: not equal @copydoc operator!=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept { return (lhs != basic_json(rhs)); } /*! @brief comparison: not equal @copydoc operator!=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) != rhs); } /*! @brief comparison: less than Compares whether one JSON value @a lhs is less than another JSON value @a rhs according to the following rules: - If @a lhs and @a rhs have the same type, the values are compared using the default `<` operator. - Integer and floating-point numbers are automatically converted before comparison - In case @a lhs and @a rhs have different types, the values are ignored and the order of the types is considered, see @ref operator<(const value_t, const value_t). @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether @a lhs is less than @a rhs @complexity Linear. @exceptionsafety No-throw guarantee: this function never throws exceptions. @liveexample{The example demonstrates comparing several JSON types.,operator__less} @since version 1.0.0 */ friend bool operator<(const_reference lhs, const_reference rhs) noexcept { const auto lhs_type = lhs.type(); const auto rhs_type = rhs.type(); if (lhs_type == rhs_type) { switch (lhs_type) { case value_t::array: return (*lhs.m_value.array) < (*rhs.m_value.array); case value_t::object: return *lhs.m_value.object < *rhs.m_value.object; case value_t::null: return false; case value_t::string: return *lhs.m_value.string < *rhs.m_value.string; case value_t::boolean: return lhs.m_value.boolean < rhs.m_value.boolean; case value_t::number_integer: return lhs.m_value.number_integer < rhs.m_value.number_integer; case value_t::number_unsigned: return lhs.m_value.number_unsigned < rhs.m_value.number_unsigned; case value_t::number_float: return lhs.m_value.number_float < rhs.m_value.number_float; default: return false; } } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) { return static_cast(lhs.m_value.number_integer) < rhs.m_value.number_float; } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) { return lhs.m_value.number_float < static_cast(rhs.m_value.number_integer); } else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) { return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_float; } else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) { return lhs.m_value.number_float < static_cast(rhs.m_value.number_unsigned); } else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) { return lhs.m_value.number_integer < static_cast(rhs.m_value.number_unsigned); } else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) { return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_integer; } // We only reach this line if we cannot compare values. In that case, // we compare types. Note we have to call the operator explicitly, // because MSVC has problems otherwise. return operator<(lhs_type, rhs_type); } /*! @brief comparison: less than @copydoc operator<(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept { return (lhs < basic_json(rhs)); } /*! @brief comparison: less than @copydoc operator<(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) < rhs); } /*! @brief comparison: less than or equal Compares whether one JSON value @a lhs is less than or equal to another JSON value by calculating `not (rhs < lhs)`. @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether @a lhs is less than or equal to @a rhs @complexity Linear. @exceptionsafety No-throw guarantee: this function never throws exceptions. @liveexample{The example demonstrates comparing several JSON types.,operator__greater} @since version 1.0.0 */ friend bool operator<=(const_reference lhs, const_reference rhs) noexcept { return not (rhs < lhs); } /*! @brief comparison: less than or equal @copydoc operator<=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept { return (lhs <= basic_json(rhs)); } /*! @brief comparison: less than or equal @copydoc operator<=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) <= rhs); } /*! @brief comparison: greater than Compares whether one JSON value @a lhs is greater than another JSON value by calculating `not (lhs <= rhs)`. @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether @a lhs is greater than to @a rhs @complexity Linear. @exceptionsafety No-throw guarantee: this function never throws exceptions. @liveexample{The example demonstrates comparing several JSON types.,operator__lessequal} @since version 1.0.0 */ friend bool operator>(const_reference lhs, const_reference rhs) noexcept { return not (lhs <= rhs); } /*! @brief comparison: greater than @copydoc operator>(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept { return (lhs > basic_json(rhs)); } /*! @brief comparison: greater than @copydoc operator>(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) > rhs); } /*! @brief comparison: greater than or equal Compares whether one JSON value @a lhs is greater than or equal to another JSON value by calculating `not (lhs < rhs)`. @param[in] lhs first JSON value to consider @param[in] rhs second JSON value to consider @return whether @a lhs is greater than or equal to @a rhs @complexity Linear. @exceptionsafety No-throw guarantee: this function never throws exceptions. @liveexample{The example demonstrates comparing several JSON types.,operator__greaterequal} @since version 1.0.0 */ friend bool operator>=(const_reference lhs, const_reference rhs) noexcept { return not (lhs < rhs); } /*! @brief comparison: greater than or equal @copydoc operator>=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept { return (lhs >= basic_json(rhs)); } /*! @brief comparison: greater than or equal @copydoc operator>=(const_reference, const_reference) */ template::value, int>::type = 0> friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept { return (basic_json(lhs) >= rhs); } /// @} /////////////////// // serialization // /////////////////// /// @name serialization /// @{ /*! @brief serialize to stream Serialize the given JSON value @a j to the output stream @a o. The JSON value will be serialized using the @ref dump member function. - The indentation of the output can be controlled with the member variable `width` of the output stream @a o. For instance, using the manipulator `std::setw(4)` on @a o sets the indentation level to `4` and the serialization result is the same as calling `dump(4)`. - The indentation character can be controlled with the member variable `fill` of the output stream @a o. For instance, the manipulator `std::setfill('\\t')` sets indentation to use a tab character rather than the default space character. @param[in,out] o stream to serialize to @param[in] j JSON value to serialize @return the stream @a o @throw type_error.316 if a string stored inside the JSON value is not UTF-8 encoded @complexity Linear. @liveexample{The example below shows the serialization with different parameters to `width` to adjust the indentation level.,operator_serialize} @since version 1.0.0; indentation character added in version 3.0.0 */ friend std::ostream& operator<<(std::ostream& o, const basic_json& j) { // read width member and use it as indentation parameter if nonzero const bool pretty_print = (o.width() > 0); const auto indentation = (pretty_print ? o.width() : 0); // reset width to 0 for subsequent calls to this stream o.width(0); // do the actual serialization serializer s(detail::output_adapter(o), o.fill()); s.dump(j, pretty_print, false, static_cast(indentation)); return o; } /*! @brief serialize to stream @deprecated This stream operator is deprecated and will be removed in future 4.0.0 of the library. Please use @ref operator<<(std::ostream&, const basic_json&) instead; that is, replace calls like `j >> o;` with `o << j;`. @since version 1.0.0; deprecated since version 3.0.0 */ JSON_DEPRECATED friend std::ostream& operator>>(const basic_json& j, std::ostream& o) { return o << j; } /// @} ///////////////////// // deserialization // ///////////////////// /// @name deserialization /// @{ /*! @brief deserialize from a compatible input This function reads from a compatible input. Examples are: - an array of 1-byte values - strings with character/literal type with size of 1 byte - input streams - container with contiguous storage of 1-byte values. Compatible container types include `std::vector`, `std::string`, `std::array`, `std::valarray`, and `std::initializer_list`. Furthermore, C-style arrays can be used with `std::begin()`/`std::end()`. User-defined containers can be used as long as they implement random-access iterators and a contiguous storage. @pre Each element of the container has a size of 1 byte. Violating this precondition yields undefined behavior. **This precondition is enforced with a static assertion.** @pre The container storage is contiguous. Violating this precondition yields undefined behavior. **This precondition is enforced with an assertion.** @pre Each element of the container has a size of 1 byte. Violating this precondition yields undefined behavior. **This precondition is enforced with a static assertion.** @warning There is no way to enforce all preconditions at compile-time. If the function is called with a noncompliant container and with assertions switched off, the behavior is undefined and will most likely yield segmentation violation. @param[in] i input to read from @param[in] cb a parser callback function of type @ref parser_callback_t which is used to control the deserialization by filtering unwanted values (optional) @return result of the deserialization @throw parse_error.101 if a parse error occurs; example: `""unexpected end of input; expected string literal""` @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails @complexity Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function @a cb has a super-linear complexity. @note A UTF-8 byte order mark is silently ignored. @liveexample{The example below demonstrates the `parse()` function reading from an array.,parse__array__parser_callback_t} @liveexample{The example below demonstrates the `parse()` function with and without callback function.,parse__string__parser_callback_t} @liveexample{The example below demonstrates the `parse()` function with and without callback function.,parse__istream__parser_callback_t} @liveexample{The example below demonstrates the `parse()` function reading from a contiguous container.,parse__contiguouscontainer__parser_callback_t} @since version 2.0.3 (contiguous containers) */ static basic_json parse(detail::input_adapter i, const parser_callback_t cb = nullptr, const bool allow_exceptions = true) { basic_json result; parser(i, cb, allow_exceptions).parse(true, result); return result; } /*! @copydoc basic_json parse(detail::input_adapter, const parser_callback_t) */ static basic_json parse(detail::input_adapter& i, const parser_callback_t cb = nullptr, const bool allow_exceptions = true) { basic_json result; parser(i, cb, allow_exceptions).parse(true, result); return result; } static bool accept(detail::input_adapter i) { return parser(i).accept(true); } static bool accept(detail::input_adapter& i) { return parser(i).accept(true); } /*! @brief deserialize from an iterator range with contiguous storage This function reads from an iterator range of a container with contiguous storage of 1-byte values. Compatible container types include `std::vector`, `std::string`, `std::array`, `std::valarray`, and `std::initializer_list`. Furthermore, C-style arrays can be used with `std::begin()`/`std::end()`. User-defined containers can be used as long as they implement random-access iterators and a contiguous storage. @pre The iterator range is contiguous. Violating this precondition yields undefined behavior. **This precondition is enforced with an assertion.** @pre Each element in the range has a size of 1 byte. Violating this precondition yields undefined behavior. **This precondition is enforced with a static assertion.** @warning There is no way to enforce all preconditions at compile-time. If the function is called with noncompliant iterators and with assertions switched off, the behavior is undefined and will most likely yield segmentation violation. @tparam IteratorType iterator of container with contiguous storage @param[in] first begin of the range to parse (included) @param[in] last end of the range to parse (excluded) @param[in] cb a parser callback function of type @ref parser_callback_t which is used to control the deserialization by filtering unwanted values (optional) @param[in] allow_exceptions whether to throw exceptions in case of a parse error (optional, true by default) @return result of the deserialization @throw parse_error.101 in case of an unexpected token @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails @complexity Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function @a cb has a super-linear complexity. @note A UTF-8 byte order mark is silently ignored. @liveexample{The example below demonstrates the `parse()` function reading from an iterator range.,parse__iteratortype__parser_callback_t} @since version 2.0.3 */ template::iterator_category>::value, int>::type = 0> static basic_json parse(IteratorType first, IteratorType last, const parser_callback_t cb = nullptr, const bool allow_exceptions = true) { basic_json result; parser(detail::input_adapter(first, last), cb, allow_exceptions).parse(true, result); return result; } template::iterator_category>::value, int>::type = 0> static bool accept(IteratorType first, IteratorType last) { return parser(detail::input_adapter(first, last)).accept(true); } /*! @brief deserialize from stream @deprecated This stream operator is deprecated and will be removed in version 4.0.0 of the library. Please use @ref operator>>(std::istream&, basic_json&) instead; that is, replace calls like `j << i;` with `i >> j;`. @since version 1.0.0; deprecated since version 3.0.0 */ JSON_DEPRECATED friend std::istream& operator<<(basic_json& j, std::istream& i) { return operator>>(i, j); } /*! @brief deserialize from stream Deserializes an input stream to a JSON value. @param[in,out] i input stream to read a serialized JSON value from @param[in,out] j JSON value to write the deserialized input to @throw parse_error.101 in case of an unexpected token @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails @complexity Linear in the length of the input. The parser is a predictive LL(1) parser. @note A UTF-8 byte order mark is silently ignored. @liveexample{The example below shows how a JSON value is constructed by reading a serialization from a stream.,operator_deserialize} @sa parse(std::istream&, const parser_callback_t) for a variant with a parser callback function to filter values while parsing @since version 1.0.0 */ friend std::istream& operator>>(std::istream& i, basic_json& j) { parser(detail::input_adapter(i)).parse(false, j); return i; } /// @} /////////////////////////// // convenience functions // /////////////////////////// /*! @brief return the type as string Returns the type name as string to be used in error messages - usually to indicate that a function was called on a wrong JSON type. @return a string representation of a the @a m_type member: Value type | return value ----------- | ------------- null | `"null"` boolean | `"boolean"` string | `"string"` number | `"number"` (for all number types) object | `"object"` array | `"array"` discarded | `"discarded"` @exceptionsafety No-throw guarantee: this function never throws exceptions. @complexity Constant. @liveexample{The following code exemplifies `type_name()` for all JSON types.,type_name} @sa @ref type() -- return the type of the JSON value @sa @ref operator value_t() -- return the type of the JSON value (implicit) @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept` since 3.0.0 */ const char* type_name() const noexcept { { switch (m_type) { case value_t::null: return "null"; case value_t::object: return "object"; case value_t::array: return "array"; case value_t::string: return "string"; case value_t::boolean: return "boolean"; case value_t::discarded: return "discarded"; default: return "number"; } } } private: ////////////////////// // member variables // ////////////////////// /// the type of the current element value_t m_type = value_t::null; /// the value of the current element json_value m_value = {}; ////////////////////////////////////////// // binary serialization/deserialization // ////////////////////////////////////////// /// @name binary serialization/deserialization support /// @{ public: /*! @brief create a CBOR serialization of a given JSON value Serializes a given JSON value @a j to a byte vector using the CBOR (Concise Binary Object Representation) serialization format. CBOR is a binary serialization format which aims to be more compact than JSON itself, yet more efficient to parse. The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification (RFC 7049): JSON value type | value/range | CBOR type | first byte --------------- | ------------------------------------------ | ---------------------------------- | --------------- null | `null` | Null | 0xF6 boolean | `true` | True | 0xF5 boolean | `false` | False | 0xF4 number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39 number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38 number_integer | -24..-1 | Negative integer | 0x20..0x37 number_integer | 0..23 | Integer | 0x00..0x17 number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18 number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B number_unsigned | 0..23 | Integer | 0x00..0x17 number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18 number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B number_float | *any value* | Double-Precision Float | 0xFB string | *length*: 0..23 | UTF-8 string | 0x60..0x77 string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78 string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79 string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B array | *size*: 0..23 | array | 0x80..0x97 array | *size*: 23..255 | array (1 byte follow) | 0x98 array | *size*: 256..65535 | array (2 bytes follow) | 0x99 array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B object | *size*: 0..23 | map | 0xA0..0xB7 object | *size*: 23..255 | map (1 byte follow) | 0xB8 object | *size*: 256..65535 | map (2 bytes follow) | 0xB9 object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB @note The mapping is **complete** in the sense that any JSON value type can be converted to a CBOR value. @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. @note The following CBOR types are not used in the conversion: - byte strings (0x40..0x5F) - UTF-8 strings terminated by "break" (0x7F) - arrays terminated by "break" (0x9F) - maps terminated by "break" (0xBF) - date/time (0xC0..0xC1) - bignum (0xC2..0xC3) - decimal fraction (0xC4) - bigfloat (0xC5) - tagged items (0xC6..0xD4, 0xD8..0xDB) - expected conversions (0xD5..0xD7) - simple values (0xE0..0xF3, 0xF8) - undefined (0xF7) - half and single-precision floats (0xF9-0xFA) - break (0xFF) @param[in] j JSON value to serialize @return MessagePack serialization as byte vector @complexity Linear in the size of the JSON value @a j. @liveexample{The example shows the serialization of a JSON value to a byte vector in CBOR format.,to_cbor} @sa http://cbor.io @sa @ref from_cbor(detail::input_adapter, const bool strict) for the analogous deserialization @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format @since version 2.0.9 */ static std::vector to_cbor(const basic_json& j) { std::vector result; to_cbor(j, result); return result; } static void to_cbor(const basic_json& j, detail::output_adapter o) { binary_writer(o).write_cbor(j); } static void to_cbor(const basic_json& j, detail::output_adapter o) { binary_writer(o).write_cbor(j); } /*! @brief create a MessagePack serialization of a given JSON value Serializes a given JSON value @a j to a byte vector using the MessagePack serialization format. MessagePack is a binary serialization format which aims to be more compact than JSON itself, yet more efficient to parse. The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack specification: JSON value type | value/range | MessagePack type | first byte --------------- | --------------------------------- | ---------------- | ---------- null | `null` | nil | 0xC0 boolean | `true` | true | 0xC3 boolean | `false` | false | 0xC2 number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3 number_integer | -2147483648..-32769 | int32 | 0xD2 number_integer | -32768..-129 | int16 | 0xD1 number_integer | -128..-33 | int8 | 0xD0 number_integer | -32..-1 | negative fixint | 0xE0..0xFF number_integer | 0..127 | positive fixint | 0x00..0x7F number_integer | 128..255 | uint 8 | 0xCC number_integer | 256..65535 | uint 16 | 0xCD number_integer | 65536..4294967295 | uint 32 | 0xCE number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF number_unsigned | 0..127 | positive fixint | 0x00..0x7F number_unsigned | 128..255 | uint 8 | 0xCC number_unsigned | 256..65535 | uint 16 | 0xCD number_unsigned | 65536..4294967295 | uint 32 | 0xCE number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF number_float | *any value* | float 64 | 0xCB string | *length*: 0..31 | fixstr | 0xA0..0xBF string | *length*: 32..255 | str 8 | 0xD9 string | *length*: 256..65535 | str 16 | 0xDA string | *length*: 65536..4294967295 | str 32 | 0xDB array | *size*: 0..15 | fixarray | 0x90..0x9F array | *size*: 16..65535 | array 16 | 0xDC array | *size*: 65536..4294967295 | array 32 | 0xDD object | *size*: 0..15 | fix map | 0x80..0x8F object | *size*: 16..65535 | map 16 | 0xDE object | *size*: 65536..4294967295 | map 32 | 0xDF @note The mapping is **complete** in the sense that any JSON value type can be converted to a MessagePack value. @note The following values can **not** be converted to a MessagePack value: - strings with more than 4294967295 bytes - arrays with more than 4294967295 elements - objects with more than 4294967295 elements @note The following MessagePack types are not used in the conversion: - bin 8 - bin 32 (0xC4..0xC6) - ext 8 - ext 32 (0xC7..0xC9) - float 32 (0xCA) - fixext 1 - fixext 16 (0xD4..0xD8) @note Any MessagePack output created @ref to_msgpack can be successfully parsed by @ref from_msgpack. @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. @param[in] j JSON value to serialize @return MessagePack serialization as byte vector @complexity Linear in the size of the JSON value @a j. @liveexample{The example shows the serialization of a JSON value to a byte vector in MessagePack format.,to_msgpack} @sa http://msgpack.org @sa @ref from_msgpack(const std::vector&, const size_t) for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format @since version 2.0.9 */ static std::vector to_msgpack(const basic_json& j) { std::vector result; to_msgpack(j, result); return result; } static void to_msgpack(const basic_json& j, detail::output_adapter o) { binary_writer(o).write_msgpack(j); } static void to_msgpack(const basic_json& j, detail::output_adapter o) { binary_writer(o).write_msgpack(j); } /*! @brief create a UBJSON serialization of a given JSON value Serializes a given JSON value @a j to a byte vector using the UBJSON (Universal Binary JSON) serialization format. UBJSON aims to be more compact than JSON itself, yet more efficient to parse. The library uses the following mapping from JSON values types to UBJSON types according to the UBJSON specification: JSON value type | value/range | UBJSON type | marker --------------- | --------------------------------- | ----------- | ------ null | `null` | null | `Z` boolean | `true` | true | `T` boolean | `false` | false | `F` number_integer | -9223372036854775808..-2147483649 | int64 | `L` number_integer | -2147483648..-32769 | int32 | `l` number_integer | -32768..-129 | int16 | `I` number_integer | -128..127 | int8 | `i` number_integer | 128..255 | uint8 | `U` number_integer | 256..32767 | int16 | `I` number_integer | 32768..2147483647 | int32 | `l` number_integer | 2147483648..9223372036854775807 | int64 | `L` number_unsigned | 0..127 | int8 | `i` number_unsigned | 128..255 | uint8 | `U` number_unsigned | 256..32767 | int16 | `I` number_unsigned | 32768..2147483647 | int32 | `l` number_unsigned | 2147483648..9223372036854775807 | int64 | `L` number_float | *any value* | float64 | `D` string | *with shortest length indicator* | string | `S` array | *see notes on optimized format* | array | `[` object | *see notes on optimized format* | map | `{` @note The mapping is **complete** in the sense that any JSON value type can be converted to a UBJSON value. @note The following values can **not** be converted to a UBJSON value: - strings with more than 9223372036854775807 bytes (theoretical) - unsigned integer numbers above 9223372036854775807 @note The following markers are not used in the conversion: - `Z`: no-op values are not created. - `C`: single-byte strings are serialized with `S` markers. @note Any UBJSON output created @ref to_ubjson can be successfully parsed by @ref from_ubjson. @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. @note The optimized formats for containers are supported: Parameter @a use_size adds size information to the beginning of a container and removes the closing marker. Parameter @a use_type further checks whether all elements of a container have the same type and adds the type marker to the beginning of the container. The @a use_type parameter must only be used together with @a use_size = true. Note that @a use_size = true alone may result in larger representations - the benefit of this parameter is that the receiving side is immediately informed on the number of elements of the container. @param[in] j JSON value to serialize @param[in] use_size whether to add size annotations to container types @param[in] use_type whether to add type annotations to container types (must be combined with @a use_size = true) @return UBJSON serialization as byte vector @complexity Linear in the size of the JSON value @a j. @liveexample{The example shows the serialization of a JSON value to a byte vector in UBJSON format.,to_ubjson} @sa http://ubjson.org @sa @ref from_ubjson(detail::input_adapter, const bool strict) for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @since version 3.1.0 */ static std::vector to_ubjson(const basic_json& j, const bool use_size = false, const bool use_type = false) { std::vector result; to_ubjson(j, result, use_size, use_type); return result; } static void to_ubjson(const basic_json& j, detail::output_adapter o, const bool use_size = false, const bool use_type = false) { binary_writer(o).write_ubjson(j, use_size, use_type); } static void to_ubjson(const basic_json& j, detail::output_adapter o, const bool use_size = false, const bool use_type = false) { binary_writer(o).write_ubjson(j, use_size, use_type); } /*! @brief create a JSON value from an input in CBOR format Deserializes a given input @a i to a JSON value using the CBOR (Concise Binary Object Representation) serialization format. The library maps CBOR types to JSON value types as follows: CBOR type | JSON value type | first byte ---------------------- | --------------- | ---------- Integer | number_unsigned | 0x00..0x17 Unsigned integer | number_unsigned | 0x18 Unsigned integer | number_unsigned | 0x19 Unsigned integer | number_unsigned | 0x1A Unsigned integer | number_unsigned | 0x1B Negative integer | number_integer | 0x20..0x37 Negative integer | number_integer | 0x38 Negative integer | number_integer | 0x39 Negative integer | number_integer | 0x3A Negative integer | number_integer | 0x3B Negative integer | number_integer | 0x40..0x57 UTF-8 string | string | 0x60..0x77 UTF-8 string | string | 0x78 UTF-8 string | string | 0x79 UTF-8 string | string | 0x7A UTF-8 string | string | 0x7B UTF-8 string | string | 0x7F array | array | 0x80..0x97 array | array | 0x98 array | array | 0x99 array | array | 0x9A array | array | 0x9B array | array | 0x9F map | object | 0xA0..0xB7 map | object | 0xB8 map | object | 0xB9 map | object | 0xBA map | object | 0xBB map | object | 0xBF False | `false` | 0xF4 True | `true` | 0xF5 Nill | `null` | 0xF6 Half-Precision Float | number_float | 0xF9 Single-Precision Float | number_float | 0xFA Double-Precision Float | number_float | 0xFB @warning The mapping is **incomplete** in the sense that not all CBOR types can be converted to a JSON value. The following CBOR types are not supported and will yield parse errors (parse_error.112): - byte strings (0x40..0x5F) - date/time (0xC0..0xC1) - bignum (0xC2..0xC3) - decimal fraction (0xC4) - bigfloat (0xC5) - tagged items (0xC6..0xD4, 0xD8..0xDB) - expected conversions (0xD5..0xD7) - simple values (0xE0..0xF3, 0xF8) - undefined (0xF7) @warning CBOR allows map keys of any type, whereas JSON only allows strings as keys in object values. Therefore, CBOR maps with keys other than UTF-8 strings are rejected (parse_error.113). @note Any CBOR output created @ref to_cbor can be successfully parsed by @ref from_cbor. @param[in] i an input in CBOR format convertible to an input adapter @param[in] strict whether to expect the input to be consumed until EOF (true by default) @return deserialized JSON value @throw parse_error.110 if the given input ends prematurely or the end of file was not reached when @a strict was set to true @throw parse_error.112 if unsupported features from CBOR were used in the given input @a v or if the input is not valid CBOR @throw parse_error.113 if a string was expected as map key, but not found @complexity Linear in the size of the input @a i. @liveexample{The example shows the deserialization of a byte vector in CBOR format to a JSON value.,from_cbor} @sa http://cbor.io @sa @ref to_cbor(const basic_json&) for the analogous serialization @sa @ref from_msgpack(detail::input_adapter, const bool) for the related MessagePack format @sa @ref from_ubjson(detail::input_adapter, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added @a strict parameter since 3.0.0 */ static basic_json from_cbor(detail::input_adapter i, const bool strict = true) { return binary_reader(i).parse_cbor(strict); } /*! @copydoc from_cbor(detail::input_adapter, const bool) */ template::value, int> = 0> static basic_json from_cbor(A1 && a1, A2 && a2, const bool strict = true) { return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_cbor(strict); } /*! @brief create a JSON value from an input in MessagePack format Deserializes a given input @a i to a JSON value using the MessagePack serialization format. The library maps MessagePack types to JSON value types as follows: MessagePack type | JSON value type | first byte ---------------- | --------------- | ---------- positive fixint | number_unsigned | 0x00..0x7F fixmap | object | 0x80..0x8F fixarray | array | 0x90..0x9F fixstr | string | 0xA0..0xBF nil | `null` | 0xC0 false | `false` | 0xC2 true | `true` | 0xC3 float 32 | number_float | 0xCA float 64 | number_float | 0xCB uint 8 | number_unsigned | 0xCC uint 16 | number_unsigned | 0xCD uint 32 | number_unsigned | 0xCE uint 64 | number_unsigned | 0xCF int 8 | number_integer | 0xD0 int 16 | number_integer | 0xD1 int 32 | number_integer | 0xD2 int 64 | number_integer | 0xD3 str 8 | string | 0xD9 str 16 | string | 0xDA str 32 | string | 0xDB array 16 | array | 0xDC array 32 | array | 0xDD map 16 | object | 0xDE map 32 | object | 0xDF negative fixint | number_integer | 0xE0-0xFF @warning The mapping is **incomplete** in the sense that not all MessagePack types can be converted to a JSON value. The following MessagePack types are not supported and will yield parse errors: - bin 8 - bin 32 (0xC4..0xC6) - ext 8 - ext 32 (0xC7..0xC9) - fixext 1 - fixext 16 (0xD4..0xD8) @note Any MessagePack output created @ref to_msgpack can be successfully parsed by @ref from_msgpack. @param[in] i an input in MessagePack format convertible to an input adapter @param[in] strict whether to expect the input to be consumed until EOF (true by default) @throw parse_error.110 if the given input ends prematurely or the end of file was not reached when @a strict was set to true @throw parse_error.112 if unsupported features from MessagePack were used in the given input @a i or if the input is not valid MessagePack @throw parse_error.113 if a string was expected as map key, but not found @complexity Linear in the size of the input @a i. @liveexample{The example shows the deserialization of a byte vector in MessagePack format to a JSON value.,from_msgpack} @sa http://msgpack.org @sa @ref to_msgpack(const basic_json&) for the analogous serialization @sa @ref from_cbor(detail::input_adapter, const bool) for the related CBOR format @sa @ref from_ubjson(detail::input_adapter, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added @a strict parameter since 3.0.0 */ static basic_json from_msgpack(detail::input_adapter i, const bool strict = true) { return binary_reader(i).parse_msgpack(strict); } /*! @copydoc from_msgpack(detail::input_adapter, const bool) */ template::value, int> = 0> static basic_json from_msgpack(A1 && a1, A2 && a2, const bool strict = true) { return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_msgpack(strict); } /*! @brief create a JSON value from an input in UBJSON format Deserializes a given input @a i to a JSON value using the UBJSON (Universal Binary JSON) serialization format. The library maps UBJSON types to JSON value types as follows: UBJSON type | JSON value type | marker ----------- | --------------------------------------- | ------ no-op | *no value, next value is read* | `N` null | `null` | `Z` false | `false` | `F` true | `true` | `T` float32 | number_float | `d` float64 | number_float | `D` uint8 | number_unsigned | `U` int8 | number_integer | `i` int16 | number_integer | `I` int32 | number_integer | `l` int64 | number_integer | `L` string | string | `S` char | string | `C` array | array (optimized values are supported) | `[` object | object (optimized values are supported) | `{` @note The mapping is **complete** in the sense that any UBJSON value can be converted to a JSON value. @param[in] i an input in UBJSON format convertible to an input adapter @param[in] strict whether to expect the input to be consumed until EOF (true by default) @throw parse_error.110 if the given input ends prematurely or the end of file was not reached when @a strict was set to true @throw parse_error.112 if a parse error occurs @throw parse_error.113 if a string could not be parsed successfully @complexity Linear in the size of the input @a i. @liveexample{The example shows the deserialization of a byte vector in UBJSON format to a JSON value.,from_ubjson} @sa http://ubjson.org @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the analogous serialization @sa @ref from_cbor(detail::input_adapter, const bool) for the related CBOR format @sa @ref from_msgpack(detail::input_adapter, const bool) for the related MessagePack format @since version 3.1.0 */ static basic_json from_ubjson(detail::input_adapter i, const bool strict = true) { return binary_reader(i).parse_ubjson(strict); } template::value, int> = 0> static basic_json from_ubjson(A1 && a1, A2 && a2, const bool strict = true) { return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_ubjson(strict); } /// @} ////////////////////////// // JSON Pointer support // ////////////////////////// /// @name JSON Pointer functions /// @{ /*! @brief access specified element via JSON Pointer Uses a JSON pointer to retrieve a reference to the respective JSON value. No bound checking is performed. Similar to @ref operator[](const typename object_t::key_type&), `null` values are created in arrays and objects if necessary. In particular: - If the JSON pointer points to an object key that does not exist, it is created an filled with a `null` value before a reference to it is returned. - If the JSON pointer points to an array index that does not exist, it is created an filled with a `null` value before a reference to it is returned. All indices between the current maximum and the given index are also filled with `null`. - The special value `-` is treated as a synonym for the index past the end. @param[in] ptr a JSON pointer @return reference to the element pointed to by @a ptr @complexity Constant. @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.404 if the JSON pointer can not be resolved @liveexample{The behavior is shown in the example.,operatorjson_pointer} @since version 2.0.0 */ reference operator[](const json_pointer& ptr) { return ptr.get_unchecked(this); } /*! @brief access specified element via JSON Pointer Uses a JSON pointer to retrieve a reference to the respective JSON value. No bound checking is performed. The function does not change the JSON value; no `null` values are created. In particular, the the special value `-` yields an exception. @param[in] ptr JSON pointer to the desired element @return const reference to the element pointed to by @a ptr @complexity Constant. @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved @liveexample{The behavior is shown in the example.,operatorjson_pointer_const} @since version 2.0.0 */ const_reference operator[](const json_pointer& ptr) const { return ptr.get_unchecked(this); } /*! @brief access specified element via JSON Pointer Returns a reference to the element at with specified JSON pointer @a ptr, with bounds checking. @param[in] ptr JSON pointer to the desired element @return reference to the element pointed to by @a ptr @throw parse_error.106 if an array index in the passed JSON pointer @a ptr begins with '0'. See example below. @throw parse_error.109 if an array index in the passed JSON pointer @a ptr is not a number. See example below. @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr is out of range. See example below. @throw out_of_range.402 if the array index '-' is used in the passed JSON pointer @a ptr. As `at` provides checked access (and no elements are implicitly inserted), the index '-' is always invalid. See example below. @throw out_of_range.403 if the JSON pointer describes a key of an object which cannot be found. See example below. @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @since version 2.0.0 @liveexample{The behavior is shown in the example.,at_json_pointer} */ reference at(const json_pointer& ptr) { return ptr.get_checked(this); } /*! @brief access specified element via JSON Pointer Returns a const reference to the element at with specified JSON pointer @a ptr, with bounds checking. @param[in] ptr JSON pointer to the desired element @return reference to the element pointed to by @a ptr @throw parse_error.106 if an array index in the passed JSON pointer @a ptr begins with '0'. See example below. @throw parse_error.109 if an array index in the passed JSON pointer @a ptr is not a number. See example below. @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr is out of range. See example below. @throw out_of_range.402 if the array index '-' is used in the passed JSON pointer @a ptr. As `at` provides checked access (and no elements are implicitly inserted), the index '-' is always invalid. See example below. @throw out_of_range.403 if the JSON pointer describes a key of an object which cannot be found. See example below. @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. See example below. @exceptionsafety Strong guarantee: if an exception is thrown, there are no changes in the JSON value. @complexity Constant. @since version 2.0.0 @liveexample{The behavior is shown in the example.,at_json_pointer_const} */ const_reference at(const json_pointer& ptr) const { return ptr.get_checked(this); } /*! @brief return flattened JSON value The function creates a JSON object whose keys are JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all primitive. The original JSON value can be restored using the @ref unflatten() function. @return an object that maps JSON pointers to primitive values @note Empty objects and arrays are flattened to `null` and will not be reconstructed correctly by the @ref unflatten() function. @complexity Linear in the size the JSON value. @liveexample{The following code shows how a JSON object is flattened to an object whose keys consist of JSON pointers.,flatten} @sa @ref unflatten() for the reverse function @since version 2.0.0 */ basic_json flatten() const { basic_json result(value_t::object); json_pointer::flatten("", *this, result); return result; } /*! @brief unflatten a previously flattened JSON value The function restores the arbitrary nesting of a JSON value that has been flattened before using the @ref flatten() function. The JSON value must meet certain constraints: 1. The value must be an object. 2. The keys must be JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901)) 3. The mapped values must be primitive JSON types. @return the original JSON from a flattened version @note Empty objects and arrays are flattened by @ref flatten() to `null` values and can not unflattened to their original type. Apart from this example, for a JSON value `j`, the following is always true: `j == j.flatten().unflatten()`. @complexity Linear in the size the JSON value. @throw type_error.314 if value is not an object @throw type_error.315 if object values are not primitive @liveexample{The following code shows how a flattened JSON object is unflattened into the original nested JSON object.,unflatten} @sa @ref flatten() for the reverse function @since version 2.0.0 */ basic_json unflatten() const { return json_pointer::unflatten(*this); } /// @} ////////////////////////// // JSON Patch functions // ////////////////////////// /// @name JSON Patch functions /// @{ /*! @brief applies a JSON patch [JSON Patch](http://jsonpatch.com) defines a JSON document structure for expressing a sequence of operations to apply to a JSON) document. With this function, a JSON Patch is applied to the current JSON value by executing all operations from the patch. @param[in] json_patch JSON patch document @return patched document @note The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value. @throw parse_error.104 if the JSON patch does not consist of an array of objects @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory attributes are missing); example: `"operation add must have member path"` @throw out_of_range.401 if an array index is out of range. @throw out_of_range.403 if a JSON pointer inside the patch could not be resolved successfully in the current JSON value; example: `"key baz not found"` @throw out_of_range.405 if JSON pointer has no parent ("add", "remove", "move") @throw other_error.501 if "test" operation was unsuccessful @complexity Linear in the size of the JSON value and the length of the JSON patch. As usually only a fraction of the JSON value is affected by the patch, the complexity can usually be neglected. @liveexample{The following code shows how a JSON patch is applied to a value.,patch} @sa @ref diff -- create a JSON patch by comparing two JSON values @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901) @since version 2.0.0 */ basic_json patch(const basic_json& json_patch) const { // make a working copy to apply the patch to basic_json result = *this; // the valid JSON Patch operations enum class patch_operations {add, remove, replace, move, copy, test, invalid}; const auto get_op = [](const std::string & op) { if (op == "add") { return patch_operations::add; } if (op == "remove") { return patch_operations::remove; } if (op == "replace") { return patch_operations::replace; } if (op == "move") { return patch_operations::move; } if (op == "copy") { return patch_operations::copy; } if (op == "test") { return patch_operations::test; } return patch_operations::invalid; }; // wrapper for "add" operation; add value at ptr const auto operation_add = [&result](json_pointer & ptr, basic_json val) { // adding to the root of the target document means replacing it if (ptr.is_root()) { result = val; } else { // make sure the top element of the pointer exists json_pointer top_pointer = ptr.top(); if (top_pointer != ptr) { result.at(top_pointer); } // get reference to parent of JSON pointer ptr const auto last_path = ptr.pop_back(); basic_json& parent = result[ptr]; switch (parent.m_type) { case value_t::null: case value_t::object: { // use operator[] to add value parent[last_path] = val; break; } case value_t::array: { if (last_path == "-") { // special case: append to back parent.push_back(val); } else { const auto idx = json_pointer::array_index(last_path); if (JSON_UNLIKELY(static_cast(idx) > parent.size())) { // avoid undefined behavior JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); } else { // default case: insert add offset parent.insert(parent.begin() + static_cast(idx), val); } } break; } default: { // if there exists a parent it cannot be primitive assert(false); // LCOV_EXCL_LINE } } } }; // wrapper for "remove" operation; remove value at ptr const auto operation_remove = [&result](json_pointer & ptr) { // get reference to parent of JSON pointer ptr const auto last_path = ptr.pop_back(); basic_json& parent = result.at(ptr); // remove child if (parent.is_object()) { // perform range check auto it = parent.find(last_path); if (JSON_LIKELY(it != parent.end())) { parent.erase(it); } else { JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found")); } } else if (parent.is_array()) { // note erase performs range check parent.erase(static_cast(json_pointer::array_index(last_path))); } }; // type check: top level value must be an array if (JSON_UNLIKELY(not json_patch.is_array())) { JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); } // iterate and apply the operations for (const auto& val : json_patch) { // wrapper to get a value for an operation const auto get_value = [&val](const std::string & op, const std::string & member, bool string_type) -> basic_json & { // find value auto it = val.m_value.object->find(member); // context-sensitive error message const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; // check if desired value is present if (JSON_UNLIKELY(it == val.m_value.object->end())) { JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); } // check if result is of type string if (JSON_UNLIKELY(string_type and not it->second.is_string())) { JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'")); } // no error: return value return it->second; }; // type check: every element of the array must be an object if (JSON_UNLIKELY(not val.is_object())) { JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); } // collect mandatory members const std::string op = get_value("op", "op", true); const std::string path = get_value(op, "path", true); json_pointer ptr(path); switch (get_op(op)) { case patch_operations::add: { operation_add(ptr, get_value("add", "value", false)); break; } case patch_operations::remove: { operation_remove(ptr); break; } case patch_operations::replace: { // the "path" location must exist - use at() result.at(ptr) = get_value("replace", "value", false); break; } case patch_operations::move: { const std::string from_path = get_value("move", "from", true); json_pointer from_ptr(from_path); // the "from" location must exist - use at() basic_json v = result.at(from_ptr); // The move operation is functionally identical to a // "remove" operation on the "from" location, followed // immediately by an "add" operation at the target // location with the value that was just removed. operation_remove(from_ptr); operation_add(ptr, v); break; } case patch_operations::copy: { const std::string from_path = get_value("copy", "from", true); const json_pointer from_ptr(from_path); // the "from" location must exist - use at() basic_json v = result.at(from_ptr); // The copy is functionally identical to an "add" // operation at the target location using the value // specified in the "from" member. operation_add(ptr, v); break; } case patch_operations::test: { bool success = false; JSON_TRY { // check if "value" matches the one at "path" // the "path" location must exist - use at() success = (result.at(ptr) == get_value("test", "value", false)); } JSON_CATCH (out_of_range&) { // ignore out of range errors: success remains false } // throw an exception if test fails if (JSON_UNLIKELY(not success)) { JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump())); } break; } case patch_operations::invalid: { // op must be "add", "remove", "replace", "move", "copy", or // "test" JSON_THROW(parse_error::create(105, 0, "operation value '" + op + "' is invalid")); } } } return result; } /*! @brief creates a diff as a JSON patch Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can be changed into the value @a target by calling @ref patch function. @invariant For two JSON values @a source and @a target, the following code yields always `true`: @code {.cpp} source.patch(diff(source, target)) == target; @endcode @note Currently, only `remove`, `add`, and `replace` operations are generated. @param[in] source JSON value to compare from @param[in] target JSON value to compare against @param[in] path helper value to create JSON pointers @return a JSON patch to convert the @a source to @a target @complexity Linear in the lengths of @a source and @a target. @liveexample{The following code shows how a JSON patch is created as a diff for two JSON values.,diff} @sa @ref patch -- apply a JSON patch @sa @ref merge_patch -- apply a JSON Merge Patch @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) @since version 2.0.0 */ static basic_json diff(const basic_json& source, const basic_json& target, const std::string& path = "") { // the patch basic_json result(value_t::array); // if the values are the same, return empty patch if (source == target) { return result; } if (source.type() != target.type()) { // different types: replace value result.push_back( { {"op", "replace"}, {"path", path}, {"value", target} }); } else { switch (source.type()) { case value_t::array: { // first pass: traverse common elements std::size_t i = 0; while (i < source.size() and i < target.size()) { // recursive call to compare array values at index i auto temp_diff = diff(source[i], target[i], path + "/" + std::to_string(i)); result.insert(result.end(), temp_diff.begin(), temp_diff.end()); ++i; } // i now reached the end of at least one array // in a second pass, traverse the remaining elements // remove my remaining elements const auto end_index = static_cast(result.size()); while (i < source.size()) { // add operations in reverse order to avoid invalid // indices result.insert(result.begin() + end_index, object( { {"op", "remove"}, {"path", path + "/" + std::to_string(i)} })); ++i; } // add other remaining elements while (i < target.size()) { result.push_back( { {"op", "add"}, {"path", path + "/" + std::to_string(i)}, {"value", target[i]} }); ++i; } break; } case value_t::object: { // first pass: traverse this object's elements for (auto it = source.cbegin(); it != source.cend(); ++it) { // escape the key name to be used in a JSON patch const auto key = json_pointer::escape(it.key()); if (target.find(it.key()) != target.end()) { // recursive call to compare object values at key it auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key); result.insert(result.end(), temp_diff.begin(), temp_diff.end()); } else { // found a key that is not in o -> remove it result.push_back(object( { {"op", "remove"}, {"path", path + "/" + key} })); } } // second pass: traverse other object's elements for (auto it = target.cbegin(); it != target.cend(); ++it) { if (source.find(it.key()) == source.end()) { // found a key that is not in this -> add it const auto key = json_pointer::escape(it.key()); result.push_back( { {"op", "add"}, {"path", path + "/" + key}, {"value", it.value()} }); } } break; } default: { // both primitive type: replace value result.push_back( { {"op", "replace"}, {"path", path}, {"value", target} }); break; } } } return result; } /// @} //////////////////////////////// // JSON Merge Patch functions // //////////////////////////////// /// @name JSON Merge Patch functions /// @{ /*! @brief applies a JSON Merge Patch The merge patch format is primarily intended for use with the HTTP PATCH method as a means of describing a set of modifications to a target resource's content. This function applies a merge patch to the current JSON value. The function implements the following algorithm from Section 2 of [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396): ``` define MergePatch(Target, Patch): if Patch is an Object: if Target is not an Object: Target = {} // Ignore the contents and set it to an empty Object for each Name/Value pair in Patch: if Value is null: if Name exists in Target: remove the Name/Value pair from Target else: Target[Name] = MergePatch(Target[Name], Value) return Target else: return Patch ``` Thereby, `Target` is the current object; that is, the patch is applied to the current value. @param[in] patch the patch to apply @complexity Linear in the lengths of @a patch. @liveexample{The following code shows how a JSON Merge Patch is applied to a JSON document.,merge_patch} @sa @ref patch -- apply a JSON patch @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396) @since version 3.0.0 */ void merge_patch(const basic_json& patch) { if (patch.is_object()) { if (not is_object()) { *this = object(); } for (auto it = patch.begin(); it != patch.end(); ++it) { if (it.value().is_null()) { erase(it.key()); } else { operator[](it.key()).merge_patch(it.value()); } } } else { *this = patch; } } /// @} }; } // namespace nlohmann /////////////////////// // nonmember support // /////////////////////// // specialization of std::swap, and std::hash namespace std { /*! @brief exchanges the values of two JSON objects @since version 1.0.0 */ template<> inline void swap(nlohmann::json& j1, nlohmann::json& j2) noexcept( is_nothrow_move_constructible::value and is_nothrow_move_assignable::value ) { j1.swap(j2); } /// hash value for JSON objects template<> struct hash { /*! @brief return a hash value for a JSON object @since version 1.0.0 */ std::size_t operator()(const nlohmann::json& j) const { // a naive hashing via the string representation const auto& h = hash(); return h(j.dump()); } }; /// specialization for std::less /// @note: do not remove the space after '<', /// see https://github.com/nlohmann/json/pull/679 template<> struct less< ::nlohmann::detail::value_t> { /*! @brief compare two value_t enum values @since version 3.0.0 */ bool operator()(nlohmann::detail::value_t lhs, nlohmann::detail::value_t rhs) const noexcept { return nlohmann::detail::operator<(lhs, rhs); } }; } // namespace std /*! @brief user-defined string literal for JSON values This operator implements a user-defined string literal for JSON objects. It can be used by adding `"_json"` to a string literal and returns a JSON object if no parse error occurred. @param[in] s a string representation of a JSON object @param[in] n the length of string @a s @return a JSON object @since version 1.0.0 */ inline nlohmann::json operator "" _json(const char* s, std::size_t n) { return nlohmann::json::parse(s, s + n); } /*! @brief user-defined string literal for JSON pointer This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer object if no parse error occurred. @param[in] s a string representation of a JSON Pointer @param[in] n the length of string @a s @return a JSON pointer object @since version 2.0.0 */ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) { return nlohmann::json::json_pointer(std::string(s, n)); } // #include // restore GCC/clang diagnostic settings #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic pop #endif #if defined(__clang__) #pragma GCC diagnostic pop #endif // clean up #undef JSON_CATCH #undef JSON_THROW #undef JSON_TRY #undef JSON_LIKELY #undef JSON_UNLIKELY #undef JSON_DEPRECATED #undef JSON_HAS_CPP_14 #undef JSON_HAS_CPP_17 #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION #undef NLOHMANN_BASIC_JSON_TPL #undef NLOHMANN_JSON_HAS_HELPER #endif welle.io-2.1/src/libs/kiss_fft/000077500000000000000000000000001357201522000164175ustar00rootroot00000000000000welle.io-2.1/src/libs/kiss_fft/CHANGELOG000066400000000000000000000117161357201522000176370ustar00rootroot000000000000001.3.0 2012-07-18 removed non-standard malloc.h from kiss_fft.h moved -lm to end of link line checked various return values converted python Numeric code to NumPy fixed test of int32_t on 64 bit OS added padding in a couple of places to allow SIMD alignment of structs 1.2.9 2010-05-27 threadsafe ( including OpenMP ) first edition of kissfft.hh the C++ template fft engine 1.2.8 Changed memory.h to string.h -- apparently more standard Added openmp extensions. This can have fairly linear speedups for larger FFT sizes. 1.2.7 Shrank the real-fft memory footprint. Thanks to Galen Seitz. 1.2.6 (Nov 14, 2006) The "thanks to GenArts" release. Added multi-dimensional real-optimized FFT, see tools/kiss_fftndr Thanks go to GenArts, Inc. for sponsoring the development. 1.2.5 (June 27, 2006) The "release for no good reason" release. Changed some harmless code to make some compilers' warnings go away. Added some more digits to pi -- why not. Added kiss_fft_next_fast_size() function to help people decide how much to pad. Changed multidimensional test from 8 dimensions to only 3 to avoid testing problems with fixed point (sorry Buckaroo Banzai). 1.2.4 (Oct 27, 2005) The "oops, inverse fixed point real fft was borked" release. Fixed scaling bug for inverse fixed point real fft -- also fixed test code that should've been failing. Thanks to Jean-Marc Valin for bug report. Use sys/types.h for more portable types than short,int,long => int16_t,int32_t,int64_t If your system does not have these, you may need to define them -- but at least it breaks in a loud and easily fixable way -- unlike silently using the wrong size type. Hopefully tools/psdpng.c is fixed -- thanks to Steve Kellog for pointing out the weirdness. 1.2.3 (June 25, 2005) The "you want to use WHAT as a sample" release. Added ability to use 32 bit fixed point samples -- requires a 64 bit intermediate result, a la 'long long' Added ability to do 4 FFTs in parallel by using SSE SIMD instructions. This is accomplished by using the __m128 (vector of 4 floats) as kiss_fft_scalar. Define USE_SIMD to use this. I know, I know ... this is drifting a bit from the "kiss" principle, but the speed advantages make it worth it for some. Also recent gcc makes it SOO easy to use vectors of 4 floats like a POD type. 1.2.2 (May 6, 2005) The Matthew release Replaced fixed point division with multiply&shift. Thanks to Jean-Marc Valin for discussions regarding. Considerable speedup for fixed-point. Corrected overflow protection in real fft routines when using fixed point. Finder's Credit goes to Robert Oschler of robodance for pointing me at the bug. This also led to the CHECK_OVERFLOW_OP macro. 1.2.1 (April 4, 2004) compiles cleanly with just about every -W warning flag under the sun reorganized kiss_fft_state so it could be read-only/const. This may be useful for embedded systems that are willing to predeclare twiddle factors, factorization. Fixed C_MUL,S_MUL on 16-bit platforms. tmpbuf will only be allocated if input & output buffers are same scratchbuf will only be allocated for ffts that are not multiples of 2,3,5 NOTE: The tmpbuf,scratchbuf changes may require synchronization code for multi-threaded apps. 1.2 (Feb 23, 2004) interface change -- cfg object is forward declaration of struct instead of void* This maintains type saftey and lets the compiler warn/error about stupid mistakes. (prompted by suggestion from Erik de Castro Lopo) small speed improvements added psdpng.c -- sample utility that will create png spectrum "waterfalls" from an input file ( not terribly useful yet) 1.1.1 (Feb 1, 2004 ) minor bug fix -- only affects odd rank, in-place, multi-dimensional FFTs 1.1 : (Jan 30,2004) split sample_code/ into test/ and tools/ Removed 2-D fft and added N-D fft (arbitrary) modified fftutil.c to allow multi-d FFTs Modified core fft routine to allow an input stride via kiss_fft_stride() (eased support of multi-D ffts) Added fast convolution filtering (FIR filtering using overlap-scrap method, with tail scrap) Add kfc.[ch]: the KISS FFT Cache. It takes care of allocs for you ( suggested by Oscar Lesta ). 1.0.1 (Dec 15, 2003) fixed bug that occurred when nfft==1. Thanks to Steven Johnson. 1.0 : (Dec 14, 2003) changed kiss_fft function from using a single buffer, to two buffers. If the same buffer pointer is supplied for both in and out, kiss will manage the buffer copies. added kiss_fft2d and kiss_fftr as separate source files (declarations in kiss_fft.h ) 0.4 :(Nov 4,2003) optimized for radix 2,3,4,5 0.3 :(Oct 28, 2003) woops, version 2 didn't actually factor out any radices other than 2. Thanks to Steven Johnson for finding this one. 0.2 :(Oct 27, 2003) added mixed radix, only radix 2,4 optimized versions 0.1 :(May 19 2003) initial release, radix 2 only welle.io-2.1/src/libs/kiss_fft/COPYING000066400000000000000000000027031357201522000174540ustar00rootroot00000000000000Copyright (c) 2003-2010 Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. welle.io-2.1/src/libs/kiss_fft/_kiss_fft_guts.h000066400000000000000000000132461357201522000216070ustar00rootroot00000000000000/* Copyright (c) 2003-2010, Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* kiss_fft.h defines kiss_fft_scalar as either short or a float type and defines typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ #include "kiss_fft.h" #include #define MAXFACTORS 32 /* e.g. an fft of length 128 has 4 factors as far as kissfft is concerned 4*4*4*2 */ struct kiss_fft_state{ int nfft; int inverse; int factors[2*MAXFACTORS]; kiss_fft_cpx twiddles[1]; }; /* Explanation of macros dealing with complex math: C_MUL(m,a,b) : m = a*b C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise C_SUB( res, a,b) : res = a - b C_SUBFROM( res , a) : res -= a C_ADDTO( res , a) : res += a * */ #ifdef FIXED_POINT #if (FIXED_POINT==32) # define FRACBITS 31 # define SAMPPROD int64_t #define SAMP_MAX 2147483647 #else # define FRACBITS 15 # define SAMPPROD int32_t #define SAMP_MAX 32767 #endif #define SAMP_MIN -SAMP_MAX #if defined(CHECK_OVERFLOW) # define CHECK_OVERFLOW_OP(a,op,b) \ if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } #endif # define smul(a,b) ( (SAMPPROD)(a)*(b) ) # define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) # define S_MUL(a,b) sround( smul(a,b) ) # define C_MUL(m,a,b) \ do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) # define DIVSCALAR(x,k) \ (x) = sround( smul( x, SAMP_MAX/k ) ) # define C_FIXDIV(c,div) \ do { DIVSCALAR( (c).r , div); \ DIVSCALAR( (c).i , div); }while (0) # define C_MULBYSCALAR( c, s ) \ do{ (c).r = sround( smul( (c).r , s ) ) ;\ (c).i = sround( smul( (c).i , s ) ) ; }while(0) #else /* not FIXED_POINT*/ # define S_MUL(a,b) ( (a)*(b) ) #define C_MUL(m,a,b) \ do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) # define C_FIXDIV(c,div) /* NOOP */ # define C_MULBYSCALAR( c, s ) \ do{ (c).r *= (s);\ (c).i *= (s); }while(0) #endif #ifndef CHECK_OVERFLOW_OP # define CHECK_OVERFLOW_OP(a,op,b) /* noop */ #endif #define C_ADD( res, a,b)\ do { \ CHECK_OVERFLOW_OP((a).r,+,(b).r)\ CHECK_OVERFLOW_OP((a).i,+,(b).i)\ (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ }while(0) #define C_SUB( res, a,b)\ do { \ CHECK_OVERFLOW_OP((a).r,-,(b).r)\ CHECK_OVERFLOW_OP((a).i,-,(b).i)\ (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ }while(0) #define C_ADDTO( res , a)\ do { \ CHECK_OVERFLOW_OP((res).r,+,(a).r)\ CHECK_OVERFLOW_OP((res).i,+,(a).i)\ (res).r += (a).r; (res).i += (a).i;\ }while(0) #define C_SUBFROM( res , a)\ do {\ CHECK_OVERFLOW_OP((res).r,-,(a).r)\ CHECK_OVERFLOW_OP((res).i,-,(a).i)\ (res).r -= (a).r; (res).i -= (a).i; \ }while(0) #ifdef FIXED_POINT # define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase)) # define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase)) # define HALF_OF(x) ((x)>>1) #elif defined(USE_SIMD) # define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) # define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) # define HALF_OF(x) ((x)*_mm_set1_ps(.5)) #else # define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) # define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) # define HALF_OF(x) ((x)*.5) #endif #define kf_cexp(x,phase) \ do{ \ (x)->r = KISS_FFT_COS(phase);\ (x)->i = KISS_FFT_SIN(phase);\ }while(0) /* a debugging function */ #define pcpx(c)\ fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) #ifdef KISS_FFT_USE_ALLOCA // define this to allow use of alloca instead of malloc for temporary buffers // Temporary buffers are used in two case: // 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5 // 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform. #include #define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) #define KISS_FFT_TMP_FREE(ptr) #else #define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) #define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) #endif welle.io-2.1/src/libs/kiss_fft/kiss_fft.c000066400000000000000000000305641357201522000204030ustar00rootroot00000000000000/* Copyright (c) 2003-2010, Mark Borgerding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "_kiss_fft_guts.h" /* The guts header contains all the multiplication and addition macros that are defined for fixed or floating point complex numbers. It also delares the kf_ internal functions. */ static void kf_bfly2( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m ) { kiss_fft_cpx * Fout2; kiss_fft_cpx * tw1 = st->twiddles; kiss_fft_cpx t; Fout2 = Fout + m; do{ C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); C_MUL (t, *Fout2 , *tw1); tw1 += fstride; C_SUB( *Fout2 , *Fout , t ); C_ADDTO( *Fout , t ); ++Fout2; ++Fout; }while (--m); } static void kf_bfly4( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, const size_t m ) { kiss_fft_cpx *tw1,*tw2,*tw3; kiss_fft_cpx scratch[6]; size_t k=m; const size_t m2=2*m; const size_t m3=3*m; tw3 = tw2 = tw1 = st->twiddles; do { C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); C_MUL(scratch[0],Fout[m] , *tw1 ); C_MUL(scratch[1],Fout[m2] , *tw2 ); C_MUL(scratch[2],Fout[m3] , *tw3 ); C_SUB( scratch[5] , *Fout, scratch[1] ); C_ADDTO(*Fout, scratch[1]); C_ADD( scratch[3] , scratch[0] , scratch[2] ); C_SUB( scratch[4] , scratch[0] , scratch[2] ); C_SUB( Fout[m2], *Fout, scratch[3] ); tw1 += fstride; tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); if(st->inverse) { Fout[m].r = scratch[5].r - scratch[4].i; Fout[m].i = scratch[5].i + scratch[4].r; Fout[m3].r = scratch[5].r + scratch[4].i; Fout[m3].i = scratch[5].i - scratch[4].r; }else{ Fout[m].r = scratch[5].r + scratch[4].i; Fout[m].i = scratch[5].i - scratch[4].r; Fout[m3].r = scratch[5].r - scratch[4].i; Fout[m3].i = scratch[5].i + scratch[4].r; } ++Fout; }while(--k); } static void kf_bfly3( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, size_t m ) { size_t k=m; const size_t m2 = 2*m; kiss_fft_cpx *tw1,*tw2; kiss_fft_cpx scratch[5]; kiss_fft_cpx epi3; epi3 = st->twiddles[fstride*m]; tw1=tw2=st->twiddles; do{ C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); C_MUL(scratch[1],Fout[m] , *tw1); C_MUL(scratch[2],Fout[m2] , *tw2); C_ADD(scratch[3],scratch[1],scratch[2]); C_SUB(scratch[0],scratch[1],scratch[2]); tw1 += fstride; tw2 += fstride*2; Fout[m].r = Fout->r - HALF_OF(scratch[3].r); Fout[m].i = Fout->i - HALF_OF(scratch[3].i); C_MULBYSCALAR( scratch[0] , epi3.i ); C_ADDTO(*Fout,scratch[3]); Fout[m2].r = Fout[m].r + scratch[0].i; Fout[m2].i = Fout[m].i - scratch[0].r; Fout[m].r -= scratch[0].i; Fout[m].i += scratch[0].r; ++Fout; }while(--k); } static void kf_bfly5( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m ) { kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; int u; kiss_fft_cpx scratch[13]; kiss_fft_cpx * twiddles = st->twiddles; kiss_fft_cpx *tw; kiss_fft_cpx ya,yb; ya = twiddles[fstride*m]; yb = twiddles[fstride*2*m]; Fout0=Fout; Fout1=Fout0+m; Fout2=Fout0+2*m; Fout3=Fout0+3*m; Fout4=Fout0+4*m; tw=st->twiddles; for ( u=0; ur += scratch[7].r + scratch[8].r; Fout0->i += scratch[7].i + scratch[8].i; scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); C_SUB(*Fout1,scratch[5],scratch[6]); C_ADD(*Fout4,scratch[5],scratch[6]); scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); C_ADD(*Fout2,scratch[11],scratch[12]); C_SUB(*Fout3,scratch[11],scratch[12]); ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; } } /* perform the butterfly for one stage of a mixed radix FFT */ static void kf_bfly_generic( kiss_fft_cpx * Fout, const size_t fstride, const kiss_fft_cfg st, int m, int p ) { int u,k,q1,q; kiss_fft_cpx * twiddles = st->twiddles; kiss_fft_cpx t; int Norig = st->nfft; kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p); for ( u=0; u=Norig) twidx-=Norig; C_MUL(t,scratch[q] , twiddles[twidx] ); C_ADDTO( Fout[ k ] ,t); } k += m; } } KISS_FFT_TMP_FREE(scratch); } static void kf_work( kiss_fft_cpx * Fout, const kiss_fft_cpx * f, const size_t fstride, int in_stride, int * factors, const kiss_fft_cfg st ) { kiss_fft_cpx * Fout_beg=Fout; const int p=*factors++; /* the radix */ const int m=*factors++; /* stage's fft length/p */ const kiss_fft_cpx * Fout_end = Fout + p*m; #ifdef _OPENMP // use openmp extensions at the // top-level (not recursive) if (fstride==1 && p<=5) { int k; // execute the p different work units in different threads # pragma omp parallel for for (k=0;k floor_sqrt) p = n; /* no more factors, skip to end */ } n /= p; *facbuf++ = p; *facbuf++ = n; } while (n > 1); } /* * * User-callable function to allocate all necessary storage space for the fft. * * The return value is a contiguous block of memory, allocated with malloc. As such, * It can be freed with free(), rather than a kiss_fft-specific function. * */ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) { kiss_fft_cfg st=NULL; size_t memneeded = sizeof(struct kiss_fft_state) + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ if ( lenmem==NULL ) { st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); }else{ if (mem != NULL && *lenmem >= memneeded) st = (kiss_fft_cfg)mem; *lenmem = memneeded; } if (st) { int i; st->nfft=nfft; st->inverse = inverse_fft; for (i=0;iinverse) phase *= -1; kf_cexp(st->twiddles+i, phase ); } kf_factor(nfft,st->factors); } return st; } void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) { if (fin == fout) { //NOTE: this is not really an in-place FFT algorithm. //It just performs an out-of-place FFT into a temp buffer kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft); kf_work(tmpbuf,fin,1,in_stride, st->factors,st); memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); KISS_FFT_TMP_FREE(tmpbuf); }else{ kf_work( fout, fin, 1,in_stride, st->factors,st ); } } void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) { kiss_fft_stride(cfg,fin,fout,1); } void kiss_fft_cleanup(void) { // nothing needed any more } int kiss_fft_next_fast_size(int n) { while(1) { int m=n; while ( (m%2) == 0 ) m/=2; while ( (m%3) == 0 ) m/=3; while ( (m%5) == 0 ) m/=5; if (m<=1) break; /* n is completely factorable by twos, threes, and fives */ n++; } return n; } welle.io-2.1/src/libs/kiss_fft/kiss_fft.h000066400000000000000000000063451357201522000204100ustar00rootroot00000000000000#ifndef KISS_FFT_H #define KISS_FFT_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* ATTENTION! If you would like a : -- a utility that will handle the caching of fft objects -- real-only (no imaginary time component ) FFT -- a multi-dimensional FFT -- a command-line utility to perform ffts -- a command-line utility to perform fast-convolution filtering Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c in the tools/ directory. */ #ifdef USE_SIMD # include # define kiss_fft_scalar __m128 #define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16) #define KISS_FFT_FREE _mm_free #else #define KISS_FFT_MALLOC malloc #define KISS_FFT_FREE free #endif #ifdef FIXED_POINT #include # if (FIXED_POINT == 32) # define kiss_fft_scalar int32_t # else # define kiss_fft_scalar int16_t # endif #else # ifndef kiss_fft_scalar /* default is float */ # define kiss_fft_scalar float # endif #endif typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; typedef struct kiss_fft_state* kiss_fft_cfg; /* * kiss_fft_alloc * * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. * * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); * * The return value from fft_alloc is a cfg buffer used internally * by the fft routine or NULL. * * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. * The returned value should be free()d when done to avoid memory leaks. * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, * then the function places the cfg in mem and the size used in *lenmem * and returns mem. * * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), * then the function returns NULL and places the minimum cfg * buffer size in *lenmem. * */ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); /* * kiss_fft(cfg,in_out_buf) * * Perform an FFT on a complex input buffer. * for a forward FFT, * fin should be f[0] , f[1] , ... ,f[nfft-1] * fout will be F[0] , F[1] , ... ,F[nfft-1] * Note that each element is complex and can be accessed like f[k].r and f[k].i * */ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); /* A more generic version of the above function. It reads its input from every Nth sample. * */ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); /* If kiss_fft_alloc allocated a buffer, it is one contiguous buffer and can be simply free()d when no longer needed*/ #define kiss_fft_free free /* Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up your compiler output to call this before you exit. */ void kiss_fft_cleanup(void); /* * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5) */ int kiss_fft_next_fast_size(int n); /* for real ffts, we need an even size */ #define kiss_fftr_next_fast_size_real(n) \ (kiss_fft_next_fast_size( ((n)+1)>>1)<<1) #ifdef __cplusplus } #endif #endif welle.io-2.1/src/libs/mpg123/000077500000000000000000000000001357201522000156205ustar00rootroot00000000000000welle.io-2.1/src/libs/mpg123/AUTHORS000066400000000000000000000216051357201522000166740ustar00rootroot00000000000000This is an attempt to give credit to the people who contributed in some way to the mpg123 project. There are names and email addresses listed. Please use these addresses only to contact contributors with some question about their mpg123 contribution. You are explicitly not allowed to send them unwanted business offers or to question the quality of their sex life. -------------------- Being on the list of contributing authors not necessarily means that there is significant copyright in parts of the source code. There are obviously contributions of differing complexity. I try to mention people who motivated changes at least by suggesting some definite code changes, even if their code did not enter the mpg123 source verbatim. Trivial changes like pointing out ovbious syntax errors that make compilers cry do not land here. -------------------- Current maintainers with various sorts of contributions: Thomas Orgis Patrick Dehne Jonathan Yong <10walls@gmail.com> Taihei Momma Co-initiator of the revived mpg123 project, but not that involved anymore: Nicholas J Humfrey Special thanks go to Taihei, the person who keeps the assembly optimisations alive and takes care of portability to OSX/iOS platforms. Generic address pointing to the current maintainer (hopefully still works in future in case maintainership will change again): The creator: Michael Hipp (email: hippm@informatik.uni-tuebingen.de - please bother maintainers first) Contributions/ideas Thomas Orgis era (includes backports from mhipp trunk): Won-Kyu Park : patch to get rid of asm textrels (x86 PIC) Michael Weiser : update of coreaudio output to AudioComponents API Bent Bisballe Nyeng : patch for MPG123_NO_PEEK_END and MPG123_FORCE_SEEKABLE Eric S. Raymond : man page fixes Tobias Weber : patch for --disable-equalizer Hans de Goede : patch to skip APE tags Stephan Vedder : MSVC++ 2013 port update Rajeev V. Pillai : pointing out/patching issues in HTTP code and behaviour of mpg123 remote/terminal control Jarno Lehtinen : tinyalsa output Anthony Wells : initial version of ID3v2 APIC patch David Wohlferd : Win32 WaveOut buffer destructor fix. Mike Gorchak : QNX native audio output (QSA) Dan McGee : various patches (also for test suite) Jonathan Yong (jon_y) <10walls@gmail.com>: win32 hacking, win32 wasapi audio. Malcolm Boczek : Common language runtime wrapper Elbert Pol (TeLLie) : OS/2 port fixup Jeroen Valkonet : motivate pitch control, suggestive patch for pitch command in generic control interface Andy Hefner : patch for that second UTF16 issue Taihei Monma : A whole lot of new/improved assembler code, including Altivec! Christian Weisgerber , Brad Smith: sndio output Patrick Dehne (P4tr3ck) : more MSVC++ porting, patch to handle missing bit reservoirs Thorsten Glaser : icy2utf8, suggest utf8 locale stuff Dan Smith : ABI fixes for ensuring stack alignment (esp. for MinGW-built DLL with MSVC) Michael Ryzhykh : mpg123.spec.in Stefan Lenselink : initial aRts output Sergej Kvachonok : win32 audio rewrite Winston: SunOS-4.1.4/gcc-2.7.0 testing and suggestions for fixes (legacy Makefile, integer type headers) Mika Tiainen: pointing out the fix for the UTF to ASCII filtering of tags to actually work Nick Kurshev : extended 3dnow (from mplayer) Zuxy Meng : SSE (from mplayer) Honza : idea and prototype patch for ICY meta data support Petr Baudis : patches: term sigcont, id3 display unicode fallback and condensed output Petr Salinger : i486 enhancement mpdavig@users.sourceforge.net: linux-ppc-nas Makefile.legacy entry Adrian Bacon : patched decode_i586_dither (noise shaped float/int rounding) Cool Feet Audio project : realtime equalizer control Steve Grundell : clean stdout in control mode with stdout decoding Romain Dolbeau : Altivec support (taken from mplayer) higway : MMX Patch Clemens Ladisch : ALSA 0.9/1.0 support Debian Daniel Kobras era: Steve Kemp Dan Olson Syuuhei Kashiyama Rupert Levene Andreas Dilger Erik B. Andersen Chris Butler Martin Sjogren Chet Hosey Roland Rosenfeld Debian Colin Watson era: Helge Deller Chet Hosey Christopher C. Chimelis Roland Rosenfeld Marcelo E. Magallon Initial Debianers: Tommi Virtanen Paul Haggart Contributions/ideas Michael Hipp era: Mikko Tommila: DCT9 Oliver Fromme MPEG Software Simulation Group: reference decoder package Tobias Bading: idea for DCT64 in subband synthesis from maplay package Jeff Tsay and Mikko Tommila: MDCT36 from maplay package Philipp Knirsch : DCT36/manual unroll idea Thomas Woerner: SGI Audio Damien Clermonte: HP-UX audio fixes Niclas Lindstrom : OS2 port Stefan Bieschewski : Pentium optimizations, decode_i586.s Martin Denn : NAS port Niklas Beisert : MPEG 2.5 tables and : NetBSD Patch(es) Kevin Brintnall : BSD patch Tony Million: win32 port Steven Tiger Lang: advanced shuffle Eric B. Mitchell: esd port Ryan R. Prosser : esd port for Solaris Andreas Neuhaus: initial generic control interface (additionally fetched from changelog:) Ralf Hildebrandt : audio_alib changes : BSDOS 4.0 with gcc added to Makefile Bertrand Petit : frontend changes Erik Mouw : SGI audio fix for non RAD machines Daniel O'Connor : freebsd-esd make-entry D. Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>: enhanced head_check Wilson, Jeff D : xterm-title Robert Bihlmeyer : esd changes Hannu Napari's : SGI audio patches : native AIX support : playlist patch Gilles Zunino : SGI audio patches Matthew Parslow : esdserver patch : equalizer patch (equalfile setting) Ducroquet Erwan : HPUX/ALib support Shane Wegner : genrepatch Samuel Audet : wav-File patch "J. Dean Brederson" : SGI-RAD support Chou Ye-chi : sajberplay/FreeBSD patch Fabrice Bellard : 486 optimizations A. Hermansen and J. Kysela : ALSA output KIMURA Takuhiro : K6-3DNow Petr Stehlik : MINT Andy : float2int speed up proposal Brian Foutz : TK3Play Thomas Niederreiter : RIFF header fix Stefan Gybas : m68k patch Grant Erickson : Linux PPC patch Peter Berger : BSDi patch Henrik P Johnson : HTTP auth Steven Tiger Lang : advanced shuffle "Brian J. Swetland" : front-end (remote) patch Tillmann Steinbrecher : shuffle patch M.Stekelenburg : i386-getbits Antti Andreimann : outburst patch Hur TaeSung : 'http accept' patch (from post-0.59 changes that yet have to go into new trunk:) Hans Schwengeler : audio_dec additions Wojciech Baraski's Mp3Play (check the tools folder): Mp3Play frontend Daniel Koukola: audio_oss.c patch Munechika SUMIKAWA : IPv6 TEMNOTA : HTTP,FTP patch/playlist fix Peter Surda : VBR patch Ben : ARM startup time improvements Dave MacKenzie : init_output() patch pasky's : close-on-stop patch welle.io-2.1/src/libs/mpg123/COPYING000066400000000000000000001174161357201522000166650ustar00rootroot00000000000000This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. Main message, to include in "About ..." boxes, etc: Copyright (c) 1995-2013 by Michael Hipp and others, free software under the terms of the LGPL v2.1 There is an attempt to cover the actual list of authors in the AUTHORS file. Project maintainer since 2006 is Thomas Orgis and many people have contributed since the Michael Hipp era, but he stays the initial source and it would be impractical to count them all individually, so it's "and others". Source files contain the phrase "the mpg123 project" to the same effect in their license boilerplate; especially those that were added after maintainership changed. The person mainly responsible for the first version is usually named in the phrase "initially written by ...". All files in the distribution that don't carry a license note on their own are licensed under the terms of the LGPL 2.1; exceptions may apply, especially to files not in the official distribution but in the revision control repository. The formal license text follows. ======================= 1. The LGPL version 2.1 ======================= GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ==================== 2. The GPL version 2 ==================== GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS welle.io-2.1/src/libs/mpg123/Makemodule.am000066400000000000000000000137701357201522000202320ustar00rootroot00000000000000# Module for non-recursive mpg123 build system. EXTRA_DIST += src/libmpg123/mpg123.h.in EXTRA_PROGRAMS += src/libmpg123/testcpu src_libmpg123_testcpu_DEPENDENCIES = src/libmpg123/getcpuflags.$(OBJEXT) src_libmpg123_testcpu_SOURCES = src/libmpg123/testcpu.c src_libmpg123_testcpu_LDADD = \ src/compat/libcompat.la \ src/libmpg123/getcpuflags.$(OBJEXT) # Necessary? CLEANFILES += src/libmpg123/*.a lib_LTLIBRARIES += src/libmpg123/libmpg123.la nodist_include_HEADERS += src/libmpg123/mpg123.h include_HEADERS += src/libmpg123/fmt123.h src_libmpg123_libmpg123_la_LDFLAGS = \ -no-undefined \ -version-info @LIBMPG123_VERSION@ \ -export-symbols-regex '^mpg123_' src_libmpg123_libmpg123_la_LIBADD = \ src/compat/libcompat.la \ @DECODER_LOBJ@ @LFS_LOBJ@ @LIBS@ src_libmpg123_libmpg123_la_DEPENDENCIES = \ src/compat/libcompat.la \ @DECODER_LOBJ@ @LFS_LOBJ@ src_libmpg123_libmpg123_la_SOURCES = \ src/libmpg123/fmt123.h \ src/libmpg123/mpeghead.h \ src/libmpg123/parse.c \ src/libmpg123/parse.h \ src/libmpg123/frame.c \ src/libmpg123/format.c \ src/libmpg123/frame.h \ src/libmpg123/reader.h \ src/libmpg123/debug.h \ src/libmpg123/decode.h \ src/libmpg123/sample.h \ src/libmpg123/dct64.c \ src/libmpg123/synth.h \ src/libmpg123/synth_mono.h \ src/libmpg123/synth_ntom.h \ src/libmpg123/synth_8bit.h \ src/libmpg123/synths.h \ src/libmpg123/equalizer.c \ src/libmpg123/huffman.h \ src/libmpg123/newhuffman.h \ src/libmpg123/icy.h \ src/libmpg123/icy2utf8.h \ src/libmpg123/id3.h \ src/libmpg123/id3.c \ src/libmpg123/true.h \ src/libmpg123/getbits.h \ src/libmpg123/optimize.h \ src/libmpg123/optimize.c \ src/libmpg123/readers.c \ src/libmpg123/tabinit.c \ src/libmpg123/libmpg123.c \ src/libmpg123/gapless.h \ src/libmpg123/mpg123lib_intern.h \ src/libmpg123/abi_align.h \ src/libmpg123/mangle.h \ src/libmpg123/getcpuflags.h \ src/libmpg123/index.h \ src/libmpg123/index.c EXTRA_src_libmpg123_libmpg123_la_SOURCES = \ src/libmpg123/lfs_alias.c \ src/libmpg123/lfs_wrap.c \ src/libmpg123/icy.c \ src/libmpg123/icy2utf8.c \ src/libmpg123/l2tables.h \ src/libmpg123/layer1.c \ src/libmpg123/layer2.c \ src/libmpg123/layer3.c \ src/libmpg123/dither.h \ src/libmpg123/dither_impl.h \ src/libmpg123/dither.c \ src/libmpg123/feature.c \ src/libmpg123/dct36_3dnowext.S \ src/libmpg123/dct36_3dnow.S \ src/libmpg123/dct36_sse.S \ src/libmpg123/dct36_x86_64.S \ src/libmpg123/dct36_avx.S \ src/libmpg123/dct36_neon.S \ src/libmpg123/dct36_neon64.S \ src/libmpg123/dct64_3dnowext.S \ src/libmpg123/dct64_3dnow.S \ src/libmpg123/dct64_altivec.c \ src/libmpg123/dct64_i386.c \ src/libmpg123/dct64_i486.c \ src/libmpg123/dct64_mmx.S \ src/libmpg123/dct64_sse.S \ src/libmpg123/dct64_sse_float.S \ src/libmpg123/dct64_x86_64.S \ src/libmpg123/dct64_x86_64_float.S \ src/libmpg123/dct64_neon.S \ src/libmpg123/dct64_neon_float.S \ src/libmpg123/dct64_neon64.S \ src/libmpg123/dct64_neon64_float.S \ src/libmpg123/dct64_avx.S \ src/libmpg123/dct64_avx_float.S \ src/libmpg123/synth_3dnowext.S \ src/libmpg123/synth_3dnow.S \ src/libmpg123/synth_altivec.c \ src/libmpg123/synth_i486.c \ src/libmpg123/synth_i586_dither.S \ src/libmpg123/synth_i586.S \ src/libmpg123/synth_mmx.S \ src/libmpg123/synth_sse3d.h \ src/libmpg123/synth_sse.S \ src/libmpg123/synth_sse_float.S \ src/libmpg123/synth_sse_s32.S \ src/libmpg123/synth_sse_accurate.S \ src/libmpg123/synth_stereo_sse_float.S \ src/libmpg123/synth_stereo_sse_s32.S \ src/libmpg123/synth_stereo_sse_accurate.S \ src/libmpg123/synth_x86_64.S \ src/libmpg123/synth_x86_64_float.S \ src/libmpg123/synth_x86_64_s32.S \ src/libmpg123/synth_x86_64_accurate.S \ src/libmpg123/synth_stereo_x86_64.S \ src/libmpg123/synth_stereo_x86_64_float.S \ src/libmpg123/synth_stereo_x86_64_s32.S \ src/libmpg123/synth_stereo_x86_64_accurate.S \ src/libmpg123/synth_arm.S \ src/libmpg123/synth_arm_accurate.S \ src/libmpg123/synth_neon.S \ src/libmpg123/synth_neon_float.S \ src/libmpg123/synth_neon_s32.S \ src/libmpg123/synth_neon_accurate.S \ src/libmpg123/synth_stereo_neon.S \ src/libmpg123/synth_stereo_neon_float.S \ src/libmpg123/synth_stereo_neon_s32.S \ src/libmpg123/synth_stereo_neon_accurate.S \ src/libmpg123/synth_neon64.S \ src/libmpg123/synth_neon64_float.S \ src/libmpg123/synth_neon64_s32.S \ src/libmpg123/synth_neon64_accurate.S \ src/libmpg123/synth_stereo_neon64.S \ src/libmpg123/synth_stereo_neon64_float.S \ src/libmpg123/synth_stereo_neon64_s32.S \ src/libmpg123/synth_stereo_neon64_accurate.S \ src/libmpg123/synth_stereo_avx.S \ src/libmpg123/synth_stereo_avx_float.S \ src/libmpg123/synth_stereo_avx_s32.S \ src/libmpg123/synth_stereo_avx_accurate.S \ src/libmpg123/ntom.c \ src/libmpg123/synth.c \ src/libmpg123/synth_8bit.c \ src/libmpg123/synth_real.c \ src/libmpg123/synth_s32.c \ src/libmpg123/equalizer_3dnow.S \ src/libmpg123/tabinit_mmx.S \ src/libmpg123/stringbuf.c \ src/libmpg123/getcpuflags.S \ src/libmpg123/getcpuflags_x86_64.S \ src/libmpg123/getcpuflags_arm.c \ src/libmpg123/check_neon.S \ src/libmpg123/l12_integer_tables.h \ src/libmpg123/l3_integer_tables.h if USE_YASM_FOR_AVX ## Override rules for the sources that should be assembled with yasm AVX_SRCS = \ src/libmpg123/dct36_avx.S \ src/libmpg123/dct64_avx.S \ src/libmpg123/dct64_avx_float.S \ src/libmpg123/synth_stereo_avx.S \ src/libmpg123/synth_stereo_avx_float.S \ src/libmpg123/synth_stereo_avx_s32.S \ src/libmpg123/synth_stereo_avx_accurate.S AVX_OBJS = $(AVX_SRCS:.S=.@OBJEXT@) ASM_DEPS = \ src/libmpg123/mangle.h \ $(top_builddir)/src/config.h \ src/intsym.h $(AVX_OBJS): %.@OBJEXT@: %.S $(ASM_DEPS) $(CPP) $(DEFAULT_INCLUDES) $(INCLUDES) -DASMALIGN_BALIGN $< | @YASM@ - @YASMFLAGS@ @YASM_FORMAT@ -o $@ $(AVX_OBJS:.@OBJEXT@=.lo): %.lo: %.@OBJEXT@ @echo "# Generated by ltmain.sh (GNU libtool)" >$@ @echo "pic_object='`basename $<`'" >>$@ @echo "non_pic_object='`basename $<`'" >>$@ endif welle.io-2.1/src/libs/mpg123/abi_align.h000066400000000000000000000022161357201522000176770ustar00rootroot00000000000000/* abi_align: An attempt to avoid breakage because of mixing compilers with different alignment. copyright 1995-2015 by the mpg123 project free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org There used to be code that checks alignment, but it did not really work anyway. The only straw we have is putting that alignment attribute to API functions. */ #ifndef MPG123_H_ABI_ALIGN #define MPG123_H_ABI_ALIGN #include "config.h" /* ABI conformance for other compilers. mpg123 needs 16byte-aligned (or more) stack for SSE and friends. gcc provides that, but others don't necessarily. */ #ifdef ABI_ALIGN_FUN #ifndef attribute_align_arg #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__>1) # define attribute_align_arg __attribute__((force_align_arg_pointer)) /* The gcc that can align the stack does not need the check... nor does it work with gcc 4.3+, anyway. */ #else # define attribute_align_arg #endif #endif /* attribute_align_arg */ #else /* ABI_ALIGN_FUN */ #define attribute_align_arg #endif /* ABI_ALIGN_FUN */ #endif /* MPG123_H_ABI_ALIGN */ welle.io-2.1/src/libs/mpg123/check_neon.S000066400000000000000000000011241357201522000200360ustar00rootroot00000000000000/* check_neon: check NEON availability copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Momma */ #include "mangle.h" #ifndef __aarch64__ #ifndef _M_ARM .code 32 #endif #ifndef __APPLE__ .fpu neon #endif #endif .text GLOBAL_SYMBOL ASM_NAME(check_neon) #ifdef __ELF__ .type ASM_NAME(check_neon), %function #endif ALIGN4 ASM_NAME(check_neon): #ifdef __aarch64__ orr v0.16b, v0.16b, v0.16b ret #else vorr d0, d0, d0 bx lr #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/compat.c000066400000000000000000000353571357201522000172640ustar00rootroot00000000000000/* compat: Some compatibility functions (basic memory & string stuff in separate file) The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX. So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-) copyright 2007-2016 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis, Windows Unicode stuff by JonY. */ #include "config.h" /* This source file does need _POSIX_SOURCE to get some sigaction. */ #define _POSIX_SOURCE #include "compat.h" #ifdef _MSC_VER #include #if(defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP)) #define WINDOWS_UWP #endif #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_DIRENT_H # include #endif /* Win32 is only supported with unicode now. These headers also cover module stuff. The WANT_WIN32_UNICODE macro is synonymous with "want windows-specific API, and only the unicode variants of which". */ #ifdef WANT_WIN32_UNICODE #include #include #include #include #endif #ifdef USE_MODULES # ifdef HAVE_DLFCN_H # include # endif #endif #include "debug.h" #ifndef WINDOWS_UWP char *compat_getenv(const char* name) { char *ret = NULL; #ifdef WANT_WIN32_UNICODE wchar_t *env; wchar_t *wname = NULL; if(win32_utf8_wide(name, &wname, NULL) > 0) { env = _wgetenv(wname); free(wname); if(env) win32_wide_utf8(env, &ret, NULL); } #else ret = getenv(name); if(ret) ret = compat_strdup(ret); #endif return ret; } #ifdef WANT_WIN32_UNICODE /* Convert unix UTF-8 (or ASCII) paths to Windows wide character paths. */ static wchar_t* u2wpath(const char *upath) { wchar_t* wpath, *p; if(!upath || win32_utf8_wide(upath, &wpath, NULL) < 1) return NULL; for(p=wpath; *p; ++p) if(*p == L'/') *p = L'\\'; return wpath; } /* Convert Windows wide character paths to unix UTF-8. */ static char* w2upath(const wchar_t *wpath) { char* upath, *p; if(!wpath || win32_wide_utf8(wpath, &upath, NULL) < 1) return NULL; for(p=upath; *p; ++p) if(*p == '\\') *p = '/'; return upath; } /* An absolute path that is too long and not already marked with \\?\ can be marked as a long one and still work. */ static int wpath_need_elongation(wchar_t *wpath) { if( wpath && !PathIsRelativeW(wpath) && wcslen(wpath) > MAX_PATH-1 && wcsncmp(L"\\\\?\\", wpath, 4) ) return 1; else return 0; } /* Take any wide windows path and turn it into a path that is allowed to be longer than MAX_PATH, if it is not already. */ static wchar_t* wlongpath(wchar_t *wpath) { size_t len, plen; const wchar_t *prefix = L""; wchar_t *wlpath = NULL; if(!wpath) return NULL; /* Absolute paths that do not start with \\?\ get that prepended to allow them being long. */ if(!PathIsRelativeW(wpath) && wcsncmp(L"\\\\?\\", wpath, 4)) { if(wcslen(wpath) >= 2 && PathIsUNCW(wpath)) { /* \\server\path -> \\?\UNC\server\path */ prefix = L"\\\\?\\UNC"; ++wpath; /* Skip the first \. */ } else /* c:\some/path -> \\?\c:\some\path */ prefix = L"\\\\?\\"; } plen = wcslen(prefix); len = plen + wcslen(wpath); wlpath = malloc(len+1*sizeof(wchar_t)); if(wlpath) { /* Brute force memory copying, swprintf is too dandy. */ memcpy(wlpath, prefix, sizeof(wchar_t)*plen); memcpy(wlpath+plen, wpath, sizeof(wchar_t)*(len-plen)); wlpath[len] = 0; } return wlpath; } /* Convert unix path to wide windows path, optionally marking it as long path if necessary. */ static wchar_t* u2wlongpath(const char *upath) { wchar_t *wpath = NULL; wchar_t *wlpath = NULL; wpath = u2wpath(upath); if(wpath_need_elongation(wpath)) { wlpath = wlongpath(wpath); free(wpath); wpath = wlpath; } return wpath; } #endif #else static wchar_t* u2wlongpath(const char *upath) { wchar_t* wpath, *p; if (!upath || win32_utf8_wide(upath, &wpath, NULL) < 1) return NULL; for (p = wpath; *p; ++p) if (*p == L'/') *p = L'\\'; return wpath; } #endif /* Always add a default permission mask in case of flags|O_CREAT. */ int compat_open(const char *filename, int flags) { int ret; #if defined (WANT_WIN32_UNICODE) wchar_t *frag = NULL; frag = u2wlongpath(filename); /* Fallback to plain open when ucs-2 conversion fails */ if(!frag) goto open_fallback; /*Try _wopen */ ret = _wopen(frag, flags|_O_BINARY, _S_IREAD | _S_IWRITE); if(ret != -1 ) goto open_ok; /* msdn says -1 means failure */ open_fallback: #endif #if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ /* Try plain old _open(), if it fails, do nothing */ ret = _open(filename, flags|_O_BINARY, _S_IREAD | _S_IWRITE); #else ret = open(filename, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); #endif #if defined (WANT_WIN32_UNICODE) open_ok: free(frag); #endif return ret; } /* Moved over from wav.c, logic with fallbacks added from the example of compat_open(). */ FILE* compat_fopen(const char *filename, const char *mode) { FILE* stream = NULL; #ifdef WANT_WIN32_UNICODE int cnt = 0; wchar_t *wname = NULL; wchar_t *wmode = NULL; wname = u2wlongpath(filename); if(!wname) goto fopen_fallback; cnt = win32_utf8_wide(mode, &wmode, NULL); if( (wmode == NULL) || (cnt == 0)) goto fopen_fallback; stream = _wfopen(wname, wmode); if(stream) goto fopen_ok; fopen_fallback: #endif stream = fopen(filename, mode); #ifdef WANT_WIN32_UNICODE fopen_ok: free(wmode); free(wname); #endif return stream; } FILE* compat_fdopen(int fd, const char *mode) { return fdopen(fd, mode); } int compat_close(int infd) { #if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ return _close(infd); #else return close(infd); #endif } int compat_fclose(FILE *stream) { return fclose(stream); } /* Windows Unicode stuff */ #ifdef WANT_WIN32_UNICODE int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen) { size_t len; char *buf; int ret = 0; len = WideCharToMultiByte(CP_UTF8, 0, wptr, -1, NULL, 0, NULL, NULL); /* Get utf-8 string length */ buf = calloc(len + 1, sizeof (char)); /* Can we assume sizeof char always = 1? */ if(!buf) len = 0; else { if (len != 0) ret = WideCharToMultiByte(CP_UTF8, 0, wptr, -1, buf, len, NULL, NULL); /*Do actual conversion*/ buf[len] = '0'; /* Must terminate */ } *mbptr = buf; /* Set string pointer to allocated buffer */ if(buflen != NULL) *buflen = (len) * sizeof (char); /* Give length of allocated memory if needed. */ return ret; } int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen) { size_t len; wchar_t *buf; int ret = 0; len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mbptr, -1, NULL, 0); /* Get converted size */ buf = calloc(len + 1, sizeof (wchar_t)); /* Allocate memory accordingly */ if(!buf) len = 0; else { if (len != 0) ret = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, mbptr, -1, buf, len); /* Do conversion */ buf[len] = L'0'; /* Must terminate */ } *wptr = buf; /* Set string pointer to allocated buffer */ if (buflen != NULL) *buflen = len * sizeof (wchar_t); /* Give length of allocated memory if needed. */ return ret; /* Number of characters written */ } #endif #ifndef WINDOWS_UWP /* The Windows file and path stuff is an extract of jon_y's win32 loader prototype from the loader_rework branch. It's been divided in to reusable functons by ThOr in the hope to work out some generic-looking loader code for both POSIX and Windows. The routines might be helpful for consistent path work in other parts of mpg123, too. This all is about getting some working code on a wide range of systems while staying somewhat sane. If it does ridiculously inefficient things with extraneous copies and grabbing of functions that made it late to some official APIs, that's still fine with us. */ char* compat_catpath(const char *prefix, const char* path) { char *ret = NULL; #ifdef WANT_WIN32_UNICODE wchar_t *wprefix = NULL; /* Wide windows versions of */ wchar_t *wpath = NULL; /* input arguments. */ wchar_t *locwret = NULL; /* Tmp return value from LocalAlloc */ /* This variation of combinepath can work with long and UNC paths, but is not officially exposed in any DLLs, It also allocates all its buffers internally via LocalAlloc, avoiding buffer overflow problems. ThOr: I presume this hack is for supporting pre-8 Windows, as from Windows 8 on, this is documented in the API. */ HRESULT (__stdcall *mypac)( const wchar_t *in, const wchar_t* more , unsigned long flags, wchar_t **out ) = NULL; HMODULE pathcch = NULL; if(!prefix && !path) goto catpath_end; wprefix = u2wpath(prefix); wpath = u2wpath(path); if((prefix && !wprefix) || (path && !wpath)) goto catpath_end; /* Again: I presume this whole fun is to get at PathAllocCombine even when pathcch.h is not available (like in MinGW32). */ if( (pathcch = GetModuleHandleA("kernelbase")) ) mypac = (void *)GetProcAddress(pathcch, "PathAllocCombine"); if(mypac) /* PATHCCH_ALLOW_LONG_PATH = 1 per API docs */ { debug("Actually calling PathAllocCombine!"); mypac(wprefix, wpath, 1, &locwret); } else { /* Playing safe, if we'd care much about performance, this would be on the stack. */ locwret = LocalAlloc(LPTR, sizeof(wchar_t)*MAX_PATH); if(locwret) PathCombineW(locwret, wprefix, wpath); } ret = w2upath(locwret); catpath_end: LocalFree(locwret); free(wprefix); free(wpath); #else size_t len, prelen, patlen; if(path && path[0] == '/') prefix = NULL; /* Absolute path stays as it is. */ prelen = prefix ? strlen(prefix) : 0; patlen = path ? strlen(path) : 0; /* Concatenate the two, put a / in between if both present. */ len = ((prefix && path) ? 1 : 0) + prelen + patlen; ret = malloc(len+1); if(ret) { size_t off=0; memcpy(ret, prefix, prelen); if(prefix && path) ret[prelen+(off++)] = '/'; memcpy(ret+prelen+off, path, patlen); ret[len] = 0; } #endif return ret; } int compat_isdir(const char *path) { int ret = 0; #ifdef WANT_WIN32_UNICODE wchar_t *wpath; wpath = u2wlongpath(path); if(wpath) { DWORD attr = GetFileAttributesW(wpath); if(attr != INVALID_FILE_ATTRIBUTES && attr & FILE_ATTRIBUTE_DIRECTORY) ret=1; free(wpath); } #else struct stat sb; if(path && !stat(path, &sb)) { if(S_ISDIR(sb.st_mode)) ret=1; } #endif return ret; } struct compat_dir { char *path; #ifdef WANT_WIN32_UNICODE int gotone; /* Got a result stored from FindFirstFileW. */ WIN32_FIND_DATAW d; HANDLE ffn; #else DIR* dir; #endif }; struct compat_dir* compat_diropen(char *path) { struct compat_dir *cd; if(!path) return NULL; cd = malloc(sizeof(*cd)); if(!cd) return NULL; #ifdef WANT_WIN32_UNICODE cd->gotone = 0; { char *pattern; wchar_t *wpattern; pattern = compat_catpath(path, "*"); wpattern = u2wlongpath(pattern); if(wpattern) { cd->ffn = FindFirstFileW(wpattern, &(cd->d)); if(cd->ffn == INVALID_HANDLE_VALUE) { /* FindClose() only needed after successful first find, right? */ free(cd); cd = NULL; } else cd->gotone = 1; } free(wpattern); free(pattern); } #else cd->dir = opendir(path); if(!cd->dir) { free(cd); cd = NULL; } #endif if(cd) { cd->path = compat_strdup(path); if(!cd->path) { compat_dirclose(cd); cd = NULL; } } return cd; } void compat_dirclose(struct compat_dir *cd) { if(cd) { free(cd->path); #ifdef WANT_WIN32_UNICODE FindClose(cd->ffn); #else closedir(cd->dir); #endif free(cd); } } char* compat_nextfile(struct compat_dir *cd) { if(!cd) return NULL; #ifdef WANT_WIN32_UNICODE while(cd->gotone || FindNextFileW(cd->ffn, &(cd->d))) { cd->gotone = 0; if(!(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { char *ret; win32_wide_utf8(cd->d.cFileName, &ret, NULL); return ret; } } #else { struct dirent *dp; while((dp = readdir(cd->dir))) { struct stat fst; char *fullpath = compat_catpath(cd->path, dp->d_name); if(fullpath && !stat(fullpath, &fst) && S_ISREG(fst.st_mode)) { free(fullpath); return compat_strdup(dp->d_name); } free(fullpath); } } #endif return NULL; } char* compat_nextdir(struct compat_dir *cd) { if(!cd) return NULL; #ifdef WANT_WIN32_UNICODE while(cd->gotone || FindNextFileW(cd->ffn, &(cd->d))) { cd->gotone = 0; if(cd->d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { char *ret; win32_wide_utf8(cd->d.cFileName, &ret, NULL); return ret; } } #else { struct dirent *dp; while((dp = readdir(cd->dir))) { struct stat fst; char *fullpath = compat_catpath(cd->path, dp->d_name); if(fullpath && !stat(fullpath, &fst) && S_ISDIR(fst.st_mode)) { free(fullpath); return compat_strdup(dp->d_name); } free(fullpath); } } #endif return NULL; } #endif #ifdef USE_MODULES /* This is what I expected the platform-specific dance for dynamic module support to be. Little did I know about the peculiarities of (long) paths and directory/file search on Windows. */ void *compat_dlopen(const char *path) { void *handle = NULL; #ifdef WANT_WIN32_UNICODE wchar_t *wpath; wpath = u2wlongpath(path); if(wpath) handle = LoadLibraryW(wpath); free(wpath); #else handle = dlopen(path, RTLD_NOW); #endif return handle; } void *compat_dlsym(void *handle, const char *name) { void *sym = NULL; if(!handle) return NULL; #ifdef WANT_WIN32_UNICODE sym = GetProcAddress(handle, name); #else sym = dlsym(handle, name); #endif return sym; } void compat_dlclose(void *handle) { if(!handle) return; #ifdef WANT_WIN32_UNICODE FreeLibrary(handle); #else dlclose(handle); #endif } #endif /* USE_MODULES */ /* This shall survive signals and any return value less than given byte count is an error */ size_t unintr_write(int fd, void const *buffer, size_t bytes) { size_t written = 0; while(bytes) { ssize_t part = write(fd, (char*)buffer+written, bytes); if(part < 0 && errno != EINTR) break; bytes -= part; written += part; } return written; } /* Same for reading the data. */ size_t unintr_read(int fd, void *buffer, size_t bytes) { size_t got = 0; while(bytes) { ssize_t part = read(fd, (char*)buffer+got, bytes); if(part < 0 && errno != EINTR) break; bytes -= part; got += part; } return got; } #ifndef NO_CATCHSIGNAL #if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H) void (*catchsignal(int signum, void(*handler)()))() { struct sigaction new_sa; struct sigaction old_sa; #ifdef DONT_CATCH_SIGNALS fprintf (stderr, "Not catching any signals.\n"); return ((void (*)()) -1); #endif new_sa.sa_handler = handler; sigemptyset(&new_sa.sa_mask); new_sa.sa_flags = 0; if(sigaction(signum, &new_sa, &old_sa) == -1) return ((void (*)()) -1); return (old_sa.sa_handler); } #endif #endif welle.io-2.1/src/libs/mpg123/compat.h000066400000000000000000000222671357201522000172650ustar00rootroot00000000000000/* compat: Some compatibility functions and header inclusions. Basic standard C stuff, that may barely be above/around C89. The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX. It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues. So, don't include stdlib.h or string.h ... include compat.h. copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #ifndef MPG123_COMPAT_H #define MPG123_COMPAT_H #include "config.h" #include "intsym.h" /* For --nagging compilation with -std=c89, we need to disable the inline keyword. */ #ifdef PLAIN_C89 #ifndef inline #define inline #endif #endif #include #ifdef HAVE_STDLIB_H /* realloc, size_t */ #include #endif #include #include #ifdef HAVE_SIGNAL_H #include #else #ifdef HAVE_SYS_SIGNAL_H #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif /* Types, types, types. */ /* Do we actually need these two in addition to sys/types.h? As replacement? */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_INTTYPES_H #include #endif #ifdef HAVE_STDINT_H #include #endif /* We want SIZE_MAX, etc. */ #ifdef HAVE_LIMITS_H #include #endif #ifndef SIZE_MAX #define SIZE_MAX ((size_t)-1) #endif #ifndef ULONG_MAX #define ULONG_MAX ((unsigned long)-1) #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef OS2 #include #endif #ifdef HAVE_SYS_TIME_H #include #endif /* For select(), I need select.h according to POSIX 2001, else: sys/time.h sys/types.h unistd.h */ #ifdef HAVE_SYS_SELECT_H #include #endif /* compat_open makes little sense without */ #include /* To parse big numbers... */ #ifdef HAVE_ATOLL #define atobigint atoll #else #define atobigint atol #endif typedef unsigned char byte; #if defined(_MSC_VER) && !defined(MPG123_DEF_SSIZE_T) #define MPG123_DEF_SSIZE_T #include typedef ptrdiff_t ssize_t; #endif /* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ void *safe_realloc(void *ptr, size_t size); #ifndef HAVE_STRERROR const char *strerror(int errnum); #endif /* Roll our own strdup() that does not depend on libc feature test macros and returns NULL on NULL input instead of crashing. */ char* compat_strdup(const char *s); /* If we have the size checks enabled, try to derive some sane printfs. Simple start: Use max integer type and format if long is not big enough. I am hesitating to use %ll without making sure that it's there... */ #if !(defined PLAIN_C89) && (defined SIZEOF_OFF_T) && (SIZEOF_OFF_T > SIZEOF_LONG) && (defined PRIiMAX) # define OFF_P PRIiMAX typedef intmax_t off_p; #else # define OFF_P "li" typedef long off_p; #endif #if !(defined PLAIN_C89) && (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX) # define SIZE_P PRIuMAX typedef uintmax_t size_p; #else # define SIZE_P "lu" typedef unsigned long size_p; #endif #if !(defined PLAIN_C89) && (defined SIZEOF_SSIZE_T) && (SIZEOF_SSIZE_T > SIZEOF_LONG) && (defined PRIiMAX) # define SSIZE_P PRIuMAX typedef intmax_t ssize_p; #else # define SSIZE_P "li" typedef long ssize_p; #endif /* Get an environment variable, possibly converted to UTF-8 from wide string. The return value is a copy that you shall free. */ char *compat_getenv(const char* name); /** * Opening a file handle can be different. * This function here is defined to take a path in native encoding (ISO8859 / UTF-8 / ...), or, when MS Windows Unicode support is enabled, an UTF-8 string that will be converted back to native UCS-2 (wide character) before calling the system's open function. * @param[in] wptr Pointer to wide string. * @param[in] mbptr Pointer to multibyte string. * @return file descriptor (>=0) or error code. */ int compat_open(const char *filename, int flags); FILE* compat_fopen(const char *filename, const char *mode); /** * Also fdopen to avoid having to define POSIX macros in various source files. */ FILE* compat_fdopen(int fd, const char *mode); /** * Closing a file handle can be platform specific. * This function takes a file descriptor that is to be closed. * @param[in] infd File descriptor to be closed. * @return 0 if the file was successfully closed. A return value of -1 indicates an error. */ int compat_close(int infd); int compat_fclose(FILE* stream); /* Those do make sense in a separate file, but I chose to include them in compat.c because that's the one source whose object is shared between mpg123 and libmpg123 -- and both need the functionality internally. */ #ifdef WANT_WIN32_UNICODE /** * win32_uni2mbc * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. * Caller is supposed to free allocated buffer. * @param[in] wptr Pointer to wide string. * @param[out] mbptr Pointer to multibyte string. * @param[out] buflen Optional parameter for length of allocated buffer. * @return status of WideCharToMultiByte conversion. * * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx */ int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen); /** * win32_mbc2uni * Converts a null terminated UTF-8 string to a UCS-2 equivalent. * Caller is supposed to free allocated buffer. * @param[out] mbptr Pointer to multibyte string. * @param[in] wptr Pointer to wide string. * @param[out] buflen Optional parameter for length of allocated buffer. * @return status of WideCharToMultiByte conversion. * * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx */ int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen); #endif /* A little bit of path abstraction: We always work with plain char strings that usually represent POSIX-ish UTF-8 paths (something like c:/some/file might appear). For Windows, those are converted to wide strings with \ instead of / and possible fun is had with prefixes to get around the old path length limit. Outside of the compat library, that stuff should not matter, although something like //?/UNC/server/some/file could be thrown around as UTF-8 string, to be converted to a wide \\?\UNC\server\some\file just before handing it to Windows API. There is a lot of unnecessary memory allocation and string copying because of this, but this filesystem stuff is not really relevant to mpg123 performance, so the goal is to keep the code outside the compatibility layer simple. */ /* Concatenate a prefix and a path, one of them alowed to be NULL. If the path is already absolute, the prefix is ignored. Relative parts (like /..) are resolved if this is sensible for the platform (meaning: for Windows), else they are preserved (on POSIX, actual file system access would be needed because of symlinks). */ char* compat_catpath(const char *prefix, const char* path); /* Return 1 if the given path indicates an existing directory, 0 otherwise. */ int compat_isdir(const char *path); /* Directory traversal. This talks ASCII/UTF-8 paths externally, converts to/from wchar_t internally if the platform wants that. Returning NULL means failure to open/end of listing. There is no promise about sorting entries. */ struct compat_dir; /* Returns NULL if either directory failed to open or listing is empty. Listing can still be empty even if non-NULL, so always rely on the nextfile/nextdir functions. */ struct compat_dir* compat_diropen(char *path); void compat_dirclose(struct compat_dir*); /* Get the next entry that is a file (or symlink to one). The returned string is a copy that needs to be freed after use. */ char* compat_nextfile(struct compat_dir*); /* Get the next entry that is a directory (or symlink to one). The returned string is a copy that needs to be freed after use. */ char* compat_nextdir (struct compat_dir*); #ifdef USE_MODULES /* For keeping the path mess local, a system-specific dlopen() variant is contained in here, too. This is very thin wrapping, even sparing definition of a handle type, just using void pointers. Use of absolute paths is a good idea if you want to be sure which file is openend, as default search paths vary. */ void *compat_dlopen (const char *path); void *compat_dlsym (void *handle, const char* name); void compat_dlclose(void *handle); #endif /* Blocking write/read of data with signal resilience. Both continue after being interrupted by signals and always return the amount of processed data (shortage indicating actual problem or EOF). */ size_t unintr_write(int fd, void const *buffer, size_t bytes); size_t unintr_read (int fd, void *buffer, size_t bytes); /* That one comes from Tellie on OS/2, needed in resolver. */ #ifdef __KLIBC__ typedef int socklen_t; #endif /* OSX SDK defines an enum with "normal" as value. That clashes with optimize.h */ #ifdef __APPLE__ #define normal mpg123_normal #endif #include "true.h" #if (!defined(WIN32) || defined (__CYGWIN__)) && defined(HAVE_SIGNAL_H) void (*catchsignal(int signum, void(*handler)()))(); #endif #endif welle.io-2.1/src/libs/mpg123/compat_str.c000066400000000000000000000021001357201522000201300ustar00rootroot00000000000000/* compat: Some compatibility functions (basic memory and string stuff) The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX. So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-) copyright 2007-2016 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis, Windows Unicode stuff by JonY. */ #include "compat.h" #include "debug.h" /* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ void *safe_realloc(void *ptr, size_t size) { if(ptr == NULL) return malloc(size); else return realloc(ptr, size); } #ifndef HAVE_STRERROR const char *strerror(int errnum) { extern int sys_nerr; extern char *sys_errlist[]; return (errnum < sys_nerr) ? sys_errlist[errnum] : ""; } #endif char* compat_strdup(const char *src) { char *dest = NULL; if(src) { size_t len; len = strlen(src)+1; if((dest = malloc(len))) memcpy(dest, src, len); } return dest; } welle.io-2.1/src/libs/mpg123/config.h000066400000000000000000000316001357201522000172360ustar00rootroot00000000000000/* src/config.h. Generated from config.h.in by configure. */ /* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define if your architecture wants/needs/can use attribute_align_arg and alignment checks. It is for 32bit x86... */ /* #undef ABI_ALIGN_FUN */ /* Define to use proper rounding. */ /* #undef ACCURATE_ROUNDING */ /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ /* Define if .balign is present. */ #define ASMALIGN_BALIGN 1 /* Define if .align just takes byte count. */ /* #undef ASMALIGN_BYTE */ /* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */ /* #undef ASMALIGN_EXP */ /* Define if __attribute__((aligned(16))) shall be used */ #define CCALIGN 1 /* Define if debugging is enabled. */ /* #undef DEBUG */ /* The default audio output module(s) to use */ #define DEFAULT_OUTPUT_MODULE "alsa,oss,sndio,jack,portaudio,pulse" /* Define if building with dynamcally linked libmpg123 */ #define DYNAMIC_BUILD 1 /* Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter */ /* #undef EOVERFLOW */ /* Define if FIFO support is enabled. */ #define FIFO 1 /* Define if frame index should be used. */ #define FRAME_INDEX 1 /* Define if gapless is enabled. */ #define GAPLESS 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_ALC_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_ALIB_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_AL_ALC_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_AL_AL_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_AL_H */ /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_ASM_AUDIOIO_H */ /* Define to 1 if you have the `atoll' function. */ #define HAVE_ATOLL 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_AUDIOS_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_AUDIOUNIT_AUDIOUNIT_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_CORESERVICES_CORESERVICES_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_CULIB_H */ /* Define to 1 if you have the header file. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you have the `dlclose' function. */ #define HAVE_DLCLOSE 1 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `dlopen' function. */ #define HAVE_DLOPEN 1 /* Define to 1 if you have the `dlsym' function. */ #define HAVE_DLSYM 1 /* Define if getaddrinfo accepts the AI_ADDRCONFIG flag */ #define HAVE_GAI_ADDRCONFIG 1 /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getpagesize' function. */ #define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the `getuid' function. */ #define HAVE_GETUID 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LANGINFO_H 1 /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 /* Define to 1 if you have the `mx' library (-lmx). */ /* #undef HAVE_LIBMX */ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the header file. */ //#define HAVE_LINUX_SOUNDCARD_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_MACHINE_SOUNDCARD_H */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `mkfifo' function. */ #define HAVE_MKFIFO 1 /* Define to 1 if you have a working `mmap' system call. */ #define HAVE_MMAP 1 /* Define to 1 if you have the header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_NETINET_TCP_H */ /* Define to 1 if you have the `nl_langinfo' function. */ #define HAVE_NL_LANGINFO 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_OPENAL_ALC_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_OPENAL_AL_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_OS2ME_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_OS2_H */ /* Define to 1 if you have the `random' function. */ #define HAVE_RANDOM 1 /* Define to 1 if you have the header file. */ #define HAVE_SCHED_H 1 /* Define to 1 if you have the `sched_setscheduler' function. */ #define HAVE_SCHED_SETSCHEDULER 1 /* Define to 1 if you have the `setlocale' function. */ #define HAVE_SETLOCALE 1 /* Define to 1 if you have the `setpriority' function. */ #define HAVE_SETPRIORITY 1 /* Define to 1 if you have the `setuid' function. */ #define HAVE_SETUID 1 /* Define to 1 if you have the header file. */ #define HAVE_SIGNAL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SNDIO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDIO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_SUN_AUDIOIO_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_AUDIOIO_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_AUDIO_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_RESOURCE_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SELECT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SIGNAL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOUNDCARD_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_WAIT_H 1 /* Define this if you have the POSIX termios library */ #define HAVE_TERMIOS 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_WINDOWS_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_WS2TCPIP_H */ /* Define to indicate that float storage follows IEEE754. */ #define IEEE_FLOAT 1 /* size of the frame index seek table */ #define INDEX_SIZE 1000 /* Define if IPV6 support is enabled. */ #define IPV6 1 /* Define this to the size of native offset type in bits, used for LFS alias functions. */ #define LFS_ALIAS_BITS 64 /* Define to the extension used for runtime loadable modules, say, ".so". */ #define LT_MODULE_EXT ".so" /* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to the shared library suffix, say, ".dylib". */ /* #undef LT_SHARED_EXT */ /* Define to the shared archive member specification, say "(shr.o)". */ /* #undef LT_SHARED_LIB_MEMBER */ /* Define if network support is enabled. */ #define NETWORK 1 /* Define to disable 16 bit integer output. */ /* #undef NO_16BIT */ /* Define to disable 32 bit and 24 bit integer output. */ /* #undef NO_32BIT */ /* Define to disable 8 bit integer output. */ /* #undef NO_8BIT */ /* Define to disable downsampled decoding. */ /* #undef NO_DOWNSAMPLE */ /* Define to disable equalizer. */ /* #undef NO_EQUALIZER */ /* Define to disable error messages in combination with a return value (the return is left intact). */ /* #undef NO_ERETURN */ /* Define to disable error messages. */ /* #undef NO_ERRORMSG */ /* Define to disable feeder and buffered readers. */ /* #undef NO_FEEDER */ /* Define to disable ICY handling. */ /* #undef NO_ICY */ /* Define to disable ID3v2 parsing. */ /* #undef NO_ID3V2 */ /* Define to disable layer I. */ /* #undef NO_LAYER1 */ /* Define to disable layer II. */ /* #undef NO_LAYER2 */ /* Define to disable layer III. */ /* #undef NO_LAYER3 */ /* Define to disable ntom resampling. */ /* #undef NO_NTOM */ /* Define to disable real output. */ /* #undef NO_REAL */ /* Define to disable string functions. */ /* #undef NO_STRING */ /* Define for post-processed 32 bit formats. */ /* #undef NO_SYNTH32 */ /* Define to disable warning messages. */ /* #undef NO_WARNING */ /* Name of package */ #define PACKAGE "mpg123" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "maintainer@mpg123.org" /* Define to the full name of this package. */ #define PACKAGE_NAME "mpg123" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "mpg123 1.25.10" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "mpg123" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ #define PACKAGE_VERSION "1.25.10" /* Define if portaudio v18 API is wanted. */ /* #undef PORTAUDIO18 */ /* The size of `int32_t', as computed by sizeof. */ #define SIZEOF_INT32_T 4 /* The size of `long', as computed by sizeof. */ #define SIZEOF_LONG 8 /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 /* The size of `size_t', as computed by sizeof. */ #define SIZEOF_SIZE_T 8 /* The size of `ssize_t', as computed by sizeof. */ #define SIZEOF_SSIZE_T 8 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if modules are enabled */ #define USE_MODULES 1 /* Define for new Huffman decoding scheme. */ #define USE_NEW_HUFFTABLE 1 /* Define to use yasm for assemble AVX sources. */ /* #undef USE_YASM_FOR_AVX */ /* Version number of package */ #define VERSION "1.25.10" /* Define to use Win32 named pipes */ /* #undef WANT_WIN32_FIFO */ /* Define to use Win32 sockets */ /* #undef WANT_WIN32_SOCKETS */ /* Define to use Unicode for Windows */ /* #undef WANT_WIN32_UNICODE */ /* WinXP and above for ipv6 */ /* #undef WINVER */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN /* # undef WORDS_BIGENDIAN */ # endif #endif /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* WinXP and above for ipv6 */ /* #undef _WIN32_WINNT */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `short' if does not define. */ /* #undef int16_t */ /* Define to `int' if does not define. */ /* #undef int32_t */ /* Define to `long long' if does not define. */ /* #undef int64_t */ /* Define to the native offset type (long or actually off_t). */ #define lfs_alias_t off_t /* Define to `long int' if does not define. */ /* #undef off_t */ /* Define to `unsigned long' if does not define. */ /* #undef size_t */ /* Define to `long' if does not define. */ /* #undef ssize_t */ /* Define to `unsigned short' if does not define. */ /* #undef uint16_t */ /* Define to `unsigned int' if does not define. */ /* #undef uint32_t */ /* Define to `unsigned long' if does not define. */ /* #undef uintptr_t */ welle.io-2.1/src/libs/mpg123/dct36_3dnow.S000066400000000000000000000257151357201522000200130ustar00rootroot00000000000000/* dct64_3dnow.s: Replacement of dct36() with AMD's 3DNow! SIMD operations support copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Syuuhei Kashiyama This code based 'dct36_3dnow.s' by Syuuhei Kashiyama ,only two types of changes have been made: - remove PREFETCH instruction for speedup - change function name for support 3DNow! automatic detect You can find Kashiyama's original 3dnow! support patch (for mpg123-0.59o) at http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese). by KIMURA Takuhiro - until 31.Mar.1999 - after 1.Apr.1999 Replacement of dct36() with AMD's 3DNow! SIMD operations support Syuuhei Kashiyama The author of this program disclaim whole expressed or implied warranties with regard to this program, and in no event shall the author of this program liable to whatever resulted from the use of this program. Use it at your own risk. */ #include "mangle.h" .globl ASM_NAME(dct36_3dnow) /* .type ASM_NAME(dct36_3dnow),@function */ ASM_NAME(dct36_3dnow): pushl %ebp movl %esp,%ebp #if defined(PIC) && defined(__APPLE__) sub $4,%esp #endif pushl %esi pushl %ebx #undef _EBX_ #define _EBX_ %edi PREPARE_GOT GET_GOT #if defined(PIC) && defined(__APPLE__) #define _COS9_ 0(%edi) #define _tfcos36_ 0(%eax) mov GLOBAL_VAR_PTR(tfcos36), %eax mov GLOBAL_VAR_PTR(COS9), %edi mov %eax, -4(%ebp) #else #define _COS9_ GLOBAL_VAR(COS9) #define _tfcos36_ GLOBAL_VAR(tfcos36) #endif movl 8(%ebp),%eax movl 12(%ebp),%esi movl 16(%ebp),%ecx movl 20(%ebp),%edx movl 24(%ebp),%ebx femms movq (%eax),%mm0 movq 4(%eax),%mm1 pfadd %mm1,%mm0 movq %mm0,4(%eax) psrlq $32,%mm1 movq 12(%eax),%mm2 punpckldq %mm2,%mm1 pfadd %mm2,%mm1 movq %mm1,12(%eax) psrlq $32,%mm2 movq 20(%eax),%mm3 punpckldq %mm3,%mm2 pfadd %mm3,%mm2 movq %mm2,20(%eax) psrlq $32,%mm3 movq 28(%eax),%mm4 punpckldq %mm4,%mm3 pfadd %mm4,%mm3 movq %mm3,28(%eax) psrlq $32,%mm4 movq 36(%eax),%mm5 punpckldq %mm5,%mm4 pfadd %mm5,%mm4 movq %mm4,36(%eax) psrlq $32,%mm5 movq 44(%eax),%mm6 punpckldq %mm6,%mm5 pfadd %mm6,%mm5 movq %mm5,44(%eax) psrlq $32,%mm6 movq 52(%eax),%mm7 punpckldq %mm7,%mm6 pfadd %mm7,%mm6 movq %mm6,52(%eax) psrlq $32,%mm7 movq 60(%eax),%mm0 punpckldq %mm0,%mm7 pfadd %mm0,%mm7 movq %mm7,60(%eax) psrlq $32,%mm0 movd 68(%eax),%mm1 pfadd %mm1,%mm0 movd %mm0,68(%eax) movd 4(%eax),%mm0 movd 12(%eax),%mm1 punpckldq %mm1,%mm0 punpckldq 20(%eax),%mm1 pfadd %mm1,%mm0 movd %mm0,12(%eax) psrlq $32,%mm0 movd %mm0,20(%eax) psrlq $32,%mm1 movd 28(%eax),%mm2 punpckldq %mm2,%mm1 punpckldq 36(%eax),%mm2 pfadd %mm2,%mm1 movd %mm1,28(%eax) psrlq $32,%mm1 movd %mm1,36(%eax) psrlq $32,%mm2 movd 44(%eax),%mm3 punpckldq %mm3,%mm2 punpckldq 52(%eax),%mm3 pfadd %mm3,%mm2 movd %mm2,44(%eax) psrlq $32,%mm2 movd %mm2,52(%eax) psrlq $32,%mm3 movd 60(%eax),%mm4 punpckldq %mm4,%mm3 punpckldq 68(%eax),%mm4 pfadd %mm4,%mm3 movd %mm3,60(%eax) psrlq $32,%mm3 movd %mm3,68(%eax) movq 24(%eax),%mm0 movq 48(%eax),%mm1 movd 12+_COS9_,%mm2 punpckldq %mm2,%mm2 movd 24+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm2,%mm0 pfmul %mm3,%mm1 pushl %eax movl $1,%eax movd %eax,%mm7 pi2fd %mm7,%mm7 popl %eax movq 8(%eax),%mm2 movd 4+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfadd %mm0,%mm2 movq 40(%eax),%mm3 movd 20+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq 56(%eax),%mm3 movd 28+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq 32(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 0+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 108(%edx),%mm6 punpckldq 104(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,36(%ecx) psrlq $32,%mm5 movd %mm5,32(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 32(%edx),%mm6 punpckldq 36(%edx),%mm6 pfmul %mm6,%mm5 movd 32(%esi),%mm6 punpckldq 36(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,1024(%ebx) psrlq $32,%mm5 movd %mm5,1152(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 32+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 140(%edx),%mm6 punpckldq 72(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,68(%ecx) psrlq $32,%mm5 movd %mm5,0(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 0(%edx),%mm6 punpckldq 68(%edx),%mm6 pfmul %mm6,%mm5 movd 0(%esi),%mm6 punpckldq 68(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,0(%ebx) psrlq $32,%mm5 movd %mm5,2176(%ebx) movq 8(%eax),%mm2 movq 40(%eax),%mm3 pfsub %mm3,%mm2 movq 56(%eax),%mm3 pfsub %mm3,%mm2 movd 12+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 movq 16(%eax),%mm3 movq 32(%eax),%mm4 pfsub %mm4,%mm3 movq 64(%eax),%mm4 pfsub %mm4,%mm3 movd 24+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 movq 48(%eax),%mm4 pfsub %mm4,%mm3 movq (%eax),%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 4+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 112(%edx),%mm6 punpckldq 100(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,40(%ecx) psrlq $32,%mm5 movd %mm5,28(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 28(%edx),%mm6 punpckldq 40(%edx),%mm6 pfmul %mm6,%mm5 movd 28(%esi),%mm6 punpckldq 40(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,896(%ebx) psrlq $32,%mm5 movd %mm5,1280(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 28+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 136(%edx),%mm6 punpckldq 76(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,64(%ecx) psrlq $32,%mm5 movd %mm5,4(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 4(%edx),%mm6 punpckldq 64(%edx),%mm6 pfmul %mm6,%mm5 movd 4(%esi),%mm6 punpckldq 64(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,128(%ebx) psrlq $32,%mm5 movd %mm5,2048(%ebx) movq 8(%eax),%mm2 movd 20+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfsub %mm0,%mm2 movq 40(%eax),%mm3 movd 28+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfsub %mm3,%mm2 movq 56(%eax),%mm3 movd 4+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq 32(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 8+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 116(%edx),%mm6 punpckldq 96(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,44(%ecx) psrlq $32,%mm5 movd %mm5,24(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 24(%edx),%mm6 punpckldq 44(%edx),%mm6 pfmul %mm6,%mm5 movd 24(%esi),%mm6 punpckldq 44(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,768(%ebx) psrlq $32,%mm5 movd %mm5,1408(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 24+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 132(%edx),%mm6 punpckldq 80(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,60(%ecx) psrlq $32,%mm5 movd %mm5,8(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 8(%edx),%mm6 punpckldq 60(%edx),%mm6 pfmul %mm6,%mm5 movd 8(%esi),%mm6 punpckldq 60(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,256(%ebx) psrlq $32,%mm5 movd %mm5,1920(%ebx) movq 8(%eax),%mm2 movd 28+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfsub %mm0,%mm2 movq 40(%eax),%mm3 movd 4+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq 56(%eax),%mm3 movd 20+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfsub %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq 32(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 12+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 120(%edx),%mm6 punpckldq 92(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,48(%ecx) psrlq $32,%mm5 movd %mm5,20(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 20(%edx),%mm6 punpckldq 48(%edx),%mm6 pfmul %mm6,%mm5 movd 20(%esi),%mm6 punpckldq 48(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,640(%ebx) psrlq $32,%mm5 movd %mm5,1536(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 20+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 128(%edx),%mm6 punpckldq 84(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,56(%ecx) psrlq $32,%mm5 movd %mm5,12(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 12(%edx),%mm6 punpckldq 56(%edx),%mm6 pfmul %mm6,%mm5 movd 12(%esi),%mm6 punpckldq 56(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,384(%ebx) psrlq $32,%mm5 movd %mm5,1792(%ebx) movq (%eax),%mm4 movq 16(%eax),%mm3 pfsub %mm3,%mm4 movq 32(%eax),%mm3 pfadd %mm3,%mm4 movq 48(%eax),%mm3 pfsub %mm3,%mm4 movq 64(%eax),%mm3 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 16+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 124(%edx),%mm6 punpckldq 88(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,52(%ecx) psrlq $32,%mm5 movd %mm5,16(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 16(%edx),%mm6 punpckldq 52(%edx),%mm6 pfmul %mm6,%mm5 movd 16(%esi),%mm6 punpckldq 52(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,512(%ebx) psrlq $32,%mm5 movd %mm5,1664(%ebx) femms RESTORE_GOT popl %ebx popl %esi movl %ebp,%esp popl %ebp ret #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_tfcos36: .indirect_symbol ASM_NAME(tfcos36) .long 0 L_COS9: .indirect_symbol ASM_NAME(COS9) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_3dnowext.S000066400000000000000000000266241357201522000205340ustar00rootroot00000000000000/* dct36_3dnowext: extended 3DNow optimized DCT36 copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org Transformed back into standalone asm, with help of gcc -S -DHAVE_CONFIG_H -I. -march=k6-3 -O3 -Wall -pedantic -fno-strict-aliasing -DREAL_IS_FLOAT -c -o dct36_3dnowext.{S,c} MPlayer comment follows. */ /* * dct36_3dnow.c - 3DNow! optimized dct36() * * This code based 'dct36_3dnow.s' by Syuuhei Kashiyama * , only two types of changes have been made: * * - removed PREFETCH instruction for speedup * - changed function name for support 3DNow! automatic detection * * You can find Kashiyama's original 3dnow! support patch * (for mpg123-0.59o) at * http://user.ecc.u-tokyo.ac.jp/~g810370/linux-simd/ (Japanese). * * by KIMURA Takuhiro - until 31.Mar.1999 * - after 1.Apr.1999 * * Modified for use with MPlayer, for details see the changelog at * http://svn.mplayerhq.hu/mplayer/trunk/ * $Id: dct36_3dnow.c 18786 2006-06-22 13:34:00Z diego $ * * Original disclaimer: * The author of this program disclaim whole expressed or implied * warranties with regard to this program, and in no event shall the * author of this program liable to whatever resulted from the use of * this program. Use it at your own risk. * * 2003/06/21: Moved to GCC inline assembly - Alex Beregszaszi */ #include "mangle.h" .text ALIGN32 .globl ASM_NAME(dct36_3dnowext) /* .type ASM_NAME(dct36_3dnowext), @function */ ASM_NAME(dct36_3dnowext): pushl %ebp movl %esp, %ebp #if defined(PIC) && defined(__APPLE__) sub $4, %esp #endif pushl %esi pushl %ebx #undef _EBX_ #define _EBX_ %edi PREPARE_GOT GET_GOT #if defined(PIC) && defined(__APPLE__) #define _COS9_ 0(%edi) #define _tfcos36_ 0(%eax) mov GLOBAL_VAR_PTR(tfcos36), %eax mov GLOBAL_VAR_PTR(COS9), %edi mov %eax, -4(%ebp) #else #define _COS9_ GLOBAL_VAR(COS9) #define _tfcos36_ GLOBAL_VAR(tfcos36) #endif movl 8(%ebp), %eax movl 12(%ebp), %esi movl 16(%ebp), %ecx movl 20(%ebp), %edx movl 24(%ebp), %ebx /* APP */ movq (%eax),%mm0 movq 4(%eax),%mm1 pfadd %mm1,%mm0 movq %mm0,4(%eax) psrlq $32,%mm1 movq 12(%eax),%mm2 punpckldq %mm2,%mm1 pfadd %mm2,%mm1 movq %mm1,12(%eax) psrlq $32,%mm2 movq 20(%eax),%mm3 punpckldq %mm3,%mm2 pfadd %mm3,%mm2 movq %mm2,20(%eax) psrlq $32,%mm3 movq 28(%eax),%mm4 punpckldq %mm4,%mm3 pfadd %mm4,%mm3 movq %mm3,28(%eax) psrlq $32,%mm4 movq 36(%eax),%mm5 punpckldq %mm5,%mm4 pfadd %mm5,%mm4 movq %mm4,36(%eax) psrlq $32,%mm5 movq 44(%eax),%mm6 punpckldq %mm6,%mm5 pfadd %mm6,%mm5 movq %mm5,44(%eax) psrlq $32,%mm6 movq 52(%eax),%mm7 punpckldq %mm7,%mm6 pfadd %mm7,%mm6 movq %mm6,52(%eax) psrlq $32,%mm7 movq 60(%eax),%mm0 punpckldq %mm0,%mm7 pfadd %mm0,%mm7 movq %mm7,60(%eax) psrlq $32,%mm0 movd 68(%eax),%mm1 pfadd %mm1,%mm0 movd %mm0,68(%eax) movd 4(%eax),%mm0 movd 12(%eax),%mm1 punpckldq %mm1,%mm0 punpckldq 20(%eax),%mm1 pfadd %mm1,%mm0 movd %mm0,12(%eax) psrlq $32,%mm0 movd %mm0,20(%eax) psrlq $32,%mm1 movd 28(%eax),%mm2 punpckldq %mm2,%mm1 punpckldq 36(%eax),%mm2 pfadd %mm2,%mm1 movd %mm1,28(%eax) psrlq $32,%mm1 movd %mm1,36(%eax) psrlq $32,%mm2 movd 44(%eax),%mm3 punpckldq %mm3,%mm2 punpckldq 52(%eax),%mm3 pfadd %mm3,%mm2 movd %mm2,44(%eax) psrlq $32,%mm2 movd %mm2,52(%eax) psrlq $32,%mm3 movd 60(%eax),%mm4 punpckldq %mm4,%mm3 punpckldq 68(%eax),%mm4 pfadd %mm4,%mm3 movd %mm3,60(%eax) psrlq $32,%mm3 movd %mm3,68(%eax) movq 24(%eax),%mm0 movq 48(%eax),%mm1 movd 12+_COS9_,%mm2 punpckldq %mm2,%mm2 movd 24+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm2,%mm0 pfmul %mm3,%mm1 pushl %eax movl $1,%eax movd %eax,%mm7 pi2fd %mm7,%mm7 popl %eax movq 8(%eax),%mm2 movd 4+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfadd %mm0,%mm2 movq 40(%eax),%mm3 movd 20+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq 56(%eax),%mm3 movd 28+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq 32(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 0+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 108(%edx),%mm6 punpckldq 104(%edx),%mm6 pfmul %mm6,%mm5 pswapd %mm5,%mm5 movq %mm5,32(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 32(%edx),%mm6 punpckldq 36(%edx),%mm6 pfmul %mm6,%mm5 movd 32(%esi),%mm6 punpckldq 36(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,1024(%ebx) psrlq $32,%mm5 movd %mm5,1152(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 32+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 140(%edx),%mm6 punpckldq 72(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,68(%ecx) psrlq $32,%mm5 movd %mm5,0(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 0(%edx),%mm6 punpckldq 68(%edx),%mm6 pfmul %mm6,%mm5 movd 0(%esi),%mm6 punpckldq 68(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,0(%ebx) psrlq $32,%mm5 movd %mm5,2176(%ebx) movq 8(%eax),%mm2 movq 40(%eax),%mm3 pfsub %mm3,%mm2 movq 56(%eax),%mm3 pfsub %mm3,%mm2 movd 12+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 movq 16(%eax),%mm3 movq 32(%eax),%mm4 pfsub %mm4,%mm3 movq 64(%eax),%mm4 pfsub %mm4,%mm3 movd 24+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 movq 48(%eax),%mm4 pfsub %mm4,%mm3 movq (%eax),%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 4+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 112(%edx),%mm6 punpckldq 100(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,40(%ecx) psrlq $32,%mm5 movd %mm5,28(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 28(%edx),%mm6 punpckldq 40(%edx),%mm6 pfmul %mm6,%mm5 movd 28(%esi),%mm6 punpckldq 40(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,896(%ebx) psrlq $32,%mm5 movd %mm5,1280(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 28+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 136(%edx),%mm6 punpckldq 76(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,64(%ecx) psrlq $32,%mm5 movd %mm5,4(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 4(%edx),%mm6 punpckldq 64(%edx),%mm6 pfmul %mm6,%mm5 movd 4(%esi),%mm6 punpckldq 64(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,128(%ebx) psrlq $32,%mm5 movd %mm5,2048(%ebx) movq 8(%eax),%mm2 movd 20+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfsub %mm0,%mm2 movq 40(%eax),%mm3 movd 28+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfsub %mm3,%mm2 movq 56(%eax),%mm3 movd 4+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq 32(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 8+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 116(%edx),%mm6 punpckldq 96(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,44(%ecx) psrlq $32,%mm5 movd %mm5,24(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 24(%edx),%mm6 punpckldq 44(%edx),%mm6 pfmul %mm6,%mm5 movd 24(%esi),%mm6 punpckldq 44(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,768(%ebx) psrlq $32,%mm5 movd %mm5,1408(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 24+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 132(%edx),%mm6 punpckldq 80(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,60(%ecx) psrlq $32,%mm5 movd %mm5,8(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 8(%edx),%mm6 punpckldq 60(%edx),%mm6 pfmul %mm6,%mm5 movd 8(%esi),%mm6 punpckldq 60(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,256(%ebx) psrlq $32,%mm5 movd %mm5,1920(%ebx) movq 8(%eax),%mm2 movd 28+_COS9_,%mm3 punpckldq %mm3,%mm3 pfmul %mm3,%mm2 pfsub %mm0,%mm2 movq 40(%eax),%mm3 movd 4+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfadd %mm3,%mm2 movq 56(%eax),%mm3 movd 20+_COS9_,%mm4 punpckldq %mm4,%mm4 pfmul %mm4,%mm3 pfsub %mm3,%mm2 movq (%eax),%mm3 movq 16(%eax),%mm4 movd 16+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq 32(%eax),%mm4 movd 32+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfadd %mm4,%mm3 pfadd %mm1,%mm3 movq 64(%eax),%mm4 movd 8+_COS9_,%mm5 punpckldq %mm5,%mm5 pfmul %mm5,%mm4 pfsub %mm4,%mm3 movq %mm2,%mm4 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 12+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 120(%edx),%mm6 punpckldq 92(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,48(%ecx) psrlq $32,%mm5 movd %mm5,20(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 20(%edx),%mm6 punpckldq 48(%edx),%mm6 pfmul %mm6,%mm5 movd 20(%esi),%mm6 punpckldq 48(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,640(%ebx) psrlq $32,%mm5 movd %mm5,1536(%ebx) movq %mm3,%mm4 pfsub %mm2,%mm4 movq %mm7,%mm5 punpckldq 20+_tfcos36_,%mm5 #if defined(PIC) && defined(__APPLE__) mov 8(%ebp),%eax #endif pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 128(%edx),%mm6 punpckldq 84(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,56(%ecx) psrlq $32,%mm5 movd %mm5,12(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 12(%edx),%mm6 punpckldq 56(%edx),%mm6 pfmul %mm6,%mm5 movd 12(%esi),%mm6 punpckldq 56(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,384(%ebx) psrlq $32,%mm5 movd %mm5,1792(%ebx) movq (%eax),%mm4 movq 16(%eax),%mm3 pfsub %mm3,%mm4 movq 32(%eax),%mm3 pfadd %mm3,%mm4 movq 48(%eax),%mm3 pfsub %mm3,%mm4 movq 64(%eax),%mm3 pfadd %mm3,%mm4 movq %mm7,%mm5 #if defined(PIC) && defined(__APPLE__) mov -4(%ebp),%eax #endif punpckldq 16+_tfcos36_,%mm5 pfmul %mm5,%mm4 movq %mm4,%mm5 pfacc %mm5,%mm5 movd 124(%edx),%mm6 punpckldq 88(%edx),%mm6 pfmul %mm6,%mm5 movd %mm5,52(%ecx) psrlq $32,%mm5 movd %mm5,16(%ecx) movq %mm4,%mm6 punpckldq %mm6,%mm5 pfsub %mm6,%mm5 punpckhdq %mm5,%mm5 movd 16(%edx),%mm6 punpckldq 52(%edx),%mm6 pfmul %mm6,%mm5 movd 16(%esi),%mm6 punpckldq 52(%esi),%mm6 pfadd %mm6,%mm5 movd %mm5,512(%ebx) psrlq $32,%mm5 movd %mm5,1664(%ebx) femms /* NO_APP */ RESTORE_GOT popl %ebx popl %esi leave ret /* .size ASM_NAME(dct36_3dnowext), .-ASM_NAME(dct36_3dnowext) */ #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_tfcos36: .indirect_symbol ASM_NAME(tfcos36) .long 0 L_COS9: .indirect_symbol ASM_NAME(COS9) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_avx.S000066400000000000000000000165451357201522000175600ustar00rootroot00000000000000/* dct36_avx: AVX optimized dct36 for x86-64 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifdef IS_MSABI #define in %rcx #define out1 %rdx #define out2 %r8 #define w %r9 #define ts %r10 #define COS9_ %rax #define tfcos36_ %r11 #else #define in %rdi #define out1 %rsi #define out2 %rdx #define w %rcx #define ts %r8 #define COS9_ %rax #define tfcos36_ %r9 #endif /* void dct36_avx(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 dct36_avx_COS9: .long 0x3f5db3d7 .long 0x3f5db3d7 .long 0x3f000000 .long 0x3f000000 .long 0x3f7c1c5c .long 0x3f7c1c5c .long 0x3f708fb2 .long 0x3f708fb2 .long 0x3f248dbb .long 0x3f248dbb .long 0x3e31d0d4 .long 0x3e31d0d4 .long 0x3eaf1d44 .long 0x3eaf1d44 .long 0x3f441b7d .long 0x3f441b7d ALIGN16 dct36_avx_tfcos36: .long 0x3f007d2b .long 0x3f0483ee .long 0x3f0d3b7d .long 0x3f1c4257 .long 0x40b79454 .long 0x3ff746ea .long 0x3f976fd9 .long 0x3f5f2944 .long 0x3f3504f3 ALIGN16 dct36_avx_sign: .long 0x80000000,0x80000000,0x80000000,0x80000000 .text ALIGN16 .globl ASM_NAME(dct36_avx) ASM_NAME(dct36_avx): #ifdef IS_MSABI push %rbp mov %rsp, %rbp sub $160, %rsp movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) movaps %xmm13, 112(%rsp) movaps %xmm14, 128(%rsp) movaps %xmm15, 144(%rsp) movq 48(%rbp), ts #endif lea dct36_avx_COS9(%rip), COS9_ lea dct36_avx_tfcos36(%rip), tfcos36_ xorps %xmm4, %xmm4 movups (in), %xmm0 movups 16(in), %xmm1 movups 32(in), %xmm2 movups 48(in), %xmm3 movlps 64(in), %xmm4 vshufps $0x93, %xmm0, %xmm0, %xmm5 vshufps $0x93, %xmm1, %xmm1, %xmm6 vshufps $0x93, %xmm2, %xmm2, %xmm7 vshufps $0x93, %xmm3, %xmm3, %xmm8 vshufps $0xe1, %xmm4, %xmm4, %xmm9 movss %xmm8, %xmm9 #[fg--] addps %xmm9, %xmm4 #[gh--] movss %xmm7, %xmm8 addps %xmm8, %xmm3 #[cdef] movss %xmm6, %xmm7 addps %xmm7, %xmm2 #[89ab] movss %xmm5, %xmm6 addps %xmm6, %xmm1 #[4567] xorps %xmm6, %xmm6 movss %xmm6, %xmm5 addps %xmm5, %xmm0 #[0123] vblendps $0x5, %xmm6, %xmm3, %xmm7 vshufps $0x4e, %xmm4, %xmm3, %xmm4 addps %xmm7, %xmm4 vblendps $0x5, %xmm6, %xmm2, %xmm7 vshufps $0x4e, %xmm3, %xmm2, %xmm3 addps %xmm7, %xmm3 vblendps $0x5, %xmm6, %xmm1, %xmm7 vshufps $0x4e, %xmm2, %xmm1, %xmm2 addps %xmm7, %xmm2 vblendps $0x5, %xmm6, %xmm0, %xmm7 vshufps $0x4e, %xmm1, %xmm0, %xmm1 addps %xmm7, %xmm1 vmovlhps %xmm0, %xmm6, %xmm0 /* xmm0 in[-,-,0,1] xmm1 in[2,3,4,5] xmm2 in[6,7,8,9] xmm3 in[10,11,12,13] xmm4 in[14,15,16,17] */ vblendps $0xc, %xmm3, %xmm2, %xmm5 blendps $0xc, %xmm4, %xmm3 blendps $0xc, %xmm2, %xmm4 movaps %xmm5, %xmm2 /* xmm2 in[6,7,12,13] xmm3 in[10,11,16,17] xmm4 in[14,15,8,9] */ movaps (COS9_), %xmm15 movaps 16(COS9_), %xmm6 movaps 32(COS9_), %xmm7 movaps 48(COS9_), %xmm8 vmulps %xmm2, %xmm15, %xmm5 addps %xmm0, %xmm5 /* xmm5 [ta33,tb33,ta66,tb66] xmm6 COS9_[1,1,2,2] xmm7 COS9_[5,5,8,8] xmm8 COS9_[7,7,4,4] xmm15 COS9_[3,3,6,6] */ vmulps %xmm1, %xmm6, %xmm9 vmulps %xmm3, %xmm7, %xmm12 vmulps %xmm4, %xmm8, %xmm13 addps %xmm5, %xmm9 addps %xmm13, %xmm12 addps %xmm9, %xmm12 vsubps %xmm3, %xmm1, %xmm13 vshufps $0xe0, %xmm2, %xmm0, %xmm14 vsubps %xmm14, %xmm0, %xmm14 subps %xmm4, %xmm13 mulps %xmm15, %xmm13 addps %xmm14, %xmm13 vmulps %xmm1, %xmm7, %xmm9 vmulps %xmm3, %xmm8, %xmm15 vmulps %xmm4, %xmm6, %xmm14 subps %xmm5, %xmm9 subps %xmm15, %xmm14 addps %xmm9, %xmm14 mulps %xmm1, %xmm8 mulps %xmm3, %xmm6 mulps %xmm4, %xmm7 subps %xmm5, %xmm8 subps %xmm7, %xmm6 vaddps %xmm6, %xmm8, %xmm15 movss 32(tfcos36_), %xmm5 subps %xmm1, %xmm0 subps %xmm2, %xmm4 addps %xmm3, %xmm0 addps %xmm4, %xmm0 shufps $0xaf, %xmm0, %xmm0 vmulss %xmm5, %xmm0, %xmm11 /* xmm12 [1a-0,1b-0, 2a-0, 2b-0] xmm13 [1a-1,1b-1, 2a-1, 2b-1] xmm14 [1a-2,1b-2,-2a-2,-2b-2] xmm15 [1a-3,1b-3,-2a-3,-2b-3] */ vunpckhps %xmm13, %xmm12, %xmm5 vunpcklps %xmm13, %xmm12, %xmm12 vunpckhps %xmm15, %xmm14, %xmm6 vunpcklps %xmm15, %xmm14, %xmm14 xorps dct36_avx_sign(%rip), %xmm6 /* xmm12 [1a-0,1a-1,1b-0,1b-1] xmm5 [2a-0,2a-1,2b-0,2b-1] xmm14 [1a-2,1a-3,1b-2,1b-3] xmm6 [2a-2,2a-3,2b-2,2b-3] */ vmovlhps %xmm14, %xmm12, %xmm0 movhlps %xmm12, %xmm14 vmovlhps %xmm6, %xmm5, %xmm1 vmovhlps %xmm5, %xmm6, %xmm15 /* xmm0 tmp1a xmm1 tmp2a xmm14 tmp1b xmm15 tmp2b */ movaps (tfcos36_), %xmm6 movaps 16(tfcos36_), %xmm7 vsubps %xmm14, %xmm15, %xmm10 addps %xmm14, %xmm15 vsubps %xmm0, %xmm1, %xmm14 addps %xmm1, %xmm0 vmulps %xmm6, %xmm15, %xmm1 mulps %xmm10, %xmm7 /* %xmm0 tmp[0,1,2,3] %xmm1 tmp[17,16,15,14] %xmm14 tmp[8,7,6,5] %xmm7 tmp[9,10,11,12] %xmm11 tmp[13,-,4,-] */ movups 108(w), %xmm2 movups 92(w), %xmm3 shufps $0x1b, %xmm3, %xmm3 movups 36(w), %xmm4 movups 20(w), %xmm5 shufps $0x1b, %xmm5, %xmm5 vsubps %xmm1, %xmm0, %xmm6 addps %xmm1, %xmm0 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movups 36(out1), %xmm1 movups 20(out1), %xmm3 shufps $0x1b, %xmm6, %xmm6 addps %xmm4, %xmm1 addps %xmm6, %xmm3 shufps $0x1b, %xmm0, %xmm0 movups %xmm2, 36(out2) movups %xmm0, 20(out2) movss %xmm1, 32*36(ts) movss %xmm3, 32*20(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*44(ts) movss %xmm4, 32*28(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*40(ts) movss %xmm3, 32*24(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*48(ts) movss %xmm4, 32*32(ts) movhlps %xmm11, %xmm0 movss 124(w), %xmm2 movss 88(w), %xmm3 movss 52(w), %xmm4 movss 16(w), %xmm5 movss %xmm0, %xmm6 addss %xmm11, %xmm0 subss %xmm11, %xmm6 mulss %xmm0, %xmm2 mulss %xmm3, %xmm0 mulss %xmm6, %xmm4 mulss %xmm5, %xmm6 addss 52(out1), %xmm4 addss 16(out1), %xmm6 movss %xmm2, 52(out2) movss %xmm0, 16(out2) movss %xmm4, 32*52(ts) movss %xmm6, 32*16(ts) movaps %xmm14, %xmm0 movaps %xmm7, %xmm1 MOVUAPS 128(w), %xmm2 movups 72(w), %xmm3 shufps $0x1b, %xmm2, %xmm2 movlps 56(w), %xmm4 movhps 64(w), %xmm4 MOVUAPS (w), %xmm5 shufps $0x1b, %xmm4, %xmm4 vsubps %xmm1, %xmm0, %xmm6 addps %xmm1, %xmm0 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movlps 56(out1), %xmm1 movhps 64(out1), %xmm1 movups (out1), %xmm3 shufps $0x1b, %xmm4, %xmm4 addps %xmm6, %xmm3 addps %xmm4, %xmm1 shufps $0x1b, %xmm2, %xmm2 movups %xmm0, (out2) movlps %xmm2, 56(out2) movhps %xmm2, 64(out2) movss %xmm1, 32*56(ts) movss %xmm3, (ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*64(ts) movss %xmm4, 32*8(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*60(ts) movss %xmm3, 32*4(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*68(ts) movss %xmm4, 32*12(ts) #ifdef IS_MSABI movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 movaps 112(%rsp), %xmm13 movaps 128(%rsp), %xmm14 movaps 144(%rsp), %xmm15 mov %rbp, %rsp pop %rbp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_neon.S000066400000000000000000000121541357201522000177110ustar00rootroot00000000000000/* dct36_neon: ARM NEON optimized dct36 copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef _M_ARM .code 32 #endif #ifndef __APPLE__ .fpu neon #endif .text ALIGN16 dct36_neon_COS9: .word 0x3f5db3d7 .word 0x3f5db3d7 .word 0x3f000000 .word 0x3f000000 .word 0x3f7c1c5c .word 0x3f7c1c5c .word 0x3f708fb2 .word 0x3f708fb2 .word 0x3f248dbb .word 0x3f248dbb .word 0x3e31d0d4 .word 0x3e31d0d4 .word 0x3eaf1d44 .word 0x3eaf1d44 .word 0x3f441b7d .word 0x3f441b7d .word 0x3f007d2b .word 0x3f0483ee .word 0x3f0d3b7d .word 0x3f1c4257 .word 0x40b79454 .word 0x3ff746ea .word 0x3f976fd9 .word 0x3f5f2944 .word 0x3f800000 .word 0x3f3504f3 ALIGN4 GLOBAL_SYMBOL ASM_NAME(dct36_neon) #ifdef __ELF__ .type ASM_NAME(dct36_neon), %function #endif ASM_NAME(dct36_neon): push {r4-r5, lr} vpush {q4-q7} ldr r4, [sp, #76] adr r5, dct36_neon_COS9 vceq.i32 q14, q14, q14 veor q15, q15, q15 vshl.i64 q14, q14, #32 vld1.32 {q0, q1}, [r0]! vld1.32 {q2, q3}, [r0]! vld1.32 {d8}, [r0] vext.8 q5, q15, q0, #12 vext.8 q6, q0, q1, #12 vext.8 q7, q1, q2, #12 vext.8 q8, q2, q3, #12 vext.8 d18, d7, d8, #4 vadd.f32 q0, q0, q5 vadd.f32 q1, q1, q6 vadd.f32 q2, q2, q7 vadd.f32 q3, q3, q8 vadd.f32 d8, d8, d18 vext.8 q6, q0, q1, #8 vext.8 q7, q1, q2, #8 vext.8 q8, q2, q3, #8 vext.8 q9, q3, q4, #8 vand q10, q0, q14 vext.8 q0, q15, q0, #8 vand q11, q1, q14 vand q12, q2, q14 vand q13, q3, q14 vadd.f32 q1, q10, q6 vadd.f32 q2, q11, q7 vadd.f32 q3, q12, q8 vadd.f32 q4, q13, q9 /* q0 in[-,-,0,1] q1 in[2,3,4,5] q2 in[6,7,8,9] q3 in[10,11,12,13] q4 in[14,15,16,17] */ vswp d5, d7 vswp d7, d9 /* q2 in[6,7,12,13] q3 in[10,11,16,17] q4 in[14,15,8,9] */ vld1.32 {q5, q6}, [r5, :128]! vld1.32 {q7, q8}, [r5, :128]! vmov q9, q0 vmla.f32 q9, q2, q5 /* q6 COS9_[1,1,2,2] q7 COS9_[5,5,8,8] q8 COS9_[7,7,4,4] q5 COS9_[3,3,6,6] q9 [ta33,tb33,ta66,tb66] */ vmov q10, q9 vmov d26, d0 vmov d27, d5 vmul.f32 q12, q1, q6 vsub.f32 q11, q1, q3 vmla.f32 q10, q3, q7 vsub.f32 q13, q0, q13 vmla.f32 q12, q4, q8 vsub.f32 q11, q11, q4 vmul.f32 q14, q1, q7 vmul.f32 q15, q1, q8 vadd.f32 q12, q12, q10 vmov q10, q9 vmla.f32 q13, q11, q5 vmla.f32 q10, q3, q8 vmla.f32 q14, q4, q6 vmla.f32 q9, q4, q7 vmla.f32 q15, q3, q6 vsub.f32 q14, q14, q10 vsub.f32 q15, q15, q9 /* q12 [1a-0,1b-0, 2a-0, 2b-0] q13 [1a-1,1b-1, 2a-1, 2b-1] q14 [1a-2,1b-2,-2a-2,-2b-2] q15 [1a-3,1b-3,-2a-3,-2b-3] */ vzip.32 q12, q13 vzip.32 q14, q15 vneg.f32 q15, q15 /* q12 [1a-0,1a-1,1b-0,1b-1] q13 [2a-0,2a-1,2b-0,2b-1] q14 [1a-2,1a-3,1b-2,1b-3] q15 [2a-2,2a-3,2b-2,2b-3] */ vswp d25, d28 vswp d27, d30 /* q12 tmp1a q13 tmp2a q14 tmp1b q15 tmp2b */ vsub.f32 d1, d1, d3 vsub.f32 d9, d9, d5 vld1.32 {q5, q6}, [r5, :128]! vld1.32 {d0}, [r5, :64] vadd.f32 q10, q14, q15 vsub.f32 q8, q15, q14 vadd.f32 d1, d1, d7 vadd.f32 q9, q12, q13 vsub.f32 q7, q13, q12 vadd.f32 d1, d1, d9 vmul.f32 q10, q10, q5 vmul.f32 q8, q8, q6 vmul.f32 d0, d1, d0 /* q9 tmp[0,1,2,3] q10 tmp[17,16,15,14] q7 tmp[8,7,6,5] q8 tmp[9,10,11,12] d0 tmp[4,13] */ add r0, r4, #640 add r5, r3, #20 vld1.32 {q1,q2}, [r5] add r5, r3, #92 vld1.32 {q3,q4}, [r5] add r5, r1, #20 vld1.32 {q5,q6}, [r5] vadd.f32 q11, q9, q10 vsub.f32 q12, q9, q10 vmul.f32 q10, q11, q4 vmla.f32 q6, q12, q2 vrev64.32 q11, q11 vrev64.32 q12, q12 vswp d22, d23 vswp d24, d25 vmul.f32 q9, q11, q3 vmla.f32 q5, q12, q1 add r5, r2, #20 vst1.32 {q9,q10}, [r5] mov r5, #128 vst1.32 {d10[0]}, [r0], r5 vst1.32 {d10[1]}, [r0], r5 vst1.32 {d11[0]}, [r0], r5 vst1.32 {d11[1]}, [r0], r5 vst1.32 {d12[0]}, [r0], r5 vst1.32 {d12[1]}, [r0], r5 vst1.32 {d13[0]}, [r0], r5 vst1.32 {d13[1]}, [r0], r5 add r0, r4, #1792 add r5, r3, #56 vld1.32 {q1}, [r3] vld1.32 {q2,q3}, [r5] add r5, r3, #128 vld1.32 {q4}, [r5] add r5, r1, #56 vld1.32 {q5}, [r1] vld1.32 {q6}, [r5] vadd.f32 q9, q7, q8 vsub.f32 q10, q7, q8 vmul.f32 q7, q9, q3 vmla.f32 q5, q10, q1 vrev64.32 q9, q9 vrev64.32 q10, q10 vswp d18, d19 vswp d20, d21 vmul.f32 q8, q9, q4 vmla.f32 q6, q10, q2 add r5, r2, #56 vst1.32 {q7}, [r2] vst1.32 {q8}, [r5] mov r5, #128 vst1.32 {d10[0]}, [r4], r5 vst1.32 {d10[1]}, [r4], r5 vst1.32 {d11[0]}, [r4], r5 vst1.32 {d11[1]}, [r4], r5 vst1.32 {d12[0]}, [r0], r5 vst1.32 {d12[1]}, [r0], r5 vst1.32 {d13[0]}, [r0], r5 vst1.32 {d13[1]}, [r0], r5 vtrn.32 d0, d1 add r5, r3, #16 vld1.32 {d2}, [r5] add r5, r3, #52 vld1.32 {d3}, [r5] add r5, r3, #88 vld1.32 {d4}, [r5] add r3, r3, #124 vld1.32 {d5}, [r3] add r5, r1, #16 vld1.32 {d6}, [r5] add r1, r1, #52 vld1.32 {d7}, [r1] vadd.f32 d8, d0, d1 vsub.f32 d9, d0, d1 vmul.f32 d4, d8, d4 vmul.f32 d5, d8, d5 vmla.f32 d6, d9, d2 vmla.f32 d7, d9, d3 add r2, r2, #16 vst1.32 {d4[0]}, [r2] add r2, r2, #36 vst1.32 {d5[0]}, [r2] vst1.32 {d6[0]}, [r4] add r4, r4, #1152 vst1.32 {d7[0]}, [r4] vpop {q4-q7} pop {r4-r5, pc} NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_neon64.S000066400000000000000000000127741357201522000200730ustar00rootroot00000000000000/* dct36_neon64: NEON optimized dct36 for AArch64 copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 dct36_aarch64_COS9: .word 0x3f5db3d7 .word 0x3f5db3d7 .word 0x3f000000 .word 0x3f000000 .word 0x3f7c1c5c .word 0x3f7c1c5c .word 0x3f708fb2 .word 0x3f708fb2 .word 0x3f248dbb .word 0x3f248dbb .word 0x3e31d0d4 .word 0x3e31d0d4 .word 0x3eaf1d44 .word 0x3eaf1d44 .word 0x3f441b7d .word 0x3f441b7d .word 0x3f007d2b .word 0x3f0483ee .word 0x3f0d3b7d .word 0x3f1c4257 .word 0x40b79454 .word 0x3ff746ea .word 0x3f976fd9 .word 0x3f5f2944 .word 0x3f800000 .word 0x3f3504f3 .text ALIGN4 .globl ASM_NAME(dct36_neon64) #ifdef __ELF__ .type ASM_NAME(dct36_neon64), %function #endif ASM_NAME(dct36_neon64): adrp x5, AARCH64_PCREL_HI(dct36_aarch64_COS9) add x5, x5, AARCH64_PCREL_LO(dct36_aarch64_COS9) cmeq v28.16b, v28.16b, v28.16b eor v29.16b, v29.16b, v29.16b shl v28.2d, v28.2d, #32 ld1 {v0.4s,v1.4s,v2.4s,v3.4s}, [x0], #64 ld1 {v4.2s}, [x0] ext v16.16b, v29.16b, v0.16b, #12 ext v17.16b, v0.16b, v1.16b, #12 ext v18.16b, v1.16b, v2.16b, #12 ext v19.16b, v2.16b, v3.16b, #12 ext v20.16b, v3.16b, v4.16b, #12 fadd v0.4s, v0.4s, v16.4s fadd v1.4s, v1.4s, v17.4s fadd v2.4s, v2.4s, v18.4s fadd v3.4s, v3.4s, v19.4s fadd v4.2s, v4.2s, v20.2s ext v16.16b, v0.16b, v1.16b, #8 ext v17.16b, v1.16b, v2.16b, #8 ext v18.16b, v2.16b, v3.16b, #8 ext v19.16b, v3.16b, v4.16b, #8 and v20.16b, v0.16b, v28.16b ext v0.16b, v29.16b, v0.16b, #8 and v21.16b, v1.16b, v28.16b and v22.16b, v2.16b, v28.16b and v23.16b, v3.16b, v28.16b fadd v1.4s, v20.4s, v16.4s fadd v2.4s, v21.4s, v17.4s fadd v3.4s, v22.4s, v18.4s fadd v4.4s, v23.4s, v19.4s /* v0 in[-,-,0,1] v1 in[2,3,4,5] v2 in[6,7,8,9] v3 in[10,11,12,13] v4 in[14,15,16,17] */ orr v5.16b, v2.16b, v2.16b ins v2.d[1], v3.d[1] ins v3.d[1], v4.d[1] ins v4.d[1], v5.d[1] /* v2 in[6,7,12,13] v3 in[10,11,16,17] v4 in[14,15,8,9] */ ld1 {v16.4s,v17.4s,v18.4s,v19.4s}, [x5], #64 orr v20.16b, v0.16b, v0.16b fmla v20.4s, v2.4s, v16.4s /* v17 COS9_[1,1,2,2] v18 COS9_[5,5,8,8] v19 COS9_[7,7,4,4] v16 COS9_[3,3,6,6] v20 [ta33,tb33,ta66,tb66] */ orr v21.16b, v20.16b, v20.16b orr v23.16b, v20.16b, v20.16b zip2 v25.2d, v29.2d, v2.2d fsub v22.4s, v1.4s, v3.4s fmul v24.4s, v1.4s, v17.4s fmul v26.4s, v1.4s, v18.4s fmul v27.4s, v1.4s, v19.4s fmla v21.4s, v3.4s, v18.4s fmla v23.4s, v3.4s, v19.4s fmla v20.4s, v4.4s, v18.4s fsub v25.4s, v0.4s, v25.4s fsub v22.4s, v22.4s, v4.4s fmla v24.4s, v4.4s, v19.4s fmla v26.4s, v4.4s, v17.4s fmla v27.4s, v3.4s, v17.4s fmla v25.4s, v22.4s, v16.4s fadd v24.4s, v24.4s, v21.4s fsub v26.4s, v26.4s, v23.4s fsub v27.4s, v27.4s, v20.4s zip1 v16.4s, v24.4s, v25.4s zip2 v17.4s, v24.4s, v25.4s zip1 v18.4s, v26.4s, v27.4s zip2 v19.4s, v26.4s, v27.4s fneg v19.4s, v19.4s zip1 v20.2d, v16.2d, v18.2d zip1 v21.2d, v17.2d, v19.2d zip2 v22.2d, v16.2d, v18.2d zip2 v23.2d, v17.2d, v19.2d ld1 {v5.4s,v6.4s}, [x5], #32 ld1 {v7.2s}, [x5] fsub v0.4s, v0.4s, v1.4s fsub v4.4s, v4.4s, v2.4s fadd v17.4s, v22.4s, v23.4s fsub v19.4s, v23.4s, v22.4s fadd v0.4s, v0.4s, v3.4s fadd v16.4s, v20.4s, v21.4s fsub v18.4s, v21.4s, v20.4s fadd v0.4s, v0.4s, v4.4s fmul v17.4s, v17.4s, v5.4s fmul v19.4s, v19.4s, v6.4s AARCH64_DUP_2D(v0, v0, 1) fmul v0.2s, v0.2s, v7.2s /* v16 tmp[0,1,2,3] v17 tmp[17,16,15,14] v18 tmp[8,7,6,5] v19 tmp[9,10,11,12] v0 tmp[4,13] */ add x0, x4, #640 add x5, x3, #20 add x6, x3, #92 add x7, x1, #20 ld1 {v1.4s,v2.4s}, [x5] ld1 {v3.4s,v4.4s}, [x6] ld1 {v5.4s,v6.4s}, [x7] fadd v20.4s, v16.4s, v17.4s fsub v21.4s, v16.4s, v17.4s fmul v4.4s, v20.4s, v4.4s fmla v6.4s, v21.4s, v2.4s rev64 v20.4s, v20.4s rev64 v21.4s, v21.4s ext v20.16b, v20.16b, v20.16b, #8 ext v21.16b, v21.16b, v21.16b, #8 fmul v3.4s, v20.4s, v3.4s fmla v5.4s, v21.4s, v1.4s add x5, x2, #20 mov x9, #128 st1 {v3.4s,v4.4s}, [x5] st1 {v5.s}[0], [x0], x9 st1 {v5.s}[1], [x0], x9 st1 {v5.s}[2], [x0], x9 st1 {v5.s}[3], [x0], x9 st1 {v6.s}[0], [x0], x9 st1 {v6.s}[1], [x0], x9 st1 {v6.s}[2], [x0], x9 st1 {v6.s}[3], [x0], x9 add x0, x4, #1792 add x5, x3, #56 add x6, x3, #128 add x7, x1, #56 ld1 {v1.4s}, [x3] ld1 {v2.4s,v3.4s}, [x5] ld1 {v4.4s}, [x6] ld1 {v5.4s}, [x1] ld1 {v6.4s}, [x7] fadd v20.4s, v18.4s, v19.4s fsub v21.4s, v18.4s, v19.4s fmul v3.4s, v20.4s, v3.4s fmla v5.4s, v21.4s, v1.4s rev64 v20.4s, v20.4s rev64 v21.4s, v21.4s ext v20.16b, v20.16b, v20.16b, #8 ext v21.16b, v21.16b, v21.16b, #8 fmul v4.4s, v20.4s, v4.4s fmla v6.4s, v21.4s, v2.4s add x5, x2, #56 st1 {v3.4s}, [x2] st1 {v4.4s}, [x5] st1 {v5.s}[0], [x4], x9 st1 {v5.s}[1], [x4], x9 st1 {v5.s}[2], [x4], x9 st1 {v5.s}[3], [x4], x9 st1 {v6.s}[0], [x0], x9 st1 {v6.s}[1], [x0], x9 st1 {v6.s}[2], [x0], x9 st1 {v6.s}[3], [x0], x9 ins v1.s[0], v0.s[1] ldr s2, [x3, #16] ldr s3, [x3, #52] ldr s4, [x3, #88] ldr s5, [x3, #124] ldr s6, [x1, #16] ldr s7, [x1, #52] fadd s16, s0, s1 fsub s17, s0, s1 fmul s4, s16, s4 fmul s5, s16, s5 fmadd s6, s17, s2, s6 fmadd s7, s17, s3, s7 str s4, [x2, #16] str s5, [x2, #52] str s6, [x4] str s7, [x4, #1152] ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_sse.S000066400000000000000000000165321357201522000175500ustar00rootroot00000000000000/* dct36_sse: SSE optimized dct36 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #define in %edi #define out1 %edi #define out2 %edx #define w %ecx #define ts %eax #define tmp %esi /* void dct36_sse(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 dct36_sse_COS9: .long 0x3f5db3d7 .long 0x3f5db3d7 .long 0x3f000000 .long 0x3f000000 .long 0x3f7c1c5c .long 0x3f7c1c5c .long 0x3f708fb2 .long 0x3f708fb2 .long 0x3f248dbb .long 0x3f248dbb .long 0x3e31d0d4 .long 0x3e31d0d4 .long 0x3eaf1d44 .long 0x3eaf1d44 .long 0x3f441b7d .long 0x3f441b7d ALIGN16 dct36_sse_tfcos36: .long 0x3f007d2b .long 0x3f0483ee .long 0x3f0d3b7d .long 0x3f1c4257 .long 0x40b79454 .long 0x3ff746ea .long 0x3f976fd9 .long 0x3f5f2944 .long 0x3f3504f3 ALIGN16 dct36_sse_mask: .long 0,0xffffffff,0,0xffffffff ALIGN16 dct36_sse_sign: .long 0x80000000,0x80000000,0x80000000,0x80000000 .text ALIGN16 .globl ASM_NAME(dct36_sse) ASM_NAME(dct36_sse): push %ebp mov %esp, %ebp and $-16, %esp sub $80, %esp push %ebx push %esi push %edi lea 12(%esp), tmp movl 8(%ebp), in GET_GOT lea LOCAL_VAR(dct36_sse_COS9), %eax lea LOCAL_VAR(dct36_sse_tfcos36), %edx xorps %xmm0, %xmm0 xorps %xmm5, %xmm5 movlps 64(in), %xmm5 movups 48(in), %xmm4 movups 32(in), %xmm3 movups 16(in), %xmm2 movups (in), %xmm1 movaps %xmm5, %xmm6 shufps $0xe1, %xmm6, %xmm6 movaps %xmm4, %xmm7 shufps $0x93, %xmm7, %xmm7 movss %xmm7, %xmm6 addps %xmm6, %xmm5 movaps %xmm3, %xmm6 shufps $0x93, %xmm6, %xmm6 movss %xmm6, %xmm7 addps %xmm7, %xmm4 movaps %xmm2, %xmm7 shufps $0x93, %xmm7, %xmm7 movss %xmm7, %xmm6 addps %xmm6, %xmm3 movaps %xmm1, %xmm6 shufps $0x93, %xmm6, %xmm6 movss %xmm6, %xmm7 addps %xmm7, %xmm2 movss %xmm0, %xmm6 addps %xmm6, %xmm1 movaps LOCAL_VAR(dct36_sse_mask), %xmm0 movaps %xmm4, %xmm6 shufps $0x4e, %xmm5, %xmm4 movaps %xmm3, %xmm7 shufps $0x4e, %xmm6, %xmm3 andps %xmm0, %xmm6 addps %xmm6, %xmm4 movaps %xmm2, %xmm6 shufps $0x4e, %xmm7, %xmm2 andps %xmm0, %xmm7 addps %xmm7, %xmm3 movaps %xmm1, %xmm7 shufps $0x4e, %xmm6, %xmm1 andps %xmm0, %xmm6 addps %xmm6, %xmm2 movaps %xmm7, %xmm6 andps %xmm0, %xmm7 xorps %xmm0, %xmm0 addps %xmm7, %xmm1 movlhps %xmm6, %xmm0 /* xmm0 in[-,-,0,1] xmm1 in[2,3,4,5] xmm2 in[6,7,8,9] xmm3 in[10,11,12,13] xmm4 in[14,15,16,17] */ movaps %xmm2, %xmm5 shufps $0xe4, %xmm3, %xmm5 shufps $0xe4, %xmm4, %xmm3 shufps $0xe4, %xmm2, %xmm4 movaps %xmm5, %xmm2 /* xmm2 in[6,7,12,13] xmm3 in[10,11,16,17] xmm4 in[14,15,8,9] */ mulps (%eax), %xmm5 addps %xmm0, %xmm5 movaps %xmm0, (tmp) movaps %xmm2, 16(tmp) /* 0(tmp) in[-,-,0,1] xmm5 [ta33,tb33,ta66,tb66] */ movaps %xmm1, %xmm6 subps %xmm3, %xmm6 subps %xmm4, %xmm6 xorps %xmm7, %xmm7 shufps $0xe0, %xmm2, %xmm7 mulps (%eax), %xmm6 subps %xmm7, %xmm0 addps %xmm0, %xmm6 movaps %xmm6, 48(tmp) movaps 16(%eax), %xmm2 movaps %xmm1, %xmm0 movaps %xmm3, %xmm6 movaps %xmm4, %xmm7 mulps %xmm2, %xmm0 mulps 32(%eax), %xmm6 mulps 48(%eax), %xmm7 addps %xmm5, %xmm0 addps %xmm7, %xmm6 addps %xmm6, %xmm0 movaps %xmm0, 32(tmp) movaps %xmm1, %xmm0 movaps %xmm3, %xmm6 movaps %xmm4, %xmm7 mulps 32(%eax), %xmm0 mulps 48(%eax), %xmm6 mulps %xmm2, %xmm7 subps %xmm5, %xmm0 subps %xmm6, %xmm7 addps %xmm7, %xmm0 movaps %xmm0, 64(tmp) movaps %xmm1, %xmm6 movaps %xmm4, %xmm7 mulps 48(%eax), %xmm6 mulps %xmm3, %xmm2 mulps 32(%eax), %xmm7 subps %xmm5, %xmm6 subps %xmm7, %xmm2 addps %xmm2, %xmm6 movaps (tmp), %xmm0 movss 32(%edx), %xmm5 subps %xmm1, %xmm0 subps 16(tmp), %xmm4 addps %xmm3, %xmm0 addps %xmm4, %xmm0 shufps $0xaf, %xmm0, %xmm0 mulss %xmm5, %xmm0 movaps %xmm0, (tmp) movaps 32(tmp), %xmm0 movaps 48(tmp), %xmm1 movaps 64(tmp), %xmm2 /* xmm0 [1a-0,1b-0, 2a-0, 2b-0] xmm1 [1a-1,1b-1, 2a-1, 2b-1] xmm2 [1a-2,1b-2,-2a-2,-2b-2] xmm6 [1a-3,1b-3,-2a-3,-2b-3] */ movaps %xmm0, %xmm3 unpcklps %xmm1, %xmm0 unpckhps %xmm1, %xmm3 movaps %xmm2, %xmm5 unpcklps %xmm6, %xmm2 unpckhps %xmm6, %xmm5 xorps LOCAL_VAR(dct36_sse_sign), %xmm5 /* xmm0 [1a-0,1a-1,1b-0,1b-1] xmm3 [2a-0,2a-1,2b-0,2b-1] xmm2 [1a-2,1a-3,1b-2,1b-3] xmm5 [2a-2,2a-3,2b-2,2b-3] */ movaps %xmm0, %xmm1 movlhps %xmm2, %xmm0 movhlps %xmm1, %xmm2 movaps %xmm3, %xmm4 movlhps %xmm5, %xmm3 movhlps %xmm4, %xmm5 /* xmm0 tmp1a xmm3 tmp2a xmm2 tmp1b xmm5 tmp2b */ movaps (%edx), %xmm6 movaps 16(%edx), %xmm7 movaps %xmm5, %xmm1 addps %xmm2, %xmm5 subps %xmm2, %xmm1 movaps %xmm3, %xmm2 addps %xmm0, %xmm3 subps %xmm0, %xmm2 mulps %xmm6, %xmm5 mulps %xmm1, %xmm7 movaps %xmm2, 16(tmp) /* %xmm3 tmp[0,1,2,3] %xmm5 tmp[17,16,15,14] 16(tmp) tmp[8,7,6,5] %xmm7 tmp[9,10,11,12] 0(tmp) tmp[13,-,4,-] */ movl 12(%ebp), out1 movl 16(%ebp), out2 movl 20(%ebp), w movl 24(%ebp), ts movaps %xmm3, %xmm0 movaps %xmm5, %xmm1 movups 108(w), %xmm2 movups 92(w), %xmm3 shufps $0x1b, %xmm3, %xmm3 movups 36(w), %xmm4 movups 20(w), %xmm5 shufps $0x1b, %xmm5, %xmm5 movaps %xmm0, %xmm6 addps %xmm1, %xmm0 subps %xmm1, %xmm6 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movups 36(out1), %xmm1 movups 20(out1), %xmm3 shufps $0x1b, %xmm6, %xmm6 addps %xmm4, %xmm1 addps %xmm6, %xmm3 shufps $0x1b, %xmm0, %xmm0 movups %xmm2, 36(out2) movups %xmm0, 20(out2) movss %xmm1, 32*36(ts) movss %xmm3, 32*20(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*44(ts) movss %xmm4, 32*28(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*40(ts) movss %xmm3, 32*24(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*48(ts) movss %xmm4, 32*32(ts) movss 8(tmp), %xmm0 movss (tmp), %xmm1 movss 124(w), %xmm2 movss 88(w), %xmm3 movss 52(w), %xmm4 movss 16(w), %xmm5 movss %xmm0, %xmm6 addss %xmm1, %xmm0 subss %xmm1, %xmm6 mulss %xmm0, %xmm2 mulss %xmm3, %xmm0 mulss %xmm6, %xmm4 mulss %xmm5, %xmm6 addss 52(out1), %xmm4 addss 16(out1), %xmm6 movss %xmm2, 52(out2) movss %xmm0, 16(out2) movss %xmm4, 32*52(ts) movss %xmm6, 32*16(ts) movaps 16(tmp), %xmm0 movaps %xmm7, %xmm1 MOVUAPS 128(w), %xmm2 movups 72(w), %xmm3 shufps $0x1b, %xmm2, %xmm2 movlps 56(w), %xmm4 movhps 64(w), %xmm4 MOVUAPS (w), %xmm5 shufps $0x1b, %xmm4, %xmm4 movaps %xmm0, %xmm6 addps %xmm1, %xmm0 subps %xmm1, %xmm6 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movlps 56(out1), %xmm1 movhps 64(out1), %xmm1 movups (out1), %xmm3 shufps $0x1b, %xmm4, %xmm4 addps %xmm6, %xmm3 addps %xmm4, %xmm1 shufps $0x1b, %xmm2, %xmm2 movups %xmm0, (out2) movlps %xmm2, 56(out2) movhps %xmm2, 64(out2) movss %xmm1, 32*56(ts) movss %xmm3, (ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*64(ts) movss %xmm4, 32*8(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*60(ts) movss %xmm3, 32*4(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*68(ts) movss %xmm4, 32*12(ts) pop %edi pop %esi pop %ebx mov %ebp, %esp pop %ebp ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct36_x86_64.S000066400000000000000000000175521357201522000177170ustar00rootroot00000000000000/* dct36_x86_64: SSE optimized dct36 for x86-64 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifdef IS_MSABI #define in %rcx #define out1 %rdx #define out2 %r8 #define w %r9 #define ts %r10 #define COS9_ %rax #define tfcos36_ %r11 #else #define in %rdi #define out1 %rsi #define out2 %rdx #define w %rcx #define ts %r8 #define COS9_ %rax #define tfcos36_ %r9 #endif /* void dct36_x86_64(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 dct36_x86_64_COS9: .long 0x3f5db3d7 .long 0x3f5db3d7 .long 0x3f000000 .long 0x3f000000 .long 0x3f7c1c5c .long 0x3f7c1c5c .long 0x3f708fb2 .long 0x3f708fb2 .long 0x3f248dbb .long 0x3f248dbb .long 0x3e31d0d4 .long 0x3e31d0d4 .long 0x3eaf1d44 .long 0x3eaf1d44 .long 0x3f441b7d .long 0x3f441b7d ALIGN16 dct36_x86_64_tfcos36: .long 0x3f007d2b .long 0x3f0483ee .long 0x3f0d3b7d .long 0x3f1c4257 .long 0x40b79454 .long 0x3ff746ea .long 0x3f976fd9 .long 0x3f5f2944 .long 0x3f3504f3 ALIGN16 dct36_x86_64_mask: .long 0,0xffffffff,0,0xffffffff ALIGN16 dct36_x86_64_sign: .long 0x80000000,0x80000000,0x80000000,0x80000000 .text ALIGN16 .globl ASM_NAME(dct36_x86_64) ASM_NAME(dct36_x86_64): #ifdef IS_MSABI push %rbp mov %rsp, %rbp sub $160, %rsp movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) movaps %xmm13, 112(%rsp) movaps %xmm14, 128(%rsp) movaps %xmm15, 144(%rsp) movq 48(%rbp), ts #endif lea dct36_x86_64_COS9(%rip), COS9_ lea dct36_x86_64_tfcos36(%rip), tfcos36_ xorps %xmm5, %xmm5 movups (in), %xmm1 movups 16(in), %xmm2 movups 32(in), %xmm3 movups 48(in), %xmm4 movlps 64(in), %xmm5 xorps %xmm6, %xmm6 movaps %xmm1, %xmm7 shufps $0x93, %xmm7, %xmm7 movaps %xmm2, %xmm8 shufps $0x93, %xmm8, %xmm8 movaps %xmm3, %xmm9 shufps $0x93, %xmm9, %xmm9 movaps %xmm4, %xmm10 shufps $0x93, %xmm10, %xmm10 movaps %xmm5, %xmm11 shufps $0xe1, %xmm11, %xmm11 movss %xmm10, %xmm11 addps %xmm11, %xmm5 movss %xmm9, %xmm10 addps %xmm10, %xmm4 movss %xmm8, %xmm9 addps %xmm9, %xmm3 movss %xmm7, %xmm8 addps %xmm8, %xmm2 movss %xmm6, %xmm7 addps %xmm7, %xmm1 movaps dct36_x86_64_mask(%rip), %xmm0 movaps %xmm4, %xmm6 shufps $0x4e, %xmm5, %xmm4 movaps %xmm3, %xmm7 shufps $0x4e, %xmm6, %xmm3 andps %xmm0, %xmm6 addps %xmm6, %xmm4 movaps %xmm2, %xmm6 shufps $0x4e, %xmm7, %xmm2 andps %xmm0, %xmm7 addps %xmm7, %xmm3 movaps %xmm1, %xmm7 shufps $0x4e, %xmm6, %xmm1 andps %xmm0, %xmm6 addps %xmm6, %xmm2 movaps %xmm7, %xmm6 andps %xmm0, %xmm7 xorps %xmm0, %xmm0 addps %xmm7, %xmm1 movlhps %xmm6, %xmm0 /* xmm0 in[-,-,0,1] xmm1 in[2,3,4,5] xmm2 in[6,7,8,9] xmm3 in[10,11,12,13] xmm4 in[14,15,16,17] */ movaps %xmm2, %xmm5 shufps $0xe4, %xmm3, %xmm5 shufps $0xe4, %xmm4, %xmm3 shufps $0xe4, %xmm2, %xmm4 movaps %xmm5, %xmm2 /* xmm2 in[6,7,12,13] xmm3 in[10,11,16,17] xmm4 in[14,15,8,9] */ movaps (COS9_), %xmm15 movaps 16(COS9_), %xmm6 movaps 32(COS9_), %xmm7 movaps 48(COS9_), %xmm8 mulps %xmm15, %xmm5 addps %xmm0, %xmm5 /* xmm5 [ta33,tb33,ta66,tb66] xmm6 COS9_[1,1,2,2] xmm7 COS9_[5,5,8,8] xmm8 COS9_[7,7,4,4] xmm15 COS9_[3,3,6,6] */ movaps %xmm6, %xmm9 movaps %xmm7, %xmm12 movaps %xmm8, %xmm13 mulps %xmm1, %xmm9 mulps %xmm3, %xmm12 mulps %xmm4, %xmm13 addps %xmm5, %xmm9 addps %xmm13, %xmm12 addps %xmm9, %xmm12 movaps %xmm1, %xmm13 subps %xmm3, %xmm13 movaps %xmm0, %xmm10 shufps $0xe0, %xmm2, %xmm10 movaps %xmm0, %xmm14 subps %xmm10, %xmm14 subps %xmm4, %xmm13 mulps %xmm15, %xmm13 addps %xmm14, %xmm13 movaps %xmm7, %xmm9 movaps %xmm8, %xmm15 movaps %xmm6, %xmm14 mulps %xmm1, %xmm9 mulps %xmm3, %xmm15 mulps %xmm4, %xmm14 subps %xmm5, %xmm9 subps %xmm15, %xmm14 addps %xmm9, %xmm14 mulps %xmm1, %xmm8 mulps %xmm3, %xmm6 mulps %xmm4, %xmm7 subps %xmm5, %xmm8 subps %xmm7, %xmm6 addps %xmm6, %xmm8 movaps %xmm8, %xmm15 movss 32(tfcos36_), %xmm5 subps %xmm1, %xmm0 subps %xmm2, %xmm4 addps %xmm3, %xmm0 addps %xmm4, %xmm0 shufps $0xaf, %xmm0, %xmm0 mulss %xmm5, %xmm0 movaps %xmm0, %xmm11 /* xmm12 [1a-0,1b-0, 2a-0, 2b-0] xmm13 [1a-1,1b-1, 2a-1, 2b-1] xmm14 [1a-2,1b-2,-2a-2,-2b-2] xmm15 [1a-3,1b-3,-2a-3,-2b-3] */ movaps %xmm12, %xmm5 unpckhps %xmm13, %xmm5 unpcklps %xmm13, %xmm12 movaps %xmm14, %xmm6 unpckhps %xmm15, %xmm6 unpcklps %xmm15, %xmm14 xorps dct36_x86_64_sign(%rip), %xmm6 /* xmm12 [1a-0,1a-1,1b-0,1b-1] xmm5 [2a-0,2a-1,2b-0,2b-1] xmm14 [1a-2,1a-3,1b-2,1b-3] xmm6 [2a-2,2a-3,2b-2,2b-3] */ movaps %xmm12, %xmm0 movlhps %xmm14, %xmm12 movhlps %xmm0, %xmm14 movaps %xmm5, %xmm0 movlhps %xmm6, %xmm0 movhlps %xmm5, %xmm6 movaps %xmm6, %xmm15 /* xmm12 tmp1a xmm0 tmp2a xmm14 tmp1b xmm15 tmp2b */ movaps (tfcos36_), %xmm6 movaps 16(tfcos36_), %xmm7 movaps %xmm15, %xmm10 addps %xmm14, %xmm15 subps %xmm14, %xmm10 movaps %xmm0, %xmm14 addps %xmm12, %xmm0 subps %xmm12, %xmm14 mulps %xmm6, %xmm15 mulps %xmm10, %xmm7 /* %xmm0 tmp[0,1,2,3] %xmm15 tmp[17,16,15,14] %xmm14 tmp[8,7,6,5] %xmm7 tmp[9,10,11,12] %xmm11 tmp[13,-,4,-] */ movaps %xmm15, %xmm1 movups 108(w), %xmm2 movups 92(w), %xmm3 shufps $0x1b, %xmm3, %xmm3 movups 36(w), %xmm4 movups 20(w), %xmm5 shufps $0x1b, %xmm5, %xmm5 movaps %xmm0, %xmm6 addps %xmm1, %xmm0 subps %xmm1, %xmm6 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movups 36(out1), %xmm1 movups 20(out1), %xmm3 shufps $0x1b, %xmm6, %xmm6 addps %xmm4, %xmm1 addps %xmm6, %xmm3 shufps $0x1b, %xmm0, %xmm0 movups %xmm2, 36(out2) movups %xmm0, 20(out2) movss %xmm1, 32*36(ts) movss %xmm3, 32*20(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*44(ts) movss %xmm4, 32*28(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*40(ts) movss %xmm3, 32*24(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*48(ts) movss %xmm4, 32*32(ts) movhlps %xmm11, %xmm0 movaps %xmm11, %xmm1 movss 124(w), %xmm2 movss 88(w), %xmm3 movss 52(w), %xmm4 movss 16(w), %xmm5 movss %xmm0, %xmm6 addss %xmm1, %xmm0 subss %xmm1, %xmm6 mulss %xmm0, %xmm2 mulss %xmm3, %xmm0 mulss %xmm6, %xmm4 mulss %xmm5, %xmm6 addss 52(out1), %xmm4 addss 16(out1), %xmm6 movss %xmm2, 52(out2) movss %xmm0, 16(out2) movss %xmm4, 32*52(ts) movss %xmm6, 32*16(ts) movaps %xmm14, %xmm0 movaps %xmm7, %xmm1 MOVUAPS 128(w), %xmm2 movups 72(w), %xmm3 shufps $0x1b, %xmm2, %xmm2 movlps 56(w), %xmm4 movhps 64(w), %xmm4 MOVUAPS (w), %xmm5 shufps $0x1b, %xmm4, %xmm4 movaps %xmm0, %xmm6 addps %xmm1, %xmm0 subps %xmm1, %xmm6 mulps %xmm0, %xmm2 mulps %xmm3, %xmm0 mulps %xmm6, %xmm4 mulps %xmm5, %xmm6 movlps 56(out1), %xmm1 movhps 64(out1), %xmm1 movups (out1), %xmm3 shufps $0x1b, %xmm4, %xmm4 addps %xmm6, %xmm3 addps %xmm4, %xmm1 shufps $0x1b, %xmm2, %xmm2 movups %xmm0, (out2) movlps %xmm2, 56(out2) movhps %xmm2, 64(out2) movss %xmm1, 32*56(ts) movss %xmm3, (ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*64(ts) movss %xmm4, 32*8(ts) shufps $0xb1, %xmm1, %xmm1 shufps $0xb1, %xmm3, %xmm3 movss %xmm1, 32*60(ts) movss %xmm3, 32*4(ts) movhlps %xmm1, %xmm2 movhlps %xmm3, %xmm4 movss %xmm2, 32*68(ts) movss %xmm4, 32*12(ts) #ifdef IS_MSABI movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 movaps 112(%rsp), %xmm13 movaps 128(%rsp), %xmm14 movaps 144(%rsp), %xmm15 mov %rbp, %rsp pop %rbp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64.c000066400000000000000000000106061357201522000167130ustar00rootroot00000000000000/* dct64.c: DCT64, the plain C version copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp */ /* * Discrete Cosine Tansform (DCT) for subband synthesis * * -funroll-loops (for gcc) will remove the loops for better performance * using loops in the source-code enhances readabillity * * * TODO: write an optimized version for the down-sampling modes * (in these modes the bands 16-31 (2:1) or 8-31 (4:1) are zero */ #include "mpg123lib_intern.h" void dct64(real *out0,real *out1,real *samples) { real bufs[64]; { register int i,j; register real *b1,*b2,*bs,*costab; b1 = samples; bs = bufs; costab = pnts[0]+16; b2 = b1 + 32; for(i=15;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=15;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); b1 = bufs; costab = pnts[1]+8; b2 = b1 + 16; { for(i=7;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=7;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); b2 += 32; costab += 8; for(i=7;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=7;i>=0;i--) *bs++ = REAL_MUL((*b1++ - *--b2), *--costab); b2 += 32; } bs = bufs; costab = pnts[2]; b2 = b1 + 8; for(j=2;j;j--) { for(i=3;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=3;i>=0;i--) *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]); b2 += 16; for(i=3;i>=0;i--) *bs++ = (*b1++ + *--b2); for(i=3;i>=0;i--) *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]); b2 += 16; } b1 = bufs; costab = pnts[3]; b2 = b1 + 4; for(j=4;j;j--) { *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]); *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]); b2 += 8; *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]); *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]); b2 += 8; } bs = bufs; costab = pnts[4]; for(j=8;j;j--) { real v0,v1; v0=*b1++; v1 = *b1++; *bs++ = (v0 + v1); *bs++ = REAL_MUL((v0 - v1), (*costab)); v0=*b1++; v1 = *b1++; *bs++ = (v0 + v1); *bs++ = REAL_MUL((v1 - v0), (*costab)); } } { register real *b1; register int i; for(b1=bufs,i=8;i;i--,b1+=4) b1[2] += b1[3]; for(b1=bufs,i=4;i;i--,b1+=8) { b1[4] += b1[6]; b1[6] += b1[5]; b1[5] += b1[7]; } for(b1=bufs,i=2;i;i--,b1+=16) { b1[8] += b1[12]; b1[12] += b1[10]; b1[10] += b1[14]; b1[14] += b1[9]; b1[9] += b1[13]; b1[13] += b1[11]; b1[11] += b1[15]; } } out0[0x10*16] = REAL_SCALE_DCT64(bufs[0]); out0[0x10*15] = REAL_SCALE_DCT64(bufs[16+0] + bufs[16+8]); out0[0x10*14] = REAL_SCALE_DCT64(bufs[8]); out0[0x10*13] = REAL_SCALE_DCT64(bufs[16+8] + bufs[16+4]); out0[0x10*12] = REAL_SCALE_DCT64(bufs[4]); out0[0x10*11] = REAL_SCALE_DCT64(bufs[16+4] + bufs[16+12]); out0[0x10*10] = REAL_SCALE_DCT64(bufs[12]); out0[0x10* 9] = REAL_SCALE_DCT64(bufs[16+12] + bufs[16+2]); out0[0x10* 8] = REAL_SCALE_DCT64(bufs[2]); out0[0x10* 7] = REAL_SCALE_DCT64(bufs[16+2] + bufs[16+10]); out0[0x10* 6] = REAL_SCALE_DCT64(bufs[10]); out0[0x10* 5] = REAL_SCALE_DCT64(bufs[16+10] + bufs[16+6]); out0[0x10* 4] = REAL_SCALE_DCT64(bufs[6]); out0[0x10* 3] = REAL_SCALE_DCT64(bufs[16+6] + bufs[16+14]); out0[0x10* 2] = REAL_SCALE_DCT64(bufs[14]); out0[0x10* 1] = REAL_SCALE_DCT64(bufs[16+14] + bufs[16+1]); out0[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); out1[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); out1[0x10* 1] = REAL_SCALE_DCT64(bufs[16+1] + bufs[16+9]); out1[0x10* 2] = REAL_SCALE_DCT64(bufs[9]); out1[0x10* 3] = REAL_SCALE_DCT64(bufs[16+9] + bufs[16+5]); out1[0x10* 4] = REAL_SCALE_DCT64(bufs[5]); out1[0x10* 5] = REAL_SCALE_DCT64(bufs[16+5] + bufs[16+13]); out1[0x10* 6] = REAL_SCALE_DCT64(bufs[13]); out1[0x10* 7] = REAL_SCALE_DCT64(bufs[16+13] + bufs[16+3]); out1[0x10* 8] = REAL_SCALE_DCT64(bufs[3]); out1[0x10* 9] = REAL_SCALE_DCT64(bufs[16+3] + bufs[16+11]); out1[0x10*10] = REAL_SCALE_DCT64(bufs[11]); out1[0x10*11] = REAL_SCALE_DCT64(bufs[16+11] + bufs[16+7]); out1[0x10*12] = REAL_SCALE_DCT64(bufs[7]); out1[0x10*13] = REAL_SCALE_DCT64(bufs[16+7] + bufs[16+15]); out1[0x10*14] = REAL_SCALE_DCT64(bufs[15]); out1[0x10*15] = REAL_SCALE_DCT64(bufs[16+15]); } welle.io-2.1/src/libs/mpg123/dct64_3dnow.S000066400000000000000000000326331357201522000200110ustar00rootroot00000000000000/* dct64_3dnow.s: Replacement of dct64() with AMD's 3DNow! SIMD operations support copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Syuuhei Kashiyama Original "license" statement: The author of this program disclaim whole expressed or implied warranties with regard to this program, and in no event shall the author of this program liable to whatever resulted from the use of this program. Use it at your own risk. */ #include "mangle.h" .globl ASM_NAME(dct64_3dnow) /* .type ASM_NAME(dct64_3dnow),@function */ ASM_NAME(dct64_3dnow): subl $256,%esp pushl %ebp pushl %edi pushl %esi pushl %ebx #undef _EBX_ #define _EBX_ %ecx GET_GOT leal 16(%esp),%ebx movl 284(%esp),%edi movl 276(%esp),%ebp movl 280(%esp),%edx leal 128(%ebx),%esi /* femms */ /* 1 */ #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(pnts),%eax movl (%eax),%eax #else movl GLOBAL_VAR(pnts),%eax #endif movq 0(%edi),%mm0 movq %mm0,%mm1 movd 124(%edi),%mm2 punpckldq 120(%edi),%mm2 movq 0(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,0(%ebx) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,124(%ebx) psrlq $32,%mm1 movd %mm1,120(%ebx) movq 8(%edi),%mm4 movq %mm4,%mm5 movd 116(%edi),%mm6 punpckldq 112(%edi),%mm6 movq 8(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,8(%ebx) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,116(%ebx) psrlq $32,%mm5 movd %mm5,112(%ebx) movq 16(%edi),%mm0 movq %mm0,%mm1 movd 108(%edi),%mm2 punpckldq 104(%edi),%mm2 movq 16(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,16(%ebx) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,108(%ebx) psrlq $32,%mm1 movd %mm1,104(%ebx) movq 24(%edi),%mm4 movq %mm4,%mm5 movd 100(%edi),%mm6 punpckldq 96(%edi),%mm6 movq 24(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,24(%ebx) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,100(%ebx) psrlq $32,%mm5 movd %mm5,96(%ebx) movq 32(%edi),%mm0 movq %mm0,%mm1 movd 92(%edi),%mm2 punpckldq 88(%edi),%mm2 movq 32(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,32(%ebx) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,92(%ebx) psrlq $32,%mm1 movd %mm1,88(%ebx) movq 40(%edi),%mm4 movq %mm4,%mm5 movd 84(%edi),%mm6 punpckldq 80(%edi),%mm6 movq 40(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,40(%ebx) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,84(%ebx) psrlq $32,%mm5 movd %mm5,80(%ebx) movq 48(%edi),%mm0 movq %mm0,%mm1 movd 76(%edi),%mm2 punpckldq 72(%edi),%mm2 movq 48(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,48(%ebx) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,76(%ebx) psrlq $32,%mm1 movd %mm1,72(%ebx) movq 56(%edi),%mm4 movq %mm4,%mm5 movd 68(%edi),%mm6 punpckldq 64(%edi),%mm6 movq 56(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,56(%ebx) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,68(%ebx) psrlq $32,%mm5 movd %mm5,64(%ebx) /* 2 */ #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(pnts),%eax movl 4(%eax),%eax #else movl 4+GLOBAL_VAR(pnts),%eax #endif /* 0,14 */ movq 0(%ebx),%mm0 movq %mm0,%mm1 movd 60(%ebx),%mm2 punpckldq 56(%ebx),%mm2 movq 0(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,0(%esi) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,60(%esi) psrlq $32,%mm1 movd %mm1,56(%esi) /* 16,30 */ movq 64(%ebx),%mm0 movq %mm0,%mm1 movd 124(%ebx),%mm2 punpckldq 120(%ebx),%mm2 pfadd %mm2,%mm0 movq %mm0,64(%esi) pfsubr %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,124(%esi) psrlq $32,%mm1 movd %mm1,120(%esi) /* 2,12 */ movq 8(%ebx),%mm4 movq %mm4,%mm5 movd 52(%ebx),%mm6 punpckldq 48(%ebx),%mm6 movq 8(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,8(%esi) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,52(%esi) psrlq $32,%mm5 movd %mm5,48(%esi) /* 18,28 */ movq 72(%ebx),%mm4 movq %mm4,%mm5 movd 116(%ebx),%mm6 punpckldq 112(%ebx),%mm6 pfadd %mm6,%mm4 movq %mm4,72(%esi) pfsubr %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,116(%esi) psrlq $32,%mm5 movd %mm5,112(%esi) /* 4,10 */ movq 16(%ebx),%mm0 movq %mm0,%mm1 movd 44(%ebx),%mm2 punpckldq 40(%ebx),%mm2 movq 16(%eax),%mm3 pfadd %mm2,%mm0 movq %mm0,16(%esi) pfsub %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,44(%esi) psrlq $32,%mm1 movd %mm1,40(%esi) /* 20,26 */ movq 80(%ebx),%mm0 movq %mm0,%mm1 movd 108(%ebx),%mm2 punpckldq 104(%ebx),%mm2 pfadd %mm2,%mm0 movq %mm0,80(%esi) pfsubr %mm2,%mm1 pfmul %mm3,%mm1 movd %mm1,108(%esi) psrlq $32,%mm1 movd %mm1,104(%esi) /* 6,8 */ movq 24(%ebx),%mm4 movq %mm4,%mm5 movd 36(%ebx),%mm6 punpckldq 32(%ebx),%mm6 movq 24(%eax),%mm7 pfadd %mm6,%mm4 movq %mm4,24(%esi) pfsub %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,36(%esi) psrlq $32,%mm5 movd %mm5,32(%esi) /* 22,24 */ movq 88(%ebx),%mm4 movq %mm4,%mm5 movd 100(%ebx),%mm6 punpckldq 96(%ebx),%mm6 pfadd %mm6,%mm4 movq %mm4,88(%esi) pfsubr %mm6,%mm5 pfmul %mm7,%mm5 movd %mm5,100(%esi) psrlq $32,%mm5 movd %mm5,96(%esi) /* 3 */ #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(pnts),%eax movl 8(%eax),%eax #else movl 8+GLOBAL_VAR(pnts),%eax #endif movq 0(%eax),%mm0 movq 8(%eax),%mm1 /* 0,6 */ movq 0(%esi),%mm2 movq %mm2,%mm3 movd 28(%esi),%mm4 punpckldq 24(%esi),%mm4 pfadd %mm4,%mm2 pfsub %mm4,%mm3 pfmul %mm0,%mm3 movq %mm2,0(%ebx) movd %mm3,28(%ebx) psrlq $32,%mm3 movd %mm3,24(%ebx) /* 2,4 */ movq 8(%esi),%mm5 movq %mm5,%mm6 movd 20(%esi),%mm7 punpckldq 16(%esi),%mm7 pfadd %mm7,%mm5 pfsub %mm7,%mm6 pfmul %mm1,%mm6 movq %mm5,8(%ebx) movd %mm6,20(%ebx) psrlq $32,%mm6 movd %mm6,16(%ebx) /* 8,14 */ movq 32(%esi),%mm2 movq %mm2,%mm3 movd 60(%esi),%mm4 punpckldq 56(%esi),%mm4 pfadd %mm4,%mm2 pfsubr %mm4,%mm3 pfmul %mm0,%mm3 movq %mm2,32(%ebx) movd %mm3,60(%ebx) psrlq $32,%mm3 movd %mm3,56(%ebx) /* 10,12 */ movq 40(%esi),%mm5 movq %mm5,%mm6 movd 52(%esi),%mm7 punpckldq 48(%esi),%mm7 pfadd %mm7,%mm5 pfsubr %mm7,%mm6 pfmul %mm1,%mm6 movq %mm5,40(%ebx) movd %mm6,52(%ebx) psrlq $32,%mm6 movd %mm6,48(%ebx) /* 16,22 */ movq 64(%esi),%mm2 movq %mm2,%mm3 movd 92(%esi),%mm4 punpckldq 88(%esi),%mm4 pfadd %mm4,%mm2 pfsub %mm4,%mm3 pfmul %mm0,%mm3 movq %mm2,64(%ebx) movd %mm3,92(%ebx) psrlq $32,%mm3 movd %mm3,88(%ebx) /* 18,20 */ movq 72(%esi),%mm5 movq %mm5,%mm6 movd 84(%esi),%mm7 punpckldq 80(%esi),%mm7 pfadd %mm7,%mm5 pfsub %mm7,%mm6 pfmul %mm1,%mm6 movq %mm5,72(%ebx) movd %mm6,84(%ebx) psrlq $32,%mm6 movd %mm6,80(%ebx) /* 24,30 */ movq 96(%esi),%mm2 movq %mm2,%mm3 movd 124(%esi),%mm4 punpckldq 120(%esi),%mm4 pfadd %mm4,%mm2 pfsubr %mm4,%mm3 pfmul %mm0,%mm3 movq %mm2,96(%ebx) movd %mm3,124(%ebx) psrlq $32,%mm3 movd %mm3,120(%ebx) /* 26,28 */ movq 104(%esi),%mm5 movq %mm5,%mm6 movd 116(%esi),%mm7 punpckldq 112(%esi),%mm7 pfadd %mm7,%mm5 pfsubr %mm7,%mm6 pfmul %mm1,%mm6 movq %mm5,104(%ebx) movd %mm6,116(%ebx) psrlq $32,%mm6 movd %mm6,112(%ebx) /* 4 */ #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(pnts),%eax movl 12(%eax),%eax #else movl 12+GLOBAL_VAR(pnts),%eax #endif movq 0(%eax),%mm0 /* 0 */ movq 0(%ebx),%mm1 movq %mm1,%mm2 movd 12(%ebx),%mm3 punpckldq 8(%ebx),%mm3 pfadd %mm3,%mm1 pfsub %mm3,%mm2 pfmul %mm0,%mm2 movq %mm1,0(%esi) movd %mm2,12(%esi) psrlq $32,%mm2 movd %mm2,8(%esi) /* 4 */ movq 16(%ebx),%mm4 movq %mm4,%mm5 movd 28(%ebx),%mm6 punpckldq 24(%ebx),%mm6 pfadd %mm6,%mm4 pfsubr %mm6,%mm5 pfmul %mm0,%mm5 movq %mm4,16(%esi) movd %mm5,28(%esi) psrlq $32,%mm5 movd %mm5,24(%esi) /* 8 */ movq 32(%ebx),%mm1 movq %mm1,%mm2 movd 44(%ebx),%mm3 punpckldq 40(%ebx),%mm3 pfadd %mm3,%mm1 pfsub %mm3,%mm2 pfmul %mm0,%mm2 movq %mm1,32(%esi) movd %mm2,44(%esi) psrlq $32,%mm2 movd %mm2,40(%esi) /* 12 */ movq 48(%ebx),%mm4 movq %mm4,%mm5 movd 60(%ebx),%mm6 punpckldq 56(%ebx),%mm6 pfadd %mm6,%mm4 pfsubr %mm6,%mm5 pfmul %mm0,%mm5 movq %mm4,48(%esi) movd %mm5,60(%esi) psrlq $32,%mm5 movd %mm5,56(%esi) /* 16 */ movq 64(%ebx),%mm1 movq %mm1,%mm2 movd 76(%ebx),%mm3 punpckldq 72(%ebx),%mm3 pfadd %mm3,%mm1 pfsub %mm3,%mm2 pfmul %mm0,%mm2 movq %mm1,64(%esi) movd %mm2,76(%esi) psrlq $32,%mm2 movd %mm2,72(%esi) /* 20 */ movq 80(%ebx),%mm4 movq %mm4,%mm5 movd 92(%ebx),%mm6 punpckldq 88(%ebx),%mm6 pfadd %mm6,%mm4 pfsubr %mm6,%mm5 pfmul %mm0,%mm5 movq %mm4,80(%esi) movd %mm5,92(%esi) psrlq $32,%mm5 movd %mm5,88(%esi) /* 24 */ movq 96(%ebx),%mm1 movq %mm1,%mm2 movd 108(%ebx),%mm3 punpckldq 104(%ebx),%mm3 pfadd %mm3,%mm1 pfsub %mm3,%mm2 pfmul %mm0,%mm2 movq %mm1,96(%esi) movd %mm2,108(%esi) psrlq $32,%mm2 movd %mm2,104(%esi) /* 28 */ movq 112(%ebx),%mm4 movq %mm4,%mm5 movd 124(%ebx),%mm6 punpckldq 120(%ebx),%mm6 pfadd %mm6,%mm4 pfsubr %mm6,%mm5 pfmul %mm0,%mm5 movq %mm4,112(%esi) movd %mm5,124(%esi) psrlq $32,%mm5 movd %mm5,120(%esi) /* 5 */ movl $-1,%eax movd %eax,%mm1 movl $1,%eax /* L | H */ movd %eax,%mm0 punpckldq %mm1,%mm0 /* 1.0 | -1.0 */ pi2fd %mm0,%mm0 movd %eax,%mm1 pi2fd %mm1,%mm1 #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(pnts),%eax movl 16(%eax),%eax #else movl 16+GLOBAL_VAR(pnts),%eax #endif movd 0(%eax),%mm2 /* 1.0 | cos0 */ punpckldq %mm2,%mm1 /* 0 */ movq 0(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq %mm2,0(%ebx) movq 8(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm4,8(%ebx) /* 4 */ movq 16(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq 24(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm2,%mm3 psrlq $32,%mm3 pfadd %mm4,%mm2 pfadd %mm3,%mm4 movq %mm2,16(%ebx) movq %mm4,24(%ebx) /* 8 */ movq 32(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq %mm2,32(%ebx) movq 40(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm4,40(%ebx) /* 12 */ movq 48(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq 56(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm2,%mm3 psrlq $32,%mm3 pfadd %mm4,%mm2 pfadd %mm3,%mm4 movq %mm2,48(%ebx) movq %mm4,56(%ebx) /* 16 */ movq 64(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq %mm2,64(%ebx) movq 72(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm4,72(%ebx) /* 20 */ movq 80(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq 88(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm2,%mm3 psrlq $32,%mm3 pfadd %mm4,%mm2 pfadd %mm3,%mm4 movq %mm2,80(%ebx) movq %mm4,88(%ebx) /* 24 */ movq 96(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq %mm2,96(%ebx) movq 104(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm4,104(%ebx) /* 28 */ movq 112(%esi),%mm2 movq %mm2,%mm3 pfmul %mm0,%mm3 pfacc %mm3,%mm2 pfmul %mm1,%mm2 movq 120(%esi),%mm4 movq %mm4,%mm5 pfmul %mm0,%mm5 pfacc %mm5,%mm4 pfmul %mm0,%mm4 pfmul %mm1,%mm4 movq %mm4,%mm5 psrlq $32,%mm5 pfacc %mm5,%mm4 movq %mm2,%mm3 psrlq $32,%mm3 pfadd %mm4,%mm2 pfadd %mm3,%mm4 movq %mm2,112(%ebx) movq %mm4,120(%ebx) /* Phase6 */ movl 0(%ebx),%eax movl %eax,1024(%ebp) movl 4(%ebx),%eax movl %eax,0(%ebp) movl %eax,0(%edx) movl 8(%ebx),%eax movl %eax,512(%ebp) movl 12(%ebx),%eax movl %eax,512(%edx) movl 16(%ebx),%eax movl %eax,768(%ebp) movl 20(%ebx),%eax movl %eax,256(%edx) movl 24(%ebx),%eax movl %eax,256(%ebp) movl 28(%ebx),%eax movl %eax,768(%edx) movq 32(%ebx),%mm0 movq 48(%ebx),%mm1 pfadd %mm1,%mm0 movd %mm0,896(%ebp) psrlq $32,%mm0 movd %mm0,128(%edx) movq 40(%ebx),%mm2 pfadd %mm2,%mm1 movd %mm1,640(%ebp) psrlq $32,%mm1 movd %mm1,384(%edx) movq 56(%ebx),%mm3 pfadd %mm3,%mm2 movd %mm2,384(%ebp) psrlq $32,%mm2 movd %mm2,640(%edx) movd 36(%ebx),%mm4 pfadd %mm4,%mm3 movd %mm3,128(%ebp) psrlq $32,%mm3 movd %mm3,896(%edx) movq 96(%ebx),%mm0 movq 64(%ebx),%mm1 movq 112(%ebx),%mm2 pfadd %mm2,%mm0 movq %mm0,%mm3 pfadd %mm1,%mm3 movd %mm3,960(%ebp) psrlq $32,%mm3 movd %mm3,64(%edx) movq 80(%ebx),%mm1 pfadd %mm1,%mm0 movd %mm0,832(%ebp) psrlq $32,%mm0 movd %mm0,192(%edx) movq 104(%ebx),%mm3 pfadd %mm3,%mm2 movq %mm2,%mm4 pfadd %mm1,%mm4 movd %mm4,704(%ebp) psrlq $32,%mm4 movd %mm4,320(%edx) movq 72(%ebx),%mm1 pfadd %mm1,%mm2 movd %mm2,576(%ebp) psrlq $32,%mm2 movd %mm2,448(%edx) movq 120(%ebx),%mm4 pfadd %mm4,%mm3 movq %mm3,%mm5 pfadd %mm1,%mm5 movd %mm5,448(%ebp) psrlq $32,%mm5 movd %mm5,576(%edx) movq 88(%ebx),%mm1 pfadd %mm1,%mm3 movd %mm3,320(%ebp) psrlq $32,%mm3 movd %mm3,704(%edx) movd 100(%ebx),%mm5 pfadd %mm5,%mm4 movq %mm4,%mm6 pfadd %mm1,%mm6 movd %mm6,192(%ebp) psrlq $32,%mm6 movd %mm6,832(%edx) movd 68(%ebx),%mm1 pfadd %mm1,%mm4 movd %mm4,64(%ebp) psrlq $32,%mm4 movd %mm4,960(%edx) /* femms */ popl %ebx popl %esi popl %edi popl %ebp addl $256,%esp ret #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_pnts: .indirect_symbol ASM_NAME(pnts) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_3dnowext.S000066400000000000000000000357131357201522000205340ustar00rootroot00000000000000/* dct64_3dnowext: extended 3DNow optimized DCT64 copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org Transformed back into standalone asm, with help of gcc -S -DHAVE_CONFIG_H -I. -march=k6-3 -O3 -Wall -pedantic -fno-strict-aliasing -DREAL_IS_FLOAT -c -o dct64_3dnowext.{S,c} MPlayer comment follows. */ /* * This code was taken from http://www.mpg123.org * See ChangeLog of mpg123-0.59s-pre.1 for detail * Applied to mplayer by Nick Kurshev * Partial 3dnowex-DSP! optimization by Nick Kurshev * * TODO: optimize scalar 3dnow! code * Warning: Phases 7 & 8 are not tested */ #include "mangle.h" .data ALIGN4 /* .type plus_1f, @object .size plus_1f, 4 */ plus_1f: .long 1065353216 ALIGN8 /* .type x_plus_minus_3dnow, @object .size x_plus_minus_3dnow, 8 */ x_plus_minus_3dnow: .long 0 .long -2147483648 .text ALIGN32 .globl ASM_NAME(dct64_3dnowext) /* .type ASM_NAME(dct64_3dnowext), @function */ ASM_NAME(dct64_3dnowext): pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %ebx subl $260, %esp GET_GOT #if defined(OPT_X86) && defined(PIC) movl _EBX_, (%esp) /* save PIC register */ #endif /* APP */ movl 16(%ebp),%eax leal 128+-268(%ebp),%edx movl 8(%ebp),%esi movl 12(%ebp),%edi #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(costab_mmxsse),%ebx #else leal GLOBAL_VAR(costab_mmxsse),%ebx #endif leal -268(%ebp),%ecx movq (%eax), %mm0 movq 8(%eax), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 120(%eax), %mm1 pswapd 112(%eax), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, (%edx) movq %mm4, 8(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul (%ebx), %mm3 pfmul 8(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 120(%edx) movq %mm7, 112(%edx) movq 16(%eax), %mm0 movq 24(%eax), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 104(%eax), %mm1 pswapd 96(%eax), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 16(%edx) movq %mm4, 24(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul 16(%ebx), %mm3 pfmul 24(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 104(%edx) movq %mm7, 96(%edx) movq 32(%eax), %mm0 movq 40(%eax), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 88(%eax), %mm1 pswapd 80(%eax), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 32(%edx) movq %mm4, 40(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul 32(%ebx), %mm3 pfmul 40(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 88(%edx) movq %mm7, 80(%edx) movq 48(%eax), %mm0 movq 56(%eax), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 72(%eax), %mm1 pswapd 64(%eax), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 48(%edx) movq %mm4, 56(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul 48(%ebx), %mm3 pfmul 56(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 72(%edx) movq %mm7, 64(%edx) movq (%edx), %mm0 movq 8(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 56(%edx), %mm1 pswapd 48(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, (%ecx) movq %mm4, 8(%ecx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul 64(%ebx), %mm3 pfmul 72(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 56(%ecx) movq %mm7, 48(%ecx) movq 16(%edx), %mm0 movq 24(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 40(%edx), %mm1 pswapd 32(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 16(%ecx) movq %mm4, 24(%ecx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul 80(%ebx), %mm3 pfmul 88(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 40(%ecx) movq %mm7, 32(%ecx) movq 64(%edx), %mm0 movq 72(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 120(%edx), %mm1 pswapd 112(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 64(%ecx) movq %mm4, 72(%ecx) pfsubr %mm1, %mm3 pfsubr %mm5, %mm7 pfmul 64(%ebx), %mm3 pfmul 72(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 120(%ecx) movq %mm7, 112(%ecx) movq 80(%edx), %mm0 movq 88(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 104(%edx), %mm1 pswapd 96(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 80(%ecx) movq %mm4, 88(%ecx) pfsubr %mm1, %mm3 pfsubr %mm5, %mm7 pfmul 80(%ebx), %mm3 pfmul 88(%ebx), %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 104(%ecx) movq %mm7, 96(%ecx) movq 96(%ebx), %mm2 movq 104(%ebx), %mm6 movq (%ecx), %mm0 movq 8(%ecx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 24(%ecx), %mm1 pswapd 16(%ecx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, (%edx) movq %mm4, 8(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm6, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 24(%edx) movq %mm7, 16(%edx) movq 32(%ecx), %mm0 movq 40(%ecx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 56(%ecx), %mm1 pswapd 48(%ecx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 32(%edx) movq %mm4, 40(%edx) pfsubr %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm6, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 56(%edx) movq %mm7, 48(%edx) movq 64(%ecx), %mm0 movq 72(%ecx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 88(%ecx), %mm1 pswapd 80(%ecx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 64(%edx) movq %mm4, 72(%edx) pfsub %mm1, %mm3 pfsub %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm6, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 88(%edx) movq %mm7, 80(%edx) movq 96(%ecx), %mm0 movq 104(%ecx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 120(%ecx), %mm1 pswapd 112(%ecx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 96(%edx) movq %mm4, 104(%edx) pfsubr %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm6, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 120(%edx) movq %mm7, 112(%edx) movq 112(%ebx), %mm2 movq (%edx), %mm0 movq 16(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 8(%edx), %mm1 pswapd 24(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, (%ecx) movq %mm4, 16(%ecx) pfsub %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm2, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 8(%ecx) movq %mm7, 24(%ecx) movq 32(%edx), %mm0 movq 48(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 40(%edx), %mm1 pswapd 56(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 32(%ecx) movq %mm4, 48(%ecx) pfsub %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm2, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 40(%ecx) movq %mm7, 56(%ecx) movq 64(%edx), %mm0 movq 80(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 72(%edx), %mm1 pswapd 88(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 64(%ecx) movq %mm4, 80(%ecx) pfsub %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm2, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 72(%ecx) movq %mm7, 88(%ecx) movq 96(%edx), %mm0 movq 112(%edx), %mm4 movq %mm0, %mm3 movq %mm4, %mm7 pswapd 104(%edx), %mm1 pswapd 120(%edx), %mm5 pfadd %mm1, %mm0 pfadd %mm5, %mm4 movq %mm0, 96(%ecx) movq %mm4, 112(%ecx) pfsub %mm1, %mm3 pfsubr %mm5, %mm7 pfmul %mm2, %mm3 pfmul %mm2, %mm7 pswapd %mm3, %mm3 pswapd %mm7, %mm7 movq %mm3, 104(%ecx) movq %mm7, 120(%ecx) #if defined(OPT_X86) && defined(PIC) #undef _EBX_ #define _EBX_ %eax movl (%esp), _EBX_ #endif movd LOCAL_VAR(plus_1f), %mm6 punpckldq 120(%ebx), %mm6 movq LOCAL_VAR(x_plus_minus_3dnow), %mm7 movq 32(%ecx), %mm0 movq 64(%ecx), %mm2 movq %mm0, %mm1 movq %mm2, %mm3 pxor %mm7, %mm1 pxor %mm7, %mm3 pfacc %mm1, %mm0 pfacc %mm3, %mm2 pfmul %mm6, %mm0 pfmul %mm6, %mm2 movq %mm0, 32(%edx) movq %mm2, 64(%edx) movd 44(%ecx), %mm0 movd 40(%ecx), %mm2 movd 120(%ebx), %mm3 punpckldq 76(%ecx), %mm0 punpckldq 72(%ecx), %mm2 punpckldq %mm3, %mm3 movq %mm0, %mm4 movq %mm2, %mm5 pfsub %mm2, %mm0 pfmul %mm3, %mm0 movq %mm0, %mm1 pfadd %mm5, %mm0 pfadd %mm4, %mm0 movq %mm0, %mm2 punpckldq %mm1, %mm0 punpckhdq %mm1, %mm2 movq %mm0, 40(%edx) movq %mm2, 72(%edx) movd 48(%ecx), %mm3 movd 60(%ecx), %mm2 pfsub 52(%ecx), %mm3 pfsub 56(%ecx), %mm2 pfmul 120(%ebx), %mm3 pfmul 120(%ebx), %mm2 movq %mm2, %mm1 pfadd 56(%ecx), %mm1 pfadd 60(%ecx), %mm1 movq %mm1, %mm0 pfadd 48(%ecx), %mm0 pfadd 52(%ecx), %mm0 pfadd %mm3, %mm1 punpckldq %mm2, %mm1 pfadd %mm3, %mm2 punpckldq %mm2, %mm0 movq %mm1, 56(%edx) movq %mm0, 48(%edx) movd 92(%ecx), %mm1 pfsub 88(%ecx), %mm1 pfmul 120(%ebx), %mm1 movd %mm1, 92(%edx) pfadd 92(%ecx), %mm1 pfadd 88(%ecx), %mm1 movq %mm1, %mm0 pfadd 80(%ecx), %mm0 pfadd 84(%ecx), %mm0 movd %mm0, 80(%edx) movd 80(%ecx), %mm0 pfsub 84(%ecx), %mm0 pfmul 120(%ebx), %mm0 pfadd %mm0, %mm1 pfadd 92(%edx), %mm0 punpckldq %mm1, %mm0 movq %mm0, 84(%edx) movq 96(%ecx), %mm0 movq %mm0, %mm1 pxor %mm7, %mm1 pfacc %mm1, %mm0 pfmul %mm6, %mm0 movq %mm0, 96(%edx) movd 108(%ecx), %mm0 pfsub 104(%ecx), %mm0 pfmul 120(%ebx), %mm0 movd %mm0, 108(%edx) pfadd 104(%ecx), %mm0 pfadd 108(%ecx), %mm0 movd %mm0, 104(%edx) movd 124(%ecx), %mm1 pfsub 120(%ecx), %mm1 pfmul 120(%ebx), %mm1 movd %mm1, 124(%edx) pfadd 120(%ecx), %mm1 pfadd 124(%ecx), %mm1 movq %mm1, %mm0 pfadd 112(%ecx), %mm0 pfadd 116(%ecx), %mm0 movd %mm0, 112(%edx) movd 112(%ecx), %mm0 pfsub 116(%ecx), %mm0 pfmul 120(%ebx), %mm0 pfadd %mm0,%mm1 pfadd 124(%edx), %mm0 punpckldq %mm1, %mm0 movq %mm0, 116(%edx) jnz .L01 movd (%ecx), %mm0 pfadd 4(%ecx), %mm0 movd %mm0, 1024(%esi) movd (%ecx), %mm0 pfsub 4(%ecx), %mm0 pfmul 120(%ebx), %mm0 movd %mm0, (%esi) movd %mm0, (%edi) movd 12(%ecx), %mm0 pfsub 8(%ecx), %mm0 pfmul 120(%ebx), %mm0 movd %mm0, 512(%edi) pfadd 12(%ecx), %mm0 pfadd 8(%ecx), %mm0 movd %mm0, 512(%esi) movd 16(%ecx), %mm0 pfsub 20(%ecx), %mm0 pfmul 120(%ebx), %mm0 movq %mm0, %mm3 movd 28(%ecx), %mm0 pfsub 24(%ecx), %mm0 pfmul 120(%ebx), %mm0 movd %mm0, 768(%edi) movq %mm0, %mm2 pfadd 24(%ecx), %mm0 pfadd 28(%ecx), %mm0 movq %mm0, %mm1 pfadd 16(%ecx), %mm0 pfadd 20(%ecx), %mm0 movd %mm0, 768(%esi) pfadd %mm3, %mm1 movd %mm1, 256(%esi) pfadd %mm3, %mm2 movd %mm2, 256(%edi) movq 32(%edx), %mm0 movq 48(%edx), %mm1 pfadd 48(%edx), %mm0 pfadd 40(%edx), %mm1 movd %mm0, 896(%esi) movd %mm1, 640(%esi) psrlq $32, %mm0 psrlq $32, %mm1 movd %mm0, 128(%edi) movd %mm1, 384(%edi) movd 40(%edx), %mm0 pfadd 56(%edx), %mm0 movd %mm0, 384(%esi) movd 56(%edx), %mm0 pfadd 36(%edx), %mm0 movd %mm0, 128(%esi) movd 60(%edx), %mm0 movd %mm0, 896(%edi) pfadd 44(%edx), %mm0 movd %mm0, 640(%edi) movq 96(%edx), %mm0 movq 112(%edx), %mm2 movq 104(%edx), %mm4 pfadd 112(%edx), %mm0 pfadd 104(%edx), %mm2 pfadd 120(%edx), %mm4 movq %mm0, %mm1 movq %mm2, %mm3 movq %mm4, %mm5 pfadd 64(%edx), %mm0 pfadd 80(%edx), %mm2 pfadd 72(%edx), %mm4 movd %mm0, 960(%esi) movd %mm2, 704(%esi) movd %mm4, 448(%esi) psrlq $32, %mm0 psrlq $32, %mm2 psrlq $32, %mm4 movd %mm0, 64(%edi) movd %mm2, 320(%edi) movd %mm4, 576(%edi) pfadd 80(%edx), %mm1 pfadd 72(%edx), %mm3 pfadd 88(%edx), %mm5 movd %mm1, 832(%esi) movd %mm3, 576(%esi) movd %mm5, 320(%esi) psrlq $32, %mm1 psrlq $32, %mm3 psrlq $32, %mm5 movd %mm1, 192(%edi) movd %mm3, 448(%edi) movd %mm5, 704(%edi) movd 120(%edx), %mm0 pfadd 100(%edx), %mm0 movq %mm0, %mm1 pfadd 88(%edx), %mm0 movd %mm0, 192(%esi) pfadd 68(%edx), %mm1 movd %mm1, 64(%esi) movd 124(%edx), %mm0 movd %mm0, 960(%edi) pfadd 92(%edx), %mm0 movd %mm0, 832(%edi) jmp .L_bye .L01: movq (%ecx), %mm0 movq %mm0, %mm1 pxor %mm7, %mm1 pfacc %mm1, %mm0 pfmul %mm6, %mm0 pf2iw %mm0, %mm0 movd %mm0, %eax movw %ax, 512(%esi) psrlq $32, %mm0 movd %mm0, %eax movw %ax, (%esi) movd 12(%ecx), %mm0 pfsub 8(%ecx), %mm0 pfmul 120(%ebx), %mm0 pf2iw %mm0, %mm7 movd %mm7, %eax movw %ax, 256(%edi) pfadd 12(%ecx), %mm0 pfadd 8(%ecx), %mm0 pf2iw %mm0, %mm0 movd %mm0, %eax movw %ax, 256(%esi) movd 16(%ecx), %mm3 pfsub 20(%ecx), %mm3 pfmul 120(%ebx), %mm3 movq %mm3, %mm2 movd 28(%ecx), %mm2 pfsub 24(%ecx), %mm2 pfmul 120(%ebx), %mm2 movq %mm2, %mm1 pf2iw %mm2, %mm7 movd %mm7, %eax movw %ax, 384(%edi) pfadd 24(%ecx), %mm1 pfadd 28(%ecx), %mm1 movq %mm1, %mm0 pfadd 16(%ecx), %mm0 pfadd 20(%ecx), %mm0 pf2iw %mm0, %mm0 movd %mm0, %eax movw %ax, 384(%esi) pfadd %mm3, %mm1 pf2iw %mm1, %mm1 movd %mm1, %eax movw %ax, 128(%esi) pfadd %mm3, %mm2 pf2iw %mm2, %mm2 movd %mm2, %eax movw %ax, 128(%edi) movq 32(%edx), %mm0 movq 48(%edx), %mm1 pfadd 48(%edx), %mm0 pfadd 40(%edx), %mm1 pf2iw %mm0, %mm0 pf2iw %mm1, %mm1 movd %mm0, %eax movd %mm1, %ecx movw %ax, 448(%esi) movw %cx, 320(%esi) psrlq $32, %mm0 psrlq $32, %mm1 movd %mm0, %eax movd %mm1, %ecx movw %ax, 64(%edi) movw %cx, 192(%edi) movd 40(%edx), %mm3 movd 56(%edx), %mm4 movd 60(%edx), %mm0 movd 44(%edx), %mm2 movd 120(%edx), %mm5 punpckldq %mm4, %mm3 punpckldq 124(%edx), %mm0 pfadd 100(%edx), %mm5 punpckldq 36(%edx), %mm4 punpckldq 92(%edx), %mm2 movq %mm5, %mm6 pfadd %mm4, %mm3 pf2iw %mm0, %mm1 pf2iw %mm3, %mm3 pfadd 88(%edx), %mm5 movd %mm1, %eax movd %mm3, %ecx movw %ax, 448(%edi) movw %cx, 192(%esi) pf2iw %mm5, %mm5 psrlq $32, %mm1 psrlq $32, %mm3 movd %mm5, %ebx movd %mm1, %eax movd %mm3, %ecx movw %bx, 96(%esi) movw %ax, 480(%edi) movw %cx, 64(%esi) pfadd %mm2, %mm0 pf2iw %mm0, %mm0 movd %mm0, %eax pfadd 68(%edx), %mm6 movw %ax, 320(%edi) psrlq $32, %mm0 pf2iw %mm6, %mm6 movd %mm0, %eax movd %mm6, %ebx movw %ax, 416(%edi) movw %bx, 32(%esi) movq 96(%edx), %mm0 movq 112(%edx), %mm2 movq 104(%edx), %mm4 pfadd %mm2, %mm0 pfadd %mm4, %mm2 pfadd 120(%edx), %mm4 movq %mm0, %mm1 movq %mm2, %mm3 movq %mm4, %mm5 pfadd 64(%edx), %mm0 pfadd 80(%edx), %mm2 pfadd 72(%edx), %mm4 pf2iw %mm0, %mm0 pf2iw %mm2, %mm2 pf2iw %mm4, %mm4 movd %mm0, %eax movd %mm2, %ecx movd %mm4, %ebx movw %ax, 480(%esi) movw %cx, 352(%esi) movw %bx, 224(%esi) psrlq $32, %mm0 psrlq $32, %mm2 psrlq $32, %mm4 movd %mm0, %eax movd %mm2, %ecx movd %mm4, %ebx movw %ax, 32(%edi) movw %cx, 160(%edi) movw %bx, 288(%edi) pfadd 80(%edx), %mm1 pfadd 72(%edx), %mm3 pfadd 88(%edx), %mm5 pf2iw %mm1, %mm1 pf2iw %mm3, %mm3 pf2iw %mm5, %mm5 movd %mm1, %eax movd %mm3, %ecx movd %mm5, %ebx movw %ax, 416(%esi) movw %cx, 288(%esi) movw %bx, 160(%esi) psrlq $32, %mm1 psrlq $32, %mm3 psrlq $32, %mm5 movd %mm1, %eax movd %mm3, %ecx movd %mm5, %ebx movw %ax, 96(%edi) movw %cx, 224(%edi) movw %bx, 352(%edi) movsw .L_bye: femms /* NO_APP */ addl $260, %esp popl %ebx popl %esi popl %edi leave ret /* .size ASM_NAME(dct64_3dnowext), .-ASM_NAME(dct64_3dnowext) */ #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_costab_mmxsse: .indirect_symbol ASM_NAME(costab_mmxsse) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_altivec.c000066400000000000000000000201521357201522000204170ustar00rootroot00000000000000/* dct64_altivec.c: Discrete Cosine Tansform (DCT) for Altivec copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp altivec optimization by tmkk */ /* * Discrete Cosine Tansform (DCT) for subband synthesis * * -funroll-loops (for gcc) will remove the loops for better performance * using loops in the source-code enhances readabillity * * * TODO: write an optimized version for the down-sampling modes * (in these modes the bands 16-31 (2:1) or 8-31 (4:1) are zero */ #include "mpg123lib_intern.h" #ifndef __APPLE__ #include #endif void dct64_altivec(real *out0,real *out1,real *samples) { ALIGNED(16) real bufs[32]; { register real *b1,*costab; vector unsigned char vinvert,vperm1,vperm2,vperm3,vperm4; vector float v1,v2,v3,v4,v5,v6,v7,v8; vector float vbs1,vbs2,vbs3,vbs4,vbs5,vbs6,vbs7,vbs8; vector float vbs9,vbs10,vbs11,vbs12,vbs13,vbs14,vbs15,vbs16; vector float vzero; b1 = samples; costab = pnts[0]; vzero = vec_xor(vzero,vzero); #ifdef __APPLE__ vinvert = (vector unsigned char)(12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3); #else vinvert = (vector unsigned char){12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3}; #endif vperm1 = vec_lvsl(0,b1); vperm2 = vec_perm(vperm1,vperm1,vinvert); v1 = vec_ld(0,b1); v2 = vec_ld(16,b1); v3 = vec_ld(112,b1); v4 = vec_ld(127,b1); v5 = vec_perm(v1,v2,vperm1); /* b1[0,1,2,3] */ v6 = vec_perm(v3,v4,vperm2); /* b1[31,30,29,28] */ vbs1 = vec_add(v5,v6); vbs8 = vec_sub(v5,v6); v1 = vec_ld(32,b1); v4 = vec_ld(96,b1); v5 = vec_perm(v2,v1,vperm1); /* b1[4,5,6,7] */ v6 = vec_perm(v4,v3,vperm2); /* b1[27,26,25,24] */ vbs2 = vec_add(v5,v6); vbs7 = vec_sub(v5,v6); v2 = vec_ld(48,b1); v3 = vec_ld(80,b1); v5 = vec_perm(v1,v2,vperm1); /* b1[8,9,10,11] */ v6 = vec_perm(v3,v4,vperm2); /* b1[23,22,21,20] */ vbs3 = vec_add(v5,v6); vbs6 = vec_sub(v5,v6); v1 = vec_ld(64,b1); v5 = vec_perm(v2,v1,vperm1); /* b1[12,13,14,15] */ v6 = vec_perm(v1,v3,vperm2); /* b1[19,18,17,16] */ vbs4 = vec_add(v5,v6); vbs5 = vec_sub(v5,v6); v1 = vec_ld(0,costab); vbs8 = vec_madd(vbs8,v1,vzero); v2 = vec_ld(16,costab); vbs7 = vec_madd(vbs7,v2,vzero); v3 = vec_ld(32,costab); vbs6 = vec_madd(vbs6,v3,vzero); v4 = vec_ld(48,costab); vbs5 = vec_madd(vbs5,v4,vzero); vbs6 = vec_perm(vbs6,vbs6,vinvert); vbs5 = vec_perm(vbs5,vbs5,vinvert); costab = pnts[1]; v1 = vec_perm(vbs4,vbs4,vinvert); vbs9 = vec_add(vbs1,v1); v3 = vec_sub(vbs1,v1); v5 = vec_ld(0,costab); v2 = vec_perm(vbs3,vbs3,vinvert); vbs10 = vec_add(vbs2,v2); v4 = vec_sub(vbs2,v2); v6 = vec_ld(16,costab); vbs12 = vec_madd(v3,v5,vzero); vbs11 = vec_madd(v4,v6,vzero); v7 = vec_sub(vbs7,vbs6); v8 = vec_sub(vbs8,vbs5); vbs13 = vec_add(vbs5,vbs8); vbs14 = vec_add(vbs6,vbs7); vbs15 = vec_madd(v7,v6,vzero); vbs16 = vec_madd(v8,v5,vzero); costab = pnts[2]; v1 = vec_perm(vbs10,vbs10,vinvert); v5 = vec_perm(vbs14,vbs14,vinvert); vbs1 = vec_add(v1,vbs9); vbs5 = vec_add(v5,vbs13); v2 = vec_sub(vbs9,v1); v6 = vec_sub(vbs13,v5); v3 = vec_ld(0,costab); vbs11 = vec_perm(vbs11,vbs11,vinvert); vbs15 = vec_perm(vbs15,vbs15,vinvert); vbs3 = vec_add(vbs11,vbs12); vbs7 = vec_add(vbs15,vbs16); v4 = vec_sub(vbs12,vbs11); v7 = vec_sub(vbs16,vbs15); vbs2 = vec_madd(v2,v3,vzero); vbs4 = vec_madd(v4,v3,vzero); vbs6 = vec_madd(v6,v3,vzero); vbs8 = vec_madd(v7,v3,vzero); vbs2 = vec_perm(vbs2,vbs2,vinvert); vbs4 = vec_perm(vbs4,vbs4,vinvert); vbs6 = vec_perm(vbs6,vbs6,vinvert); vbs8 = vec_perm(vbs8,vbs8,vinvert); costab = pnts[3]; #ifdef __APPLE__ vperm1 = (vector unsigned char)(0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23); vperm2 = (vector unsigned char)(12,13,14,15,8,9,10,11,28,29,30,31,24,25,26,27); vperm3 = (vector unsigned char)(0,1,2,3,4,5,6,7,20,21,22,23,16,17,18,19); #else vperm1 = (vector unsigned char){0,1,2,3,4,5,6,7,16,17,18,19,20,21,22,23}; vperm2 = (vector unsigned char){12,13,14,15,8,9,10,11,28,29,30,31,24,25,26,27}; vperm3 = (vector unsigned char){0,1,2,3,4,5,6,7,20,21,22,23,16,17,18,19}; #endif vperm4 = vec_add(vperm3,vec_splat_u8(8)); v1 = vec_ld(0,costab); v2 = vec_splat(v1,0); v3 = vec_splat(v1,1); v1 = vec_mergeh(v2,v3); v2 = vec_perm(vbs1,vbs3,vperm1); v3 = vec_perm(vbs2,vbs4,vperm1); v4 = vec_perm(vbs1,vbs3,vperm2); v5 = vec_perm(vbs2,vbs4,vperm2); v6 = vec_sub(v2,v4); v7 = vec_sub(v3,v5); v2 = vec_add(v2,v4); v3 = vec_add(v3,v5); v4 = vec_madd(v6,v1,vzero); v5 = vec_nmsub(v7,v1,vzero); vbs9 = vec_perm(v2,v4,vperm3); vbs11 = vec_perm(v2,v4,vperm4); vbs10 = vec_perm(v3,v5,vperm3); vbs12 = vec_perm(v3,v5,vperm4); v2 = vec_perm(vbs5,vbs7,vperm1); v3 = vec_perm(vbs6,vbs8,vperm1); v4 = vec_perm(vbs5,vbs7,vperm2); v5 = vec_perm(vbs6,vbs8,vperm2); v6 = vec_sub(v2,v4); v7 = vec_sub(v3,v5); v2 = vec_add(v2,v4); v3 = vec_add(v3,v5); v4 = vec_madd(v6,v1,vzero); v5 = vec_nmsub(v7,v1,vzero); vbs13 = vec_perm(v2,v4,vperm3); vbs15 = vec_perm(v2,v4,vperm4); vbs14 = vec_perm(v3,v5,vperm3); vbs16 = vec_perm(v3,v5,vperm4); costab = pnts[4]; v1 = vec_lde(0,costab); #ifdef __APPLE__ v2 = (vector float)(1.0f,-1.0f,1.0f,-1.0f); #else v2 = (vector float){1.0f,-1.0f,1.0f,-1.0f}; #endif v3 = vec_splat(v1,0); v1 = vec_madd(v2,v3,vzero); v2 = vec_mergeh(vbs9,vbs10); v3 = vec_mergel(vbs9,vbs10); v4 = vec_mergeh(vbs11,vbs12); v5 = vec_mergel(vbs11,vbs12); v6 = vec_mergeh(v2,v3); v7 = vec_mergel(v2,v3); v2 = vec_mergeh(v4,v5); v3 = vec_mergel(v4,v5); v4 = vec_sub(v6,v7); v5 = vec_sub(v2,v3); v6 = vec_add(v6,v7); v7 = vec_add(v2,v3); v2 = vec_madd(v4,v1,vzero); v3 = vec_madd(v5,v1,vzero); vbs1 = vec_mergeh(v6,v2); vbs2 = vec_mergel(v6,v2); vbs3 = vec_mergeh(v7,v3); vbs4 = vec_mergel(v7,v3); v2 = vec_mergeh(vbs13,vbs14); v3 = vec_mergel(vbs13,vbs14); v4 = vec_mergeh(vbs15,vbs16); v5 = vec_mergel(vbs15,vbs16); v6 = vec_mergeh(v2,v3); v7 = vec_mergel(v2,v3); v2 = vec_mergeh(v4,v5); v3 = vec_mergel(v4,v5); v4 = vec_sub(v6,v7); v5 = vec_sub(v2,v3); v6 = vec_add(v6,v7); v7 = vec_add(v2,v3); v2 = vec_madd(v4,v1,vzero); v3 = vec_madd(v5,v1,vzero); vbs5 = vec_mergeh(v6,v2); vbs6 = vec_mergel(v6,v2); vbs7 = vec_mergeh(v7,v3); vbs8 = vec_mergel(v7,v3); vec_st(vbs1,0,bufs); vec_st(vbs2,16,bufs); vec_st(vbs3,32,bufs); vec_st(vbs4,48,bufs); vec_st(vbs5,64,bufs); vec_st(vbs6,80,bufs); vec_st(vbs7,96,bufs); vec_st(vbs8,112,bufs); } { register real *b1; register int i; for(b1=bufs,i=8;i;i--,b1+=4) b1[2] += b1[3]; for(b1=bufs,i=4;i;i--,b1+=8) { b1[4] += b1[6]; b1[6] += b1[5]; b1[5] += b1[7]; } for(b1=bufs,i=2;i;i--,b1+=16) { b1[8] += b1[12]; b1[12] += b1[10]; b1[10] += b1[14]; b1[14] += b1[9]; b1[9] += b1[13]; b1[13] += b1[11]; b1[11] += b1[15]; } } out0[0x10*16] = bufs[0]; out0[0x10*15] = bufs[16+0] + bufs[16+8]; out0[0x10*14] = bufs[8]; out0[0x10*13] = bufs[16+8] + bufs[16+4]; out0[0x10*12] = bufs[4]; out0[0x10*11] = bufs[16+4] + bufs[16+12]; out0[0x10*10] = bufs[12]; out0[0x10* 9] = bufs[16+12] + bufs[16+2]; out0[0x10* 8] = bufs[2]; out0[0x10* 7] = bufs[16+2] + bufs[16+10]; out0[0x10* 6] = bufs[10]; out0[0x10* 5] = bufs[16+10] + bufs[16+6]; out0[0x10* 4] = bufs[6]; out0[0x10* 3] = bufs[16+6] + bufs[16+14]; out0[0x10* 2] = bufs[14]; out0[0x10* 1] = bufs[16+14] + bufs[16+1]; out0[0x10* 0] = bufs[1]; out1[0x10* 0] = bufs[1]; out1[0x10* 1] = bufs[16+1] + bufs[16+9]; out1[0x10* 2] = bufs[9]; out1[0x10* 3] = bufs[16+9] + bufs[16+5]; out1[0x10* 4] = bufs[5]; out1[0x10* 5] = bufs[16+5] + bufs[16+13]; out1[0x10* 6] = bufs[13]; out1[0x10* 7] = bufs[16+13] + bufs[16+3]; out1[0x10* 8] = bufs[3]; out1[0x10* 9] = bufs[16+3] + bufs[16+11]; out1[0x10*10] = bufs[11]; out1[0x10*11] = bufs[16+11] + bufs[16+7]; out1[0x10*12] = bufs[7]; out1[0x10*13] = bufs[16+7] + bufs[16+15]; out1[0x10*14] = bufs[15]; out1[0x10*15] = bufs[16+15]; } welle.io-2.1/src/libs/mpg123/dct64_avx.S000066400000000000000000000224571357201522000175600ustar00rootroot00000000000000/* dct36_sse: AVX optimized dct64 for x86-64 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #define samples %rdx #define costab %rcx #define out0 %rdi #define out1 %rsi /* void dct64_avx(short *out0, short *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN32 costab_avx: .long 1056974725 .long 1057056395 .long 1057223771 .long 1057485416 .long 1057855544 .long 1058356026 .long 1059019886 .long 1059897405 .long 1061067246 .long 1062657950 .long 1064892987 .long 1066774581 .long 1069414683 .long 1073984175 .long 1079645762 .long 1092815430 .long 1057005197 .long 1057342072 .long 1058087743 .long 1059427869 .long 1061799040 .long 1065862217 .long 1071413542 .long 1084439708 .long 1057128951 .long 1058664893 .long 1063675095 .long 1076102863 .long 1057655764 .long 1067924853 .long 1060439283 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_avx) ASM_NAME(dct64_avx): #ifdef IS_MSABI push %rbp mov %rsp, %rbp sub $112, %rsp movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) push %rdi push %rsi mov %rcx, %rdi mov %rdx, %rsi mov %r8, %rdx #endif leaq costab_avx(%rip), costab vmovups (samples), %ymm0 # input[0,1,2,3,4,5,6,7] vmovups 32(samples), %ymm1 # input[8,9,10,11,12,13,14,15] vperm2f128 $0x23, 64(samples), %ymm2, %ymm2 vperm2f128 $0x23, 96(samples), %ymm3, %ymm3 vshufps $0x1b, %ymm2, %ymm2, %ymm2 # input[23,22,21,20,19,18,17,16] vshufps $0x1b, %ymm3, %ymm3, %ymm3 # input[31,30,29,28,27,26,25,24] vsubps %ymm2, %ymm1, %ymm6 vsubps %ymm3, %ymm0, %ymm7 vaddps %ymm0, %ymm3, %ymm4 # bufs[0,1,2,3,4,5,6,7] vaddps %ymm1, %ymm2, %ymm5 # bufs[8,9,10,11,12,13,14,15] vmulps (costab), %ymm7, %ymm7 # bufs[31,30,29,28,27,26,25,24] cos64[0,1,2,3,4,5,6,7] vmulps 32(costab), %ymm6, %ymm6 # bufs[23,22,21,20,19,18,17,16] cos64[8,9,10,11,12,13,14,15] vmovaps 64(costab), %ymm8 # cos32[0,1,2,3,4,5,6,7] vshufps $0x1b, %ymm5, %ymm5, %ymm5 vshufps $0x1b, %ymm6, %ymm6, %ymm6 vperm2f128 $0x01, %ymm5, %ymm5, %ymm5 # bufs[15,14,13,12,11,10,9,8] vperm2f128 $0x01, %ymm6, %ymm6, %ymm6 # bufs[16,17,18,19,20,21,22,23] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm6, %ymm7, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[32,33,34,35,36,37,38,39] vaddps %ymm6, %ymm7, %ymm2 # bufs[48,49,50,51,52,53,54,55] vmulps %ymm1, %ymm8, %ymm1 # bufs[47,46,45,44,43,42,41,40] vmulps %ymm3, %ymm8, %ymm3 # bufs[63,62,61,60,59,58,57,56] vmovaps 96(costab), %ymm8 # cos16[0,1,2,3]:cos8[0,1]:cos4[0]:- vperm2f128 $0x00, %ymm8, %ymm8, %ymm9 # cos16[0,1,2,3,0,1,2,3] vperm2f128 $0x20, %ymm1, %ymm0, %ymm4 # bufs[32,33,34,35,47,46,45,44] vperm2f128 $0x31, %ymm1, %ymm0, %ymm5 vshufps $0x1b, %ymm5, %ymm5, %ymm5 # bufs[39,38,37,36,40,41,42,43] vperm2f128 $0x20, %ymm3, %ymm2, %ymm6 # bufs[48,49,50,51,63,62,61,60] vperm2f128 $0x31, %ymm3, %ymm2, %ymm7 vshufps $0x1b, %ymm7, %ymm7, %ymm7 # bufs[55,54,53,52,56,57,58,59] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[0,1,2,3,8,9,10,11] vaddps %ymm7, %ymm6, %ymm2 # bufs[16,17,18,19,24,25,26,27] vmulps %ymm1, %ymm9, %ymm1 # bufs[7,6,5,4,15,14,13,12] vmulps %ymm3, %ymm9, %ymm3 # bufs[23,22,21,20,31,30,29,28] vperm2f128 $0x11, %ymm8, %ymm8, %ymm8 # cos8[0,1]:cos4[0]:-:cos8[0,1]:cos4[0]:- vmovddup %ymm8, %ymm9 # cos8[0,1,0,1,0,1,0,1] vunpcklps %ymm1, %ymm0, %ymm4 # bufs[0,7,1,6,8,15,9,14] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[2,5,3,4,10,13,11,12] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[16,23,17,22,24,31,25,30] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[18,21,19,20,26,29,27,28] vshufps $0xd8, %ymm4, %ymm4, %ymm4 # bufs[0,1,7,6,8,9,15,14] vshufps $0x72, %ymm5, %ymm5, %ymm5 # bufs[3,2,4,5,11,10,12,13] vshufps $0xd8, %ymm6, %ymm6, %ymm6 # bufs[16,17,23,22,24,25,31,30] vshufps $0x72, %ymm7, %ymm7, %ymm7 # bufs[19,18,20,21,27,26,28,29] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[32,33,36,37,40,41,44,45] vaddps %ymm7, %ymm6, %ymm2 # bufs[48,49,52,53,56,57,60,61] vmulps %ymm1, %ymm9, %ymm1 # bufs[35,34,39,38,43,42,47,46] vmulps %ymm3, %ymm9, %ymm3 # bufs[51,50,55,54,59,58,63,62] vpermilps $0xaa, %ymm8, %ymm8 # cos4[0,0,0,0,0,0,0,0] vshufps $0xd8, %ymm0, %ymm0, %ymm0 # bufs[32,36,33,37,40,44,41,45] vshufps $0xd8, %ymm1, %ymm1, %ymm1 # bufs[35,39,34,38,43,47,42,46] vshufps $0xd8, %ymm2, %ymm2, %ymm2 # bufs[48,52,49,53,56,60,57,61] vshufps $0xd8, %ymm3, %ymm3, %ymm3 # bufs[51,55,50,54,59,63,58,62] vunpcklps %ymm1, %ymm0, %ymm4 # bufs[32,35,36,39,40,43,44,47] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[33,34,37,38,41,42,45,46] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[48,51,52,55,56,59,60,63] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[49,50,53,54,57,58,61,62] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[0,2,4,6,8,10,12,14] vaddps %ymm7, %ymm6, %ymm2 # bufs[16,18,20,22,24,26,28,30] vmulps %ymm1, %ymm8, %ymm1 # bufs[1,3,5,7,9,11,13,15] vmulps %ymm3, %ymm8, %ymm3 # bufs[17,19,21,23,25,27,29,31] vxorps %ymm8, %ymm8, %ymm8 vblendps $0xaa, %ymm1, %ymm8, %ymm5 vblendps $0xaa, %ymm3, %ymm8, %ymm6 vaddps %ymm5, %ymm0, %ymm0 vaddps %ymm6, %ymm2, %ymm2 vunpcklps %ymm1, %ymm0, %ymm4 # bufs[0,1,2,3,8,9,10,11] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[4,5,6,7,12,13,14,15] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[16,17,18,19,24,25,26,27] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[20,21,22,23,28,29,30,31] vextractf128 $0x1, %ymm4, %xmm0 # bufs[8,9,10,11] vextractf128 $0x1, %ymm5, %xmm1 # bufs[12,13,14,15] vextractf128 $0x1, %ymm6, %xmm2 # bufs[24,25,26,27] vextractf128 $0x1, %ymm7, %xmm3 # bufs[28,29,30,31] vshufps $0x1e, %xmm5, %xmm5, %xmm9 # bufs[6,7,5,4] vshufps $0x1e, %xmm1, %xmm1, %xmm10 # bufs[14,15,13,12] vshufps $0x1e, %xmm7, %xmm7, %xmm11 # bufs[22,23,21,20] vshufps $0x1e, %xmm3, %xmm3, %xmm12 # bufs[30,31,29,28] vblendps $0x7, %xmm9, %xmm8, %xmm9 # bufs[6,7,5,-] vblendps $0x7, %xmm10, %xmm8, %xmm10 # bufs[14,15,13,-] vblendps $0x7, %xmm11, %xmm8, %xmm11 # bufs[22,23,21,-] vblendps $0x7, %xmm12, %xmm8, %xmm12 # bufs[30,31,29,-] vaddps %xmm5, %xmm9, %xmm5 vaddps %xmm1, %xmm10, %xmm1 vaddps %xmm7, %xmm11, %xmm7 vaddps %xmm3, %xmm12, %xmm3 prefetcht0 512(out0) vshufps $0x1e, %xmm0, %xmm0, %xmm9 # bufs[10,11,9,8] vshufps $0x1e, %xmm2, %xmm2, %xmm10 # bufs[26,27,25,24] vaddps %xmm1, %xmm0, %xmm0 vaddps %xmm3, %xmm2, %xmm2 vblendps $0x7, %xmm9, %xmm8, %xmm9 # bufs[10,11,9,-] vblendps $0x7, %xmm10, %xmm8, %xmm10 # bufs[26,27,25,-] vaddps %xmm1, %xmm9, %xmm1 vaddps %xmm3, %xmm10, %xmm3 vzeroupper prefetcht0 512(out1) cvtps2dq %xmm4, %xmm4 cvtps2dq %xmm0, %xmm0 cvtps2dq %xmm5, %xmm5 cvtps2dq %xmm1, %xmm1 packssdw %xmm5, %xmm4 packssdw %xmm1, %xmm0 movq %xmm4, %rcx pshufd $0x4e, %xmm4, %xmm5 movq %xmm0, %rdx pshufd $0x4e, %xmm0, %xmm1 movq %xmm5, %r8 movq %xmm1, %r9 addq $512, out0 movq $-64, %rax movw %cx, (out0) movw %dx, (out0,%rax,1) movw %r8w, (out0,%rax,2) movw %r9w, -64(out0,%rax,2) leaq (out0,%rax,4), out0 shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 movw %cx, (out0,%rax,4) negq %rax movw %cx, (out1) movw %dx, (out1,%rax,1) movw %r8w, (out1,%rax,2) movw %r9w, 64(out1,%rax,2) leaq (out1,%rax,4), out1 shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 negq %rax movw %cx, (out0) movw %dx, (out0,%rax,1) movw %r8w, (out0,%rax,2) movw %r9w, -64(out0,%rax,2) shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 negq %rax movw %cx, (out1) movw %dx, (out1,%rax,1) movw %r8w, (out1,%rax,2) movw %r9w, 64(out1,%rax,2) leaq -32(out0,%rax,4), out0 negq %rax leaq 32(out1,%rax,4), out1 vshufps $0x1e, %xmm6, %xmm6, %xmm0 vblendps $0x7, %xmm0, %xmm8, %xmm0 addps %xmm2, %xmm6 addps %xmm7, %xmm2 addps %xmm3, %xmm7 addps %xmm0, %xmm3 cvtps2dq %xmm6, %xmm6 cvtps2dq %xmm2, %xmm2 cvtps2dq %xmm7, %xmm7 cvtps2dq %xmm3, %xmm3 packssdw %xmm7, %xmm6 packssdw %xmm3, %xmm2 movq %xmm6, %rcx pshufd $0x4e, %xmm6, %xmm7 movq %xmm2, %rdx pshufd $0x4e, %xmm2, %xmm3 movq %xmm7, %r8 movq %xmm3, %r9 movw %cx, (out0) movw %dx, (out0,%rax,1) movw %r8w, (out0,%rax,2) movw %r9w, -64(out0,%rax,2) leaq (out0,%rax,4), out0 shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 negq %rax movw %cx, (out1) movw %dx, (out1,%rax,1) movw %r8w, (out1,%rax,2) movw %r9w, 64(out1,%rax,2) leaq (out1,%rax,4), out1 shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 negq %rax movw %cx, (out0) movw %dx, (out0,%rax,1) movw %r8w, (out0,%rax,2) movw %r9w, -64(out0,%rax,2) shr $16, %rcx shr $16, %rdx shr $16, %r8 shr $16, %r9 negq %rax movw %cx, (out1) movw %dx, (out1,%rax,1) movw %r8w, (out1,%rax,2) movw %r9w, 64(out1,%rax,2) #ifdef IS_MSABI pop %rsi pop %rdi movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 mov %rbp, %rsp pop %rbp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_avx_float.S000066400000000000000000000221171357201522000207360ustar00rootroot00000000000000/* dct64_x86_64_float: SSE optimized dct64 for x86-64 (float output version) copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #define samples %rdx #define costab %rcx #define out0 %rdi #define out1 %rsi /* void dct64_real_avx(real *out0, real *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN32 costab_avx: .long 1056974725 .long 1057056395 .long 1057223771 .long 1057485416 .long 1057855544 .long 1058356026 .long 1059019886 .long 1059897405 .long 1061067246 .long 1062657950 .long 1064892987 .long 1066774581 .long 1069414683 .long 1073984175 .long 1079645762 .long 1092815430 .long 1057005197 .long 1057342072 .long 1058087743 .long 1059427869 .long 1061799040 .long 1065862217 .long 1071413542 .long 1084439708 .long 1057128951 .long 1058664893 .long 1063675095 .long 1076102863 .long 1057655764 .long 1067924853 .long 1060439283 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_real_avx) ASM_NAME(dct64_real_avx): #ifdef IS_MSABI push %rbp mov %rsp, %rbp sub $112, %rsp movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) push %rdi push %rsi mov %rcx, %rdi mov %rdx, %rsi mov %r8, %rdx #endif leaq costab_avx(%rip), costab vmovups (samples), %ymm0 # input[0,1,2,3,4,5,6,7] vmovups 32(samples), %ymm1 # input[8,9,10,11,12,13,14,15] vperm2f128 $0x23, 64(samples), %ymm2, %ymm2 vperm2f128 $0x23, 96(samples), %ymm3, %ymm3 vshufps $0x1b, %ymm2, %ymm2, %ymm2 # input[23,22,21,20,19,18,17,16] vshufps $0x1b, %ymm3, %ymm3, %ymm3 # input[31,30,29,28,27,26,25,24] vsubps %ymm2, %ymm1, %ymm6 vsubps %ymm3, %ymm0, %ymm7 vaddps %ymm0, %ymm3, %ymm4 # bufs[0,1,2,3,4,5,6,7] vaddps %ymm1, %ymm2, %ymm5 # bufs[8,9,10,11,12,13,14,15] vmulps (costab), %ymm7, %ymm7 # bufs[31,30,29,28,27,26,25,24] cos64[0,1,2,3,4,5,6,7] vmulps 32(costab), %ymm6, %ymm6 # bufs[23,22,21,20,19,18,17,16] cos64[8,9,10,11,12,13,14,15] vmovaps 64(costab), %ymm8 # cos32[0,1,2,3,4,5,6,7] vshufps $0x1b, %ymm5, %ymm5, %ymm5 vshufps $0x1b, %ymm6, %ymm6, %ymm6 vperm2f128 $0x01, %ymm5, %ymm5, %ymm5 # bufs[15,14,13,12,11,10,9,8] vperm2f128 $0x01, %ymm6, %ymm6, %ymm6 # bufs[16,17,18,19,20,21,22,23] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm6, %ymm7, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[32,33,34,35,36,37,38,39] vaddps %ymm6, %ymm7, %ymm2 # bufs[48,49,50,51,52,53,54,55] vmulps %ymm1, %ymm8, %ymm1 # bufs[47,46,45,44,43,42,41,40] vmulps %ymm3, %ymm8, %ymm3 # bufs[63,62,61,60,59,58,57,56] vmovaps 96(costab), %ymm8 # cos16[0,1,2,3]:cos8[0,1]:cos4[0]:- vperm2f128 $0x00, %ymm8, %ymm8, %ymm9 # cos16[0,1,2,3,0,1,2,3] vperm2f128 $0x20, %ymm1, %ymm0, %ymm4 # bufs[32,33,34,35,47,46,45,44] vperm2f128 $0x31, %ymm1, %ymm0, %ymm5 vshufps $0x1b, %ymm5, %ymm5, %ymm5 # bufs[39,38,37,36,40,41,42,43] vperm2f128 $0x20, %ymm3, %ymm2, %ymm6 # bufs[48,49,50,51,63,62,61,60] vperm2f128 $0x31, %ymm3, %ymm2, %ymm7 vshufps $0x1b, %ymm7, %ymm7, %ymm7 # bufs[55,54,53,52,56,57,58,59] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[0,1,2,3,8,9,10,11] vaddps %ymm7, %ymm6, %ymm2 # bufs[16,17,18,19,24,25,26,27] vmulps %ymm1, %ymm9, %ymm1 # bufs[7,6,5,4,15,14,13,12] vmulps %ymm3, %ymm9, %ymm3 # bufs[23,22,21,20,31,30,29,28] vperm2f128 $0x11, %ymm8, %ymm8, %ymm8 # cos8[0,1]:cos4[0]:-:cos8[0,1]:cos4[0]:- vmovddup %ymm8, %ymm9 # cos8[0,1,0,1,0,1,0,1] vunpcklps %ymm1, %ymm0, %ymm4 # bufs[0,7,1,6,8,15,9,14] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[2,5,3,4,10,13,11,12] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[16,23,17,22,24,31,25,30] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[18,21,19,20,26,29,27,28] vshufps $0xd8, %ymm4, %ymm4, %ymm4 # bufs[0,1,7,6,8,9,15,14] vshufps $0x72, %ymm5, %ymm5, %ymm5 # bufs[3,2,4,5,11,10,12,13] vshufps $0xd8, %ymm6, %ymm6, %ymm6 # bufs[16,17,23,22,24,25,31,30] vshufps $0x72, %ymm7, %ymm7, %ymm7 # bufs[19,18,20,21,27,26,28,29] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[32,33,36,37,40,41,44,45] vaddps %ymm7, %ymm6, %ymm2 # bufs[48,49,52,53,56,57,60,61] vmulps %ymm1, %ymm9, %ymm1 # bufs[35,34,39,38,43,42,47,46] vmulps %ymm3, %ymm9, %ymm3 # bufs[51,50,55,54,59,58,63,62] vpermilps $0xaa, %ymm8, %ymm8 # cos4[0,0,0,0,0,0,0,0] vshufps $0xd8, %ymm0, %ymm0, %ymm0 # bufs[32,36,33,37,40,44,41,45] vshufps $0xd8, %ymm1, %ymm1, %ymm1 # bufs[35,39,34,38,43,47,42,46] vshufps $0xd8, %ymm2, %ymm2, %ymm2 # bufs[48,52,49,53,56,60,57,61] vshufps $0xd8, %ymm3, %ymm3, %ymm3 # bufs[51,55,50,54,59,63,58,62] vunpcklps %ymm1, %ymm0, %ymm4 # bufs[32,35,36,39,40,43,44,47] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[33,34,37,38,41,42,45,46] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[48,51,52,55,56,59,60,63] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[49,50,53,54,57,58,61,62] vsubps %ymm5, %ymm4, %ymm1 vsubps %ymm7, %ymm6, %ymm3 vaddps %ymm5, %ymm4, %ymm0 # bufs[0,2,4,6,8,10,12,14] vaddps %ymm7, %ymm6, %ymm2 # bufs[16,18,20,22,24,26,28,30] vmulps %ymm1, %ymm8, %ymm1 # bufs[1,3,5,7,9,11,13,15] vmulps %ymm3, %ymm8, %ymm3 # bufs[17,19,21,23,25,27,29,31] vxorps %ymm8, %ymm8, %ymm8 vblendps $0xaa, %ymm1, %ymm8, %ymm5 vblendps $0xaa, %ymm3, %ymm8, %ymm6 vaddps %ymm5, %ymm0, %ymm0 vaddps %ymm6, %ymm2, %ymm2 vunpcklps %ymm1, %ymm0, %ymm4 # bufs[0,1,2,3,8,9,10,11] vunpckhps %ymm1, %ymm0, %ymm5 # bufs[4,5,6,7,12,13,14,15] vunpcklps %ymm3, %ymm2, %ymm6 # bufs[16,17,18,19,24,25,26,27] vunpckhps %ymm3, %ymm2, %ymm7 # bufs[20,21,22,23,28,29,30,31] vextractf128 $0x1, %ymm4, %xmm0 # bufs[8,9,10,11] vextractf128 $0x1, %ymm5, %xmm1 # bufs[12,13,14,15] vextractf128 $0x1, %ymm6, %xmm2 # bufs[24,25,26,27] vextractf128 $0x1, %ymm7, %xmm3 # bufs[28,29,30,31] vshufps $0x1e, %xmm5, %xmm5, %xmm9 # bufs[6,7,5,4] vshufps $0x1e, %xmm1, %xmm1, %xmm10 # bufs[14,15,13,12] vshufps $0x1e, %xmm7, %xmm7, %xmm11 # bufs[22,23,21,20] vshufps $0x1e, %xmm3, %xmm3, %xmm12 # bufs[30,31,29,28] vblendps $0x7, %xmm9, %xmm8, %xmm9 # bufs[6,7,5,-] vblendps $0x7, %xmm10, %xmm8, %xmm10 # bufs[14,15,13,-] vblendps $0x7, %xmm11, %xmm8, %xmm11 # bufs[22,23,21,-] vblendps $0x7, %xmm12, %xmm8, %xmm12 # bufs[30,31,29,-] vaddps %xmm5, %xmm9, %xmm5 vaddps %xmm1, %xmm10, %xmm1 vaddps %xmm7, %xmm11, %xmm7 vaddps %xmm3, %xmm12, %xmm3 prefetcht0 1024(out0) vshufps $0x1e, %xmm0, %xmm0, %xmm9 # bufs[10,11,9,8] vshufps $0x1e, %xmm2, %xmm2, %xmm10 # bufs[26,27,25,24] vaddps %xmm1, %xmm0, %xmm0 vaddps %xmm3, %xmm2, %xmm2 vblendps $0x7, %xmm9, %xmm8, %xmm9 # bufs[10,11,9,-] vblendps $0x7, %xmm10, %xmm8, %xmm10 # bufs[26,27,25,-] vaddps %xmm1, %xmm9, %xmm1 vaddps %xmm3, %xmm10, %xmm3 vzeroupper prefetcht0 1024(out1) addq $1024, out0 movq $-128, %rax movss %xmm4, (out0) movss %xmm0, (out0,%rax,1) movss %xmm5, (out0,%rax,2) movss %xmm1, -128(out0,%rax,2) leaq (out0,%rax,4), out0 movhlps %xmm4, %xmm9 movhlps %xmm0, %xmm10 movhlps %xmm5, %xmm11 movhlps %xmm1, %xmm12 vmovss %xmm9, (out0) vmovss %xmm10, (out0,%rax,1) vmovss %xmm11, (out0,%rax,2) vmovss %xmm12, -128(out0,%rax,2) leaq (out0,%rax,4), out0 negq %rax shufps $0xb1, %xmm4, %xmm4 shufps $0xb1, %xmm0, %xmm0 shufps $0xb1, %xmm5, %xmm5 shufps $0xb1, %xmm1, %xmm1 movss %xmm4, (out0) movss %xmm4, (out1) leaq (out1,%rax,1), out1 movss %xmm0, (out1) movss %xmm5, (out1,%rax,1) movss %xmm1, (out1,%rax,2) leaq (out1,%rax,4), out1 movhlps %xmm4, %xmm4 movhlps %xmm0, %xmm0 movhlps %xmm5, %xmm5 movhlps %xmm1, %xmm1 movss %xmm4, -128(out1) movss %xmm0, (out1) movss %xmm5, (out1,%rax,1) movss %xmm1, (out1,%rax,2) leaq -64(out0,%rax,8), out0 negq %rax vshufps $0x1e, %xmm6, %xmm6, %xmm0 vblendps $0x7, %xmm0, %xmm8, %xmm0 addps %xmm2, %xmm6 addps %xmm7, %xmm2 addps %xmm3, %xmm7 addps %xmm0, %xmm3 movss %xmm6, (out0) movss %xmm2, (out0,%rax,1) movss %xmm7, (out0,%rax,2) movss %xmm3, -128(out0,%rax,2) leaq (out0,%rax,4), out0 movhlps %xmm6, %xmm0 movhlps %xmm2, %xmm1 movhlps %xmm7, %xmm4 movhlps %xmm3, %xmm5 movss %xmm0, (out0) movss %xmm1, (out0,%rax,1) movss %xmm4, (out0,%rax,2) movss %xmm5, -128(out0,%rax,2) leaq 64(out1,%rax,4), out1 negq %rax shufps $0xb1, %xmm6, %xmm6 shufps $0xb1, %xmm2, %xmm2 shufps $0xb1, %xmm7, %xmm7 shufps $0xb1, %xmm3, %xmm3 movss %xmm6, -128(out1) movss %xmm2, (out1) movss %xmm7, (out1,%rax,1) movss %xmm3, (out1,%rax,2) leaq (out1,%rax,4), out1 movhlps %xmm6, %xmm6 movhlps %xmm2, %xmm2 movhlps %xmm7, %xmm7 movhlps %xmm3, %xmm3 movss %xmm6, -128(out1) movss %xmm2, (out1) movss %xmm7, (out1,%rax,1) movss %xmm3, (out1,%rax,2) #ifdef IS_MSABI pop %rsi pop %rdi movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 mov %rbp, %rsp pop %rbp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_i386.c000066400000000000000000000261401357201522000174640ustar00rootroot00000000000000/* dct64_i386.c: DCT64, a C variant for i386 copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp */ /* * Discrete Cosine Tansform (DCT) for subband synthesis * optimized for machines with no auto-increment. * The performance is highly compiler dependend. Maybe * the dct64.c version for 'normal' processor may be faster * even for Intel processors. */ #include "mpg123lib_intern.h" static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples) { { register real *costab = pnts[0]; b1[0x00] = samples[0x00] + samples[0x1F]; b1[0x01] = samples[0x01] + samples[0x1E]; b1[0x1F] = REAL_MUL(samples[0x00] - samples[0x1F], costab[0x0]); b1[0x1E] = REAL_MUL(samples[0x01] - samples[0x1E], costab[0x1]); b1[0x02] = samples[0x02] + samples[0x1D]; b1[0x03] = samples[0x03] + samples[0x1C]; b1[0x1D] = REAL_MUL(samples[0x02] - samples[0x1D], costab[0x2]); b1[0x1C] = REAL_MUL(samples[0x03] - samples[0x1C], costab[0x3]); b1[0x04] = samples[0x04] + samples[0x1B]; b1[0x05] = samples[0x05] + samples[0x1A]; b1[0x1B] = REAL_MUL(samples[0x04] - samples[0x1B], costab[0x4]); b1[0x1A] = REAL_MUL(samples[0x05] - samples[0x1A], costab[0x5]); b1[0x06] = samples[0x06] + samples[0x19]; b1[0x07] = samples[0x07] + samples[0x18]; b1[0x19] = REAL_MUL(samples[0x06] - samples[0x19], costab[0x6]); b1[0x18] = REAL_MUL(samples[0x07] - samples[0x18], costab[0x7]); b1[0x08] = samples[0x08] + samples[0x17]; b1[0x09] = samples[0x09] + samples[0x16]; b1[0x17] = REAL_MUL(samples[0x08] - samples[0x17], costab[0x8]); b1[0x16] = REAL_MUL(samples[0x09] - samples[0x16], costab[0x9]); b1[0x0A] = samples[0x0A] + samples[0x15]; b1[0x0B] = samples[0x0B] + samples[0x14]; b1[0x15] = REAL_MUL(samples[0x0A] - samples[0x15], costab[0xA]); b1[0x14] = REAL_MUL(samples[0x0B] - samples[0x14], costab[0xB]); b1[0x0C] = samples[0x0C] + samples[0x13]; b1[0x0D] = samples[0x0D] + samples[0x12]; b1[0x13] = REAL_MUL(samples[0x0C] - samples[0x13], costab[0xC]); b1[0x12] = REAL_MUL(samples[0x0D] - samples[0x12], costab[0xD]); b1[0x0E] = samples[0x0E] + samples[0x11]; b1[0x0F] = samples[0x0F] + samples[0x10]; b1[0x11] = REAL_MUL(samples[0x0E] - samples[0x11], costab[0xE]); b1[0x10] = REAL_MUL(samples[0x0F] - samples[0x10], costab[0xF]); } { register real *costab = pnts[1]; b2[0x00] = b1[0x00] + b1[0x0F]; b2[0x01] = b1[0x01] + b1[0x0E]; b2[0x0F] = REAL_MUL(b1[0x00] - b1[0x0F], costab[0]); b2[0x0E] = REAL_MUL(b1[0x01] - b1[0x0E], costab[1]); b2[0x02] = b1[0x02] + b1[0x0D]; b2[0x03] = b1[0x03] + b1[0x0C]; b2[0x0D] = REAL_MUL(b1[0x02] - b1[0x0D], costab[2]); b2[0x0C] = REAL_MUL(b1[0x03] - b1[0x0C], costab[3]); b2[0x04] = b1[0x04] + b1[0x0B]; b2[0x05] = b1[0x05] + b1[0x0A]; b2[0x0B] = REAL_MUL(b1[0x04] - b1[0x0B], costab[4]); b2[0x0A] = REAL_MUL(b1[0x05] - b1[0x0A], costab[5]); b2[0x06] = b1[0x06] + b1[0x09]; b2[0x07] = b1[0x07] + b1[0x08]; b2[0x09] = REAL_MUL(b1[0x06] - b1[0x09], costab[6]); b2[0x08] = REAL_MUL(b1[0x07] - b1[0x08], costab[7]); /* */ b2[0x10] = b1[0x10] + b1[0x1F]; b2[0x11] = b1[0x11] + b1[0x1E]; b2[0x1F] = REAL_MUL(b1[0x1F] - b1[0x10], costab[0]); b2[0x1E] = REAL_MUL(b1[0x1E] - b1[0x11], costab[1]); b2[0x12] = b1[0x12] + b1[0x1D]; b2[0x13] = b1[0x13] + b1[0x1C]; b2[0x1D] = REAL_MUL(b1[0x1D] - b1[0x12], costab[2]); b2[0x1C] = REAL_MUL(b1[0x1C] - b1[0x13], costab[3]); b2[0x14] = b1[0x14] + b1[0x1B]; b2[0x15] = b1[0x15] + b1[0x1A]; b2[0x1B] = REAL_MUL(b1[0x1B] - b1[0x14], costab[4]); b2[0x1A] = REAL_MUL(b1[0x1A] - b1[0x15], costab[5]); b2[0x16] = b1[0x16] + b1[0x19]; b2[0x17] = b1[0x17] + b1[0x18]; b2[0x19] = REAL_MUL(b1[0x19] - b1[0x16], costab[6]); b2[0x18] = REAL_MUL(b1[0x18] - b1[0x17], costab[7]); } { register real *costab = pnts[2]; b1[0x00] = b2[0x00] + b2[0x07]; b1[0x07] = REAL_MUL(b2[0x00] - b2[0x07], costab[0]); b1[0x01] = b2[0x01] + b2[0x06]; b1[0x06] = REAL_MUL(b2[0x01] - b2[0x06], costab[1]); b1[0x02] = b2[0x02] + b2[0x05]; b1[0x05] = REAL_MUL(b2[0x02] - b2[0x05], costab[2]); b1[0x03] = b2[0x03] + b2[0x04]; b1[0x04] = REAL_MUL(b2[0x03] - b2[0x04], costab[3]); b1[0x08] = b2[0x08] + b2[0x0F]; b1[0x0F] = REAL_MUL(b2[0x0F] - b2[0x08], costab[0]); b1[0x09] = b2[0x09] + b2[0x0E]; b1[0x0E] = REAL_MUL(b2[0x0E] - b2[0x09], costab[1]); b1[0x0A] = b2[0x0A] + b2[0x0D]; b1[0x0D] = REAL_MUL(b2[0x0D] - b2[0x0A], costab[2]); b1[0x0B] = b2[0x0B] + b2[0x0C]; b1[0x0C] = REAL_MUL(b2[0x0C] - b2[0x0B], costab[3]); b1[0x10] = b2[0x10] + b2[0x17]; b1[0x17] = REAL_MUL(b2[0x10] - b2[0x17], costab[0]); b1[0x11] = b2[0x11] + b2[0x16]; b1[0x16] = REAL_MUL(b2[0x11] - b2[0x16], costab[1]); b1[0x12] = b2[0x12] + b2[0x15]; b1[0x15] = REAL_MUL(b2[0x12] - b2[0x15], costab[2]); b1[0x13] = b2[0x13] + b2[0x14]; b1[0x14] = REAL_MUL(b2[0x13] - b2[0x14], costab[3]); b1[0x18] = b2[0x18] + b2[0x1F]; b1[0x1F] = REAL_MUL(b2[0x1F] - b2[0x18], costab[0]); b1[0x19] = b2[0x19] + b2[0x1E]; b1[0x1E] = REAL_MUL(b2[0x1E] - b2[0x19], costab[1]); b1[0x1A] = b2[0x1A] + b2[0x1D]; b1[0x1D] = REAL_MUL(b2[0x1D] - b2[0x1A], costab[2]); b1[0x1B] = b2[0x1B] + b2[0x1C]; b1[0x1C] = REAL_MUL(b2[0x1C] - b2[0x1B], costab[3]); } { register real const cos0 = pnts[3][0]; register real const cos1 = pnts[3][1]; b2[0x00] = b1[0x00] + b1[0x03]; b2[0x03] = REAL_MUL(b1[0x00] - b1[0x03], cos0); b2[0x01] = b1[0x01] + b1[0x02]; b2[0x02] = REAL_MUL(b1[0x01] - b1[0x02], cos1); b2[0x04] = b1[0x04] + b1[0x07]; b2[0x07] = REAL_MUL(b1[0x07] - b1[0x04], cos0); b2[0x05] = b1[0x05] + b1[0x06]; b2[0x06] = REAL_MUL(b1[0x06] - b1[0x05], cos1); b2[0x08] = b1[0x08] + b1[0x0B]; b2[0x0B] = REAL_MUL(b1[0x08] - b1[0x0B], cos0); b2[0x09] = b1[0x09] + b1[0x0A]; b2[0x0A] = REAL_MUL(b1[0x09] - b1[0x0A], cos1); b2[0x0C] = b1[0x0C] + b1[0x0F]; b2[0x0F] = REAL_MUL(b1[0x0F] - b1[0x0C], cos0); b2[0x0D] = b1[0x0D] + b1[0x0E]; b2[0x0E] = REAL_MUL(b1[0x0E] - b1[0x0D], cos1); b2[0x10] = b1[0x10] + b1[0x13]; b2[0x13] = REAL_MUL(b1[0x10] - b1[0x13], cos0); b2[0x11] = b1[0x11] + b1[0x12]; b2[0x12] = REAL_MUL(b1[0x11] - b1[0x12], cos1); b2[0x14] = b1[0x14] + b1[0x17]; b2[0x17] = REAL_MUL(b1[0x17] - b1[0x14], cos0); b2[0x15] = b1[0x15] + b1[0x16]; b2[0x16] = REAL_MUL(b1[0x16] - b1[0x15], cos1); b2[0x18] = b1[0x18] + b1[0x1B]; b2[0x1B] = REAL_MUL(b1[0x18] - b1[0x1B], cos0); b2[0x19] = b1[0x19] + b1[0x1A]; b2[0x1A] = REAL_MUL(b1[0x19] - b1[0x1A], cos1); b2[0x1C] = b1[0x1C] + b1[0x1F]; b2[0x1F] = REAL_MUL(b1[0x1F] - b1[0x1C], cos0); b2[0x1D] = b1[0x1D] + b1[0x1E]; b2[0x1E] = REAL_MUL(b1[0x1E] - b1[0x1D], cos1); } { register real const cos0 = pnts[4][0]; b1[0x00] = b2[0x00] + b2[0x01]; b1[0x01] = REAL_MUL(b2[0x00] - b2[0x01], cos0); b1[0x02] = b2[0x02] + b2[0x03]; b1[0x03] = REAL_MUL(b2[0x03] - b2[0x02], cos0); b1[0x02] += b1[0x03]; b1[0x04] = b2[0x04] + b2[0x05]; b1[0x05] = REAL_MUL(b2[0x04] - b2[0x05], cos0); b1[0x06] = b2[0x06] + b2[0x07]; b1[0x07] = REAL_MUL(b2[0x07] - b2[0x06], cos0); b1[0x06] += b1[0x07]; b1[0x04] += b1[0x06]; b1[0x06] += b1[0x05]; b1[0x05] += b1[0x07]; b1[0x08] = b2[0x08] + b2[0x09]; b1[0x09] = REAL_MUL(b2[0x08] - b2[0x09], cos0); b1[0x0A] = b2[0x0A] + b2[0x0B]; b1[0x0B] = REAL_MUL(b2[0x0B] - b2[0x0A], cos0); b1[0x0A] += b1[0x0B]; b1[0x0C] = b2[0x0C] + b2[0x0D]; b1[0x0D] = REAL_MUL(b2[0x0C] - b2[0x0D], cos0); b1[0x0E] = b2[0x0E] + b2[0x0F]; b1[0x0F] = REAL_MUL(b2[0x0F] - b2[0x0E], cos0); b1[0x0E] += b1[0x0F]; b1[0x0C] += b1[0x0E]; b1[0x0E] += b1[0x0D]; b1[0x0D] += b1[0x0F]; b1[0x10] = b2[0x10] + b2[0x11]; b1[0x11] = REAL_MUL(b2[0x10] - b2[0x11], cos0); b1[0x12] = b2[0x12] + b2[0x13]; b1[0x13] = REAL_MUL(b2[0x13] - b2[0x12], cos0); b1[0x12] += b1[0x13]; b1[0x14] = b2[0x14] + b2[0x15]; b1[0x15] = REAL_MUL(b2[0x14] - b2[0x15], cos0); b1[0x16] = b2[0x16] + b2[0x17]; b1[0x17] = REAL_MUL(b2[0x17] - b2[0x16], cos0); b1[0x16] += b1[0x17]; b1[0x14] += b1[0x16]; b1[0x16] += b1[0x15]; b1[0x15] += b1[0x17]; b1[0x18] = b2[0x18] + b2[0x19]; b1[0x19] = REAL_MUL(b2[0x18] - b2[0x19], cos0); b1[0x1A] = b2[0x1A] + b2[0x1B]; b1[0x1B] = REAL_MUL(b2[0x1B] - b2[0x1A], cos0); b1[0x1A] += b1[0x1B]; b1[0x1C] = b2[0x1C] + b2[0x1D]; b1[0x1D] = REAL_MUL(b2[0x1C] - b2[0x1D], cos0); b1[0x1E] = b2[0x1E] + b2[0x1F]; b1[0x1F] = REAL_MUL(b2[0x1F] - b2[0x1E], cos0); b1[0x1E] += b1[0x1F]; b1[0x1C] += b1[0x1E]; b1[0x1E] += b1[0x1D]; b1[0x1D] += b1[0x1F]; } out0[0x10*16] = REAL_SCALE_DCT64(b1[0x00]); out0[0x10*12] = REAL_SCALE_DCT64(b1[0x04]); out0[0x10* 8] = REAL_SCALE_DCT64(b1[0x02]); out0[0x10* 4] = REAL_SCALE_DCT64(b1[0x06]); out0[0x10* 0] = REAL_SCALE_DCT64(b1[0x01]); out1[0x10* 0] = REAL_SCALE_DCT64(b1[0x01]); out1[0x10* 4] = REAL_SCALE_DCT64(b1[0x05]); out1[0x10* 8] = REAL_SCALE_DCT64(b1[0x03]); out1[0x10*12] = REAL_SCALE_DCT64(b1[0x07]); #if 1 out0[0x10*14] = REAL_SCALE_DCT64(b1[0x08] + b1[0x0C]); out0[0x10*10] = REAL_SCALE_DCT64(b1[0x0C] + b1[0x0a]); out0[0x10* 6] = REAL_SCALE_DCT64(b1[0x0A] + b1[0x0E]); out0[0x10* 2] = REAL_SCALE_DCT64(b1[0x0E] + b1[0x09]); out1[0x10* 2] = REAL_SCALE_DCT64(b1[0x09] + b1[0x0D]); out1[0x10* 6] = REAL_SCALE_DCT64(b1[0x0D] + b1[0x0B]); out1[0x10*10] = REAL_SCALE_DCT64(b1[0x0B] + b1[0x0F]); out1[0x10*14] = REAL_SCALE_DCT64(b1[0x0F]); #else b1[0x08] += b1[0x0C]; out0[0x10*14] = REAL_SCALE_DCT64(b1[0x08]); b1[0x0C] += b1[0x0a]; out0[0x10*10] = REAL_SCALE_DCT64(b1[0x0C]); b1[0x0A] += b1[0x0E]; out0[0x10* 6] = REAL_SCALE_DCT64(b1[0x0A]); b1[0x0E] += b1[0x09]; out0[0x10* 2] = REAL_SCALE_DCT64(b1[0x0E]); b1[0x09] += b1[0x0D]; out1[0x10* 2] = REAL_SCALE_DCT64(b1[0x09]); b1[0x0D] += b1[0x0B]; out1[0x10* 6] = REAL_SCALE_DCT64(b1[0x0D]); b1[0x0B] += b1[0x0F]; out1[0x10*10] = REAL_SCALE_DCT64(b1[0x0B]); out1[0x10*14] = REAL_SCALE_DCT64(b1[0x0F]); #endif { real tmp; tmp = b1[0x18] + b1[0x1C]; out0[0x10*15] = REAL_SCALE_DCT64(tmp + b1[0x10]); out0[0x10*13] = REAL_SCALE_DCT64(tmp + b1[0x14]); tmp = b1[0x1C] + b1[0x1A]; out0[0x10*11] = REAL_SCALE_DCT64(tmp + b1[0x14]); out0[0x10* 9] = REAL_SCALE_DCT64(tmp + b1[0x12]); tmp = b1[0x1A] + b1[0x1E]; out0[0x10* 7] = REAL_SCALE_DCT64(tmp + b1[0x12]); out0[0x10* 5] = REAL_SCALE_DCT64(tmp + b1[0x16]); tmp = b1[0x1E] + b1[0x19]; out0[0x10* 3] = REAL_SCALE_DCT64(tmp + b1[0x16]); out0[0x10* 1] = REAL_SCALE_DCT64(tmp + b1[0x11]); tmp = b1[0x19] + b1[0x1D]; out1[0x10* 1] = REAL_SCALE_DCT64(tmp + b1[0x11]); out1[0x10* 3] = REAL_SCALE_DCT64(tmp + b1[0x15]); tmp = b1[0x1D] + b1[0x1B]; out1[0x10* 5] = REAL_SCALE_DCT64(tmp + b1[0x15]); out1[0x10* 7] = REAL_SCALE_DCT64(tmp + b1[0x13]); tmp = b1[0x1B] + b1[0x1F]; out1[0x10* 9] = REAL_SCALE_DCT64(tmp + b1[0x13]); out1[0x10*11] = REAL_SCALE_DCT64(tmp + b1[0x17]); out1[0x10*13] = REAL_SCALE_DCT64(b1[0x17] + b1[0x1F]); out1[0x10*15] = REAL_SCALE_DCT64(b1[0x1F]); } } /* * the call via dct64 is a trick to force GCC to use * (new) registers for the b1,b2 pointer to the bufs[xx] field */ void dct64_i386(real *a,real *b,real *c) { real bufs[0x40]; dct64_1(a,b,bufs,bufs+0x20,c); } welle.io-2.1/src/libs/mpg123/dct64_i486.c000066400000000000000000000232611357201522000174660ustar00rootroot00000000000000/* dct64_i486.c: DCT64, a plain C variant for i486 copyright 1998-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Fabrice Bellard */ /* Discrete Cosine Tansform (DCT) for subband synthesis. * * This code is optimized for 80486. It should be compiled with gcc * 2.7.2 or higher. * * Note: This code does not give the necessary accuracy. Moreover, no * overflow test are done. * * (c) 1998 Fabrice Bellard. */ #include "mpg123lib_intern.h" #define COS_0_0 16403 #define COS_0_1 16563 #define COS_0_2 16890 #define COS_0_3 17401 #define COS_0_4 18124 #define COS_0_5 19101 #define COS_0_6 20398 #define COS_0_7 22112 #define COS_0_8 24396 #define COS_0_9 27503 #define COS_0_10 31869 #define COS_0_11 38320 #define COS_0_12 48633 #define COS_0_13 67429 #define COS_0_14 111660 #define COS_0_15 333906 #define COS_1_0 16463 #define COS_1_1 17121 #define COS_1_2 18577 #define COS_1_3 21195 #define COS_1_4 25826 #define COS_1_5 34756 #define COS_1_6 56441 #define COS_1_7 167154 #define COS_2_0 16704 #define COS_2_1 19704 #define COS_2_2 29490 #define COS_2_3 83981 #define COS_3_0 17733 #define COS_3_1 42813 #define COS_4_0 23170 #define SETOUT(out,n,expr) out[FIR_BUFFER_SIZE*(n)]=(expr) #define MULL(a,b) (((long long)(a)*(long long)(b)) >> 15) #define MUL(a,b) \ (\ ((!(b & 0x3F)) ? (((a)*(b >> 6)) >> 9) :\ ((!(b & 0x1F)) ? (((a)*(b >> 5)) >> 10) :\ ((!(b & 0x0F)) ? (((a)*(b >> 4)) >> 11) :\ ((!(b & 0x07)) ? (((a)*(b >> 3)) >> 12) :\ ((!(b & 0x03)) ? (((a)*(b >> 2)) >> 13) :\ ((!(b & 0x01)) ? (((a)*(b >> 1)) >> 14) :\ (((a)*(b )) >> 15)))))))) void dct64_1_486(int *out0,int *out1,int *b1,int *b2) { b1[0x00] = b2[0x00] + b2[0x1F]; b1[0x1F] = MUL((b2[0x00] - b2[0x1F]),COS_0_0); b1[0x01] = b2[0x01] + b2[0x1E]; b1[0x1E] = MUL((b2[0x01] - b2[0x1E]),COS_0_1); b1[0x02] = b2[0x02] + b2[0x1D]; b1[0x1D] = MUL((b2[0x02] - b2[0x1D]),COS_0_2); b1[0x03] = b2[0x03] + b2[0x1C]; b1[0x1C] = MUL((b2[0x03] - b2[0x1C]),COS_0_3); b1[0x04] = b2[0x04] + b2[0x1B]; b1[0x1B] = MUL((b2[0x04] - b2[0x1B]),COS_0_4); b1[0x05] = b2[0x05] + b2[0x1A]; b1[0x1A] = MUL((b2[0x05] - b2[0x1A]),COS_0_5); b1[0x06] = b2[0x06] + b2[0x19]; b1[0x19] = MUL((b2[0x06] - b2[0x19]),COS_0_6); b1[0x07] = b2[0x07] + b2[0x18]; b1[0x18] = MUL((b2[0x07] - b2[0x18]),COS_0_7); b1[0x08] = b2[0x08] + b2[0x17]; b1[0x17] = MUL((b2[0x08] - b2[0x17]),COS_0_8); b1[0x09] = b2[0x09] + b2[0x16]; b1[0x16] = MUL((b2[0x09] - b2[0x16]),COS_0_9); b1[0x0A] = b2[0x0A] + b2[0x15]; b1[0x15] = MUL((b2[0x0A] - b2[0x15]),COS_0_10); b1[0x0B] = b2[0x0B] + b2[0x14]; b1[0x14] = MUL((b2[0x0B] - b2[0x14]),COS_0_11); b1[0x0C] = b2[0x0C] + b2[0x13]; b1[0x13] = MUL((b2[0x0C] - b2[0x13]),COS_0_12); b1[0x0D] = b2[0x0D] + b2[0x12]; b1[0x12] = MULL((b2[0x0D] - b2[0x12]),COS_0_13); b1[0x0E] = b2[0x0E] + b2[0x11]; b1[0x11] = MULL((b2[0x0E] - b2[0x11]),COS_0_14); b1[0x0F] = b2[0x0F] + b2[0x10]; b1[0x10] = MULL((b2[0x0F] - b2[0x10]),COS_0_15); b2[0x00] = b1[0x00] + b1[0x0F]; b2[0x0F] = MUL((b1[0x00] - b1[0x0F]),COS_1_0); b2[0x01] = b1[0x01] + b1[0x0E]; b2[0x0E] = MUL((b1[0x01] - b1[0x0E]),COS_1_1); b2[0x02] = b1[0x02] + b1[0x0D]; b2[0x0D] = MUL((b1[0x02] - b1[0x0D]),COS_1_2); b2[0x03] = b1[0x03] + b1[0x0C]; b2[0x0C] = MUL((b1[0x03] - b1[0x0C]),COS_1_3); b2[0x04] = b1[0x04] + b1[0x0B]; b2[0x0B] = MUL((b1[0x04] - b1[0x0B]),COS_1_4); b2[0x05] = b1[0x05] + b1[0x0A]; b2[0x0A] = MUL((b1[0x05] - b1[0x0A]),COS_1_5); b2[0x06] = b1[0x06] + b1[0x09]; b2[0x09] = MUL((b1[0x06] - b1[0x09]),COS_1_6); b2[0x07] = b1[0x07] + b1[0x08]; b2[0x08] = MULL((b1[0x07] - b1[0x08]),COS_1_7); b2[0x10] = b1[0x10] + b1[0x1F]; b2[0x1F] = MUL((b1[0x1F] - b1[0x10]),COS_1_0); b2[0x11] = b1[0x11] + b1[0x1E]; b2[0x1E] = MUL((b1[0x1E] - b1[0x11]),COS_1_1); b2[0x12] = b1[0x12] + b1[0x1D]; b2[0x1D] = MUL((b1[0x1D] - b1[0x12]),COS_1_2); b2[0x13] = b1[0x13] + b1[0x1C]; b2[0x1C] = MUL((b1[0x1C] - b1[0x13]),COS_1_3); b2[0x14] = b1[0x14] + b1[0x1B]; b2[0x1B] = MUL((b1[0x1B] - b1[0x14]),COS_1_4); b2[0x15] = b1[0x15] + b1[0x1A]; b2[0x1A] = MUL((b1[0x1A] - b1[0x15]),COS_1_5); b2[0x16] = b1[0x16] + b1[0x19]; b2[0x19] = MUL((b1[0x19] - b1[0x16]),COS_1_6); b2[0x17] = b1[0x17] + b1[0x18]; b2[0x18] = MULL((b1[0x18] - b1[0x17]),COS_1_7); b1[0x00] = b2[0x00] + b2[0x07]; b1[0x07] = MUL((b2[0x00] - b2[0x07]),COS_2_0); b1[0x01] = b2[0x01] + b2[0x06]; b1[0x06] = MUL((b2[0x01] - b2[0x06]),COS_2_1); b1[0x02] = b2[0x02] + b2[0x05]; b1[0x05] = MUL((b2[0x02] - b2[0x05]),COS_2_2); b1[0x03] = b2[0x03] + b2[0x04]; b1[0x04] = MULL((b2[0x03] - b2[0x04]),COS_2_3); b1[0x08] = b2[0x08] + b2[0x0F]; b1[0x0F] = MUL((b2[0x0F] - b2[0x08]),COS_2_0); b1[0x09] = b2[0x09] + b2[0x0E]; b1[0x0E] = MUL((b2[0x0E] - b2[0x09]),COS_2_1); b1[0x0A] = b2[0x0A] + b2[0x0D]; b1[0x0D] = MUL((b2[0x0D] - b2[0x0A]),COS_2_2); b1[0x0B] = b2[0x0B] + b2[0x0C]; b1[0x0C] = MULL((b2[0x0C] - b2[0x0B]),COS_2_3); b1[0x10] = b2[0x10] + b2[0x17]; b1[0x17] = MUL((b2[0x10] - b2[0x17]),COS_2_0); b1[0x11] = b2[0x11] + b2[0x16]; b1[0x16] = MUL((b2[0x11] - b2[0x16]),COS_2_1); b1[0x12] = b2[0x12] + b2[0x15]; b1[0x15] = MUL((b2[0x12] - b2[0x15]),COS_2_2); b1[0x13] = b2[0x13] + b2[0x14]; b1[0x14] = MULL((b2[0x13] - b2[0x14]),COS_2_3); b1[0x18] = b2[0x18] + b2[0x1F]; b1[0x1F] = MUL((b2[0x1F] - b2[0x18]),COS_2_0); b1[0x19] = b2[0x19] + b2[0x1E]; b1[0x1E] = MUL((b2[0x1E] - b2[0x19]),COS_2_1); b1[0x1A] = b2[0x1A] + b2[0x1D]; b1[0x1D] = MUL((b2[0x1D] - b2[0x1A]),COS_2_2); b1[0x1B] = b2[0x1B] + b2[0x1C]; b1[0x1C] = MULL((b2[0x1C] - b2[0x1B]),COS_2_3); b2[0x00] = b1[0x00] + b1[0x03]; b2[0x03] = MUL((b1[0x00] - b1[0x03]),COS_3_0); b2[0x01] = b1[0x01] + b1[0x02]; b2[0x02] = MUL((b1[0x01] - b1[0x02]),COS_3_1); b2[0x04] = b1[0x04] + b1[0x07]; b2[0x07] = MUL((b1[0x07] - b1[0x04]),COS_3_0); b2[0x05] = b1[0x05] + b1[0x06]; b2[0x06] = MUL((b1[0x06] - b1[0x05]),COS_3_1); b2[0x08] = b1[0x08] + b1[0x0B]; b2[0x0B] = MUL((b1[0x08] - b1[0x0B]),COS_3_0); b2[0x09] = b1[0x09] + b1[0x0A]; b2[0x0A] = MUL((b1[0x09] - b1[0x0A]),COS_3_1); b2[0x0C] = b1[0x0C] + b1[0x0F]; b2[0x0F] = MUL((b1[0x0F] - b1[0x0C]),COS_3_0); b2[0x0D] = b1[0x0D] + b1[0x0E]; b2[0x0E] = MUL((b1[0x0E] - b1[0x0D]),COS_3_1); b2[0x10] = b1[0x10] + b1[0x13]; b2[0x13] = MUL((b1[0x10] - b1[0x13]),COS_3_0); b2[0x11] = b1[0x11] + b1[0x12]; b2[0x12] = MUL((b1[0x11] - b1[0x12]),COS_3_1); b2[0x14] = b1[0x14] + b1[0x17]; b2[0x17] = MUL((b1[0x17] - b1[0x14]),COS_3_0); b2[0x15] = b1[0x15] + b1[0x16]; b2[0x16] = MUL((b1[0x16] - b1[0x15]),COS_3_1); b2[0x18] = b1[0x18] + b1[0x1B]; b2[0x1B] = MUL((b1[0x18] - b1[0x1B]),COS_3_0); b2[0x19] = b1[0x19] + b1[0x1A]; b2[0x1A] = MUL((b1[0x19] - b1[0x1A]),COS_3_1); b2[0x1C] = b1[0x1C] + b1[0x1F]; b2[0x1F] = MUL((b1[0x1F] - b1[0x1C]),COS_3_0); b2[0x1D] = b1[0x1D] + b1[0x1E]; b2[0x1E] = MUL((b1[0x1E] - b1[0x1D]),COS_3_1); { int i; for(i=0;i<32;i+=4) { b1[i+0x00] = b2[i+0x00] + b2[i+0x01]; b1[i+0x01] = MUL((b2[i+0x00] - b2[i+0x01]),COS_4_0); b1[i+0x02] = b2[i+0x02] + b2[i+0x03]; b1[i+0x03] = MUL((b2[i+0x03] - b2[i+0x02]),COS_4_0); } } b1[0x02] += b1[0x03]; b1[0x06] += b1[0x07]; b1[0x04] += b1[0x06]; b1[0x06] += b1[0x05]; b1[0x05] += b1[0x07]; b1[0x0A] += b1[0x0B]; b1[0x0E] += b1[0x0F]; b1[0x0C] += b1[0x0E]; b1[0x0E] += b1[0x0D]; b1[0x0D] += b1[0x0F]; b1[0x12] += b1[0x13]; b1[0x16] += b1[0x17]; b1[0x14] += b1[0x16]; b1[0x16] += b1[0x15]; b1[0x15] += b1[0x17]; b1[0x1A] += b1[0x1B]; b1[0x1E] += b1[0x1F]; b1[0x1C] += b1[0x1E]; b1[0x1E] += b1[0x1D]; b1[0x1D] += b1[0x1F]; SETOUT(out0,16,b1[0x00]); SETOUT(out0,12,b1[0x04]); SETOUT(out0, 8,b1[0x02]); SETOUT(out0, 4,b1[0x06]); SETOUT(out0, 0,b1[0x01]); SETOUT(out1, 0,b1[0x01]); SETOUT(out1, 4,b1[0x05]); SETOUT(out1, 8,b1[0x03]); SETOUT(out1,12,b1[0x07]); b1[0x08] += b1[0x0C]; SETOUT(out0,14,b1[0x08]); b1[0x0C] += b1[0x0a]; SETOUT(out0,10,b1[0x0C]); b1[0x0A] += b1[0x0E]; SETOUT(out0, 6,b1[0x0A]); b1[0x0E] += b1[0x09]; SETOUT(out0, 2,b1[0x0E]); b1[0x09] += b1[0x0D]; SETOUT(out1, 2,b1[0x09]); b1[0x0D] += b1[0x0B]; SETOUT(out1, 6,b1[0x0D]); b1[0x0B] += b1[0x0F]; SETOUT(out1,10,b1[0x0B]); SETOUT(out1,14,b1[0x0F]); b1[0x18] += b1[0x1C]; SETOUT(out0,15,b1[0x10] + b1[0x18]); SETOUT(out0,13,b1[0x18] + b1[0x14]); b1[0x1C] += b1[0x1a]; SETOUT(out0,11,b1[0x14] + b1[0x1C]); SETOUT(out0, 9,b1[0x1C] + b1[0x12]); b1[0x1A] += b1[0x1E]; SETOUT(out0, 7,b1[0x12] + b1[0x1A]); SETOUT(out0, 5,b1[0x1A] + b1[0x16]); b1[0x1E] += b1[0x19]; SETOUT(out0, 3,b1[0x16] + b1[0x1E]); SETOUT(out0, 1,b1[0x1E] + b1[0x11]); b1[0x19] += b1[0x1D]; SETOUT(out1, 1,b1[0x11] + b1[0x19]); SETOUT(out1, 3,b1[0x19] + b1[0x15]); b1[0x1D] += b1[0x1B]; SETOUT(out1, 5,b1[0x15] + b1[0x1D]); SETOUT(out1, 7,b1[0x1D] + b1[0x13]); b1[0x1B] += b1[0x1F]; SETOUT(out1, 9,b1[0x13] + b1[0x1B]); SETOUT(out1,11,b1[0x1B] + b1[0x17]); SETOUT(out1,13,b1[0x17] + b1[0x1F]); SETOUT(out1,15,b1[0x1F]); } /* * the call via dct64 is a trick to force GCC to use * (new) registers for the b1,b2 pointer to the bufs[xx] field */ void dct64_i486(int *a,int *b,real *samples) { int bufs[64]; int i; #ifdef REAL_IS_FIXED #define TOINT(a) ((a) * 32768 / (int)REAL_FACTOR) for(i=0;i<32;i++) { bufs[i]=TOINT(samples[i]); } #else int *p = bufs; register double const scale = ((65536.0 * 32) + 1) * 65536.0; for(i=0;i<32;i++) { *((double *) (p++)) = scale + *samples++; /* beware on bufs overrun: 8B store from x87 */ } #endif dct64_1_486(a,b,bufs+32,bufs); } welle.io-2.1/src/libs/mpg123/dct64_mmx.S000066400000000000000000000332161357201522000175560ustar00rootroot00000000000000/* dct64_mmx.s: MMX optimized DCT64 copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by the mysterious higway (apparently) */ #include "mangle.h" .text ALIGN32 .globl ASM_NAME(dct64_mmx) ASM_NAME(dct64_mmx): xorl %ecx,%ecx .globl ASM_NAME(dct64_MMX) ASM_NAME(dct64_MMX): pushl %ebx pushl %esi pushl %edi subl $256,%esp GET_GOT movl 280(%esp),%eax flds (%eax) leal 128(%esp),%edx fadds 124(%eax) movl 272(%esp),%esi fstps (%edx) movl 276(%esp),%edi flds 4(%eax) #if defined(PIC) && defined(__APPLE__) movl GLOBAL_VAR_PTR(costab_mmxsse),%ebx #else leal GLOBAL_VAR(costab_mmxsse),%ebx #endif fadds 120(%eax) orl %ecx,%ecx fstps 4(%edx) flds (%eax) movl %esp,%ecx fsubs 124(%eax) fmuls (%ebx) fstps 124(%edx) flds 4(%eax) fsubs 120(%eax) fmuls 4(%ebx) fstps 120(%edx) flds 8(%eax) fadds 116(%eax) fstps 8(%edx) flds 12(%eax) fadds 112(%eax) fstps 12(%edx) flds 8(%eax) fsubs 116(%eax) fmuls 8(%ebx) fstps 116(%edx) flds 12(%eax) fsubs 112(%eax) fmuls 12(%ebx) fstps 112(%edx) flds 16(%eax) fadds 108(%eax) fstps 16(%edx) flds 20(%eax) fadds 104(%eax) fstps 20(%edx) flds 16(%eax) fsubs 108(%eax) fmuls 16(%ebx) fstps 108(%edx) flds 20(%eax) fsubs 104(%eax) fmuls 20(%ebx) fstps 104(%edx) flds 24(%eax) fadds 100(%eax) fstps 24(%edx) flds 28(%eax) fadds 96(%eax) fstps 28(%edx) flds 24(%eax) fsubs 100(%eax) fmuls 24(%ebx) fstps 100(%edx) flds 28(%eax) fsubs 96(%eax) fmuls 28(%ebx) fstps 96(%edx) flds 32(%eax) fadds 92(%eax) fstps 32(%edx) flds 36(%eax) fadds 88(%eax) fstps 36(%edx) flds 32(%eax) fsubs 92(%eax) fmuls 32(%ebx) fstps 92(%edx) flds 36(%eax) fsubs 88(%eax) fmuls 36(%ebx) fstps 88(%edx) flds 40(%eax) fadds 84(%eax) fstps 40(%edx) flds 44(%eax) fadds 80(%eax) fstps 44(%edx) flds 40(%eax) fsubs 84(%eax) fmuls 40(%ebx) fstps 84(%edx) flds 44(%eax) fsubs 80(%eax) fmuls 44(%ebx) fstps 80(%edx) flds 48(%eax) fadds 76(%eax) fstps 48(%edx) flds 52(%eax) fadds 72(%eax) fstps 52(%edx) flds 48(%eax) fsubs 76(%eax) fmuls 48(%ebx) fstps 76(%edx) flds 52(%eax) fsubs 72(%eax) fmuls 52(%ebx) fstps 72(%edx) flds 56(%eax) fadds 68(%eax) fstps 56(%edx) flds 60(%eax) fadds 64(%eax) fstps 60(%edx) flds 56(%eax) fsubs 68(%eax) fmuls 56(%ebx) fstps 68(%edx) flds 60(%eax) fsubs 64(%eax) fmuls 60(%ebx) fstps 64(%edx) flds (%edx) fadds 60(%edx) fstps (%ecx) flds 4(%edx) fadds 56(%edx) fstps 4(%ecx) flds (%edx) fsubs 60(%edx) fmuls 64(%ebx) fstps 60(%ecx) flds 4(%edx) fsubs 56(%edx) fmuls 68(%ebx) fstps 56(%ecx) flds 8(%edx) fadds 52(%edx) fstps 8(%ecx) flds 12(%edx) fadds 48(%edx) fstps 12(%ecx) flds 8(%edx) fsubs 52(%edx) fmuls 72(%ebx) fstps 52(%ecx) flds 12(%edx) fsubs 48(%edx) fmuls 76(%ebx) fstps 48(%ecx) flds 16(%edx) fadds 44(%edx) fstps 16(%ecx) flds 20(%edx) fadds 40(%edx) fstps 20(%ecx) flds 16(%edx) fsubs 44(%edx) fmuls 80(%ebx) fstps 44(%ecx) flds 20(%edx) fsubs 40(%edx) fmuls 84(%ebx) fstps 40(%ecx) flds 24(%edx) fadds 36(%edx) fstps 24(%ecx) flds 28(%edx) fadds 32(%edx) fstps 28(%ecx) flds 24(%edx) fsubs 36(%edx) fmuls 88(%ebx) fstps 36(%ecx) flds 28(%edx) fsubs 32(%edx) fmuls 92(%ebx) fstps 32(%ecx) flds 64(%edx) fadds 124(%edx) fstps 64(%ecx) flds 68(%edx) fadds 120(%edx) fstps 68(%ecx) flds 124(%edx) fsubs 64(%edx) fmuls 64(%ebx) fstps 124(%ecx) flds 120(%edx) fsubs 68(%edx) fmuls 68(%ebx) fstps 120(%ecx) flds 72(%edx) fadds 116(%edx) fstps 72(%ecx) flds 76(%edx) fadds 112(%edx) fstps 76(%ecx) flds 116(%edx) fsubs 72(%edx) fmuls 72(%ebx) fstps 116(%ecx) flds 112(%edx) fsubs 76(%edx) fmuls 76(%ebx) fstps 112(%ecx) flds 80(%edx) fadds 108(%edx) fstps 80(%ecx) flds 84(%edx) fadds 104(%edx) fstps 84(%ecx) flds 108(%edx) fsubs 80(%edx) fmuls 80(%ebx) fstps 108(%ecx) flds 104(%edx) fsubs 84(%edx) fmuls 84(%ebx) fstps 104(%ecx) flds 88(%edx) fadds 100(%edx) fstps 88(%ecx) flds 92(%edx) fadds 96(%edx) fstps 92(%ecx) flds 100(%edx) fsubs 88(%edx) fmuls 88(%ebx) fstps 100(%ecx) flds 96(%edx) fsubs 92(%edx) fmuls 92(%ebx) fstps 96(%ecx) flds (%ecx) fadds 28(%ecx) fstps (%edx) flds (%ecx) fsubs 28(%ecx) fmuls 96(%ebx) fstps 28(%edx) flds 4(%ecx) fadds 24(%ecx) fstps 4(%edx) flds 4(%ecx) fsubs 24(%ecx) fmuls 100(%ebx) fstps 24(%edx) flds 8(%ecx) fadds 20(%ecx) fstps 8(%edx) flds 8(%ecx) fsubs 20(%ecx) fmuls 104(%ebx) fstps 20(%edx) flds 12(%ecx) fadds 16(%ecx) fstps 12(%edx) flds 12(%ecx) fsubs 16(%ecx) fmuls 108(%ebx) fstps 16(%edx) flds 32(%ecx) fadds 60(%ecx) fstps 32(%edx) flds 60(%ecx) fsubs 32(%ecx) fmuls 96(%ebx) fstps 60(%edx) flds 36(%ecx) fadds 56(%ecx) fstps 36(%edx) flds 56(%ecx) fsubs 36(%ecx) fmuls 100(%ebx) fstps 56(%edx) flds 40(%ecx) fadds 52(%ecx) fstps 40(%edx) flds 52(%ecx) fsubs 40(%ecx) fmuls 104(%ebx) fstps 52(%edx) flds 44(%ecx) fadds 48(%ecx) fstps 44(%edx) flds 48(%ecx) fsubs 44(%ecx) fmuls 108(%ebx) fstps 48(%edx) flds 64(%ecx) fadds 92(%ecx) fstps 64(%edx) flds 64(%ecx) fsubs 92(%ecx) fmuls 96(%ebx) fstps 92(%edx) flds 68(%ecx) fadds 88(%ecx) fstps 68(%edx) flds 68(%ecx) fsubs 88(%ecx) fmuls 100(%ebx) fstps 88(%edx) flds 72(%ecx) fadds 84(%ecx) fstps 72(%edx) flds 72(%ecx) fsubs 84(%ecx) fmuls 104(%ebx) fstps 84(%edx) flds 76(%ecx) fadds 80(%ecx) fstps 76(%edx) flds 76(%ecx) fsubs 80(%ecx) fmuls 108(%ebx) fstps 80(%edx) flds 96(%ecx) fadds 124(%ecx) fstps 96(%edx) flds 124(%ecx) fsubs 96(%ecx) fmuls 96(%ebx) fstps 124(%edx) flds 100(%ecx) fadds 120(%ecx) fstps 100(%edx) flds 120(%ecx) fsubs 100(%ecx) fmuls 100(%ebx) fstps 120(%edx) flds 104(%ecx) fadds 116(%ecx) fstps 104(%edx) flds 116(%ecx) fsubs 104(%ecx) fmuls 104(%ebx) fstps 116(%edx) flds 108(%ecx) fadds 112(%ecx) fstps 108(%edx) flds 112(%ecx) fsubs 108(%ecx) fmuls 108(%ebx) fstps 112(%edx) flds (%edx) fadds 12(%edx) fstps (%ecx) flds (%edx) fsubs 12(%edx) fmuls 112(%ebx) fstps 12(%ecx) flds 4(%edx) fadds 8(%edx) fstps 4(%ecx) flds 4(%edx) fsubs 8(%edx) fmuls 116(%ebx) fstps 8(%ecx) flds 16(%edx) fadds 28(%edx) fstps 16(%ecx) flds 28(%edx) fsubs 16(%edx) fmuls 112(%ebx) fstps 28(%ecx) flds 20(%edx) fadds 24(%edx) fstps 20(%ecx) flds 24(%edx) fsubs 20(%edx) fmuls 116(%ebx) fstps 24(%ecx) flds 32(%edx) fadds 44(%edx) fstps 32(%ecx) flds 32(%edx) fsubs 44(%edx) fmuls 112(%ebx) fstps 44(%ecx) flds 36(%edx) fadds 40(%edx) fstps 36(%ecx) flds 36(%edx) fsubs 40(%edx) fmuls 116(%ebx) fstps 40(%ecx) flds 48(%edx) fadds 60(%edx) fstps 48(%ecx) flds 60(%edx) fsubs 48(%edx) fmuls 112(%ebx) fstps 60(%ecx) flds 52(%edx) fadds 56(%edx) fstps 52(%ecx) flds 56(%edx) fsubs 52(%edx) fmuls 116(%ebx) fstps 56(%ecx) flds 64(%edx) fadds 76(%edx) fstps 64(%ecx) flds 64(%edx) fsubs 76(%edx) fmuls 112(%ebx) fstps 76(%ecx) flds 68(%edx) fadds 72(%edx) fstps 68(%ecx) flds 68(%edx) fsubs 72(%edx) fmuls 116(%ebx) fstps 72(%ecx) flds 80(%edx) fadds 92(%edx) fstps 80(%ecx) flds 92(%edx) fsubs 80(%edx) fmuls 112(%ebx) fstps 92(%ecx) flds 84(%edx) fadds 88(%edx) fstps 84(%ecx) flds 88(%edx) fsubs 84(%edx) fmuls 116(%ebx) fstps 88(%ecx) flds 96(%edx) fadds 108(%edx) fstps 96(%ecx) flds 96(%edx) fsubs 108(%edx) fmuls 112(%ebx) fstps 108(%ecx) flds 100(%edx) fadds 104(%edx) fstps 100(%ecx) flds 100(%edx) fsubs 104(%edx) fmuls 116(%ebx) fstps 104(%ecx) flds 112(%edx) fadds 124(%edx) fstps 112(%ecx) flds 124(%edx) fsubs 112(%edx) fmuls 112(%ebx) fstps 124(%ecx) flds 116(%edx) fadds 120(%edx) fstps 116(%ecx) flds 120(%edx) fsubs 116(%edx) fmuls 116(%ebx) fstps 120(%ecx) flds 32(%ecx) fadds 36(%ecx) fstps 32(%edx) flds 32(%ecx) fsubs 36(%ecx) fmuls 120(%ebx) fstps 36(%edx) flds 44(%ecx) fsubs 40(%ecx) fmuls 120(%ebx) fsts 44(%edx) fadds 40(%ecx) fadds 44(%ecx) fstps 40(%edx) flds 48(%ecx) fsubs 52(%ecx) fmuls 120(%ebx) flds 60(%ecx) fsubs 56(%ecx) fmuls 120(%ebx) fld %st(0) fadds 56(%ecx) fadds 60(%ecx) fld %st(0) fadds 48(%ecx) fadds 52(%ecx) fstps 48(%edx) fadd %st(2) fstps 56(%edx) fsts 60(%edx) faddp %st(1) fstps 52(%edx) flds 64(%ecx) fadds 68(%ecx) fstps 64(%edx) flds 64(%ecx) fsubs 68(%ecx) fmuls 120(%ebx) fstps 68(%edx) flds 76(%ecx) fsubs 72(%ecx) fmuls 120(%ebx) fsts 76(%edx) fadds 72(%ecx) fadds 76(%ecx) fstps 72(%edx) flds 92(%ecx) fsubs 88(%ecx) fmuls 120(%ebx) fsts 92(%edx) fadds 92(%ecx) fadds 88(%ecx) fld %st(0) fadds 80(%ecx) fadds 84(%ecx) fstps 80(%edx) flds 80(%ecx) fsubs 84(%ecx) fmuls 120(%ebx) fadd %st(0), %st(1) fadds 92(%edx) fstps 84(%edx) fstps 88(%edx) flds 96(%ecx) fadds 100(%ecx) fstps 96(%edx) flds 96(%ecx) fsubs 100(%ecx) fmuls 120(%ebx) fstps 100(%edx) flds 108(%ecx) fsubs 104(%ecx) fmuls 120(%ebx) fsts 108(%edx) fadds 104(%ecx) fadds 108(%ecx) fstps 104(%edx) flds 124(%ecx) fsubs 120(%ecx) fmuls 120(%ebx) fsts 124(%edx) fadds 120(%ecx) fadds 124(%ecx) fld %st(0) fadds 112(%ecx) fadds 116(%ecx) fstps 112(%edx) flds 112(%ecx) fsubs 116(%ecx) fmuls 120(%ebx) fadd %st(0),%st(1) fadds 124(%edx) fstps 116(%edx) fstps 120(%edx) jnz .L01 flds (%ecx) fadds 4(%ecx) fstps 1024(%esi) flds (%ecx) fsubs 4(%ecx) fmuls 120(%ebx) fsts (%esi) fstps (%edi) flds 12(%ecx) fsubs 8(%ecx) fmuls 120(%ebx) fsts 512(%edi) fadds 12(%ecx) fadds 8(%ecx) fstps 512(%esi) flds 16(%ecx) fsubs 20(%ecx) fmuls 120(%ebx) flds 28(%ecx) fsubs 24(%ecx) fmuls 120(%ebx) fsts 768(%edi) fld %st(0) fadds 24(%ecx) fadds 28(%ecx) fld %st(0) fadds 16(%ecx) fadds 20(%ecx) fstps 768(%esi) fadd %st(2) fstps 256(%esi) faddp %st(1) fstps 256(%edi) flds 32(%edx) fadds 48(%edx) fstps 896(%esi) flds 48(%edx) fadds 40(%edx) fstps 640(%esi) flds 40(%edx) fadds 56(%edx) fstps 384(%esi) flds 56(%edx) fadds 36(%edx) fstps 128(%esi) flds 36(%edx) fadds 52(%edx) fstps 128(%edi) flds 52(%edx) fadds 44(%edx) fstps 384(%edi) flds 60(%edx) fsts 896(%edi) fadds 44(%edx) fstps 640(%edi) flds 96(%edx) fadds 112(%edx) fld %st(0) fadds 64(%edx) fstps 960(%esi) fadds 80(%edx) fstps 832(%esi) flds 112(%edx) fadds 104(%edx) fld %st(0) fadds 80(%edx) fstps 704(%esi) fadds 72(%edx) fstps 576(%esi) flds 104(%edx) fadds 120(%edx) fld %st(0) fadds 72(%edx) fstps 448(%esi) fadds 88(%edx) fstps 320(%esi) flds 120(%edx) fadds 100(%edx) fld %st(0) fadds 88(%edx) fstps 192(%esi) fadds 68(%edx) fstps 64(%esi) flds 100(%edx) fadds 116(%edx) fld %st(0) fadds 68(%edx) fstps 64(%edi) fadds 84(%edx) fstps 192(%edi) flds 116(%edx) fadds 108(%edx) fld %st(0) fadds 84(%edx) fstps 320(%edi) fadds 76(%edx) fstps 448(%edi) flds 108(%edx) fadds 124(%edx) fld %st(0) fadds 76(%edx) fstps 576(%edi) fadds 92(%edx) fstps 704(%edi) flds 124(%edx) fsts 960(%edi) fadds 92(%edx) fstps 832(%edi) addl $256,%esp popl %edi popl %esi popl %ebx ret .L01: flds (%ecx) fadds 4(%ecx) fistps 512(%esi) flds (%ecx) fsubs 4(%ecx) fmuls 120(%ebx) fistps (%esi) flds 12(%ecx) fsubs 8(%ecx) fmuls 120(%ebx) fists 256(%edi) fadds 12(%ecx) fadds 8(%ecx) fistps 256(%esi) flds 16(%ecx) fsubs 20(%ecx) fmuls 120(%ebx) flds 28(%ecx) fsubs 24(%ecx) fmuls 120(%ebx) fists 384(%edi) fld %st(0) fadds 24(%ecx) fadds 28(%ecx) fld %st(0) fadds 16(%ecx) fadds 20(%ecx) fistps 384(%esi) fadd %st(2) fistps 128(%esi) faddp %st(1) fistps 128(%edi) flds 32(%edx) fadds 48(%edx) fistps 448(%esi) flds 48(%edx) fadds 40(%edx) fistps 320(%esi) flds 40(%edx) fadds 56(%edx) fistps 192(%esi) flds 56(%edx) fadds 36(%edx) fistps 64(%esi) flds 36(%edx) fadds 52(%edx) fistps 64(%edi) flds 52(%edx) fadds 44(%edx) fistps 192(%edi) flds 60(%edx) fists 448(%edi) fadds 44(%edx) fistps 320(%edi) flds 96(%edx) fadds 112(%edx) fld %st(0) fadds 64(%edx) fistps 480(%esi) fadds 80(%edx) fistps 416(%esi) flds 112(%edx) fadds 104(%edx) fld %st(0) fadds 80(%edx) fistps 352(%esi) fadds 72(%edx) fistps 288(%esi) flds 104(%edx) fadds 120(%edx) fld %st(0) fadds 72(%edx) fistps 224(%esi) fadds 88(%edx) fistps 160(%esi) flds 120(%edx) fadds 100(%edx) fld %st(0) fadds 88(%edx) fistps 96(%esi) fadds 68(%edx) fistps 32(%esi) flds 100(%edx) fadds 116(%edx) fld %st(0) fadds 68(%edx) fistps 32(%edi) fadds 84(%edx) fistps 96(%edi) flds 116(%edx) fadds 108(%edx) fld %st(0) fadds 84(%edx) fistps 160(%edi) fadds 76(%edx) fistps 224(%edi) flds 108(%edx) fadds 124(%edx) fld %st(0) fadds 76(%edx) fistps 288(%edi) fadds 92(%edx) fistps 352(%edi) flds 124(%edx) fists 480(%edi) fadds 92(%edx) fistps 416(%edi) movsw addl $256,%esp popl %edi popl %esi popl %ebx ret #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_costab_mmxsse: .indirect_symbol ASM_NAME(costab_mmxsse) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_neon.S000066400000000000000000000141151357201522000177110ustar00rootroot00000000000000/* dct64_neon: ARM NEON optimized dct64 copyright 1995-2010 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef _M_ARM .code 32 #endif #ifndef __APPLE__ .fpu neon #endif .text ALIGN16 costab_arm: .word 1056974725 .word 1057056395 .word 1057223771 .word 1057485416 .word 1057855544 .word 1058356026 .word 1059019886 .word 1059897405 .word 1061067246 .word 1062657950 .word 1064892987 .word 1066774581 .word 1069414683 .word 1073984175 .word 1079645762 .word 1092815430 .word 1057005197 .word 1057342072 .word 1058087743 .word 1059427869 .word 1061799040 .word 1065862217 .word 1071413542 .word 1084439708 .word 1057128951 .word 1058664893 .word 1063675095 .word 1076102863 .word 1057655764 .word 1067924853 .word 1060439283 .word 1060439283 ALIGN4 GLOBAL_SYMBOL ASM_NAME(dct64_neon) #ifdef __ELF__ .type ASM_NAME(dct64_neon), %function #endif ASM_NAME(dct64_neon): vpush {q4-q7} adr r3, costab_arm vld1.32 {q0, q1}, [r2]! vld1.32 {q2, q3}, [r2]! vld1.32 {q4, q5}, [r2]! vld1.32 {q6, q7}, [r2] vld1.32 {q12, q13}, [r3, :128]! vld1.32 {q14, q15}, [r3, :128]! vrev64.32 q4, q4 vrev64.32 q5, q5 vrev64.32 q6, q6 vrev64.32 q7, q7 vswp d8, d9 vswp d10, d11 vswp d12, d13 vswp d14, d15 vsub.f32 q8, q0, q7 vsub.f32 q9, q1, q6 vsub.f32 q10, q2, q5 vsub.f32 q11, q3, q4 vadd.f32 q0, q0, q7 vadd.f32 q1, q1, q6 vadd.f32 q2, q2, q5 vadd.f32 q3, q3, q4 vmul.f32 q4, q8, q12 vmul.f32 q5, q9, q13 vmul.f32 q6, q10, q14 vmul.f32 q7, q11, q15 vld1.32 {q12, q13}, [r3, :128]! vld1.32 {q14, q15}, [r3, :128] vrev64.32 q2, q2 vrev64.32 q3, q3 vrev64.32 q6, q6 vrev64.32 q7, q7 vswp d4, d5 vswp d6, d7 vswp d12, d13 vswp d14, d15 vsub.f32 q8, q0, q3 vsub.f32 q9, q1, q2 vsub.f32 q10, q4, q7 vsub.f32 q11, q5, q6 vadd.f32 q0, q0, q3 vadd.f32 q1, q1, q2 vadd.f32 q4, q4, q7 vadd.f32 q5, q5, q6 vmul.f32 q2, q8, q12 vmul.f32 q3, q9, q13 vmul.f32 q6, q10, q12 vmul.f32 q7, q11, q13 vrev64.32 q1, q1 vrev64.32 q3, q3 vrev64.32 q5, q5 vrev64.32 q7, q7 vswp d2, d3 vswp d6, d7 vswp d10, d11 vswp d14, d15 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q14 vmul.f32 q3, q9, q14 vmul.f32 q5, q10, q14 vmul.f32 q7, q11, q14 vdup.32 q12, d31[0] vmov d31, d30 vswp d1, d2 vswp d5, d6 vswp d9, d10 vswp d13, d14 vrev64.32 q1, q1 vrev64.32 q3, q3 vrev64.32 q5, q5 vrev64.32 q7, q7 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q15 vmul.f32 q3, q9, q15 vmul.f32 q5, q10, q15 vmul.f32 q7, q11, q15 vtrn.32 q0, q1 vtrn.32 q2, q3 vtrn.32 q4, q5 vtrn.32 q6, q7 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q12 vmul.f32 q3, q9, q12 vmul.f32 q5, q10, q12 vmul.f32 q7, q11, q12 vtrn.32 q0, q1 vtrn.32 q2, q3 vtrn.32 q4, q5 vtrn.32 q6, q7 vswp d1, d2 vswp d5, d6 vswp d9, d10 vswp d13, d14 vshr.u64 d16, d1, #32 vshr.u64 d17, d3, #32 vshr.u64 d18, d5, #32 vshr.u64 d19, d7, #32 vadd.f32 d1, d1, d16 vadd.f32 d3, d3, d17 vadd.f32 d5, d5, d18 vadd.f32 d7, d7, d19 vshr.u64 d20, d9, #32 vshr.u64 d21, d11, #32 vshr.u64 d22, d13, #32 vshr.u64 d23, d15, #32 vadd.f32 d9, d9, d20 vadd.f32 d11, d11, d21 vadd.f32 d13, d13, d22 vadd.f32 d15, d15, d23 vshr.u64 d16, d2, #32 vshr.u64 d18, d6, #32 vshr.u64 d20, d10, #32 vshr.u64 d22, d14, #32 vext.8 q8, q1, q8, #8 vext.8 q9, q3, q9, #8 vext.8 q10, q5, q10, #8 vext.8 q11, q7, q11, #8 vadd.f32 q1, q1, q8 vadd.f32 q3, q3, q9 vadd.f32 q5, q5, q10 vadd.f32 q7, q7, q11 vshr.u64 d16, d4, #32 vshr.u64 d18, d12, #32 vext.8 q8, q2, q8, #8 vext.8 q9, q6, q9, #8 vadd.f32 q2, q2, q3 vadd.f32 q6, q6, q7 vadd.f32 q3, q3, q8 vadd.f32 q7, q7, q9 vrev64.32 q8, q4 vshr.u64 d19, d9, #32 vext.8 d17, d17, d16, #4 vswp d9, d10 vswp d13, d14 vtrn.32 q4, q5 vtrn.32 q6, q7 vmov d16, d9 vmov d18, d11 vadd.f32 q4, q6 vadd.f32 q5, q7 vadd.f32 q6, q8 vadd.f32 q7, q9 vmov.i32 q8, #0x4b000000 vorr.i32 q8, #0x00400000 vadd.f32 q0, q0, q8 vadd.f32 q1, q1, q8 vadd.f32 q2, q2, q8 vadd.f32 q3, q3, q8 vadd.f32 q4, q4, q8 vadd.f32 q5, q5, q8 vadd.f32 q6, q6, q8 vadd.f32 q7, q7, q8 vshl.i32 q0, q0, #10 vshl.i32 q1, q1, #10 vshl.i32 q2, q2, #10 vshl.i32 q3, q3, #10 vshl.i32 q4, q4, #10 vshl.i32 q5, q5, #10 vshl.i32 q6, q6, #10 vshl.i32 q7, q7, #10 vqshrn.s32 d0, q0, #10 vqshrn.s32 d2, q1, #10 vqshrn.s32 d4, q2, #10 vqshrn.s32 d6, q3, #10 vqshrn.s32 d8, q4, #10 vqshrn.s32 d10, q5, #10 vqshrn.s32 d12, q6, #10 vqshrn.s32 d14, q7, #10 mov r3, #32 vst1.16 {d0[1]}, [r0, :16], r3 vst1.16 {d12[3]}, [r0, :16], r3 vst1.16 {d6[2]}, [r0, :16], r3 vst1.16 {d8[3]}, [r0, :16], r3 vst1.16 {d2[2]}, [r0, :16], r3 vst1.16 {d12[1]}, [r0, :16], r3 vst1.16 {d4[2]}, [r0, :16], r3 vst1.16 {d8[1]}, [r0, :16], r3 vst1.16 {d0[2]}, [r0, :16], r3 vst1.16 {d12[2]}, [r0, :16], r3 vst1.16 {d6[0]}, [r0, :16], r3 vst1.16 {d8[2]}, [r0, :16], r3 vst1.16 {d2[0]}, [r0, :16], r3 vst1.16 {d12[0]}, [r0, :16], r3 vst1.16 {d4[0]}, [r0, :16], r3 vst1.16 {d8[0]}, [r0, :16], r3 vst1.16 {d0[0]}, [r0, :16] vst1.16 {d0[1]}, [r1, :16], r3 vst1.16 {d10[0]}, [r1, :16], r3 vst1.16 {d4[1]}, [r1, :16], r3 vst1.16 {d14[0]}, [r1, :16], r3 vst1.16 {d2[1]}, [r1, :16], r3 vst1.16 {d10[2]}, [r1, :16], r3 vst1.16 {d6[1]}, [r1, :16], r3 vst1.16 {d14[2]}, [r1, :16], r3 vst1.16 {d0[3]}, [r1, :16], r3 vst1.16 {d10[1]}, [r1, :16], r3 vst1.16 {d4[3]}, [r1, :16], r3 vst1.16 {d14[1]}, [r1, :16], r3 vst1.16 {d2[3]}, [r1, :16], r3 vst1.16 {d10[3]}, [r1, :16], r3 vst1.16 {d6[3]}, [r1, :16], r3 vst1.16 {d14[3]}, [r1, :16] vpop {q4-q7} bx lr NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_neon64.S000066400000000000000000000220411357201522000200600ustar00rootroot00000000000000/* dct64_neon64: NEON optimized dct64 for AArch64 copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 costab_neon_aarch64: .word 1056974725 .word 1057056395 .word 1057223771 .word 1057485416 .word 1057855544 .word 1058356026 .word 1059019886 .word 1059897405 .word 1061067246 .word 1062657950 .word 1064892987 .word 1066774581 .word 1069414683 .word 1073984175 .word 1079645762 .word 1092815430 .word 1057005197 .word 1057342072 .word 1058087743 .word 1059427869 .word 1061799040 .word 1065862217 .word 1071413542 .word 1084439708 .word 1057128951 .word 1058664893 .word 1063675095 .word 1076102863 .word 1057655764 .word 1067924853 .word 1060439283 .word 1060439283 .text ALIGN4 .globl ASM_NAME(dct64_neon64) #ifdef __ELF__ .type ASM_NAME(dct64_neon64), %function #endif ASM_NAME(dct64_neon64): add x3, x2, #64 adrp x4, AARCH64_PCREL_HI(costab_neon_aarch64) add x4, x4, AARCH64_PCREL_LO(costab_neon_aarch64) ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [x2] ld1 {v16.4s, v17.4s, v18.4s, v19.4s}, [x3] ld1 {v20.4s, v21.4s, v22.4s, v23.4s}, [x4], #64 rev64 v19.4s, v19.4s rev64 v18.4s, v18.4s rev64 v17.4s, v17.4s rev64 v16.4s, v16.4s ext v4.16b, v19.16b, v19.16b, #8 ext v5.16b, v18.16b, v18.16b, #8 ext v6.16b, v17.16b, v17.16b, #8 ext v7.16b, v16.16b, v16.16b, #8 fsub v16.4s, v3.4s, v7.4s fsub v17.4s, v2.4s, v6.4s fsub v18.4s, v1.4s, v5.4s fsub v19.4s, v0.4s, v4.4s fadd v0.4s, v0.4s, v4.4s /* bs[0,1,2,3] */ fadd v1.4s, v1.4s, v5.4s /* bs[4,5,6,7] */ fadd v2.4s, v2.4s, v6.4s /* bs[8,9,10,11] */ fadd v3.4s, v3.4s, v7.4s /* bs[12,13,14,15] */ fmul v16.4s, v16.4s, v23.4s /* bs[19,18,17,16] */ fmul v17.4s, v17.4s, v22.4s /* bs[23,22,21,20] */ fmul v18.4s, v18.4s, v21.4s /* bs[27,26,25,24] */ fmul v19.4s, v19.4s, v20.4s /* bs[31,30,29,28] */ ld1 {v20.4s, v21.4s}, [x4], #32 rev64 v22.4s, v3.4s rev64 v23.4s, v2.4s rev64 v24.4s, v16.4s rev64 v25.4s, v17.4s ext v4.16b, v22.16b, v22.16b, #8 /* bs[15,14,13,12] */ ext v5.16b, v23.16b, v23.16b, #8 /* bs[11,10,9,8] */ ext v6.16b, v24.16b, v24.16b, #8 /* bs[16,17,18,19] */ ext v7.16b, v25.16b, v25.16b, #8 /* bs[20,21,22,23] */ fsub v26.4s, v1.4s, v5.4s fsub v27.4s, v0.4s, v4.4s fsub v28.4s, v18.4s, v7.4s fsub v29.4s, v19.4s, v6.4s fadd v4.4s, v0.4s, v4.4s /* bs[32,33,34,35] */ fadd v5.4s, v1.4s, v5.4s /* bs[36,37,38,39] */ fadd v6.4s, v6.4s, v19.4s /* bs[48,49,50,51] */ fadd v7.4s, v7.4s, v18.4s /* bs[52,53,54,55] */ fmul v26.4s, v26.4s, v21.4s /* bs[43,42,41,40] */ fmul v27.4s, v27.4s, v20.4s /* bs[47,46,45,44] */ fmul v28.4s, v28.4s, v21.4s /* bs[59,58,57,56] */ fmul v29.4s, v29.4s, v20.4s /* bs[63,62,61,60] */ ld1 {v20.4s}, [x4], #16 rev64 v16.4s, v5.4s rev64 v17.4s, v26.4s rev64 v18.4s, v7.4s rev64 v19.4s, v28.4s ext v0.16b, v16.16b, v16.16b, #8 /* bs[39,38,37,36] */ ext v1.16b, v17.16b, v17.16b, #8 /* bs[40,41,42,43] */ ext v2.16b, v18.16b, v18.16b, #8 /* bs[55,54,53,52] */ ext v3.16b, v19.16b, v19.16b, #8 /* bs[56,57,58,59] */ fsub v16.4s, v4.4s, v0.4s fsub v17.4s, v27.4s, v1.4s fsub v18.4s, v6.4s, v2.4s fsub v19.4s, v29.4s, v3.4s fadd v0.4s, v4.4s, v0.4s /* bs[0,1,2,3] */ fadd v1.4s, v1.4s, v27.4s /* bs[8,9,10,11] */ fadd v2.4s, v6.4s, v2.4s /* bs[16,17,18,19] */ fadd v3.4s, v3.4s, v29.4s /* bs[24,25,26,27] */ fmul v16.4s, v16.4s, v20.4s /* bs[7,6,5,4] */ fmul v17.4s, v17.4s, v20.4s /* bs[15,14,13,12] */ fmul v18.4s, v18.4s, v20.4s /* bs[23,22,21,20] */ fmul v19.4s, v19.4s, v20.4s /* bs[31,30,29,28] */ ld1 {v28.4s}, [x4] zip1 v4.2d, v0.2d, v16.2d /* bs[0,1,7,6] */ zip2 v5.2d, v0.2d, v16.2d /* bs[2,3,5,4] */ zip1 v6.2d, v1.2d, v17.2d /* bs[8,9,15,14] */ zip2 v7.2d, v1.2d, v17.2d /* bs[10,11,13,12] */ zip1 v20.2d, v2.2d, v18.2d /* bs[16,17,23,22] */ zip2 v21.2d, v2.2d, v18.2d /* bs[18,19,21,20] */ zip1 v22.2d, v3.2d, v19.2d /* bs[24,25,31,30] */ zip2 v23.2d, v3.2d, v19.2d /* bs[26,27,29,28] */ rev64 v5.4s, v5.4s /* bs[3,2,4,5] */ rev64 v7.4s, v7.4s /* bs[11,10,12,13] */ rev64 v21.4s, v21.4s /* bs[19,18,20,21] */ rev64 v23.4s, v23.4s /* bs[27,26,28,29] */ AARCH64_DUP_2D(v29, v28, 0) AARCH64_DUP_4S(v28, v28, 2) fsub v16.4s, v4.4s, v5.4s fsub v17.4s, v6.4s, v7.4s fsub v18.4s, v20.4s, v21.4s fsub v19.4s, v22.4s, v23.4s fadd v0.4s, v4.4s, v5.4s /* bs[32,33,36,37] */ fadd v1.4s, v6.4s, v7.4s /* bs[40,41,44,45] */ fadd v2.4s, v20.4s, v21.4s /* bs[48,49,52,53] */ fadd v3.4s, v22.4s, v23.4s /* bs[56,57,60,61] */ fmul v16.4s, v16.4s, v29.4s /* bs[35,34,39,38] */ fmul v17.4s, v17.4s, v29.4s /* bs[43,42,47,46] */ fmul v18.4s, v18.4s, v29.4s /* bs[51,50,55,54] */ fmul v19.4s, v19.4s, v29.4s /* bs[59,58,63,62] */ uzp1 v4.4s, v0.4s, v16.4s /* bs[32,36,35,39] */ uzp2 v5.4s, v0.4s, v16.4s /* bs[33,37,34,38] */ uzp1 v6.4s, v1.4s, v17.4s /* bs[40,44,43,47] */ uzp2 v7.4s, v1.4s, v17.4s /* bs[41,45,42,46] */ uzp1 v20.4s, v2.4s, v18.4s /* bs[48,52,51,55] */ uzp2 v21.4s, v2.4s, v18.4s /* bs[49,53,50,54] */ uzp1 v22.4s, v3.4s, v19.4s /* bs[56,60,59,63] */ uzp2 v23.4s, v3.4s, v19.4s /* bs[57,61,58,62] */ fsub v16.4s, v4.4s, v5.4s fsub v17.4s, v6.4s, v7.4s fsub v18.4s, v20.4s, v21.4s fsub v19.4s, v22.4s, v23.4s fadd v0.4s, v4.4s, v5.4s /* bs[0,4,2,6] */ fadd v1.4s, v6.4s, v7.4s /* bs[8,12,10,14] */ fadd v2.4s, v20.4s, v21.4s /* bs[16,20,18,22] */ fadd v3.4s, v22.4s, v23.4s /* bs[24,28,26,30] */ fmul v16.4s, v16.4s, v28.4s /* bs[1,5,3,7] */ fmul v17.4s, v17.4s, v28.4s /* bs[9,13,11,15] */ fmul v18.4s, v18.4s, v28.4s /* bs[17,21,19,23] */ fmul v19.4s, v19.4s, v28.4s /* bs[25,29,27,31] */ zip2 v4.2d, v0.2d, v1.2d /* bs[2,6,10,14] */ zip2 v5.2d, v16.2d, v17.2d /* bs[3,7,11,15] */ zip2 v6.2d, v2.2d, v3.2d /* bs[18,22,26,30] */ zip2 v7.2d, v18.2d, v19.2d /* bs[19,23,27,31] */ fadd v4.4s, v4.4s, v5.4s /* bs[2,6,10,14] */ fadd v6.4s, v6.4s, v7.4s /* bs[18,22,26,30] */ ins v0.d[1], v4.d[0] /* bs[0,4,2,6] */ ins v1.d[1], v4.d[1] /* bs[8,12,10,14] */ ins v2.d[1], v6.d[0] /* bs[16,20,18,22] */ ins v3.d[1], v6.d[1] /* bs[24,28,26,30] */ eor v31.16b, v31.16b, v31.16b zip1 v4.4s, v0.4s, v16.4s /* bs[0,1,4,5] */ zip2 v5.4s, v0.4s, v16.4s /* bs[2,3,6,7] */ zip1 v6.4s, v1.4s, v17.4s /* bs[8,9,12,13] */ zip2 v7.4s, v1.4s, v17.4s /* bs[10,11,14,15] */ zip1 v20.4s, v2.4s, v18.4s /* bs[16,17,20,21] */ zip2 v21.4s, v2.4s, v18.4s /* bs[18,19,22,23] */ zip1 v22.4s, v3.4s, v19.4s /* bs[24,25,28,29] */ zip2 v23.4s, v3.4s, v19.4s /* bs[26,27,30,31] */ zip1 v0.2d, v4.2d, v5.2d /* bs[0,1,2,3] */ zip2 v1.2d, v4.2d, v5.2d /* bs[4,5,6,7] */ zip1 v2.2d, v6.2d, v7.2d /* bs[8,9,10,11] */ zip2 v3.2d, v6.2d, v7.2d /* bs[12,13,14,15] */ rev64 v16.4s, v4.4s rev64 v17.4s, v6.4s zip1 v24.2d, v7.2d, v17.2d zip2 v16.2d, v5.2d, v16.2d zip2 v17.2d, v7.2d, v17.2d zip1 v4.2d, v20.2d, v21.2d /* bs[16,17,18,19] */ zip2 v5.2d, v20.2d, v21.2d /* bs[20,21,22,23] */ zip1 v6.2d, v22.2d, v23.2d /* bs[24,25,26,27] */ zip2 v7.2d, v22.2d, v23.2d /* bs[28,29,30,31] */ rev64 v18.4s, v20.4s rev64 v19.4s, v22.4s zip1 v25.2d, v23.2d, v19.2d zip1 v26.2d, v21.2d, v18.2d zip2 v18.2d, v21.2d, v18.2d zip2 v19.2d, v23.2d, v19.2d ins v16.s[3], v31.s[0] /* bs[6,7,5,-] */ ins v17.s[3], v31.s[0] /* bs[14,15,13,-] */ ins v18.s[3], v31.s[0] /* bs[22,23,21,-] */ ins v19.s[3], v31.s[0] /* bs[30,31,29,-] */ ins v24.s[3], v31.s[0] /* bs[10,11,9,-] */ ins v25.s[3], v31.s[0] /* bs[26,27,25,-] */ ins v26.s[3], v31.s[0] /* bs[18,19,17,-] */ fadd v1.4s, v1.4s, v16.4s fadd v3.4s, v3.4s, v17.4s fadd v5.4s, v5.4s, v18.4s fadd v7.4s, v7.4s, v19.4s fadd v2.4s, v2.4s, v3.4s fadd v3.4s, v3.4s, v24.4s fadd v6.4s, v6.4s, v7.4s fadd v7.4s, v7.4s, v25.4s fadd v4.4s, v4.4s, v6.4s fadd v6.4s, v6.4s, v5.4s fadd v5.4s, v5.4s, v7.4s fadd v7.4s, v7.4s, v26.4s fcvtns v0.4s, v0.4s fcvtns v1.4s, v1.4s fcvtns v2.4s, v2.4s fcvtns v3.4s, v3.4s fcvtns v4.4s, v4.4s fcvtns v5.4s, v5.4s fcvtns v6.4s, v6.4s fcvtns v7.4s, v7.4s sqxtn v0.4h, v0.4s sqxtn v1.4h, v1.4s sqxtn v2.4h, v2.4s sqxtn v3.4h, v3.4s sqxtn v4.4h, v4.4s sqxtn v5.4h, v5.4s sqxtn v6.4h, v6.4s sqxtn v7.4h, v7.4s mov x3, #32 st1 {v0.h}[1], [x0], x3 st1 {v7.h}[2], [x0], x3 st1 {v3.h}[2], [x0], x3 st1 {v5.h}[2], [x0], x3 st1 {v1.h}[2], [x0], x3 st1 {v6.h}[2], [x0], x3 st1 {v2.h}[2], [x0], x3 st1 {v4.h}[2], [x0], x3 st1 {v0.h}[2], [x0], x3 st1 {v7.h}[0], [x0], x3 st1 {v3.h}[0], [x0], x3 st1 {v5.h}[0], [x0], x3 st1 {v1.h}[0], [x0], x3 st1 {v6.h}[0], [x0], x3 st1 {v2.h}[0], [x0], x3 st1 {v4.h}[0], [x0], x3 st1 {v0.h}[0], [x0] st1 {v0.h}[1], [x1], x3 st1 {v4.h}[1], [x1], x3 st1 {v2.h}[1], [x1], x3 st1 {v6.h}[1], [x1], x3 st1 {v1.h}[1], [x1], x3 st1 {v5.h}[1], [x1], x3 st1 {v3.h}[1], [x1], x3 st1 {v7.h}[1], [x1], x3 st1 {v0.h}[3], [x1], x3 st1 {v4.h}[3], [x1], x3 st1 {v2.h}[3], [x1], x3 st1 {v6.h}[3], [x1], x3 st1 {v1.h}[3], [x1], x3 st1 {v5.h}[3], [x1], x3 st1 {v3.h}[3], [x1], x3 st1 {v7.h}[3], [x1] ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_neon64_float.S000066400000000000000000000213721357201522000212530ustar00rootroot00000000000000/* dct64_neon64_float: NEON optimized dct64 for AArch64 (float output version) copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 costab_neon_aarch64: .word 1056974725 .word 1057056395 .word 1057223771 .word 1057485416 .word 1057855544 .word 1058356026 .word 1059019886 .word 1059897405 .word 1061067246 .word 1062657950 .word 1064892987 .word 1066774581 .word 1069414683 .word 1073984175 .word 1079645762 .word 1092815430 .word 1057005197 .word 1057342072 .word 1058087743 .word 1059427869 .word 1061799040 .word 1065862217 .word 1071413542 .word 1084439708 .word 1057128951 .word 1058664893 .word 1063675095 .word 1076102863 .word 1057655764 .word 1067924853 .word 1060439283 .word 1060439283 .text ALIGN4 .globl ASM_NAME(dct64_real_neon64) #ifdef __ELF__ .type ASM_NAME(dct64_real_neon64), %function #endif ASM_NAME(dct64_real_neon64): add x3, x2, #64 adrp x4, AARCH64_PCREL_HI(costab_neon_aarch64) add x4, x4, AARCH64_PCREL_LO(costab_neon_aarch64) ld1 {v0.4s,v1.4s,v2.4s,v3.4s}, [x2] ld1 {v16.4s,v17.4s,v18.4s,v19.4s}, [x3] ld1 {v20.4s,v21.4s,v22.4s,v23.4s}, [x4], #64 rev64 v19.4s, v19.4s rev64 v18.4s, v18.4s rev64 v17.4s, v17.4s rev64 v16.4s, v16.4s ext v4.16b, v19.16b, v19.16b, #8 ext v5.16b, v18.16b, v18.16b, #8 ext v6.16b, v17.16b, v17.16b, #8 ext v7.16b, v16.16b, v16.16b, #8 fsub v16.4s, v3.4s, v7.4s fsub v17.4s, v2.4s, v6.4s fsub v18.4s, v1.4s, v5.4s fsub v19.4s, v0.4s, v4.4s fadd v0.4s, v0.4s, v4.4s /* bs[0,1,2,3] */ fadd v1.4s, v1.4s, v5.4s /* bs[4,5,6,7] */ fadd v2.4s, v2.4s, v6.4s /* bs[8,9,10,11] */ fadd v3.4s, v3.4s, v7.4s /* bs[12,13,14,15] */ fmul v16.4s, v16.4s, v23.4s /* bs[19,18,17,16] */ fmul v17.4s, v17.4s, v22.4s /* bs[23,22,21,20] */ fmul v18.4s, v18.4s, v21.4s /* bs[27,26,25,24] */ fmul v19.4s, v19.4s, v20.4s /* bs[31,30,29,28] */ ld1 {v20.4s, v21.4s}, [x4], #32 rev64 v22.4s, v3.4s rev64 v23.4s, v2.4s rev64 v24.4s, v16.4s rev64 v25.4s, v17.4s ext v4.16b, v22.16b, v22.16b, #8 /* bs[15,14,13,12] */ ext v5.16b, v23.16b, v23.16b, #8 /* bs[11,10,9,8] */ ext v6.16b, v24.16b, v24.16b, #8 /* bs[16,17,18,19] */ ext v7.16b, v25.16b, v25.16b, #8 /* bs[20,21,22,23] */ fsub v26.4s, v1.4s, v5.4s fsub v27.4s, v0.4s, v4.4s fsub v28.4s, v18.4s, v7.4s fsub v29.4s, v19.4s, v6.4s fadd v4.4s, v0.4s, v4.4s /* bs[32,33,34,35] */ fadd v5.4s, v1.4s, v5.4s /* bs[36,37,38,39] */ fadd v6.4s, v6.4s, v19.4s /* bs[48,49,50,51] */ fadd v7.4s, v7.4s, v18.4s /* bs[52,53,54,55] */ fmul v26.4s, v26.4s, v21.4s /* bs[43,42,41,40] */ fmul v27.4s, v27.4s, v20.4s /* bs[47,46,45,44] */ fmul v28.4s, v28.4s, v21.4s /* bs[59,58,57,56] */ fmul v29.4s, v29.4s, v20.4s /* bs[63,62,61,60] */ ld1 {v20.4s}, [x4], #16 rev64 v16.4s, v5.4s rev64 v17.4s, v26.4s rev64 v18.4s, v7.4s rev64 v19.4s, v28.4s ext v0.16b, v16.16b, v16.16b, #8 /* bs[39,38,37,36] */ ext v1.16b, v17.16b, v17.16b, #8 /* bs[40,41,42,43] */ ext v2.16b, v18.16b, v18.16b, #8 /* bs[55,54,53,52] */ ext v3.16b, v19.16b, v19.16b, #8 /* bs[56,57,58,59] */ fsub v16.4s, v4.4s, v0.4s fsub v17.4s, v27.4s, v1.4s fsub v18.4s, v6.4s, v2.4s fsub v19.4s, v29.4s, v3.4s fadd v0.4s, v4.4s, v0.4s /* bs[0,1,2,3] */ fadd v1.4s, v1.4s, v27.4s /* bs[8,9,10,11] */ fadd v2.4s, v6.4s, v2.4s /* bs[16,17,18,19] */ fadd v3.4s, v3.4s, v29.4s /* bs[24,25,26,27] */ fmul v16.4s, v16.4s, v20.4s /* bs[7,6,5,4] */ fmul v17.4s, v17.4s, v20.4s /* bs[15,14,13,12] */ fmul v18.4s, v18.4s, v20.4s /* bs[23,22,21,20] */ fmul v19.4s, v19.4s, v20.4s /* bs[31,30,29,28] */ ld1 {v28.4s}, [x4] zip1 v4.2d, v0.2d, v16.2d /* bs[0,1,7,6] */ zip2 v5.2d, v0.2d, v16.2d /* bs[2,3,5,4] */ zip1 v6.2d, v1.2d, v17.2d /* bs[8,9,15,14] */ zip2 v7.2d, v1.2d, v17.2d /* bs[10,11,13,12] */ zip1 v20.2d, v2.2d, v18.2d /* bs[16,17,23,22] */ zip2 v21.2d, v2.2d, v18.2d /* bs[18,19,21,20] */ zip1 v22.2d, v3.2d, v19.2d /* bs[24,25,31,30] */ zip2 v23.2d, v3.2d, v19.2d /* bs[26,27,29,28] */ rev64 v5.4s, v5.4s /* bs[3,2,4,5] */ rev64 v7.4s, v7.4s /* bs[11,10,12,13] */ rev64 v21.4s, v21.4s /* bs[19,18,20,21] */ rev64 v23.4s, v23.4s /* bs[27,26,28,29] */ AARCH64_DUP_2D(v29, v28, 0) AARCH64_DUP_4S(v28, v28, 2) fsub v16.4s, v4.4s, v5.4s fsub v17.4s, v6.4s, v7.4s fsub v18.4s, v20.4s, v21.4s fsub v19.4s, v22.4s, v23.4s fadd v0.4s, v4.4s, v5.4s /* bs[32,33,36,37] */ fadd v1.4s, v6.4s, v7.4s /* bs[40,41,44,45] */ fadd v2.4s, v20.4s, v21.4s /* bs[48,49,52,53] */ fadd v3.4s, v22.4s, v23.4s /* bs[56,57,60,61] */ fmul v16.4s, v16.4s, v29.4s /* bs[35,34,39,38] */ fmul v17.4s, v17.4s, v29.4s /* bs[43,42,47,46] */ fmul v18.4s, v18.4s, v29.4s /* bs[51,50,55,54] */ fmul v19.4s, v19.4s, v29.4s /* bs[59,58,63,62] */ uzp1 v4.4s, v0.4s, v16.4s /* bs[32,36,35,39] */ uzp2 v5.4s, v0.4s, v16.4s /* bs[33,37,34,38] */ uzp1 v6.4s, v1.4s, v17.4s /* bs[40,44,43,47] */ uzp2 v7.4s, v1.4s, v17.4s /* bs[41,45,42,46] */ uzp1 v20.4s, v2.4s, v18.4s /* bs[48,52,51,55] */ uzp2 v21.4s, v2.4s, v18.4s /* bs[49,53,50,54] */ uzp1 v22.4s, v3.4s, v19.4s /* bs[56,60,59,63] */ uzp2 v23.4s, v3.4s, v19.4s /* bs[57,61,58,62] */ fsub v16.4s, v4.4s, v5.4s fsub v17.4s, v6.4s, v7.4s fsub v18.4s, v20.4s, v21.4s fsub v19.4s, v22.4s, v23.4s fadd v0.4s, v4.4s, v5.4s /* bs[0,4,2,6] */ fadd v1.4s, v6.4s, v7.4s /* bs[8,12,10,14] */ fadd v2.4s, v20.4s, v21.4s /* bs[16,20,18,22] */ fadd v3.4s, v22.4s, v23.4s /* bs[24,28,26,30] */ fmul v16.4s, v16.4s, v28.4s /* bs[1,5,3,7] */ fmul v17.4s, v17.4s, v28.4s /* bs[9,13,11,15] */ fmul v18.4s, v18.4s, v28.4s /* bs[17,21,19,23] */ fmul v19.4s, v19.4s, v28.4s /* bs[25,29,27,31] */ zip2 v4.2d, v0.2d, v1.2d /* bs[2,6,10,14] */ zip2 v5.2d, v16.2d, v17.2d /* bs[3,7,11,15] */ zip2 v6.2d, v2.2d, v3.2d /* bs[18,22,26,30] */ zip2 v7.2d, v18.2d, v19.2d /* bs[19,23,27,31] */ fadd v4.4s, v4.4s, v5.4s /* bs[2,6,10,14] */ fadd v6.4s, v6.4s, v7.4s /* bs[18,22,26,30] */ ins v0.d[1], v4.d[0] /* bs[0,4,2,6] */ ins v1.d[1], v4.d[1] /* bs[8,12,10,14] */ ins v2.d[1], v6.d[0] /* bs[16,20,18,22] */ ins v3.d[1], v6.d[1] /* bs[24,28,26,30] */ eor v31.16b, v31.16b, v31.16b zip1 v4.4s, v0.4s, v16.4s /* bs[0,1,4,5] */ zip2 v5.4s, v0.4s, v16.4s /* bs[2,3,6,7] */ zip1 v6.4s, v1.4s, v17.4s /* bs[8,9,12,13] */ zip2 v7.4s, v1.4s, v17.4s /* bs[10,11,14,15] */ zip1 v20.4s, v2.4s, v18.4s /* bs[16,17,20,21] */ zip2 v21.4s, v2.4s, v18.4s /* bs[18,19,22,23] */ zip1 v22.4s, v3.4s, v19.4s /* bs[24,25,28,29] */ zip2 v23.4s, v3.4s, v19.4s /* bs[26,27,30,31] */ zip1 v0.2d, v4.2d, v5.2d /* bs[0,1,2,3] */ zip2 v1.2d, v4.2d, v5.2d /* bs[4,5,6,7] */ zip1 v2.2d, v6.2d, v7.2d /* bs[8,9,10,11] */ zip2 v3.2d, v6.2d, v7.2d /* bs[12,13,14,15] */ rev64 v16.4s, v4.4s rev64 v17.4s, v6.4s zip1 v24.2d, v7.2d, v17.2d zip2 v16.2d, v5.2d, v16.2d zip2 v17.2d, v7.2d, v17.2d zip1 v4.2d, v20.2d, v21.2d /* bs[16,17,18,19] */ zip2 v5.2d, v20.2d, v21.2d /* bs[20,21,22,23] */ zip1 v6.2d, v22.2d, v23.2d /* bs[24,25,26,27] */ zip2 v7.2d, v22.2d, v23.2d /* bs[28,29,30,31] */ rev64 v18.4s, v20.4s rev64 v19.4s, v22.4s zip1 v25.2d, v23.2d, v19.2d zip1 v26.2d, v21.2d, v18.2d zip2 v18.2d, v21.2d, v18.2d zip2 v19.2d, v23.2d, v19.2d ins v16.s[3], v31.s[0] /* bs[6,7,5,-] */ ins v17.s[3], v31.s[0] /* bs[14,15,13,-] */ ins v18.s[3], v31.s[0] /* bs[22,23,21,-] */ ins v19.s[3], v31.s[0] /* bs[30,31,29,-] */ ins v24.s[3], v31.s[0] /* bs[10,11,9,-] */ ins v25.s[3], v31.s[0] /* bs[26,27,25,-] */ ins v26.s[3], v31.s[0] /* bs[18,19,17,-] */ fadd v1.4s, v1.4s, v16.4s fadd v3.4s, v3.4s, v17.4s fadd v5.4s, v5.4s, v18.4s fadd v7.4s, v7.4s, v19.4s fadd v2.4s, v2.4s, v3.4s fadd v3.4s, v3.4s, v24.4s fadd v6.4s, v6.4s, v7.4s fadd v7.4s, v7.4s, v25.4s fadd v4.4s, v4.4s, v6.4s fadd v6.4s, v6.4s, v5.4s fadd v5.4s, v5.4s, v7.4s fadd v7.4s, v7.4s, v26.4s mov x3, #64 st1 {v0.s}[1], [x0], x3 st1 {v7.s}[2], [x0], x3 st1 {v3.s}[2], [x0], x3 st1 {v5.s}[2], [x0], x3 st1 {v1.s}[2], [x0], x3 st1 {v6.s}[2], [x0], x3 st1 {v2.s}[2], [x0], x3 st1 {v4.s}[2], [x0], x3 st1 {v0.s}[2], [x0], x3 st1 {v7.s}[0], [x0], x3 st1 {v3.s}[0], [x0], x3 st1 {v5.s}[0], [x0], x3 st1 {v1.s}[0], [x0], x3 st1 {v6.s}[0], [x0], x3 st1 {v2.s}[0], [x0], x3 st1 {v4.s}[0], [x0], x3 st1 {v0.s}[0], [x0] st1 {v0.s}[1], [x1], x3 st1 {v4.s}[1], [x1], x3 st1 {v2.s}[1], [x1], x3 st1 {v6.s}[1], [x1], x3 st1 {v1.s}[1], [x1], x3 st1 {v5.s}[1], [x1], x3 st1 {v3.s}[1], [x1], x3 st1 {v7.s}[1], [x1], x3 st1 {v0.s}[3], [x1], x3 st1 {v4.s}[3], [x1], x3 st1 {v2.s}[3], [x1], x3 st1 {v6.s}[3], [x1], x3 st1 {v1.s}[3], [x1], x3 st1 {v5.s}[3], [x1], x3 st1 {v3.s}[3], [x1], x3 st1 {v7.s}[3], [x1] ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_neon_float.S000066400000000000000000000130501357201522000210730ustar00rootroot00000000000000/* dct64_neon_float: ARM NEON optimized dct64 (float output version) copyright 1995-2010 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifndef _M_ARM .code 32 #endif #ifndef __APPLE__ .fpu neon #endif .text ALIGN16 costab_arm: .word 1056974725 .word 1057056395 .word 1057223771 .word 1057485416 .word 1057855544 .word 1058356026 .word 1059019886 .word 1059897405 .word 1061067246 .word 1062657950 .word 1064892987 .word 1066774581 .word 1069414683 .word 1073984175 .word 1079645762 .word 1092815430 .word 1057005197 .word 1057342072 .word 1058087743 .word 1059427869 .word 1061799040 .word 1065862217 .word 1071413542 .word 1084439708 .word 1057128951 .word 1058664893 .word 1063675095 .word 1076102863 .word 1057655764 .word 1067924853 .word 1060439283 .word 1060439283 ALIGN4 GLOBAL_SYMBOL ASM_NAME(dct64_real_neon) #ifdef __ELF__ .type ASM_NAME(dct64_real_neon), %function #endif ASM_NAME(dct64_real_neon): vpush {q4-q7} adr r3, costab_arm vld1.32 {q0, q1}, [r2]! vld1.32 {q2, q3}, [r2]! vld1.32 {q4, q5}, [r2]! vld1.32 {q6, q7}, [r2] vld1.32 {q12, q13}, [r3, :128]! vld1.32 {q14, q15}, [r3, :128]! vrev64.32 q4, q4 vrev64.32 q5, q5 vrev64.32 q6, q6 vrev64.32 q7, q7 vswp d8, d9 vswp d10, d11 vswp d12, d13 vswp d14, d15 vsub.f32 q8, q0, q7 vsub.f32 q9, q1, q6 vsub.f32 q10, q2, q5 vsub.f32 q11, q3, q4 vadd.f32 q0, q0, q7 vadd.f32 q1, q1, q6 vadd.f32 q2, q2, q5 vadd.f32 q3, q3, q4 vmul.f32 q4, q8, q12 vmul.f32 q5, q9, q13 vmul.f32 q6, q10, q14 vmul.f32 q7, q11, q15 vld1.32 {q12, q13}, [r3, :128]! vld1.32 {q14, q15}, [r3, :128] vrev64.32 q2, q2 vrev64.32 q3, q3 vrev64.32 q6, q6 vrev64.32 q7, q7 vswp d4, d5 vswp d6, d7 vswp d12, d13 vswp d14, d15 vsub.f32 q8, q0, q3 vsub.f32 q9, q1, q2 vsub.f32 q10, q4, q7 vsub.f32 q11, q5, q6 vadd.f32 q0, q0, q3 vadd.f32 q1, q1, q2 vadd.f32 q4, q4, q7 vadd.f32 q5, q5, q6 vmul.f32 q2, q8, q12 vmul.f32 q3, q9, q13 vmul.f32 q6, q10, q12 vmul.f32 q7, q11, q13 vrev64.32 q1, q1 vrev64.32 q3, q3 vrev64.32 q5, q5 vrev64.32 q7, q7 vswp d2, d3 vswp d6, d7 vswp d10, d11 vswp d14, d15 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q14 vmul.f32 q3, q9, q14 vmul.f32 q5, q10, q14 vmul.f32 q7, q11, q14 vdup.32 q12, d31[0] vmov d31, d30 vswp d1, d2 vswp d5, d6 vswp d9, d10 vswp d13, d14 vrev64.32 q1, q1 vrev64.32 q3, q3 vrev64.32 q5, q5 vrev64.32 q7, q7 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q15 vmul.f32 q3, q9, q15 vmul.f32 q5, q10, q15 vmul.f32 q7, q11, q15 vtrn.32 q0, q1 vtrn.32 q2, q3 vtrn.32 q4, q5 vtrn.32 q6, q7 vsub.f32 q8, q0, q1 vsub.f32 q9, q2, q3 vsub.f32 q10, q4, q5 vsub.f32 q11, q6, q7 vadd.f32 q0, q0, q1 vadd.f32 q2, q2, q3 vadd.f32 q4, q4, q5 vadd.f32 q6, q6, q7 vmul.f32 q1, q8, q12 vmul.f32 q3, q9, q12 vmul.f32 q5, q10, q12 vmul.f32 q7, q11, q12 vtrn.32 q0, q1 vtrn.32 q2, q3 vtrn.32 q4, q5 vtrn.32 q6, q7 vswp d1, d2 vswp d5, d6 vswp d9, d10 vswp d13, d14 vshr.u64 d16, d1, #32 vshr.u64 d17, d3, #32 vshr.u64 d18, d5, #32 vshr.u64 d19, d7, #32 vadd.f32 d1, d1, d16 vadd.f32 d3, d3, d17 vadd.f32 d5, d5, d18 vadd.f32 d7, d7, d19 vshr.u64 d20, d9, #32 vshr.u64 d21, d11, #32 vshr.u64 d22, d13, #32 vshr.u64 d23, d15, #32 vadd.f32 d9, d9, d20 vadd.f32 d11, d11, d21 vadd.f32 d13, d13, d22 vadd.f32 d15, d15, d23 vshr.u64 d16, d2, #32 vshr.u64 d18, d6, #32 vshr.u64 d20, d10, #32 vshr.u64 d22, d14, #32 vext.8 q8, q1, q8, #8 vext.8 q9, q3, q9, #8 vext.8 q10, q5, q10, #8 vext.8 q11, q7, q11, #8 vadd.f32 q1, q1, q8 vadd.f32 q3, q3, q9 vadd.f32 q5, q5, q10 vadd.f32 q7, q7, q11 vshr.u64 d16, d4, #32 vshr.u64 d18, d12, #32 vext.8 q8, q2, q8, #8 vext.8 q9, q6, q9, #8 vadd.f32 q2, q2, q3 vadd.f32 q6, q6, q7 vadd.f32 q3, q3, q8 vadd.f32 q7, q7, q9 vrev64.32 q8, q4 vshr.u64 d19, d9, #32 vext.8 d17, d17, d16, #4 vswp d9, d10 vswp d13, d14 vtrn.32 q4, q5 vtrn.32 q6, q7 vmov d16, d9 vmov d18, d11 vadd.f32 q4, q6 vadd.f32 q5, q7 vadd.f32 q6, q8 vadd.f32 q7, q9 mov r3, #64 vst1.32 {d0[1]}, [r0, :32], r3 vst1.32 {d13[1]}, [r0, :32], r3 vst1.32 {d7[0]}, [r0, :32], r3 vst1.32 {d9[1]}, [r0, :32], r3 vst1.32 {d3[0]}, [r0, :32], r3 vst1.32 {d12[1]}, [r0, :32], r3 vst1.32 {d5[0]}, [r0, :32], r3 vst1.32 {d8[1]}, [r0, :32], r3 vst1.32 {d1[0]}, [r0, :32], r3 vst1.32 {d13[0]}, [r0, :32], r3 vst1.32 {d6[0]}, [r0, :32], r3 vst1.32 {d9[0]}, [r0, :32], r3 vst1.32 {d2[0]}, [r0, :32], r3 vst1.32 {d12[0]}, [r0, :32], r3 vst1.32 {d4[0]}, [r0, :32], r3 vst1.32 {d8[0]}, [r0, :32], r3 vst1.32 {d0[0]}, [r0, :32] vst1.32 {d0[1]}, [r1, :32], r3 vst1.32 {d10[0]}, [r1, :32], r3 vst1.32 {d4[1]}, [r1, :32], r3 vst1.32 {d14[0]}, [r1, :32], r3 vst1.32 {d2[1]}, [r1, :32], r3 vst1.32 {d11[0]}, [r1, :32], r3 vst1.32 {d6[1]}, [r1, :32], r3 vst1.32 {d15[0]}, [r1, :32], r3 vst1.32 {d1[1]}, [r1, :32], r3 vst1.32 {d10[1]}, [r1, :32], r3 vst1.32 {d5[1]}, [r1, :32], r3 vst1.32 {d14[1]}, [r1, :32], r3 vst1.32 {d3[1]}, [r1, :32], r3 vst1.32 {d11[1]}, [r1, :32], r3 vst1.32 {d7[1]}, [r1, :32], r3 vst1.32 {d15[1]}, [r1, :32] vpop {q4-q7} bx lr NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_sse.S000066400000000000000000000232651357201522000175520ustar00rootroot00000000000000/* dct64_sse: MMX/SSE optimized dct64 copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #define ARG(n) (8+n*4)(%ebp) #define TEMP(n) (4+n*16)(%esp) #define TEMP_BYTE(n) (4+n)(%esp) /* void dct64_sse(short *out0, short *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 pnpn: .long 0 .long -2147483648 .long 0 .long -2147483648 ALIGN16 mask: .long -1 .long -1 .long -1 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_sse) ASM_NAME(dct64_sse): pushl %ebp movl %esp, %ebp andl $-16, %esp /* align the stack at 16 bytes */ subl $128, %esp /* reserve space for temporal store */ pushl %ebx GET_GOT movl ARG(2), %eax MOVUAPS (%eax), %xmm7 MOVUAPS 16(%eax), %xmm6 MOVUAPS 112(%eax), %xmm0 MOVUAPS 96(%eax), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm7, %xmm4 movaps %xmm6, %xmm5 addps %xmm0, %xmm4 addps %xmm1, %xmm5 subps %xmm0, %xmm7 subps %xmm1, %xmm6 movaps %xmm4, TEMP(0) movaps %xmm5, TEMP(1) MOVUAPS 32(%eax), %xmm2 MOVUAPS 48(%eax), %xmm3 MOVUAPS 80(%eax), %xmm0 MOVUAPS 64(%eax), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm2, %xmm5 movaps %xmm3, %xmm4 addps %xmm0, %xmm2 addps %xmm1, %xmm3 subps %xmm0, %xmm5 subps %xmm1, %xmm4 #if defined(PIC) && defined(__APPLE__) mov GLOBAL_VAR_PTR(costab_mmxsse), %ecx #else lea GLOBAL_VAR(costab_mmxsse), %ecx #endif mulps (%ecx), %xmm7 mulps 16(%ecx), %xmm6 mulps 32(%ecx), %xmm5 mulps 48(%ecx), %xmm4 shufps $0x1b, %xmm2, %xmm2 shufps $0x1b, %xmm3, %xmm3 shufps $0x1b, %xmm4, %xmm4 shufps $0x1b, %xmm5, %xmm5 movaps TEMP(0), %xmm0 movaps TEMP(1), %xmm1 subps %xmm3, %xmm0 subps %xmm2, %xmm1 addps TEMP(0), %xmm3 addps TEMP(1), %xmm2 movaps %xmm3, TEMP(0) movaps %xmm2, TEMP(1) movaps %xmm6, %xmm2 movaps %xmm7, %xmm3 subps %xmm5, %xmm6 subps %xmm4, %xmm7 addps %xmm3, %xmm4 addps %xmm2, %xmm5 mulps 64(%ecx), %xmm0 mulps 80(%ecx), %xmm1 mulps 80(%ecx), %xmm6 mulps 64(%ecx), %xmm7 movaps TEMP(0), %xmm2 movaps TEMP(1), %xmm3 shufps $0x1b, %xmm3, %xmm3 shufps $0x1b, %xmm5, %xmm5 shufps $0x1b, %xmm1, %xmm1 shufps $0x1b, %xmm6, %xmm6 movaps %xmm0, TEMP(1) subps %xmm3, %xmm2 subps %xmm1, %xmm0 addps TEMP(0), %xmm3 addps TEMP(1), %xmm1 movaps %xmm3, TEMP(0) movaps %xmm1, TEMP(2) movaps %xmm5, %xmm1 movaps %xmm4, %xmm5 movaps %xmm7, %xmm3 subps %xmm1, %xmm5 subps %xmm6, %xmm7 addps %xmm1, %xmm4 addps %xmm3, %xmm6 mulps 96(%ecx), %xmm2 mulps 96(%ecx), %xmm0 mulps 96(%ecx), %xmm5 mulps 96(%ecx), %xmm7 movaps %xmm2, TEMP(1) movaps %xmm0, TEMP(3) movaps %xmm4, %xmm2 movaps %xmm5, %xmm3 shufps $0x44, %xmm6, %xmm2 shufps $0xbb, %xmm7, %xmm5 shufps $0xbb, %xmm6, %xmm4 shufps $0x44, %xmm7, %xmm3 movaps %xmm2, %xmm6 movaps %xmm3, %xmm7 subps %xmm4, %xmm2 subps %xmm5, %xmm3 addps %xmm6, %xmm4 addps %xmm7, %xmm5 movaps 112(%ecx), %xmm0 movlhps %xmm0, %xmm0 mulps %xmm0, %xmm2 mulps %xmm0, %xmm3 movaps %xmm0, TEMP(4) movaps %xmm4, %xmm6 movaps %xmm5, %xmm7 shufps $0x14, %xmm2, %xmm4 shufps $0xbe, %xmm2, %xmm6 shufps $0x14, %xmm3, %xmm5 shufps $0xbe, %xmm3, %xmm7 movaps %xmm5, TEMP(5) movaps %xmm7, TEMP(7) movaps TEMP(0), %xmm0 movaps TEMP(1), %xmm1 movaps %xmm0, %xmm2 movaps %xmm1, %xmm3 shufps $0x44, TEMP(2), %xmm2 shufps $0xbb, TEMP(3), %xmm1 shufps $0xbb, TEMP(2), %xmm0 shufps $0x44, TEMP(3), %xmm3 movaps %xmm2, %xmm5 movaps %xmm3, %xmm7 subps %xmm0, %xmm2 subps %xmm1, %xmm3 addps %xmm5, %xmm0 addps %xmm7, %xmm1 mulps TEMP(4), %xmm2 mulps TEMP(4), %xmm3 movaps %xmm0, %xmm5 movaps %xmm1, %xmm7 shufps $0x14, %xmm2, %xmm0 shufps $0xbe, %xmm2, %xmm5 shufps $0x14, %xmm3, %xmm1 shufps $0xbe, %xmm3, %xmm7 movaps %xmm0, TEMP(0) movaps %xmm1, TEMP(1) movaps %xmm5, TEMP(2) movaps %xmm7, TEMP(3) movss 120(%ecx), %xmm5 shufps $0x00, %xmm5, %xmm5 xorps LOCAL_VAR(pnpn), %xmm5 movaps %xmm4, %xmm0 movaps %xmm6, %xmm1 unpcklps TEMP(5), %xmm4 unpckhps TEMP(5), %xmm0 unpcklps TEMP(7), %xmm6 unpckhps TEMP(7), %xmm1 movaps %xmm4, %xmm2 movaps %xmm6, %xmm3 unpcklps %xmm0, %xmm4 unpckhps %xmm0, %xmm2 unpcklps %xmm1, %xmm6 unpckhps %xmm1, %xmm3 movaps %xmm4, %xmm0 movaps %xmm6, %xmm1 subps %xmm2, %xmm0 subps %xmm3, %xmm1 addps %xmm2, %xmm4 addps %xmm3, %xmm6 mulps %xmm5, %xmm0 mulps %xmm5, %xmm1 movaps %xmm5, TEMP(5) movaps %xmm4, %xmm5 movaps %xmm6, %xmm7 unpcklps %xmm0, %xmm4 unpckhps %xmm0, %xmm5 unpcklps %xmm1, %xmm6 unpckhps %xmm1, %xmm7 movaps TEMP(0), %xmm0 movaps TEMP(2), %xmm2 movaps %xmm4, TEMP(4) movaps %xmm6, TEMP(6) movaps %xmm0, %xmm4 movaps %xmm2, %xmm6 unpcklps TEMP(1), %xmm0 unpckhps TEMP(1), %xmm4 unpcklps TEMP(3), %xmm2 unpckhps TEMP(3), %xmm6 movaps %xmm0, %xmm1 movaps %xmm2, %xmm3 unpcklps %xmm4, %xmm0 unpckhps %xmm4, %xmm1 unpcklps %xmm6, %xmm2 unpckhps %xmm6, %xmm3 movaps %xmm0, %xmm4 movaps %xmm2, %xmm6 subps %xmm1, %xmm4 subps %xmm3, %xmm6 addps %xmm1, %xmm0 addps %xmm3, %xmm2 mulps TEMP(5), %xmm4 mulps TEMP(5), %xmm6 movaps %xmm0, %xmm1 movaps %xmm2, %xmm3 unpcklps %xmm4, %xmm0 unpckhps %xmm4, %xmm1 unpcklps %xmm6, %xmm2 unpckhps %xmm6, %xmm3 movaps %xmm0, TEMP(0) movaps %xmm1, TEMP(1) movaps %xmm2, TEMP(2) movaps %xmm3, TEMP(3) movaps %xmm5, TEMP(5) movaps %xmm7, TEMP(7) movss TEMP_BYTE(12), %xmm0 movss TEMP_BYTE(28), %xmm1 movss TEMP_BYTE(44), %xmm2 movss TEMP_BYTE(60), %xmm3 addss TEMP_BYTE(8), %xmm0 addss TEMP_BYTE(24), %xmm1 addss TEMP_BYTE(40), %xmm2 addss TEMP_BYTE(56), %xmm3 movss %xmm0, TEMP_BYTE(8) movss %xmm1, TEMP_BYTE(24) movss %xmm2, TEMP_BYTE(40) movss %xmm3, TEMP_BYTE(56) movss TEMP_BYTE(76), %xmm0 movss TEMP_BYTE(92), %xmm1 movss TEMP_BYTE(108), %xmm2 movss TEMP_BYTE(124), %xmm3 addss TEMP_BYTE(72), %xmm0 addss TEMP_BYTE(88), %xmm1 addss TEMP_BYTE(104), %xmm2 addss TEMP_BYTE(120), %xmm3 movss %xmm0, TEMP_BYTE(72) movss %xmm1, TEMP_BYTE(88) movss %xmm2, TEMP_BYTE(104) movss %xmm3, TEMP_BYTE(120) movaps TEMP_BYTE(16), %xmm1 movaps TEMP_BYTE(48), %xmm3 movaps TEMP_BYTE(80), %xmm5 movaps TEMP_BYTE(112), %xmm7 movaps %xmm1, %xmm0 movaps %xmm3, %xmm2 movaps %xmm5, %xmm4 movaps %xmm7, %xmm6 shufps $0x1e, %xmm0, %xmm0 shufps $0x1e, %xmm2, %xmm2 shufps $0x1e, %xmm4, %xmm4 shufps $0x1e, %xmm6, %xmm6 leal LOCAL_VAR(mask), %ecx andps (%ecx), %xmm0 andps (%ecx), %xmm2 andps (%ecx), %xmm4 andps (%ecx), %xmm6 addps %xmm0, %xmm1 addps %xmm2, %xmm3 addps %xmm4, %xmm5 addps %xmm6, %xmm7 movaps TEMP_BYTE(32), %xmm2 movaps TEMP_BYTE(96), %xmm6 movaps %xmm2, %xmm0 movaps %xmm6, %xmm4 shufps $0x1e, %xmm0, %xmm0 shufps $0x1e, %xmm4, %xmm4 andps (%ecx), %xmm0 andps (%ecx), %xmm4 addps %xmm3, %xmm2 addps %xmm0, %xmm3 addps %xmm7, %xmm6 addps %xmm4, %xmm7 movaps TEMP_BYTE(0), %xmm0 movaps TEMP_BYTE(64), %xmm4 cvtps2pi %xmm0, %mm0 cvtps2pi %xmm1, %mm1 movhlps %xmm0, %xmm0 movhlps %xmm1, %xmm1 cvtps2pi %xmm0, %mm2 cvtps2pi %xmm1, %mm3 packssdw %mm2, %mm0 packssdw %mm3, %mm1 cvtps2pi %xmm2, %mm2 cvtps2pi %xmm3, %mm3 movhlps %xmm2, %xmm2 movhlps %xmm3, %xmm3 cvtps2pi %xmm2, %mm4 cvtps2pi %xmm3, %mm5 packssdw %mm4, %mm2 packssdw %mm5, %mm3 mov %ecx, TEMP_BYTE(0) movl ARG(0), %ecx movl ARG(1), %ebx movd %mm0, %eax movd %mm1, %edx movw %ax, 512(%ecx) movw %dx, 384(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, (%ecx) movw %ax, (%ebx) movw %dx, 128(%ebx) movd %mm2, %eax movd %mm3, %edx movw %ax, 448(%ecx) movw %dx, 320(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 64(%ebx) movw %dx, 192(%ebx) psrlq $32, %mm0 psrlq $32, %mm1 movd %mm0, %eax movd %mm1, %edx movw %ax, 256(%ecx) movw %dx, 128(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 256(%ebx) movw %dx, 384(%ebx) psrlq $32, %mm2 psrlq $32, %mm3 movd %mm2, %eax movd %mm3, %edx movw %ax, 192(%ecx) movw %dx, 64(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 320(%ebx) movw %dx, 448(%ebx) mov TEMP_BYTE(0), %eax movaps %xmm4, %xmm0 shufps $0x1e, %xmm0, %xmm0 movaps %xmm5, %xmm1 andps (%eax), %xmm0 addps %xmm6, %xmm4 addps %xmm7, %xmm5 addps %xmm1, %xmm6 addps %xmm0, %xmm7 cvtps2pi %xmm4, %mm0 cvtps2pi %xmm5, %mm1 movhlps %xmm4, %xmm4 movhlps %xmm5, %xmm5 cvtps2pi %xmm4, %mm2 cvtps2pi %xmm5, %mm3 packssdw %mm2, %mm0 packssdw %mm3, %mm1 cvtps2pi %xmm6, %mm2 cvtps2pi %xmm7, %mm3 movhlps %xmm6, %xmm6 movhlps %xmm7, %xmm7 cvtps2pi %xmm6, %mm4 cvtps2pi %xmm7, %mm5 packssdw %mm4, %mm2 packssdw %mm5, %mm3 movd %mm0, %eax movd %mm2, %edx movw %ax, 480(%ecx) movw %dx, 416(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 32(%ebx) movw %dx, 96(%ebx) psrlq $32, %mm0 psrlq $32, %mm2 movd %mm0, %eax movd %mm2, %edx movw %ax, 224(%ecx) movw %dx, 160(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 288(%ebx) movw %dx, 352(%ebx) movd %mm1, %eax movd %mm3, %edx movw %ax, 352(%ecx) movw %dx, 288(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 160(%ebx) movw %dx, 224(%ebx) psrlq $32, %mm1 psrlq $32, %mm3 movd %mm1, %eax movd %mm3, %edx movw %ax, 96(%ecx) movw %dx, 32(%ecx) shrl $16, %eax shrl $16, %edx movw %ax, 416(%ebx) movw %dx, 480(%ebx) popl %ebx movl %ebp, %esp popl %ebp ret #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_costab_mmxsse: .indirect_symbol ASM_NAME(costab_mmxsse) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_sse_float.S000066400000000000000000000220161357201522000207300ustar00rootroot00000000000000/* dct64_sse_float: SSE optimized dct64 (float output version) copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #define ARG(n) (8+n*4)(%ebp) #define TEMP(n) (4+n*16)(%esp) #define TEMP_BYTE(n) (4+n)(%esp) /* void dct64_real_sse(real *out0, real *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN16 pnpn: .long 0 .long -2147483648 .long 0 .long -2147483648 ALIGN16 mask: .long -1 .long -1 .long -1 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_real_sse) ASM_NAME(dct64_real_sse): pushl %ebp movl %esp, %ebp andl $-16, %esp /* align the stack at 16 bytes */ subl $128, %esp /* reserve space for temporal store */ pushl %ebx GET_GOT movl ARG(2), %eax MOVUAPS (%eax), %xmm7 MOVUAPS 16(%eax), %xmm6 MOVUAPS 112(%eax), %xmm0 MOVUAPS 96(%eax), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm7, %xmm4 movaps %xmm6, %xmm5 addps %xmm0, %xmm4 addps %xmm1, %xmm5 subps %xmm0, %xmm7 subps %xmm1, %xmm6 movaps %xmm4, TEMP(0) movaps %xmm5, TEMP(1) MOVUAPS 32(%eax), %xmm2 MOVUAPS 48(%eax), %xmm3 MOVUAPS 80(%eax), %xmm0 MOVUAPS 64(%eax), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm2, %xmm5 movaps %xmm3, %xmm4 addps %xmm0, %xmm2 addps %xmm1, %xmm3 subps %xmm0, %xmm5 subps %xmm1, %xmm4 #if defined(PIC) && defined(__APPLE__) mov GLOBAL_VAR_PTR(costab_mmxsse), %eax #else lea GLOBAL_VAR(costab_mmxsse), %eax #endif mulps (%eax), %xmm7 mulps 16(%eax), %xmm6 mulps 32(%eax), %xmm5 mulps 48(%eax), %xmm4 shufps $0x1b, %xmm2, %xmm2 shufps $0x1b, %xmm3, %xmm3 shufps $0x1b, %xmm4, %xmm4 shufps $0x1b, %xmm5, %xmm5 movaps TEMP(0), %xmm0 movaps TEMP(1), %xmm1 subps %xmm3, %xmm0 subps %xmm2, %xmm1 addps TEMP(0), %xmm3 addps TEMP(1), %xmm2 movaps %xmm3, TEMP(0) movaps %xmm2, TEMP(1) movaps %xmm6, %xmm2 movaps %xmm7, %xmm3 subps %xmm5, %xmm6 subps %xmm4, %xmm7 addps %xmm3, %xmm4 addps %xmm2, %xmm5 mulps 64(%eax), %xmm0 mulps 80(%eax), %xmm1 mulps 80(%eax), %xmm6 mulps 64(%eax), %xmm7 movaps TEMP(0), %xmm2 movaps TEMP(1), %xmm3 shufps $0x1b, %xmm3, %xmm3 shufps $0x1b, %xmm5, %xmm5 shufps $0x1b, %xmm1, %xmm1 shufps $0x1b, %xmm6, %xmm6 movaps %xmm0, TEMP(1) subps %xmm3, %xmm2 subps %xmm1, %xmm0 addps TEMP(0), %xmm3 addps TEMP(1), %xmm1 movaps %xmm3, TEMP(0) movaps %xmm1, TEMP(2) movaps %xmm5, %xmm1 movaps %xmm4, %xmm5 movaps %xmm7, %xmm3 subps %xmm1, %xmm5 subps %xmm6, %xmm7 addps %xmm1, %xmm4 addps %xmm3, %xmm6 mulps 96(%eax), %xmm2 mulps 96(%eax), %xmm0 mulps 96(%eax), %xmm5 mulps 96(%eax), %xmm7 movaps %xmm2, TEMP(1) movaps %xmm0, TEMP(3) movaps %xmm4, %xmm2 movaps %xmm5, %xmm3 shufps $0x44, %xmm6, %xmm2 shufps $0xbb, %xmm7, %xmm5 shufps $0xbb, %xmm6, %xmm4 shufps $0x44, %xmm7, %xmm3 movaps %xmm2, %xmm6 movaps %xmm3, %xmm7 subps %xmm4, %xmm2 subps %xmm5, %xmm3 addps %xmm6, %xmm4 addps %xmm7, %xmm5 movaps 112(%eax), %xmm0 movlhps %xmm0, %xmm0 mulps %xmm0, %xmm2 mulps %xmm0, %xmm3 movaps %xmm0, TEMP(4) movaps %xmm4, %xmm6 movaps %xmm5, %xmm7 shufps $0x14, %xmm2, %xmm4 shufps $0xbe, %xmm2, %xmm6 shufps $0x14, %xmm3, %xmm5 shufps $0xbe, %xmm3, %xmm7 movaps %xmm5, TEMP(5) movaps %xmm7, TEMP(7) movaps TEMP(0), %xmm0 movaps TEMP(1), %xmm1 movaps %xmm0, %xmm2 movaps %xmm1, %xmm3 shufps $0x44, TEMP(2), %xmm2 shufps $0xbb, TEMP(3), %xmm1 shufps $0xbb, TEMP(2), %xmm0 shufps $0x44, TEMP(3), %xmm3 movaps %xmm2, %xmm5 movaps %xmm3, %xmm7 subps %xmm0, %xmm2 subps %xmm1, %xmm3 addps %xmm5, %xmm0 addps %xmm7, %xmm1 mulps TEMP(4), %xmm2 mulps TEMP(4), %xmm3 movaps %xmm0, %xmm5 movaps %xmm1, %xmm7 shufps $0x14, %xmm2, %xmm0 shufps $0xbe, %xmm2, %xmm5 shufps $0x14, %xmm3, %xmm1 shufps $0xbe, %xmm3, %xmm7 movaps %xmm0, TEMP(0) movaps %xmm1, TEMP(1) movaps %xmm5, TEMP(2) movaps %xmm7, TEMP(3) movss 120(%eax), %xmm5 shufps $0x00, %xmm5, %xmm5 xorps LOCAL_VAR(pnpn), %xmm5 movaps %xmm4, %xmm0 movaps %xmm6, %xmm1 unpcklps TEMP(5), %xmm4 unpckhps TEMP(5), %xmm0 unpcklps TEMP(7), %xmm6 unpckhps TEMP(7), %xmm1 movaps %xmm4, %xmm2 movaps %xmm6, %xmm3 unpcklps %xmm0, %xmm4 unpckhps %xmm0, %xmm2 unpcklps %xmm1, %xmm6 unpckhps %xmm1, %xmm3 movaps %xmm4, %xmm0 movaps %xmm6, %xmm1 subps %xmm2, %xmm0 subps %xmm3, %xmm1 addps %xmm2, %xmm4 addps %xmm3, %xmm6 mulps %xmm5, %xmm0 mulps %xmm5, %xmm1 movaps %xmm5, TEMP(5) movaps %xmm4, %xmm5 movaps %xmm6, %xmm7 unpcklps %xmm0, %xmm4 unpckhps %xmm0, %xmm5 unpcklps %xmm1, %xmm6 unpckhps %xmm1, %xmm7 movaps TEMP(0), %xmm0 movaps TEMP(2), %xmm2 movaps %xmm4, TEMP(4) movaps %xmm6, TEMP(6) movaps %xmm0, %xmm4 movaps %xmm2, %xmm6 unpcklps TEMP(1), %xmm0 unpckhps TEMP(1), %xmm4 unpcklps TEMP(3), %xmm2 unpckhps TEMP(3), %xmm6 movaps %xmm0, %xmm1 movaps %xmm2, %xmm3 unpcklps %xmm4, %xmm0 unpckhps %xmm4, %xmm1 unpcklps %xmm6, %xmm2 unpckhps %xmm6, %xmm3 movaps %xmm0, %xmm4 movaps %xmm2, %xmm6 subps %xmm1, %xmm4 subps %xmm3, %xmm6 addps %xmm1, %xmm0 addps %xmm3, %xmm2 mulps TEMP(5), %xmm4 mulps TEMP(5), %xmm6 movaps %xmm0, %xmm1 movaps %xmm2, %xmm3 unpcklps %xmm4, %xmm0 unpckhps %xmm4, %xmm1 unpcklps %xmm6, %xmm2 unpckhps %xmm6, %xmm3 movaps %xmm0, TEMP(0) movaps %xmm1, TEMP(1) movaps %xmm2, TEMP(2) movaps %xmm3, TEMP(3) movaps %xmm5, TEMP(5) movaps %xmm7, TEMP(7) movss TEMP_BYTE(12), %xmm0 movss TEMP_BYTE(28), %xmm1 movss TEMP_BYTE(44), %xmm2 movss TEMP_BYTE(60), %xmm3 addss TEMP_BYTE(8), %xmm0 addss TEMP_BYTE(24), %xmm1 addss TEMP_BYTE(40), %xmm2 addss TEMP_BYTE(56), %xmm3 movss %xmm0, TEMP_BYTE(8) movss %xmm1, TEMP_BYTE(24) movss %xmm2, TEMP_BYTE(40) movss %xmm3, TEMP_BYTE(56) movss TEMP_BYTE(76), %xmm0 movss TEMP_BYTE(92), %xmm1 movss TEMP_BYTE(108), %xmm2 movss TEMP_BYTE(124), %xmm3 addss TEMP_BYTE(72), %xmm0 addss TEMP_BYTE(88), %xmm1 addss TEMP_BYTE(104), %xmm2 addss TEMP_BYTE(120), %xmm3 movss %xmm0, TEMP_BYTE(72) movss %xmm1, TEMP_BYTE(88) movss %xmm2, TEMP_BYTE(104) movss %xmm3, TEMP_BYTE(120) movaps TEMP_BYTE(16), %xmm1 movaps TEMP_BYTE(48), %xmm3 movaps TEMP_BYTE(80), %xmm5 movaps TEMP_BYTE(112), %xmm7 movaps %xmm1, %xmm0 movaps %xmm3, %xmm2 movaps %xmm5, %xmm4 movaps %xmm7, %xmm6 shufps $0x1e, %xmm0, %xmm0 shufps $0x1e, %xmm2, %xmm2 shufps $0x1e, %xmm4, %xmm4 shufps $0x1e, %xmm6, %xmm6 lea LOCAL_VAR(mask), %eax andps (%eax), %xmm0 andps (%eax), %xmm2 andps (%eax), %xmm4 andps (%eax), %xmm6 addps %xmm0, %xmm1 addps %xmm2, %xmm3 addps %xmm4, %xmm5 addps %xmm6, %xmm7 movaps TEMP_BYTE(32), %xmm2 movaps TEMP_BYTE(96), %xmm6 movaps %xmm2, %xmm0 movaps %xmm6, %xmm4 shufps $0x1e, %xmm0, %xmm0 shufps $0x1e, %xmm4, %xmm4 andps (%eax), %xmm0 andps (%eax), %xmm4 addps %xmm3, %xmm2 addps %xmm0, %xmm3 addps %xmm7, %xmm6 addps %xmm4, %xmm7 movaps TEMP_BYTE(0), %xmm0 movaps TEMP_BYTE(64), %xmm4 movl ARG(0), %ecx movl ARG(1), %ebx movss %xmm0, 1024(%ecx) movss %xmm2, 896(%ecx) movss %xmm1, 768(%ecx) movss %xmm3, 640(%ecx) shufps $0xe1, %xmm0, %xmm0 shufps $0xe1, %xmm2, %xmm2 shufps $0xe1, %xmm1, %xmm1 shufps $0xe1, %xmm3, %xmm3 movss %xmm0, (%ecx) movss %xmm0, (%ebx) movss %xmm2, 128(%ebx) movss %xmm1, 256(%ebx) movss %xmm3, 384(%ebx) movhlps %xmm0, %xmm0 movhlps %xmm2, %xmm2 movhlps %xmm1, %xmm1 movhlps %xmm3, %xmm3 movss %xmm0, 512(%ecx) movss %xmm2, 384(%ecx) movss %xmm1, 256(%ecx) movss %xmm3, 128(%ecx) shufps $0xe1, %xmm0, %xmm0 shufps $0xe1, %xmm2, %xmm2 shufps $0xe1, %xmm1, %xmm1 shufps $0xe1, %xmm3, %xmm3 movss %xmm0, 512(%ebx) movss %xmm2, 640(%ebx) movss %xmm1, 768(%ebx) movss %xmm3, 896(%ebx) movaps %xmm4, %xmm0 shufps $0x1e, %xmm0, %xmm0 movaps %xmm5, %xmm1 andps (%eax), %xmm0 addps %xmm6, %xmm4 addps %xmm7, %xmm5 addps %xmm1, %xmm6 addps %xmm0, %xmm7 movss %xmm4, 960(%ecx) movss %xmm6, 832(%ecx) movss %xmm5, 704(%ecx) movss %xmm7, 576(%ecx) movhlps %xmm4, %xmm0 movhlps %xmm6, %xmm1 movhlps %xmm5, %xmm2 movhlps %xmm7, %xmm3 movss %xmm0, 448(%ecx) movss %xmm1, 320(%ecx) movss %xmm2, 192(%ecx) movss %xmm3, 64(%ecx) shufps $0xe1, %xmm4, %xmm4 shufps $0xe1, %xmm6, %xmm6 shufps $0xe1, %xmm5, %xmm5 shufps $0xe1, %xmm7, %xmm7 movss %xmm4, 64(%ebx) movss %xmm6, 192(%ebx) movss %xmm5, 320(%ebx) movss %xmm7, 448(%ebx) shufps $0xe1, %xmm0, %xmm0 shufps $0xe1, %xmm1, %xmm1 shufps $0xe1, %xmm2, %xmm2 shufps $0xe1, %xmm3, %xmm3 movss %xmm0, 576(%ebx) movss %xmm1, 704(%ebx) movss %xmm2, 832(%ebx) movss %xmm3, 960(%ebx) popl %ebx movl %ebp, %esp popl %ebp ret #if defined(PIC) && defined(__APPLE__) .section __IMPORT,__pointers,non_lazy_symbol_pointers L_costab_mmxsse: .indirect_symbol ASM_NAME(costab_mmxsse) .long 0 #endif NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_x86_64.S000066400000000000000000000227221357201522000177130ustar00rootroot00000000000000/* dct64_x86_64: SSE optimized dct64 for x86-64 copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifdef IS_MSABI /* short *out0 */ #define ARG0 %r9 /* short *out1 */ #define ARG1 %rdx /* real *samples */ #define ARG2 %r8 #else /* short *out0 */ #define ARG0 %rdi /* short *out1 */ #define ARG1 %rsi /* real *samples */ #define ARG2 %rdx #endif /* void dct64_x86_64(short *out0, short *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN32 ASM_NAME(costab_x86_64): .long 1056974725 .long 1057056395 .long 1057223771 .long 1057485416 .long 1057855544 .long 1058356026 .long 1059019886 .long 1059897405 .long 1061067246 .long 1062657950 .long 1064892987 .long 1066774581 .long 1069414683 .long 1073984175 .long 1079645762 .long 1092815430 .long 1057005197 .long 1057342072 .long 1058087743 .long 1059427869 .long 1061799040 .long 1065862217 .long 1071413542 .long 1084439708 .long 1057128951 .long 1058664893 .long 1063675095 .long 1076102863 .long 1057655764 .long 1067924853 .long 1060439283 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_x86_64) ASM_NAME(dct64_x86_64): #ifdef IS_MSABI /* should save xmm6-15 */ movq %rcx, ARG0 subq $168, %rsp /* stack alignment + 10 xmm registers */ movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) movaps %xmm13, 112(%rsp) movaps %xmm14, 128(%rsp) movaps %xmm15, 144(%rsp) #endif leaq ASM_NAME(costab_x86_64)(%rip), %rcx MOVUAPS (ARG2), %xmm15 MOVUAPS 16(ARG2), %xmm14 MOVUAPS 112(ARG2), %xmm0 MOVUAPS 96(ARG2), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm15, %xmm8 movaps %xmm14, %xmm9 addps %xmm0, %xmm8 addps %xmm1, %xmm9 subps %xmm0, %xmm15 subps %xmm1, %xmm14 MOVUAPS 32(ARG2), %xmm13 MOVUAPS 48(ARG2), %xmm12 MOVUAPS 80(ARG2), %xmm0 MOVUAPS 64(ARG2), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm13, %xmm10 movaps %xmm12, %xmm11 addps %xmm0, %xmm10 addps %xmm1, %xmm11 subps %xmm0, %xmm13 subps %xmm1, %xmm12 movaps (%rcx), %xmm0 movaps 16(%rcx), %xmm1 movaps 32(%rcx), %xmm2 movaps 48(%rcx), %xmm3 mulps %xmm0, %xmm15 mulps %xmm1, %xmm14 mulps %xmm2, %xmm13 mulps %xmm3, %xmm12 movaps 64(%rcx), %xmm0 movaps 80(%rcx), %xmm1 pshufd $0x1b, %xmm11, %xmm2 pshufd $0x1b, %xmm10, %xmm3 shufps $0x1b, %xmm13, %xmm13 shufps $0x1b, %xmm12, %xmm12 movaps %xmm8, %xmm11 movaps %xmm9, %xmm10 movaps %xmm14, %xmm4 movaps %xmm15, %xmm5 subps %xmm2, %xmm11 subps %xmm3, %xmm10 subps %xmm13, %xmm14 subps %xmm12, %xmm15 addps %xmm2, %xmm8 addps %xmm3, %xmm9 addps %xmm5, %xmm12 addps %xmm4, %xmm13 mulps %xmm0, %xmm11 mulps %xmm1, %xmm10 mulps %xmm1, %xmm14 mulps %xmm0, %xmm15 movaps 96(%rcx), %xmm0 pshufd $0x1b, %xmm9, %xmm1 pshufd $0x1b, %xmm13, %xmm2 shufps $0x1b, %xmm10, %xmm10 shufps $0x1b, %xmm14, %xmm14 movaps %xmm8, %xmm9 movaps %xmm12, %xmm13 movaps %xmm11, %xmm3 movaps %xmm15, %xmm4 subps %xmm1, %xmm9 subps %xmm2, %xmm13 subps %xmm10, %xmm11 subps %xmm14, %xmm15 addps %xmm1, %xmm8 addps %xmm2, %xmm12 addps %xmm3, %xmm10 addps %xmm4, %xmm14 mulps %xmm0, %xmm9 mulps %xmm0, %xmm13 mulps %xmm0, %xmm11 mulps %xmm0, %xmm15 movaps 112(%rcx), %xmm0 movaps %xmm0, %xmm1 movlhps %xmm1, %xmm1 movaps %xmm8, %xmm2 movaps %xmm9, %xmm3 shufps $0x44, %xmm10, %xmm2 shufps $0xbb, %xmm11, %xmm9 shufps $0xbb, %xmm10, %xmm8 shufps $0x44, %xmm11, %xmm3 movaps %xmm2, %xmm4 movaps %xmm3, %xmm5 subps %xmm8, %xmm2 subps %xmm9, %xmm3 addps %xmm4, %xmm8 addps %xmm5, %xmm9 mulps %xmm1, %xmm2 mulps %xmm1, %xmm3 movaps %xmm8, %xmm10 movaps %xmm9, %xmm11 shufps $0x14, %xmm2, %xmm8 shufps $0xbe, %xmm2, %xmm10 shufps $0x14, %xmm3, %xmm9 shufps $0xbe, %xmm3, %xmm11 movaps %xmm12, %xmm2 movaps %xmm13, %xmm3 shufps $0x44, %xmm14, %xmm2 shufps $0xbb, %xmm15, %xmm13 shufps $0xbb, %xmm14, %xmm12 shufps $0x44, %xmm15, %xmm3 movaps %xmm2, %xmm4 movaps %xmm3, %xmm5 subps %xmm12, %xmm2 subps %xmm13, %xmm3 addps %xmm4, %xmm12 addps %xmm5, %xmm13 mulps %xmm1, %xmm2 mulps %xmm1, %xmm3 movaps %xmm12, %xmm14 movaps %xmm13, %xmm15 shufps $0x14, %xmm2, %xmm12 shufps $0xbe, %xmm2, %xmm14 shufps $0x14, %xmm3, %xmm13 shufps $0xbe, %xmm3, %xmm15 shufps $0xaa, %xmm0, %xmm0 pcmpeqd %xmm1, %xmm1 pslld $31, %xmm1 psllq $32, %xmm1 xorps %xmm1, %xmm0 movaps %xmm8, %xmm1 movaps %xmm10, %xmm2 unpcklps %xmm9, %xmm8 unpckhps %xmm9, %xmm1 unpcklps %xmm11, %xmm10 unpckhps %xmm11, %xmm2 movaps %xmm8, %xmm3 movaps %xmm10, %xmm4 unpcklps %xmm1, %xmm8 unpckhps %xmm1, %xmm3 unpcklps %xmm2, %xmm10 unpckhps %xmm2, %xmm4 movaps %xmm8, %xmm1 movaps %xmm10, %xmm2 subps %xmm3, %xmm1 subps %xmm4, %xmm2 addps %xmm3, %xmm8 addps %xmm4, %xmm10 mulps %xmm0, %xmm1 mulps %xmm0, %xmm2 movaps %xmm8, %xmm9 movaps %xmm10, %xmm11 unpcklps %xmm1, %xmm8 unpckhps %xmm1, %xmm9 unpcklps %xmm2, %xmm10 unpckhps %xmm2, %xmm11 movaps %xmm12, %xmm1 movaps %xmm14, %xmm2 unpcklps %xmm13, %xmm12 unpckhps %xmm13, %xmm1 unpcklps %xmm15, %xmm14 unpckhps %xmm15, %xmm2 movaps %xmm12, %xmm3 movaps %xmm14, %xmm4 unpcklps %xmm1, %xmm12 unpckhps %xmm1, %xmm3 unpcklps %xmm2, %xmm14 unpckhps %xmm2, %xmm4 movaps %xmm12, %xmm1 movaps %xmm14, %xmm2 subps %xmm3, %xmm1 subps %xmm4, %xmm2 addps %xmm3, %xmm12 addps %xmm4, %xmm14 mulps %xmm0, %xmm1 mulps %xmm0, %xmm2 movaps %xmm12, %xmm13 movaps %xmm14, %xmm15 unpcklps %xmm1, %xmm12 unpckhps %xmm1, %xmm13 unpcklps %xmm2, %xmm14 unpckhps %xmm2, %xmm15 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm8, %xmm0 shufpd $0x2, %xmm9, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm8 addps %xmm1, %xmm9 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm10, %xmm0 shufpd $0x2, %xmm11, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm10 addps %xmm1, %xmm11 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm12, %xmm0 shufpd $0x2, %xmm13, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm12 addps %xmm1, %xmm13 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm14, %xmm0 shufpd $0x2, %xmm15, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm14 addps %xmm1, %xmm15 pshufd $0x78, %xmm9, %xmm0 pshufd $0x78, %xmm11, %xmm1 pshufd $0x78, %xmm13, %xmm2 pshufd $0x78, %xmm15, %xmm3 psrldq $4, %xmm0 psrldq $4, %xmm1 psrldq $4, %xmm2 psrldq $4, %xmm3 addps %xmm0, %xmm9 addps %xmm1, %xmm11 addps %xmm2, %xmm13 addps %xmm3, %xmm15 pshufd $0x78, %xmm10, %xmm0 pshufd $0x78, %xmm14, %xmm1 psrldq $4, %xmm0 psrldq $4, %xmm1 addps %xmm11, %xmm10 addps %xmm15, %xmm14 addps %xmm0, %xmm11 addps %xmm1, %xmm15 cvtps2dq %xmm8, %xmm8 cvtps2dq %xmm9, %xmm9 cvtps2dq %xmm10, %xmm10 cvtps2dq %xmm11, %xmm11 packssdw %xmm10, %xmm8 packssdw %xmm11, %xmm9 movd %xmm8, %eax movd %xmm9, %ecx movw %ax, 512(ARG0) movw %cx, 384(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, (ARG0) movw %ax, (ARG1) movw %cx, 128(ARG1) movhlps %xmm8, %xmm0 movhlps %xmm9, %xmm1 movd %xmm0, %eax movd %xmm1, %ecx movw %ax, 448(ARG0) movw %cx, 320(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 64(ARG1) movw %cx, 192(ARG1) pshuflw $0xee, %xmm8, %xmm2 pshuflw $0xee, %xmm9, %xmm3 movd %xmm2, %eax movd %xmm3, %ecx movw %ax, 256(ARG0) movw %cx, 128(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 256(ARG1) movw %cx, 384(ARG1) pshuflw $0xee, %xmm0, %xmm0 pshuflw $0xee, %xmm1, %xmm1 movd %xmm0, %eax movd %xmm1, %ecx movw %ax, 192(ARG0) movw %cx, 64(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 320(ARG1) movw %cx, 448(ARG1) movaps %xmm12, %xmm0 movaps %xmm13, %xmm1 movaps %xmm14, %xmm2 movaps %xmm15, %xmm3 shufps $0x1e, %xmm0, %xmm0 pslldq $4, %xmm0 psrldq $4, %xmm0 addps %xmm2, %xmm12 addps %xmm3, %xmm13 addps %xmm1, %xmm14 addps %xmm0, %xmm15 cvtps2dq %xmm12, %xmm12 cvtps2dq %xmm13, %xmm13 cvtps2dq %xmm14, %xmm14 cvtps2dq %xmm15, %xmm15 packssdw %xmm13, %xmm12 packssdw %xmm15, %xmm14 movd %xmm12, %eax movd %xmm14, %ecx movw %ax, 480(ARG0) movw %cx, 416(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 32(ARG1) movw %cx, 96(ARG1) pshuflw $0xee, %xmm12, %xmm0 pshuflw $0xee, %xmm14, %xmm1 movd %xmm0, %eax movd %xmm1, %ecx movw %ax, 224(ARG0) movw %cx, 160(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 288(ARG1) movw %cx, 352(ARG1) movhlps %xmm12, %xmm0 movhlps %xmm14, %xmm1 movd %xmm0, %eax movd %xmm1, %ecx movw %ax, 352(ARG0) movw %cx, 288(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 160(ARG1) movw %cx, 224(ARG1) pshuflw $0xee, %xmm0, %xmm0 pshuflw $0xee, %xmm1, %xmm1 movd %xmm0, %eax movd %xmm1, %ecx movw %ax, 96(ARG0) movw %cx, 32(ARG0) shrl $16, %eax shrl $16, %ecx movw %ax, 416(ARG1) movw %cx, 480(ARG1) #ifdef IS_MSABI movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 movaps 112(%rsp), %xmm13 movaps 128(%rsp), %xmm14 movaps 144(%rsp), %xmm15 addq $168, %rsp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/dct64_x86_64_float.S000066400000000000000000000217731357201522000211050ustar00rootroot00000000000000/* dct64_x86_64_float: SSE optimized dct64 for x86-64 (float output version) copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" #ifdef IS_MSABI /* short *out0 */ #define ARG0 %r9 /* short *out1 */ #define ARG1 %rdx /* real *samples */ #define ARG2 %r8 #else /* real *out0 */ #define ARG0 %rdi /* real *out1 */ #define ARG1 %rsi /* real *samples */ #define ARG2 %rdx #endif /* void dct64_real_x86_64(real *out0, real *out1, real *samples); */ #ifndef __APPLE__ .section .rodata #else .data #endif ALIGN32 ASM_NAME(costab_x86_64): .long 1056974725 .long 1057056395 .long 1057223771 .long 1057485416 .long 1057855544 .long 1058356026 .long 1059019886 .long 1059897405 .long 1061067246 .long 1062657950 .long 1064892987 .long 1066774581 .long 1069414683 .long 1073984175 .long 1079645762 .long 1092815430 .long 1057005197 .long 1057342072 .long 1058087743 .long 1059427869 .long 1061799040 .long 1065862217 .long 1071413542 .long 1084439708 .long 1057128951 .long 1058664893 .long 1063675095 .long 1076102863 .long 1057655764 .long 1067924853 .long 1060439283 .long 0 .text ALIGN16 .globl ASM_NAME(dct64_real_x86_64) ASM_NAME(dct64_real_x86_64): #ifdef IS_MSABI /* should save xmm6-15 */ movq %rcx, ARG0 subq $168, %rsp /* stack alignment + 10 xmm registers */ movaps %xmm6, (%rsp) movaps %xmm7, 16(%rsp) movaps %xmm8, 32(%rsp) movaps %xmm9, 48(%rsp) movaps %xmm10, 64(%rsp) movaps %xmm11, 80(%rsp) movaps %xmm12, 96(%rsp) movaps %xmm13, 112(%rsp) movaps %xmm14, 128(%rsp) movaps %xmm15, 144(%rsp) #endif leaq ASM_NAME(costab_x86_64)(%rip), %rcx MOVUAPS (ARG2), %xmm15 MOVUAPS 16(ARG2), %xmm14 MOVUAPS 112(ARG2), %xmm0 MOVUAPS 96(ARG2), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm15, %xmm8 movaps %xmm14, %xmm9 addps %xmm0, %xmm8 addps %xmm1, %xmm9 subps %xmm0, %xmm15 subps %xmm1, %xmm14 MOVUAPS 32(ARG2), %xmm13 MOVUAPS 48(ARG2), %xmm12 MOVUAPS 80(ARG2), %xmm0 MOVUAPS 64(ARG2), %xmm1 shufps $0x1b, %xmm0, %xmm0 shufps $0x1b, %xmm1, %xmm1 movaps %xmm13, %xmm10 movaps %xmm12, %xmm11 addps %xmm0, %xmm10 addps %xmm1, %xmm11 subps %xmm0, %xmm13 subps %xmm1, %xmm12 movaps (%rcx), %xmm0 movaps 16(%rcx), %xmm1 movaps 32(%rcx), %xmm2 movaps 48(%rcx), %xmm3 mulps %xmm0, %xmm15 mulps %xmm1, %xmm14 mulps %xmm2, %xmm13 mulps %xmm3, %xmm12 movaps 64(%rcx), %xmm0 movaps 80(%rcx), %xmm1 pshufd $0x1b, %xmm11, %xmm2 pshufd $0x1b, %xmm10, %xmm3 shufps $0x1b, %xmm13, %xmm13 shufps $0x1b, %xmm12, %xmm12 movaps %xmm8, %xmm11 movaps %xmm9, %xmm10 movaps %xmm14, %xmm4 movaps %xmm15, %xmm5 subps %xmm2, %xmm11 subps %xmm3, %xmm10 subps %xmm13, %xmm14 subps %xmm12, %xmm15 addps %xmm2, %xmm8 addps %xmm3, %xmm9 addps %xmm5, %xmm12 addps %xmm4, %xmm13 mulps %xmm0, %xmm11 mulps %xmm1, %xmm10 mulps %xmm1, %xmm14 mulps %xmm0, %xmm15 movaps 96(%rcx), %xmm0 pshufd $0x1b, %xmm9, %xmm1 pshufd $0x1b, %xmm13, %xmm2 shufps $0x1b, %xmm10, %xmm10 shufps $0x1b, %xmm14, %xmm14 movaps %xmm8, %xmm9 movaps %xmm12, %xmm13 movaps %xmm11, %xmm3 movaps %xmm15, %xmm4 subps %xmm1, %xmm9 subps %xmm2, %xmm13 subps %xmm10, %xmm11 subps %xmm14, %xmm15 addps %xmm1, %xmm8 addps %xmm2, %xmm12 addps %xmm3, %xmm10 addps %xmm4, %xmm14 mulps %xmm0, %xmm9 mulps %xmm0, %xmm13 mulps %xmm0, %xmm11 mulps %xmm0, %xmm15 movaps 112(%rcx), %xmm0 movaps %xmm0, %xmm1 movlhps %xmm1, %xmm1 movaps %xmm8, %xmm2 movaps %xmm9, %xmm3 shufps $0x44, %xmm10, %xmm2 shufps $0xbb, %xmm11, %xmm9 shufps $0xbb, %xmm10, %xmm8 shufps $0x44, %xmm11, %xmm3 movaps %xmm2, %xmm4 movaps %xmm3, %xmm5 subps %xmm8, %xmm2 subps %xmm9, %xmm3 addps %xmm4, %xmm8 addps %xmm5, %xmm9 mulps %xmm1, %xmm2 mulps %xmm1, %xmm3 movaps %xmm8, %xmm10 movaps %xmm9, %xmm11 shufps $0x14, %xmm2, %xmm8 shufps $0xbe, %xmm2, %xmm10 shufps $0x14, %xmm3, %xmm9 shufps $0xbe, %xmm3, %xmm11 movaps %xmm12, %xmm2 movaps %xmm13, %xmm3 shufps $0x44, %xmm14, %xmm2 shufps $0xbb, %xmm15, %xmm13 shufps $0xbb, %xmm14, %xmm12 shufps $0x44, %xmm15, %xmm3 movaps %xmm2, %xmm4 movaps %xmm3, %xmm5 subps %xmm12, %xmm2 subps %xmm13, %xmm3 addps %xmm4, %xmm12 addps %xmm5, %xmm13 mulps %xmm1, %xmm2 mulps %xmm1, %xmm3 movaps %xmm12, %xmm14 movaps %xmm13, %xmm15 shufps $0x14, %xmm2, %xmm12 shufps $0xbe, %xmm2, %xmm14 shufps $0x14, %xmm3, %xmm13 shufps $0xbe, %xmm3, %xmm15 shufps $0xaa, %xmm0, %xmm0 pcmpeqd %xmm1, %xmm1 pslld $31, %xmm1 psllq $32, %xmm1 xorps %xmm1, %xmm0 movaps %xmm8, %xmm1 movaps %xmm10, %xmm2 unpcklps %xmm9, %xmm8 unpckhps %xmm9, %xmm1 unpcklps %xmm11, %xmm10 unpckhps %xmm11, %xmm2 movaps %xmm8, %xmm3 movaps %xmm10, %xmm4 unpcklps %xmm1, %xmm8 unpckhps %xmm1, %xmm3 unpcklps %xmm2, %xmm10 unpckhps %xmm2, %xmm4 movaps %xmm8, %xmm1 movaps %xmm10, %xmm2 subps %xmm3, %xmm1 subps %xmm4, %xmm2 addps %xmm3, %xmm8 addps %xmm4, %xmm10 mulps %xmm0, %xmm1 mulps %xmm0, %xmm2 movaps %xmm8, %xmm9 movaps %xmm10, %xmm11 unpcklps %xmm1, %xmm8 unpckhps %xmm1, %xmm9 unpcklps %xmm2, %xmm10 unpckhps %xmm2, %xmm11 movaps %xmm12, %xmm1 movaps %xmm14, %xmm2 unpcklps %xmm13, %xmm12 unpckhps %xmm13, %xmm1 unpcklps %xmm15, %xmm14 unpckhps %xmm15, %xmm2 movaps %xmm12, %xmm3 movaps %xmm14, %xmm4 unpcklps %xmm1, %xmm12 unpckhps %xmm1, %xmm3 unpcklps %xmm2, %xmm14 unpckhps %xmm2, %xmm4 movaps %xmm12, %xmm1 movaps %xmm14, %xmm2 subps %xmm3, %xmm1 subps %xmm4, %xmm2 addps %xmm3, %xmm12 addps %xmm4, %xmm14 mulps %xmm0, %xmm1 mulps %xmm0, %xmm2 movaps %xmm12, %xmm13 movaps %xmm14, %xmm15 unpcklps %xmm1, %xmm12 unpckhps %xmm1, %xmm13 unpcklps %xmm2, %xmm14 unpckhps %xmm2, %xmm15 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm8, %xmm0 shufpd $0x2, %xmm9, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm8 addps %xmm1, %xmm9 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm10, %xmm0 shufpd $0x2, %xmm11, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm10 addps %xmm1, %xmm11 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm12, %xmm0 shufpd $0x2, %xmm13, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm12 addps %xmm1, %xmm13 xorps %xmm0, %xmm0 xorps %xmm1, %xmm1 shufpd $0x2, %xmm14, %xmm0 shufpd $0x2, %xmm15, %xmm1 psrlq $32, %xmm0 psrlq $32, %xmm1 addps %xmm0, %xmm14 addps %xmm1, %xmm15 pshufd $0x78, %xmm9, %xmm0 pshufd $0x78, %xmm11, %xmm1 pshufd $0x78, %xmm13, %xmm2 pshufd $0x78, %xmm15, %xmm3 psrldq $4, %xmm0 psrldq $4, %xmm1 psrldq $4, %xmm2 psrldq $4, %xmm3 addps %xmm0, %xmm9 addps %xmm1, %xmm11 addps %xmm2, %xmm13 addps %xmm3, %xmm15 pshufd $0x78, %xmm10, %xmm0 pshufd $0x78, %xmm14, %xmm1 psrldq $4, %xmm0 psrldq $4, %xmm1 addps %xmm11, %xmm10 addps %xmm15, %xmm14 addps %xmm0, %xmm11 addps %xmm1, %xmm15 movss %xmm8, 1024(ARG0) movss %xmm10, 896(ARG0) movss %xmm9, 768(ARG0) movss %xmm11, 640(ARG0) movhlps %xmm8, %xmm0 movhlps %xmm10, %xmm1 movhlps %xmm9, %xmm2 movhlps %xmm11, %xmm3 movss %xmm0, 512(ARG0) movss %xmm1, 384(ARG0) movss %xmm2, 256(ARG0) movss %xmm3, 128(ARG0) pshuflw $0xee, %xmm8, %xmm4 pshuflw $0xee, %xmm10, %xmm5 pshuflw $0xee, %xmm9, %xmm6 pshuflw $0xee, %xmm11, %xmm7 movss %xmm4, (ARG0) movss %xmm4, (ARG1) movss %xmm5, 128(ARG1) movss %xmm6, 256(ARG1) movss %xmm7, 384(ARG1) pshuflw $0xee, %xmm0, %xmm0 pshuflw $0xee, %xmm1, %xmm1 pshuflw $0xee, %xmm2, %xmm2 pshuflw $0xee, %xmm3, %xmm3 movss %xmm0, 512(ARG1) movss %xmm1, 640(ARG1) movss %xmm2, 768(ARG1) movss %xmm3, 896(ARG1) pshufd $0x78, %xmm12, %xmm0 movaps %xmm13, %xmm1 psrldq $4, %xmm0 addps %xmm14, %xmm12 addps %xmm15, %xmm13 addps %xmm1, %xmm14 addps %xmm0, %xmm15 movss %xmm12, 960(ARG0) movss %xmm14, 832(ARG0) movss %xmm13, 704(ARG0) movss %xmm15, 576(ARG0) movhlps %xmm12, %xmm0 movhlps %xmm14, %xmm1 movhlps %xmm13, %xmm2 movhlps %xmm15, %xmm3 movss %xmm0, 448(ARG0) movss %xmm1, 320(ARG0) movss %xmm2, 192(ARG0) movss %xmm3, 64(ARG0) pshuflw $0xee, %xmm12, %xmm4 pshuflw $0xee, %xmm14, %xmm5 pshuflw $0xee, %xmm13, %xmm6 pshuflw $0xee, %xmm15, %xmm7 movss %xmm4, 64(ARG1) movss %xmm5, 192(ARG1) movss %xmm6, 320(ARG1) movss %xmm7, 448(ARG1) pshuflw $0xee, %xmm0, %xmm0 pshuflw $0xee, %xmm1, %xmm1 pshuflw $0xee, %xmm2, %xmm2 pshuflw $0xee, %xmm3, %xmm3 movss %xmm0, 576(ARG1) movss %xmm1, 704(ARG1) movss %xmm2, 832(ARG1) movss %xmm3, 960(ARG1) #ifdef IS_MSABI movaps (%rsp), %xmm6 movaps 16(%rsp), %xmm7 movaps 32(%rsp), %xmm8 movaps 48(%rsp), %xmm9 movaps 64(%rsp), %xmm10 movaps 80(%rsp), %xmm11 movaps 96(%rsp), %xmm12 movaps 112(%rsp), %xmm13 movaps 128(%rsp), %xmm14 movaps 144(%rsp), %xmm15 addq $168, %rsp #endif ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/debug.h000066400000000000000000000314161357201522000170640ustar00rootroot00000000000000/* debug.h: if DEBUG defined: debugging macro fprintf wrappers else: macros defined to do nothing That saves typing #ifdef DEBUG all the time and still preserves lean code without debugging. public domain (or LGPL / GPL, if you like that more;-) generated by debugdef.pl, what was trivially written by Thomas Orgis */ #include "config.h" /* I could do that with variadic macros available: #define sdebug(me, s) fprintf(stderr, "[location] " s "\n") #define debug(me, s, ...) fprintf(stderr, "[location] " s "}n", __VA_ARGS__) Variadic macros are a C99 feature... Now just predefining stuff non-variadic for up to 15 arguments. It's cumbersome to have them all with different names, though... */ #ifdef ME #define DBGPRFX ME": " #else #define DBGPRFX "" #endif #ifdef DEBUG #include #define debug(s) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__) #define debug1(s, a) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a) #define debug2(s, a, b) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b) #define debug3(s, a, b, c) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c) #define debug4(s, a, b, c, d) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d) #define debug5(s, a, b, c, d, e) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e) #define debug6(s, a, b, c, d, e, f) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f) #define debug7(s, a, b, c, d, e, f, g) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g) #define debug8(s, a, b, c, d, e, f, g, h) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h) #define debug9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) #define debug10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) #define debug11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) #define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) #define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) #define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #else #define debug(s) #define debug1(s, a) #define debug2(s, a, b) #define debug3(s, a, b, c) #define debug4(s, a, b, c, d) #define debug5(s, a, b, c, d, e) #define debug6(s, a, b, c, d, e, f) #define debug7(s, a, b, c, d, e, f, g) #define debug8(s, a, b, c, d, e, f, g, h) #define debug9(s, a, b, c, d, e, f, g, h, i) #define debug10(s, a, b, c, d, e, f, g, h, i, j) #define debug11(s, a, b, c, d, e, f, g, h, i, j, k) #define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) #define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) #define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #endif /* warning macros also here... */ #ifndef NO_WARNING #define warning(s) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__) #define warning1(s, a) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a) #define warning2(s, a, b) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b) #define warning3(s, a, b, c) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c) #define warning4(s, a, b, c, d) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d) #define warning5(s, a, b, c, d, e) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e) #define warning6(s, a, b, c, d, e, f) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f) #define warning7(s, a, b, c, d, e, f, g) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g) #define warning8(s, a, b, c, d, e, f, g, h) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h) #define warning9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) #define warning10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) #define warning11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) #define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) #define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) #define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #else #define warning(s) #define warning1(s, a) #define warning2(s, a, b) #define warning3(s, a, b, c) #define warning4(s, a, b, c, d) #define warning5(s, a, b, c, d, e) #define warning6(s, a, b, c, d, e, f) #define warning7(s, a, b, c, d, e, f, g) #define warning8(s, a, b, c, d, e, f, g, h) #define warning9(s, a, b, c, d, e, f, g, h, i) #define warning10(s, a, b, c, d, e, f, g, h, i, j) #define warning11(s, a, b, c, d, e, f, g, h, i, j, k) #define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) #define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) #define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #endif /* error macros also here... */ #ifndef NO_ERROR #define error(s) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__) #define error1(s, a) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a) #define error2(s, a, b) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b) #define error3(s, a, b, c) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c) #define error4(s, a, b, c, d) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d) #define error5(s, a, b, c, d, e) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e) #define error6(s, a, b, c, d, e, f) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f) #define error7(s, a, b, c, d, e, f, g) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g) #define error8(s, a, b, c, d, e, f, g, h) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h) #define error9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) #define error10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) #define error11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) #define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) #define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) #define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #else #define error(s) #define error1(s, a) #define error2(s, a, b) #define error3(s, a, b, c) #define error4(s, a, b, c, d) #define error5(s, a, b, c, d, e) #define error6(s, a, b, c, d, e, f) #define error7(s, a, b, c, d, e, f, g) #define error8(s, a, b, c, d, e, f, g, h) #define error9(s, a, b, c, d, e, f, g, h, i) #define error10(s, a, b, c, d, e, f, g, h, i, j) #define error11(s, a, b, c, d, e, f, g, h, i, j, k) #define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) #define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) #define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) #define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #endif /* ereturn macros also here... */ #ifndef NO_ERETURN #define ereturn(rv, s) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__); return rv; }while(0) #define ereturn1(rv, s, a) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a); return rv; }while(0) #define ereturn2(rv, s, a, b) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b); return rv; }while(0) #define ereturn3(rv, s, a, b, c) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c); return rv; }while(0) #define ereturn4(rv, s, a, b, c, d) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d); return rv; }while(0) #define ereturn5(rv, s, a, b, c, d, e) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e); return rv; }while(0) #define ereturn6(rv, s, a, b, c, d, e, f) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f); return rv; }while(0) #define ereturn7(rv, s, a, b, c, d, e, f, g) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g); return rv; }while(0) #define ereturn8(rv, s, a, b, c, d, e, f, g, h) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h); return rv; }while(0) #define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i); return rv; }while(0) #define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j); return rv; }while(0) #define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k); return rv; }while(0) #define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l); return rv; }while(0) #define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m); return rv; }while(0) #define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n); return rv; }while(0) #define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) do{ fprintf(stderr, DBGPRFX"[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); return rv; }while(0) #else #define ereturn(rv, s) return rv #define ereturn1(rv, s, a) return rv #define ereturn2(rv, s, a, b) return rv #define ereturn3(rv, s, a, b, c) return rv #define ereturn4(rv, s, a, b, c, d) return rv #define ereturn5(rv, s, a, b, c, d, e) return rv #define ereturn6(rv, s, a, b, c, d, e, f) return rv #define ereturn7(rv, s, a, b, c, d, e, f, g) return rv #define ereturn8(rv, s, a, b, c, d, e, f, g, h) return rv #define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) return rv #define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) return rv #define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) return rv #define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) return rv #define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) return rv #define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) return rv #define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) return rv #endif welle.io-2.1/src/libs/mpg123/decode.h000066400000000000000000000301031357201522000172110ustar00rootroot00000000000000/* decode.h: common definitions for decode functions This file is strongly tied with optimize.h concerning the synth functions. Perhaps one should restructure that a bit. copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis, taking WRITE_SAMPLE from decode.c */ #ifndef MPG123_DECODE_H #define MPG123_DECODE_H /* Selection of class of output routines for basic format. */ #ifndef REAL_IS_FIXED #define OUT_FORMATS 4 /* Basic output formats: 16bit, 8bit, real and s32 */ #else #define OUT_FORMATS 2 /* Only up to 16bit */ #endif #define OUT_16 0 #define OUT_8 1 /* Those are defined but not supported for fixed point decoding! */ #define OUT_REAL 2 /* Write a floating point sample (that is, one matching the internal real type). */ #define OUT_S32 3 #ifdef NO_NTOM #define NTOM_MAX 1 #else #define NTOM_MAX 8 /* maximum allowed factor for upsampling */ #define NTOM_MAX_FREQ 96000 /* maximum frequency to upsample to / downsample from */ #define NTOM_MUL (32768) void ntom_set_ntom(mpg123_handle *fr, off_t num); #endif /* Let's collect all possible synth functions here, for an overview. If they are actually defined and used depends on preprocessor machinery. See synth.c and optimize.h for that, also some special C and assembler files. */ #ifndef NO_16BIT /* The signed-16bit-producing variants. */ int synth_1to1 (real*, int, mpg123_handle*, int); int synth_1to1_dither (real*, int, mpg123_handle*, int); int synth_1to1_i386 (real*, int, mpg123_handle*, int); int synth_1to1_i586 (real*, int, mpg123_handle*, int); int synth_1to1_i586_dither(real*, int, mpg123_handle*, int); int synth_1to1_mmx (real*, int, mpg123_handle*, int); int synth_1to1_3dnow (real*, int, mpg123_handle*, int); int synth_1to1_sse (real*, int, mpg123_handle*, int); int synth_1to1_stereo_sse (real*, real*, mpg123_handle*); int synth_1to1_3dnowext (real*, int, mpg123_handle*, int); int synth_1to1_altivec (real*, int, mpg123_handle*, int); int synth_1to1_stereo_altivec(real*, real*, mpg123_handle*); int synth_1to1_x86_64 (real*, int, mpg123_handle*, int); int synth_1to1_stereo_x86_64(real*, real*, mpg123_handle*); int synth_1to1_avx (real*, int, mpg123_handle*, int); int synth_1to1_stereo_avx (real*, real*, mpg123_handle*); int synth_1to1_arm (real*, int, mpg123_handle*, int); int synth_1to1_neon (real*, int, mpg123_handle*, int); int synth_1to1_stereo_neon(real*, real*, mpg123_handle*); int synth_1to1_neon64 (real*, int, mpg123_handle*, int); int synth_1to1_stereo_neon64(real*, real*, mpg123_handle*); /* This is different, special usage in layer3.c only. Hence, the name... and now forget about it. Never use it outside that special portion of code inside layer3.c! */ int absynth_1to1_i486(real*, int, mpg123_handle*, int); /* These mono/stereo converters use one of the above for the grunt work. */ int synth_1to1_mono (real*, mpg123_handle*); int synth_1to1_m2s(real*, mpg123_handle*); /* Sample rate decimation comes in less flavours. */ #ifndef NO_DOWNSAMPLE int synth_2to1 (real*, int, mpg123_handle*, int); int synth_2to1_dither (real*, int, mpg123_handle*, int); int synth_2to1_i386 (real*, int, mpg123_handle*, int); int synth_2to1_mono (real*, mpg123_handle*); int synth_2to1_m2s(real*, mpg123_handle*); int synth_4to1 (real *,int, mpg123_handle*, int); int synth_4to1_dither (real *,int, mpg123_handle*, int); int synth_4to1_i386 (real*, int, mpg123_handle*, int); int synth_4to1_mono (real*, mpg123_handle*); int synth_4to1_m2s(real*, mpg123_handle*); #endif #ifndef NO_NTOM /* NtoM is really just one implementation. */ int synth_ntom (real *,int, mpg123_handle*, int); int synth_ntom_mono (real *, mpg123_handle *); int synth_ntom_m2s (real *, mpg123_handle *); #endif #endif #ifndef NO_8BIT /* The 8bit-producing variants. */ /* There are direct 8-bit synths and wrappers over a possibly optimized 16bit one. */ int synth_1to1_8bit (real*, int, mpg123_handle*, int); int synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int); #ifndef NO_16BIT int synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int); int synth_1to1_8bit_mono (real*, mpg123_handle*); #endif int synth_1to1_8bit_m2s(real*, mpg123_handle*); #ifndef NO_16BIT int synth_1to1_8bit_wrap_mono (real*, mpg123_handle*); int synth_1to1_8bit_wrap_m2s(real*, mpg123_handle*); #endif #ifndef NO_DOWNSAMPLE int synth_2to1_8bit (real*, int, mpg123_handle*, int); int synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int); int synth_2to1_8bit_mono (real*, mpg123_handle*); int synth_2to1_8bit_m2s(real*, mpg123_handle*); int synth_4to1_8bit (real*, int, mpg123_handle*, int); int synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int); int synth_4to1_8bit_mono (real*, mpg123_handle*); int synth_4to1_8bit_m2s(real*, mpg123_handle*); #endif #ifndef NO_NTOM int synth_ntom_8bit (real*, int, mpg123_handle*, int); int synth_ntom_8bit_mono (real*, mpg123_handle*); int synth_ntom_8bit_m2s(real*, mpg123_handle*); #endif #endif #ifndef REAL_IS_FIXED #ifndef NO_REAL /* The real-producing variants. */ int synth_1to1_real (real*, int, mpg123_handle*, int); int synth_1to1_real_i386 (real*, int, mpg123_handle*, int); int synth_1to1_real_sse (real*, int, mpg123_handle*, int); int synth_1to1_real_stereo_sse (real*, real*, mpg123_handle*); int synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int); int synth_1to1_real_stereo_x86_64(real*, real*, mpg123_handle*); int synth_1to1_real_avx (real*, int, mpg123_handle*, int); int synth_1to1_fltst_avx (real*, real*, mpg123_handle*); int synth_1to1_real_altivec (real*, int, mpg123_handle*, int); int synth_1to1_fltst_altivec(real*, real*, mpg123_handle*); int synth_1to1_real_neon (real*, int, mpg123_handle*, int); int synth_1to1_real_stereo_neon(real*, real*, mpg123_handle*); int synth_1to1_real_neon64 (real*, int, mpg123_handle*, int); int synth_1to1_fltst_neon64(real*, real*, mpg123_handle*); int synth_1to1_real_mono (real*, mpg123_handle*); int synth_1to1_real_m2s(real*, mpg123_handle*); #ifndef NO_DOWNSAMPLE int synth_2to1_real (real*, int, mpg123_handle*, int); int synth_2to1_real_i386 (real*, int, mpg123_handle*, int); int synth_2to1_real_mono (real*, mpg123_handle*); int synth_2to1_real_m2s(real*, mpg123_handle*); int synth_4to1_real (real*, int, mpg123_handle*, int); int synth_4to1_real_i386 (real*, int, mpg123_handle*, int); int synth_4to1_real_mono (real*, mpg123_handle*); int synth_4to1_real_m2s(real*, mpg123_handle*); #endif #ifndef NO_NTOM int synth_ntom_real (real*, int, mpg123_handle*, int); int synth_ntom_real_mono (real*, mpg123_handle*); int synth_ntom_real_m2s(real*, mpg123_handle*); #endif #endif #ifndef NO_32BIT /* 32bit integer */ int synth_1to1_s32 (real*, int, mpg123_handle*, int); int synth_1to1_s32_i386 (real*, int, mpg123_handle*, int); int synth_1to1_s32_sse (real*, int, mpg123_handle*, int); int synth_1to1_s32_stereo_sse (real*, real*, mpg123_handle*); int synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int); int synth_1to1_s32_stereo_x86_64(real*, real*, mpg123_handle*); int synth_1to1_s32_avx (real*, int, mpg123_handle*, int); int synth_1to1_s32_stereo_avx (real*, real*, mpg123_handle*); int synth_1to1_s32_altivec (real*, int, mpg123_handle*, int); int synth_1to1_s32_stereo_altivec(real*, real*, mpg123_handle*); int synth_1to1_s32_neon (real*, int, mpg123_handle*, int); int synth_1to1_s32_stereo_neon(real*, real*, mpg123_handle*); int synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int); int synth_1to1_s32st_neon64(real*, real*, mpg123_handle*); int synth_1to1_s32_mono (real*, mpg123_handle*); int synth_1to1_s32_m2s(real*, mpg123_handle*); #ifndef NO_DOWNSAMPLE int synth_2to1_s32 (real*, int, mpg123_handle*, int); int synth_2to1_s32_i386 (real*, int, mpg123_handle*, int); int synth_2to1_s32_mono (real*, mpg123_handle*); int synth_2to1_s32_m2s(real*, mpg123_handle*); int synth_4to1_s32 (real*, int, mpg123_handle*, int); int synth_4to1_s32_i386 (real*, int, mpg123_handle*, int); int synth_4to1_s32_mono (real*, mpg123_handle*); int synth_4to1_s32_m2s(real*, mpg123_handle*); #endif #ifndef NO_NTOM int synth_ntom_s32 (real*, int, mpg123_handle*, int); int synth_ntom_s32_mono (real*, mpg123_handle*); int synth_ntom_s32_m2s(real*, mpg123_handle*); #endif #endif #endif /* FIXED */ /* Inside these synth functions, some dct64 variants may be used. The special optimized ones that only appear in assembler code are not mentioned here. And, generally, these functions are only employed in a matching synth function. */ void dct64 (real *,real *,real *); void dct64_i386 (real *,real *,real *); void dct64_altivec(real *,real *,real *); void dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/ /* This is used by the layer 3 decoder, one generic function and 3DNow variants. */ void dct36 (real *,real *,real *,real *,real *); void dct36_3dnow (real *,real *,real *,real *,real *); void dct36_3dnowext(real *,real *,real *,real *,real *); void dct36_x86_64 (real *,real *,real *,real *,real *); void dct36_sse (real *,real *,real *,real *,real *); void dct36_avx (real *,real *,real *,real *,real *); void dct36_neon (real *,real *,real *,real *,real *); void dct36_neon64 (real *,real *,real *,real *,real *); /* Tools for NtoM resampling synth, defined in ntom.c . */ int synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */ unsigned long ntom_val(mpg123_handle *fr, off_t frame); /* compute ntom_val for frame offset */ /* Frame and sample offsets. */ #ifndef NO_NTOM /* Outsamples of _this_ frame. To be exact: The samples to be expected from the next frame decode (using the current ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one. */ off_t ntom_frame_outsamples(mpg123_handle *fr); /* Total out/insample offset. */ off_t ntom_frmouts(mpg123_handle *fr, off_t frame); off_t ntom_ins2outs(mpg123_handle *fr, off_t ins); off_t ntom_frameoff(mpg123_handle *fr, off_t soff); #endif /* Initialization of any static data that majy be needed at runtime. Make sure you call these once before it is too late. */ #ifndef NO_LAYER3 void init_layer3(void); real init_layer3_gainpow2(mpg123_handle *fr, int i); void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i)); #endif #ifndef NO_LAYER12 void init_layer12(void); real* init_layer12_table(mpg123_handle *fr, real *table, int m); void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m)); #endif void prepare_decode_tables(void); extern real *pnts[5]; /* tabinit provides, dct64 needs */ /* Runtime (re)init functions; needed more often. */ void make_decode_tables(mpg123_handle *fr); /* For every volume change. */ /* Stuff needed after updating synth setup (see set_synth_functions()). */ #ifdef OPT_MMXORSSE /* Special treatment for mmx-like decoders, these functions go into the slots below. */ void make_decode_tables_mmx(mpg123_handle *fr); #ifndef NO_LAYER3 real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i); #endif #ifndef NO_LAYER12 real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m); #endif #endif #ifndef NO_8BIT /* Needed when switching to 8bit output. */ int make_conv16to8_table(mpg123_handle *fr); #endif /* These are the actual workers. They operate on the parsed frame data and handle decompression to audio samples. The synth functions defined above are called from inside the layer handlers. */ #ifndef NO_LAYER3 int do_layer3(mpg123_handle *fr); #endif #ifndef NO_LAYER2 int do_layer2(mpg123_handle *fr); #endif #ifndef NO_LAYER1 int do_layer1(mpg123_handle *fr); #endif /* There's an 3DNow counterpart in asm. */ void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]); #endif welle.io-2.1/src/libs/mpg123/dither.c000066400000000000000000000001621357201522000172420ustar00rootroot00000000000000/* Hack to allow building the same code with and without libtool. */ #include "intsym.h" #include "dither_impl.h" welle.io-2.1/src/libs/mpg123/dither.h000066400000000000000000000010621357201522000172470ustar00rootroot00000000000000/* dither: Generate noise for dithering / noise shaping. copyright 2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #ifndef MPG123_DITHER_H #define MPG123_DITHER_H #define DITHERSIZE 65536 enum mpg123_noise_type { mpg123_white_noise = 0 ,mpg123_tpdf_noise ,mpg123_highpass_tpdf_noise }; void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype); void dither_table_init(float *dithertable); #endif welle.io-2.1/src/libs/mpg123/dither_impl.h000066400000000000000000000061521357201522000202750ustar00rootroot00000000000000/* dither: Generate shaped noise for dithering copyright 2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "config.h" #include "compat.h" #include "dither.h" static const uint32_t init_seed = 2463534242UL; #define LAP 100 /* xorshift random number generator, with output scaling to [-0.5, 0.5] This is the white noise... See http://www.jstatsoft.org/v08/i14/paper on XOR shift random number generators. */ static float rand_xorshift32(uint32_t *seed) { union { uint32_t i; float f; } fi; fi.i = *seed; fi.i ^= (fi.i<<13); fi.i ^= (fi.i>>17); fi.i ^= (fi.i<<5); *seed = fi.i; /* scale the number to [-0.5, 0.5] */ #ifdef IEEE_FLOAT fi.i = (fi.i>>9)|0x3f800000; fi.f -= 1.5f; #else fi.f = (double)fi.i / 4294967295.0; fi.f -= 0.5f; #endif return fi.f; } static void white_noise(float *table, size_t count) { size_t i; uint32_t seed = init_seed; for(i=0; i 2*LAP ? LAP : count/2; float input_noise; float xv[9], yv[9]; for(i=0;i<9;i++) { xv[i] = yv[i] = 0.0f; } for(i=0;i=lap) table[i-lap] = yv[8] * 3.0f; } } void mpg123_noise(float* table, size_t count, enum mpg123_noise_type noisetype) { switch(noisetype) { case mpg123_white_noise: white_noise(table, count); break; case mpg123_tpdf_noise: tpdf_noise(table, count); break; case mpg123_highpass_tpdf_noise: highpass_tpdf_noise(table, count); break; } } /* Generate white noise and shape it with a high pass filter. */ void dither_table_init(float *dithertable) { highpass_tpdf_noise(dithertable, DITHERSIZE); } welle.io-2.1/src/libs/mpg123/equalizer.c000066400000000000000000000006471357201522000177740ustar00rootroot00000000000000/* equalizer.c: equalizer settings copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp */ #include "mpg123lib_intern.h" void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]) { int i; for(i=0;i<32;i++) bandPtr[i] = REAL_MUL(bandPtr[i], equalizer[channel][i]); } welle.io-2.1/src/libs/mpg123/equalizer_3dnow.S000066400000000000000000000025331357201522000210620ustar00rootroot00000000000000/* equalizer_3dnow: 3DNow! optimized do_equalizer() copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by KIMURA Takuhiro */ #include "mangle.h" .text ALIGN4 .globl ASM_NAME(do_equalizer_3dnow) /* .type ASM_NAME(do_equalizer_3dnow),@function */ /* void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]); */ ASM_NAME(do_equalizer_3dnow): pushl %esi pushl %ebx /* bandPtr */ movl 12(%esp),%ebx /* channel */ movl 16(%esp),%ecx xorl %edx,%edx /* equalizer */ movl 20(%esp),%esi sall $7,%ecx ALIGN4 .L9: movq (%ebx,%edx),%mm0 pfmul (%esi,%ecx),%mm0 movq 8(%ebx,%edx),%mm1 pfmul 8(%esi,%ecx),%mm1 movq %mm0,(%ebx,%edx) movq 16(%ebx,%edx),%mm0 pfmul 16(%esi,%ecx),%mm0 movq %mm1,8(%ebx,%edx) movq 24(%ebx,%edx),%mm1 pfmul 24(%esi,%ecx),%mm1 movq %mm0,16(%ebx,%edx) movq 32(%ebx,%edx),%mm0 pfmul 32(%esi,%ecx),%mm0 movq %mm1,24(%ebx,%edx) movq 40(%ebx,%edx),%mm1 pfmul 40(%esi,%ecx),%mm1 movq %mm0,32(%ebx,%edx) movq 48(%ebx,%edx),%mm0 pfmul 48(%esi,%ecx),%mm0 movq %mm1,40(%ebx,%edx) movq 56(%ebx,%edx),%mm1 pfmul 56(%esi,%ecx),%mm1 movq %mm0,48(%ebx,%edx) movq %mm1,56(%ebx,%edx) addl $64,%edx addl $32,%ecx cmpl $124,%edx jle .L9 ALIGN4 popl %ebx popl %esi ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/feature.c000066400000000000000000000033411357201522000174200ustar00rootroot00000000000000#include "mpg123lib_intern.h" int mpg123_feature(const enum mpg123_feature_set key) { switch(key) { case MPG123_FEATURE_ABI_UTF8OPEN: #ifdef WANT_WIN32_UNICODE return 1; #else return 0; #endif /* WANT_WIN32_UNICODE */ case MPG123_FEATURE_OUTPUT_8BIT: #ifdef NO_8BIT return 0; #else return 1; #endif /* mpg123_output_8bit */ case MPG123_FEATURE_OUTPUT_16BIT: #ifdef NO_16BIT return 0; #else return 1; #endif /* mpg123_output_16bit */ case MPG123_FEATURE_OUTPUT_32BIT: #ifdef NO_32BIT return 0; #else return 1; #endif /* mpg123_output_32bit */ case MPG123_FEATURE_PARSE_ID3V2: #ifdef NO_ID3V2 return 0; #else return 1; #endif /* NO_ID3V2 */ case MPG123_FEATURE_DECODE_LAYER1: #ifdef NO_LAYER1 return 0; #else return 1; #endif /* NO_LAYER1 */ case MPG123_FEATURE_DECODE_LAYER2: #ifdef NO_LAYER2 return 0; #else return 1; #endif /* NO_LAYER2 */ case MPG123_FEATURE_DECODE_LAYER3: #ifdef NO_LAYER3 return 0; #else return 1; #endif /* NO_LAYER3 */ case MPG123_FEATURE_DECODE_ACCURATE: #ifdef ACCURATE_ROUNDING return 1; #else return 0; #endif /* ACCURATE_ROUNDING */ case MPG123_FEATURE_DECODE_DOWNSAMPLE: #ifdef NO_DOWNSAMPLE return 0; #else return 1; #endif /* NO_DOWNSAMPLE */ case MPG123_FEATURE_DECODE_NTOM: #ifdef NO_NTOM return 0; #else return 1; #endif /* NO_NTOM */ case MPG123_FEATURE_PARSE_ICY: #ifdef NO_ICY return 0; #else return 1; #endif /* NO_ICY */ case MPG123_FEATURE_INDEX: #ifdef FRAME_INDEX return 1; #else return 0; #endif /* FRAME_INDEX */ case MPG123_FEATURE_TIMEOUT_READ: #ifdef TIMEOUT_READ return 1; #else return 0; #endif case MPG123_FEATURE_EQUALIZER: #ifndef NO_EQUALIZER return 1; #else return 0; #endif default: return 0; } } welle.io-2.1/src/libs/mpg123/fmt123.h000066400000000000000000000117071357201522000170130ustar00rootroot00000000000000/* libmpg123: MPEG Audio Decoder library separate header just for audio format definitions not tied to library code copyright 1995-2015 by the mpg123 project free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org */ #ifndef MPG123_ENC_H #define MPG123_ENC_H /** \file fmt123.h Audio format definitions. */ /** \defgroup mpg123_enc mpg123 PCM sample encodings * These are definitions for audio formats used by libmpg123 and * libout123. * * @{ */ /** An enum over all sample types possibly known to mpg123. * The values are designed as bit flags to allow bitmasking for encoding * families. * This is also why the enum is not used as type for actual encoding variables, * plain integers (at least 16 bit, 15 bit being used) cover the possible * combinations of these flags. * * Note that (your build of) libmpg123 does not necessarily support all these. * Usually, you can expect the 8bit encodings and signed 16 bit. * Also 32bit float will be usual beginning with mpg123-1.7.0 . * What you should bear in mind is that (SSE, etc) optimized routines may be * absent for some formats. We do have SSE for 16, 32 bit and float, though. * 24 bit integer is done via postprocessing of 32 bit output -- just cutting * the last byte, no rounding, even. If you want better, do it yourself. * * All formats are in native byte order. If you need different endinaness, you * can simply postprocess the output buffers (libmpg123 wouldn't do anything * else). The macro MPG123_SAMPLESIZE() can be helpful there. */ enum mpg123_enc_enum { /* 0000 0000 0000 1111 Some 8 bit integer encoding. */ MPG123_ENC_8 = 0x00f /* 0000 0000 0100 0000 Some 16 bit integer encoding. */ , MPG123_ENC_16 = 0x040 /* 0100 0000 0000 0000 Some 24 bit integer encoding. */ , MPG123_ENC_24 = 0x4000 /* 0000 0001 0000 0000 Some 32 bit integer encoding. */ , MPG123_ENC_32 = 0x100 /* 0000 0000 1000 0000 Some signed integer encoding. */ , MPG123_ENC_SIGNED = 0x080 /* 0000 1110 0000 0000 Some float encoding. */ , MPG123_ENC_FLOAT = 0xe00 /* 0000 0000 1101 0000 signed 16 bit */ , MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10) /* 0000 0000 0110 0000 unsigned 16 bit */ , MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16|0x20) /* 0000 0000 0000 0001 unsigned 8 bit */ , MPG123_ENC_UNSIGNED_8 = 0x01 /* 0000 0000 1000 0010 signed 8 bit */ , MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED|0x02) /* 0000 0000 0000 0100 ulaw 8 bit */ , MPG123_ENC_ULAW_8 = 0x04 /* 0000 0000 0000 1000 alaw 8 bit */ , MPG123_ENC_ALAW_8 = 0x08 /* 0001 0001 1000 0000 signed 32 bit */ , MPG123_ENC_SIGNED_32 = MPG123_ENC_32|MPG123_ENC_SIGNED|0x1000 /* 0010 0001 0000 0000 unsigned 32 bit */ , MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32|0x2000 /* 0101 0000 1000 0000 signed 24 bit */ , MPG123_ENC_SIGNED_24 = MPG123_ENC_24|MPG123_ENC_SIGNED|0x1000 /* 0110 0000 0000 0000 unsigned 24 bit */ , MPG123_ENC_UNSIGNED_24 = MPG123_ENC_24|0x2000 /* 0000 0010 0000 0000 32bit float */ , MPG123_ENC_FLOAT_32 = 0x200 /* 0000 0100 0000 0000 64bit float */ , MPG123_ENC_FLOAT_64 = 0x400 /* Any possibly known encoding from the list above. */ , MPG123_ENC_ANY = ( MPG123_ENC_SIGNED_16 | MPG123_ENC_UNSIGNED_16 | MPG123_ENC_UNSIGNED_8 | MPG123_ENC_SIGNED_8 | MPG123_ENC_ULAW_8 | MPG123_ENC_ALAW_8 | MPG123_ENC_SIGNED_32 | MPG123_ENC_UNSIGNED_32 | MPG123_ENC_SIGNED_24 | MPG123_ENC_UNSIGNED_24 | MPG123_ENC_FLOAT_32 | MPG123_ENC_FLOAT_64 ) }; /** Get size of one PCM sample with given encoding. * This is included both in libmpg123 and libout123. Both offer * an API function to provide the macro results from library * compile-time, not that of you application. This most likely * does not matter as I do not expect any fresh PCM sample * encoding to appear. But who knows? Perhaps the encoding type * will be abused for funny things in future, not even plain PCM. * And, by the way: Thomas really likes the ?: operator. * \param enc the encoding (mpg123_enc_enum value) * \return size of one sample in bytes */ #define MPG123_SAMPLESIZE(enc) ( \ (enc) & MPG123_ENC_8 \ ? 1 \ : ( (enc) & MPG123_ENC_16 \ ? 2 \ : ( (enc) & MPG123_ENC_24 \ ? 3 \ : ( ( (enc) & MPG123_ENC_32 \ || (enc) == MPG123_ENC_FLOAT_32 ) \ ? 4 \ : ( (enc) == MPG123_ENC_FLOAT_64 \ ? 8 \ : 0 \ ) ) ) ) ) /** Structure defining an audio format. * Providing the members as individual function arguments to define a certain * output format is easy enough. This struct makes is more comfortable to deal * with a list of formats. * Negative values for the members might be used to communicate use of default * values. */ struct mpg123_fmt { long rate; /**< sampling rate in Hz */ int channels; /**< channel count */ /** encoding code, can be single value or bitwise or of members of * mpg123_enc_enum */ int encoding; }; /* @} */ #endif welle.io-2.1/src/libs/mpg123/format.c000066400000000000000000000442571357201522000172700ustar00rootroot00000000000000/* format:routines to deal with audio (output) format copyright 2008-14 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis, starting with parts of the old audio.c, with only faintly manage to show now A Major change from mpg123 <= 1.18 is that all encodings are only really disabled when done so via specific build configuration. Otherwise, the missing support of decoders to produce a certain format is augmented by postprocessing that converts the samples. This means happily creating data with higher resolution from less accurate decoder output. The main point is to still offer float encoding when the decoding core uses a fixed point representation that has only 16 bit output. Actually, that's the only point: A fixed-point build needs to create float from 16 bit, also 32 or 24 bit from the same source. That's all there is to it: Everything else is covered by fallback synth functions. It may be a further step to check if there are cases where conversion in postprocessing works well enough to omit a certain specialized decoder ... but usually, they are justified by some special way to get from float to integer to begin with. I won't cover the case of faking double output with float/s16 decoders here. Double precision output is a thing for experimental builds anyway. Mostly theoretical and without a point. */ #include "mpg123lib_intern.h" #include "debug.h" /* static int chans[NUM_CHANNELS] = { 1 , 2 }; */ static const long my_rates[MPG123_RATES] = /* only the standard rates */ { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, }; static const int my_encodings[MPG123_ENCODINGS] = { MPG123_ENC_SIGNED_16, MPG123_ENC_UNSIGNED_16, MPG123_ENC_SIGNED_32, MPG123_ENC_UNSIGNED_32, MPG123_ENC_SIGNED_24, MPG123_ENC_UNSIGNED_24, /* Floating point range, see below. */ MPG123_ENC_FLOAT_32, MPG123_ENC_FLOAT_64, /* 8 bit range, see below. */ MPG123_ENC_SIGNED_8, MPG123_ENC_UNSIGNED_8, MPG123_ENC_ULAW_8, MPG123_ENC_ALAW_8 }; /* Make that match the above table. And yes, I still don't like this kludgy stuff. */ /* range[0] <= i < range[1] for forced floating point */ static const int enc_float_range[2] = { 6, 8 }; /* same for 8 bit encodings */ static const int enc_8bit_range[2] = { 8, 12 }; /* Only one type of float is supported. Actually, double is a very special experimental case not occuring in normal builds. Might actually get rid of it. Remember here: Also with REAL_IS_FIXED, I want to be able to produce float output (f32) via post-processing. */ # ifdef REAL_IS_DOUBLE # define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_64 # else # define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_32 # endif /* The list of actually possible encodings. */ static const int good_encodings[] = { #ifndef NO_16BIT MPG123_ENC_SIGNED_16, MPG123_ENC_UNSIGNED_16, #endif #ifndef NO_32BIT MPG123_ENC_SIGNED_32, MPG123_ENC_UNSIGNED_32, MPG123_ENC_SIGNED_24, MPG123_ENC_UNSIGNED_24, #endif #ifndef NO_REAL MPG123_FLOAT_ENC, #endif #ifndef NO_8BIT MPG123_ENC_SIGNED_8, MPG123_ENC_UNSIGNED_8, MPG123_ENC_ULAW_8, MPG123_ENC_ALAW_8 #endif }; /* Check if encoding is a valid one in this build. ...lazy programming: linear search. */ static int good_enc(const int enc) { size_t i; for(i=0; iforce_rate != 0 && mp->force_rate == r) return MPG123_RATES; #endif return -1; } static int enc2num(int encoding) { int i; for(i=0;ichannels-1; int rn = rate2num(&fr->p, nf->rate); if(rn >= 0) for(i=f0;ip.audio_caps[c][rn][i]) { nf->encoding = my_encodings[i]; return 1; } } return 0; } static int freq_fit(mpg123_handle *fr, struct audioformat *nf, int f0, int f2) { nf->rate = frame_freq(fr)>>fr->p.down_sample; if(cap_fit(fr,nf,f0,f2)) return 1; if(fr->p.flags & MPG123_AUTO_RESAMPLE) { nf->rate>>=1; if(cap_fit(fr,nf,f0,f2)) return 1; nf->rate>>=1; if(cap_fit(fr,nf,f0,f2)) return 1; } #ifndef NO_NTOM /* If nothing worked, try the other rates, only without constrains from user. In case you didn't guess: We enable flexible resampling if we find a working rate. */ if( fr->p.flags & MPG123_AUTO_RESAMPLE && !fr->p.force_rate && fr->p.down_sample == 0) { int i; int c = nf->channels-1; int rn = rate2num(&fr->p, frame_freq(fr)); int rrn; if(rn < 0) return 0; /* Try higher rates first. */ for(i=f0;ip.audio_caps[c][rrn][i]) { nf->rate = my_rates[rrn]; nf->encoding = my_encodings[i]; return 1; } /* Then lower rates. */ for(i=f0;i=0; --rrn) if(fr->p.audio_caps[c][rrn][i]) { nf->rate = my_rates[rrn]; nf->encoding = my_encodings[i]; return 1; } } #endif return 0; } /* match constraints against supported audio formats, store possible setup in frame return: -1: error; 0: no format change; 1: format change */ int frame_output_format(mpg123_handle *fr) { struct audioformat nf; int f0=0; int f2=MPG123_ENCODINGS; /* Omit the 32bit and float encodings. */ mpg123_pars *p = &fr->p; /* initialize new format, encoding comes later */ nf.channels = fr->stereo; /* All this forcing should be removed in favour of the capabilities table... */ if(p->flags & MPG123_FORCE_8BIT) { f0 = enc_8bit_range[0]; f2 = enc_8bit_range[1]; } if(p->flags & MPG123_FORCE_FLOAT) { f0 = enc_float_range[0]; f2 = enc_float_range[1]; } /* force stereo is stronger */ if(p->flags & MPG123_FORCE_MONO) nf.channels = 1; if(p->flags & MPG123_FORCE_STEREO) nf.channels = 2; #ifndef NO_NTOM if(p->force_rate) { nf.rate = p->force_rate; if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */ if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */ /* try again with different stereoness */ if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1; else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2; if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */ if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */ if(NOQUIET) error3( "Unable to set up output format! Constraints: %s%s%liHz.", ( p->flags & MPG123_FORCE_STEREO ? "stereo, " : (p->flags & MPG123_FORCE_MONO ? "mono, " : "") ), (p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""), p->force_rate ); /* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */ fr->err = MPG123_BAD_OUTFORMAT; return -1; } #endif if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */ if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */ /* try again with different stereoness */ if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1; else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2; if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */ if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */ /* Here is the _bad_ end. */ if(NOQUIET) { error5( "Unable to set up output format! Constraints: %s%s%li, %li or %liHz.", ( p->flags & MPG123_FORCE_STEREO ? "stereo, " : (p->flags & MPG123_FORCE_MONO ? "mono, " : "") ), (p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""), frame_freq(fr), frame_freq(fr)>>1, frame_freq(fr)>>2 ); } /* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */ fr->err = MPG123_BAD_OUTFORMAT; return -1; end: /* Here is the _good_ end. */ /* we had a successful match, now see if there's a change */ if(nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding) { debug2("Old format with %i channels, and FORCE_MONO=%li", nf.channels, p->flags & MPG123_FORCE_MONO); return 0; /* the same format as before */ } else /* a new format */ { debug1("New format with %i channels!", nf.channels); fr->af.rate = nf.rate; fr->af.channels = nf.channels; fr->af.encoding = nf.encoding; /* Cache the size of one sample in bytes, for ease of use. */ fr->af.encsize = mpg123_encsize(fr->af.encoding); if(fr->af.encsize < 1) { if(NOQUIET) error1("Some unknown encoding??? (%i)", fr->af.encoding); fr->err = MPG123_BAD_OUTFORMAT; return -1; } /* Set up the decoder synth format. Might differ. */ #ifdef NO_SYNTH32 /* Without high-precision synths, 16 bit signed is the basis for everything higher than 8 bit. */ if(fr->af.encsize > 2) fr->af.dec_enc = MPG123_ENC_SIGNED_16; else { #endif switch(fr->af.encoding) { #ifndef NO_32BIT case MPG123_ENC_SIGNED_24: case MPG123_ENC_UNSIGNED_24: case MPG123_ENC_UNSIGNED_32: fr->af.dec_enc = MPG123_ENC_SIGNED_32; break; #endif #ifndef NO_16BIT case MPG123_ENC_UNSIGNED_16: fr->af.dec_enc = MPG123_ENC_SIGNED_16; break; #endif default: fr->af.dec_enc = fr->af.encoding; } #ifdef NO_SYNTH32 } #endif fr->af.dec_encsize = mpg123_encsize(fr->af.dec_enc); return 1; } } int attribute_align_arg mpg123_format_none(mpg123_handle *mh) { int r; if(mh == NULL) return MPG123_BAD_HANDLE; r = mpg123_fmt_none(&mh->p); if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } return r; } int attribute_align_arg mpg123_fmt_none(mpg123_pars *mp) { if(mp == NULL) return MPG123_BAD_PARS; if(PVERB(mp,3)) fprintf(stderr, "Note: Disabling all formats.\n"); memset(mp->audio_caps,0,sizeof(mp->audio_caps)); return MPG123_OK; } int attribute_align_arg mpg123_format_all(mpg123_handle *mh) { int r; if(mh == NULL) return MPG123_BAD_HANDLE; r = mpg123_fmt_all(&mh->p); if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } return r; } int attribute_align_arg mpg123_fmt_all(mpg123_pars *mp) { size_t rate, ch, enc; if(mp == NULL) return MPG123_BAD_PARS; if(PVERB(mp,3)) fprintf(stderr, "Note: Enabling all formats.\n"); for(ch=0; ch < NUM_CHANNELS; ++ch) for(rate=0; rate < MPG123_RATES+1; ++rate) for(enc=0; enc < MPG123_ENCODINGS; ++enc) mp->audio_caps[ch][rate][enc] = good_enc(my_encodings[enc]) ? 1 : 0; return MPG123_OK; } int attribute_align_arg mpg123_format(mpg123_handle *mh, long rate, int channels, int encodings) { int r; if(mh == NULL) return MPG123_BAD_HANDLE; r = mpg123_fmt(&mh->p, rate, channels, encodings); if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } return r; } int attribute_align_arg mpg123_fmt(mpg123_pars *mp, long rate, int channels, int encodings) { int ie, ic, ratei; int ch[2] = {0, 1}; if(mp == NULL) return MPG123_BAD_PARS; if(!(channels & (MPG123_MONO|MPG123_STEREO))) return MPG123_BAD_CHANNEL; if(PVERB(mp,3)) fprintf(stderr, "Note: Want to enable format %li/%i for encodings 0x%x.\n", rate, channels, encodings); if(!(channels & MPG123_STEREO)) ch[1] = 0; /* {0,0} */ else if(!(channels & MPG123_MONO)) ch[0] = 1; /* {1,1} */ ratei = rate2num(mp, rate); if(ratei < 0) return MPG123_BAD_RATE; /* now match the encodings */ for(ic = 0; ic < 2; ++ic) { for(ie = 0; ie < MPG123_ENCODINGS; ++ie) if(good_enc(my_encodings[ie]) && ((my_encodings[ie] & encodings) == my_encodings[ie])) mp->audio_caps[ch[ic]][ratei][ie] = 1; if(ch[0] == ch[1]) break; /* no need to do it again */ } return MPG123_OK; } int attribute_align_arg mpg123_format_support(mpg123_handle *mh, long rate, int encoding) { if(mh == NULL) return 0; else return mpg123_fmt_support(&mh->p, rate, encoding); } int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding) { int ch = 0; int ratei, enci; ratei = rate2num(mp, rate); enci = enc2num(encoding); if(mp == NULL || ratei < 0 || enci < 0) return 0; if(mp->audio_caps[0][ratei][enci]) ch |= MPG123_MONO; if(mp->audio_caps[1][ratei][enci]) ch |= MPG123_STEREO; return ch; } /* Call this one to ensure that any valid format will be something different than this. */ void invalidate_format(struct audioformat *af) { af->encoding = 0; af->rate = 0; af->channels = 0; } /* Number of bytes the decoder produces. */ off_t decoder_synth_bytes(mpg123_handle *fr, off_t s) { return s * fr->af.dec_encsize * fr->af.channels; } /* Samples/bytes for output buffer after post-processing. */ /* take into account: channels, bytes per sample -- NOT resampling!*/ off_t samples_to_bytes(mpg123_handle *fr , off_t s) { return s * fr->af.encsize * fr->af.channels; } off_t bytes_to_samples(mpg123_handle *fr , off_t b) { return b / fr->af.encsize / fr->af.channels; } /* Number of bytes needed for decoding _and_ post-processing. */ off_t outblock_bytes(mpg123_handle *fr, off_t s) { int encsize = (fr->af.encoding & MPG123_ENC_24) ? 4 /* Intermediate 32 bit. */ : (fr->af.encsize > fr->af.dec_encsize ? fr->af.encsize : fr->af.dec_encsize); return s * encsize * fr->af.channels; } #ifndef NO_32BIT /* Remove every fourth byte, facilitating conversion from 32 bit to 24 bit integers. This has to be aware of endianness, of course. */ static void chop_fourth_byte(struct outbuffer *buf) { unsigned char *wpos = buf->data; unsigned char *rpos = buf->data; #ifdef WORDS_BIGENDIAN while((size_t) (rpos - buf->data + 4) <= buf->fill) { /* Really stupid: Copy, increment. Byte per byte. */ *wpos = *rpos; wpos++; rpos++; *wpos = *rpos; wpos++; rpos++; *wpos = *rpos; wpos++; rpos++; rpos++; /* Skip the lowest byte (last). */ } #else while((size_t) (rpos - buf->data + 4) <= buf->fill) { /* Really stupid: Copy, increment. Byte per byte. */ rpos++; /* Skip the lowest byte (first). */ *wpos = *rpos; wpos++; rpos++; *wpos = *rpos; wpos++; rpos++; *wpos = *rpos; wpos++; rpos++; } #endif buf->fill = wpos-buf->data; } static void conv_s32_to_u32(struct outbuffer *buf) { size_t i; int32_t *ssamples = (int32_t*) buf->data; uint32_t *usamples = (uint32_t*) buf->data; size_t count = buf->fill/sizeof(int32_t); for(i=0; i= 0) usamples[i] = (uint32_t)ssamples[i] + 2147483647+1; /* The smallest value goes zero. */ else if(ssamples[i] == ((int32_t)-2147483647-1)) usamples[i] = 0; /* Now -value is in the positive range of signed int ... so it's a possible value at all. */ else usamples[i] = (uint32_t)2147483647+1 - (uint32_t)(-ssamples[i]); } } #endif /* We always assume that whole numbers are written! partials will be cut out. */ static const char *bufsizeerr = "Fatal: Buffer too small for postprocessing!"; #ifndef NO_16BIT static void conv_s16_to_u16(struct outbuffer *buf) { size_t i; int16_t *ssamples = (int16_t*) buf->data; uint16_t *usamples = (uint16_t*)buf->data; size_t count = buf->fill/sizeof(int16_t); for(i=0; idata; float *out = (float*) buf->data; size_t count = buf->fill/sizeof(int16_t); /* Does that make any sense? In x86, there is an actual instruction to divide float by integer ... but then, if we have that FPU, we don't really need fixed point decoder hacks ...? */ float scale = 1./SHORT_SCALE; if(buf->size < count*sizeof(float)) { error1("%s", bufsizeerr); return; } /* Work from the back since output is bigger. */ for(i=count-1; i>=0; --i) out[i] = (float)in[i] * scale; buf->fill = count*sizeof(float); } #endif #ifndef NO_32BIT static void conv_s16_to_s32(struct outbuffer *buf) { ssize_t i; int16_t *in = (int16_t*) buf->data; int32_t *out = (int32_t*) buf->data; size_t count = buf->fill/sizeof(int16_t); if(buf->size < count*sizeof(int32_t)) { error1("%s", bufsizeerr); return; } /* Work from the back since output is bigger. */ for(i=count-1; i>=0; --i) { out[i] = in[i]; /* Could just shift bytes, but would have to mess with sign bit. */ out[i] *= S32_RESCALE; } buf->fill = count*sizeof(int32_t); } #endif #endif void postprocess_buffer(mpg123_handle *fr) { /* This caters for the final output formats that are never produced by decoder synth directly (wide unsigned and 24 bit formats) or that are missing because of limited decoder precision (16 bit synth but 32 or 24 bit output). */ switch(fr->af.dec_enc) { #ifndef NO_32BIT case MPG123_ENC_SIGNED_32: switch(fr->af.encoding) { case MPG123_ENC_UNSIGNED_32: conv_s32_to_u32(&fr->buffer); break; case MPG123_ENC_UNSIGNED_24: conv_s32_to_u32(&fr->buffer); chop_fourth_byte(&fr->buffer); break; case MPG123_ENC_SIGNED_24: chop_fourth_byte(&fr->buffer); break; } break; #endif #ifndef NO_16BIT case MPG123_ENC_SIGNED_16: switch(fr->af.encoding) { case MPG123_ENC_UNSIGNED_16: conv_s16_to_u16(&fr->buffer); break; #ifndef NO_REAL case MPG123_ENC_FLOAT_32: conv_s16_to_f32(&fr->buffer); break; #endif #ifndef NO_32BIT case MPG123_ENC_SIGNED_32: conv_s16_to_s32(&fr->buffer); break; case MPG123_ENC_UNSIGNED_32: conv_s16_to_s32(&fr->buffer); conv_s32_to_u32(&fr->buffer); break; case MPG123_ENC_UNSIGNED_24: conv_s16_to_s32(&fr->buffer); conv_s32_to_u32(&fr->buffer); chop_fourth_byte(&fr->buffer); break; case MPG123_ENC_SIGNED_24: conv_s16_to_s32(&fr->buffer); chop_fourth_byte(&fr->buffer); break; #endif } break; #endif } } welle.io-2.1/src/libs/mpg123/frame.c000066400000000000000000000745061357201522000170720ustar00rootroot00000000000000/* frame: Heap of routines dealing with the core mpg123 data structure. copyright 2008-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #include "mpg123lib_intern.h" #include "getcpuflags.h" #include "debug.h" static void frame_fixed_reset(mpg123_handle *fr); /* that's doubled in decode_ntom.c */ #define NTOM_MUL (32768) #define aligned_pointer(p, type, alignment) align_the_pointer(p, alignment) static void *align_the_pointer(void *base, unsigned int alignment) { /* Work in unsigned integer realm, explicitly. Tricking the compiler into integer operations like % by invoking base-NULL is dangerous: It results into ptrdiff_t, which gets negative on big addresses. Big screw up, that. I try to do it "properly" here: Casting only to uintptr_t and no artihmethic with void*. */ uintptr_t baseval = (uintptr_t)(char*)base; uintptr_t aoff = baseval % alignment; debug3("align_the_pointer: pointer %p is off by %u from %u", base, (unsigned int)aoff, alignment); if(aoff) return (char*)base+alignment-aoff; else return base; } static void frame_default_pars(mpg123_pars *mp) { mp->outscale = 1.0; mp->flags = 0; #ifdef GAPLESS mp->flags |= MPG123_GAPLESS; #endif mp->flags |= MPG123_AUTO_RESAMPLE; #ifndef NO_NTOM mp->force_rate = 0; #endif mp->down_sample = 0; mp->rva = 0; mp->halfspeed = 0; mp->doublespeed = 0; mp->verbose = 0; #ifndef NO_ICY mp->icy_interval = 0; #endif mp->timeout = 0; mp->resync_limit = 1024; #ifdef FRAME_INDEX mp->index_size = INDEX_SIZE; #endif mp->preframes = 4; /* That's good for layer 3 ISO compliance bitstream. */ mpg123_fmt_all(mp); /* Default of keeping some 4K buffers at hand, should cover the "usual" use case (using 16K pipe buffers as role model). */ #ifndef NO_FEEDER mp->feedpool = 5; mp->feedbuffer = 4096; #endif } void frame_init(mpg123_handle *fr) { frame_init_par(fr, NULL); } void frame_init_par(mpg123_handle *fr, mpg123_pars *mp) { fr->own_buffer = TRUE; fr->buffer.data = NULL; fr->buffer.rdata = NULL; fr->buffer.fill = 0; fr->buffer.size = 0; fr->rawbuffs = NULL; fr->rawbuffss = 0; fr->rawdecwin = NULL; fr->rawdecwins = 0; #ifndef NO_8BIT fr->conv16to8_buf = NULL; #endif #ifdef OPT_DITHER fr->dithernoise = NULL; #endif fr->layerscratch = NULL; fr->xing_toc = NULL; fr->cpu_opts.type = defdec(); fr->cpu_opts.class = decclass(fr->cpu_opts.type); #ifndef NO_NTOM /* these two look unnecessary, check guarantee for synth_ntom_set_step (in control_generic, even)! */ fr->ntom_val[0] = NTOM_MUL>>1; fr->ntom_val[1] = NTOM_MUL>>1; fr->ntom_step = NTOM_MUL; #endif /* unnecessary: fr->buffer.size = fr->buffer.fill = 0; */ mpg123_reset_eq(fr); init_icy(&fr->icy); init_id3(fr); /* frame_outbuffer is missing... */ /* frame_buffers is missing... that one needs cpu opt setting! */ /* after these... frame_reset is needed before starting full decode */ invalidate_format(&fr->af); fr->rdat.r_read = NULL; fr->rdat.r_lseek = NULL; fr->rdat.iohandle = NULL; fr->rdat.r_read_handle = NULL; fr->rdat.r_lseek_handle = NULL; fr->rdat.cleanup_handle = NULL; fr->wrapperdata = NULL; fr->wrapperclean = NULL; fr->decoder_change = 1; fr->err = MPG123_OK; if(mp == NULL) frame_default_pars(&fr->p); else memcpy(&fr->p, mp, sizeof(struct mpg123_pars_struct)); #ifndef NO_FEEDER bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer); #endif fr->down_sample = 0; /* Initialize to silence harmless errors when debugging. */ frame_fixed_reset(fr); /* Reset only the fixed data, dynamic buffers are not there yet! */ fr->synth = NULL; fr->synth_mono = NULL; fr->make_decode_tables = NULL; #ifdef FRAME_INDEX fi_init(&fr->index); frame_index_setup(fr); /* Apply the size setting. */ #endif } #ifdef OPT_DITHER /* Also, only allocate the memory for the table on demand. In future, one could create special noise for different sampling frequencies(?). */ int frame_dither_init(mpg123_handle *fr) { /* run-time dither noise table generation */ if(fr->dithernoise == NULL) { fr->dithernoise = malloc(sizeof(float)*DITHERSIZE); if(fr->dithernoise == NULL) return 0; dither_table_init(fr->dithernoise); } return 1; } #endif mpg123_pars attribute_align_arg *mpg123_new_pars(int *error) { mpg123_pars *mp = malloc(sizeof(struct mpg123_pars_struct)); if(mp != NULL){ frame_default_pars(mp); if(error != NULL) *error = MPG123_OK; } else if(error != NULL) *error = MPG123_OUT_OF_MEM; return mp; } void attribute_align_arg mpg123_delete_pars(mpg123_pars* mp) { if(mp != NULL) free(mp); } int attribute_align_arg mpg123_reset_eq(mpg123_handle *mh) { int i; if(mh == NULL) return MPG123_BAD_HANDLE; #ifndef NO_EQUALIZER mh->have_eq_settings = 0; for(i=0; i < 32; ++i) mh->equalizer[0][i] = mh->equalizer[1][i] = DOUBLE_TO_REAL(1.0); #endif return MPG123_OK; } int frame_outbuffer(mpg123_handle *fr) { size_t size = fr->outblock; if(!fr->own_buffer) { if(fr->buffer.size < size) { fr->err = MPG123_BAD_BUFFER; if(NOQUIET) error2("have external buffer of size %"SIZE_P", need %"SIZE_P, (size_p)fr->buffer.size, (size_p)size); return MPG123_ERR; } } debug1("need frame buffer of %"SIZE_P, (size_p)size); if(fr->buffer.rdata != NULL && fr->buffer.size != size) { free(fr->buffer.rdata); fr->buffer.rdata = NULL; } fr->buffer.size = size; fr->buffer.data = NULL; /* be generous: use 16 byte alignment */ if(fr->buffer.rdata == NULL) fr->buffer.rdata = (unsigned char*) malloc(fr->buffer.size+15); if(fr->buffer.rdata == NULL) { fr->err = MPG123_OUT_OF_MEM; return MPG123_ERR; } fr->buffer.data = aligned_pointer(fr->buffer.rdata, unsigned char*, 16); fr->own_buffer = TRUE; fr->buffer.fill = 0; return MPG123_OK; } int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, unsigned char *data, size_t size) { debug2("replace buffer with %p size %"SIZE_P, data, (size_p)size); if(mh == NULL) return MPG123_BAD_HANDLE; /* Will accept any size, the error comes later... */ if(data == NULL) { mh->err = MPG123_BAD_BUFFER; return MPG123_ERR; } if(mh->buffer.rdata != NULL) free(mh->buffer.rdata); mh->own_buffer = FALSE; mh->buffer.rdata = NULL; mh->buffer.data = data; mh->buffer.size = size; mh->buffer.fill = 0; return MPG123_OK; } #ifdef FRAME_INDEX int frame_index_setup(mpg123_handle *fr) { int ret = MPG123_ERR; if(fr->p.index_size >= 0) { /* Simple fixed index. */ fr->index.grow_size = 0; debug1("resizing index to %li", fr->p.index_size); ret = fi_resize(&fr->index, (size_t)fr->p.index_size); debug2("index resized... %lu at %p", (unsigned long)fr->index.size, (void*)fr->index.data); } else { /* A growing index. We give it a start, though. */ fr->index.grow_size = (size_t)(- fr->p.index_size); if(fr->index.size < fr->index.grow_size) ret = fi_resize(&fr->index, fr->index.grow_size); else ret = MPG123_OK; /* We have minimal size already... and since growing is OK... */ } debug2("set up frame index of size %lu (ret=%i)", (unsigned long)fr->index.size, ret); return ret; } #endif static void frame_decode_buffers_reset(mpg123_handle *fr) { if(fr->rawbuffs) /* memset(NULL, 0, 0) not desired */ memset(fr->rawbuffs, 0, fr->rawbuffss); } int frame_buffers(mpg123_handle *fr) { int buffssize = 0; debug1("frame %p buffer", (void*)fr); /* the used-to-be-static buffer of the synth functions, has some subtly different types/sizes 2to1, 4to1, ntom, generic, i386: real[2][2][0x110] mmx, sse: short[2][2][0x110] i586(_dither): 4352 bytes; int/long[2][2][0x110] i486: int[2][2][17*FIR_BUFFER_SIZE] altivec: static real __attribute__ ((aligned (16))) buffs[4][4][0x110] Huh, altivec looks like fun. Well, let it be large... then, the 16 byte alignment seems to be implicit on MacOSX malloc anyway. Let's make a reasonable attempt to allocate enough memory... Keep in mind: biggest ones are i486 and altivec (mutually exclusive!), then follows i586 and normal real. mmx/sse use short but also real for resampling. Thus, minimum is 2*2*0x110*sizeof(real). */ if(fr->cpu_opts.type == altivec) buffssize = 4*4*0x110*sizeof(real); #ifdef OPT_I486 else if(fr->cpu_opts.type == ivier) buffssize = 2*2*17*FIR_BUFFER_SIZE*sizeof(int); #endif else if(fr->cpu_opts.type == ifuenf || fr->cpu_opts.type == ifuenf_dither || fr->cpu_opts.type == dreidnow) buffssize = 2*2*0x110*4; /* don't rely on type real, we need 4352 bytes */ if(2*2*0x110*sizeof(real) > buffssize) buffssize = 2*2*0x110*sizeof(real); buffssize += 15; /* For 16-byte alignment (SSE likes that). */ if(fr->rawbuffs != NULL && fr->rawbuffss != buffssize) { free(fr->rawbuffs); fr->rawbuffs = NULL; } if(fr->rawbuffs == NULL) fr->rawbuffs = (unsigned char*) malloc(buffssize); if(fr->rawbuffs == NULL) return -1; fr->rawbuffss = buffssize; fr->short_buffs[0][0] = aligned_pointer(fr->rawbuffs,short,16); fr->short_buffs[0][1] = fr->short_buffs[0][0] + 0x110; fr->short_buffs[1][0] = fr->short_buffs[0][1] + 0x110; fr->short_buffs[1][1] = fr->short_buffs[1][0] + 0x110; fr->real_buffs[0][0] = aligned_pointer(fr->rawbuffs,real,16); fr->real_buffs[0][1] = fr->real_buffs[0][0] + 0x110; fr->real_buffs[1][0] = fr->real_buffs[0][1] + 0x110; fr->real_buffs[1][1] = fr->real_buffs[1][0] + 0x110; #ifdef OPT_I486 if(fr->cpu_opts.type == ivier) { fr->int_buffs[0][0] = (int*) fr->rawbuffs; fr->int_buffs[0][1] = fr->int_buffs[0][0] + 17*FIR_BUFFER_SIZE; fr->int_buffs[1][0] = fr->int_buffs[0][1] + 17*FIR_BUFFER_SIZE; fr->int_buffs[1][1] = fr->int_buffs[1][0] + 17*FIR_BUFFER_SIZE; } #endif #ifdef OPT_ALTIVEC if(fr->cpu_opts.type == altivec) { int i,j; fr->areal_buffs[0][0] = (real*) fr->rawbuffs; for(i=0; i<4; ++i) for(j=0; j<4; ++j) fr->areal_buffs[i][j] = fr->areal_buffs[0][0] + (i*4+j)*0x110; } #endif /* now the different decwins... all of the same size, actually */ /* The MMX ones want 32byte alignment, which I'll try to ensure manually */ { int decwin_size = (512+32)*sizeof(real); #ifdef OPT_MMXORSSE #ifdef OPT_MULTI if(fr->cpu_opts.class == mmxsse) { #endif /* decwin_mmx will share, decwins will be appended ... sizeof(float)==4 */ if(decwin_size < (512+32)*4) decwin_size = (512+32)*4; /* the second window + alignment zone -- we align for 32 bytes for SSE as requirement, 64 byte for matching cache line size (that matters!) */ decwin_size += (512+32)*4 + 63; /* (512+32)*4/32 == 2176/32 == 68, so one decwin block retains alignment for 32 or 64 bytes */ #ifdef OPT_MULTI } #endif #endif #if defined(OPT_ALTIVEC) || defined(OPT_ARM) /* sizeof(real) >= 4 ... yes, it could be 8, for example. We got it intialized to at least (512+32)*sizeof(real).*/ decwin_size += 512*sizeof(real); #endif /* Hm, that's basically realloc() ... */ if(fr->rawdecwin != NULL && fr->rawdecwins != decwin_size) { free(fr->rawdecwin); fr->rawdecwin = NULL; } if(fr->rawdecwin == NULL) fr->rawdecwin = (unsigned char*) malloc(decwin_size); if(fr->rawdecwin == NULL) return -1; fr->rawdecwins = decwin_size; fr->decwin = (real*) fr->rawdecwin; #ifdef OPT_MMXORSSE #ifdef OPT_MULTI if(fr->cpu_opts.class == mmxsse) { #endif /* align decwin, assign that to decwin_mmx, append decwins */ /* I need to add to decwin what is missing to the next full 64 byte -- also I want to make gcc -pedantic happy... */ fr->decwin = aligned_pointer(fr->rawdecwin,real,64); debug1("aligned decwin: %p", (void*)fr->decwin); fr->decwin_mmx = (float*)fr->decwin; fr->decwins = fr->decwin_mmx+512+32; #ifdef OPT_MULTI } else debug("no decwins/decwin_mmx for that class"); #endif #endif } /* Layer scratch buffers are of compile-time fixed size, so allocate only once. */ if(fr->layerscratch == NULL) { /* Allocate specific layer1/2/3 buffers, so that we know they'll work for SSE. */ size_t scratchsize = 0; real *scratcher; #ifndef NO_LAYER1 scratchsize += sizeof(real) * 2 * SBLIMIT; #endif #ifndef NO_LAYER2 scratchsize += sizeof(real) * 2 * 4 * SBLIMIT; #endif #ifndef NO_LAYER3 scratchsize += sizeof(real) * 2 * SBLIMIT * SSLIMIT; /* hybrid_in */ scratchsize += sizeof(real) * 2 * SSLIMIT * SBLIMIT; /* hybrid_out */ #endif /* Now figure out correct alignment: We need 16 byte minimum, smallest unit of the blocks is 2*SBLIMIT*sizeof(real), which is 64*4=256. Let's do 64bytes as heuristic for cache line (as proven useful in buffs above). */ fr->layerscratch = malloc(scratchsize+63); if(fr->layerscratch == NULL) return -1; /* Get aligned part of the memory, then divide it up. */ scratcher = aligned_pointer(fr->layerscratch,real,64); /* Those funky pointer casts silence compilers... One might change the code at hand to really just use 1D arrays, but in practice, that would not make a (positive) difference. */ #ifndef NO_LAYER1 fr->layer1.fraction = (real(*)[SBLIMIT])scratcher; scratcher += 2 * SBLIMIT; #endif #ifndef NO_LAYER2 fr->layer2.fraction = (real(*)[4][SBLIMIT])scratcher; scratcher += 2 * 4 * SBLIMIT; #endif #ifndef NO_LAYER3 fr->layer3.hybrid_in = (real(*)[SBLIMIT][SSLIMIT])scratcher; scratcher += 2 * SBLIMIT * SSLIMIT; fr->layer3.hybrid_out = (real(*)[SSLIMIT][SBLIMIT])scratcher; scratcher += 2 * SSLIMIT * SBLIMIT; #endif /* Note: These buffers don't need resetting here. */ } /* Only reset the buffers we created just now. */ frame_decode_buffers_reset(fr); debug1("frame %p buffer done", (void*)fr); return 0; } int frame_buffers_reset(mpg123_handle *fr) { fr->buffer.fill = 0; /* hm, reset buffer fill... did we do a flush? */ fr->bsnum = 0; /* Wondering: could it be actually _wanted_ to retain buffer contents over different files? (special gapless / cut stuff) */ fr->bsbuf = fr->bsspace[1]; fr->bsbufold = fr->bsbuf; fr->bitreservoir = 0; frame_decode_buffers_reset(fr); memset(fr->bsspace, 0, 2*(MAXFRAMESIZE+512)); memset(fr->ssave, 0, 34); fr->hybrid_blc[0] = fr->hybrid_blc[1] = 0; memset(fr->hybrid_block, 0, sizeof(real)*2*2*SBLIMIT*SSLIMIT); return 0; } static void frame_icy_reset(mpg123_handle* fr) { #ifndef NO_ICY if(fr->icy.data != NULL) free(fr->icy.data); fr->icy.data = NULL; fr->icy.interval = 0; fr->icy.next = 0; #endif } static void frame_free_toc(mpg123_handle *fr) { if(fr->xing_toc != NULL){ free(fr->xing_toc); fr->xing_toc = NULL; } } /* Just copy the Xing TOC over... */ int frame_fill_toc(mpg123_handle *fr, unsigned char* in) { if(fr->xing_toc == NULL) fr->xing_toc = malloc(100); if(fr->xing_toc != NULL) { memcpy(fr->xing_toc, in, 100); #ifdef DEBUG debug("Got a TOC! Showing the values..."); { int i; for(i=0; i<100; ++i) debug2("entry %i = %i", i, fr->xing_toc[i]); } #endif return TRUE; } return FALSE; } /* Prepare the handle for a new track. Reset variables, buffers... */ int frame_reset(mpg123_handle* fr) { frame_buffers_reset(fr); frame_fixed_reset(fr); frame_free_toc(fr); #ifdef FRAME_INDEX fi_reset(&fr->index); #endif return 0; } /* Reset everythign except dynamic memory. */ static void frame_fixed_reset(mpg123_handle *fr) { frame_icy_reset(fr); open_bad(fr); fr->to_decode = FALSE; fr->to_ignore = FALSE; fr->metaflags = 0; fr->outblock = 0; /* This will be set before decoding! */ fr->num = -1; fr->input_offset = -1; fr->playnum = -1; fr->state_flags = FRAME_ACCURATE; fr->silent_resync = 0; fr->audio_start = 0; fr->clip = 0; fr->oldhead = 0; fr->firsthead = 0; fr->lay = 0; fr->vbr = MPG123_CBR; fr->abr_rate = 0; fr->track_frames = 0; fr->track_samples = -1; fr->framesize=0; fr->mean_frames = 0; fr->mean_framesize = 0; fr->freesize = 0; fr->lastscale = -1; fr->rva.level[0] = -1; fr->rva.level[1] = -1; fr->rva.gain[0] = 0; fr->rva.gain[1] = 0; fr->rva.peak[0] = 0; fr->rva.peak[1] = 0; fr->fsizeold = 0; fr->firstframe = 0; fr->ignoreframe = fr->firstframe-fr->p.preframes; fr->header_change = 0; fr->lastframe = -1; fr->fresh = 1; fr->new_format = 0; #ifdef GAPLESS frame_gapless_init(fr,-1,0,0); fr->lastoff = 0; fr->firstoff = 0; #endif #ifdef OPT_I486 fr->i486bo[0] = fr->i486bo[1] = FIR_SIZE-1; #endif fr->bo = 1; /* the usual bo */ #ifdef OPT_DITHER fr->ditherindex = 0; #endif reset_id3(fr); reset_icy(&fr->icy); /* ICY stuff should go into icy.c, eh? */ #ifndef NO_ICY fr->icy.interval = 0; fr->icy.next = 0; #endif fr->halfphase = 0; /* here or indeed only on first-time init? */ fr->error_protection = 0; fr->freeformat_framesize = -1; } static void frame_free_buffers(mpg123_handle *fr) { if(fr->rawbuffs != NULL) free(fr->rawbuffs); fr->rawbuffs = NULL; fr->rawbuffss = 0; if(fr->rawdecwin != NULL) free(fr->rawdecwin); fr->rawdecwin = NULL; fr->rawdecwins = 0; #ifndef NO_8BIT if(fr->conv16to8_buf != NULL) free(fr->conv16to8_buf); fr->conv16to8_buf = NULL; #endif if(fr->layerscratch != NULL) free(fr->layerscratch); } void frame_exit(mpg123_handle *fr) { if(fr->buffer.rdata != NULL) { debug1("freeing buffer at %p", (void*)fr->buffer.rdata); free(fr->buffer.rdata); } fr->buffer.rdata = NULL; frame_free_buffers(fr); frame_free_toc(fr); #ifdef FRAME_INDEX fi_exit(&fr->index); #endif #ifdef OPT_DITHER if(fr->dithernoise != NULL) { free(fr->dithernoise); fr->dithernoise = NULL; } #endif exit_id3(fr); clear_icy(&fr->icy); /* Clean up possible mess from LFS wrapper. */ if(fr->wrapperclean != NULL) { fr->wrapperclean(fr->wrapperdata); fr->wrapperdata = NULL; } #ifndef NO_FEEDER bc_cleanup(&fr->rdat.buffer); #endif } int attribute_align_arg mpg123_framedata(mpg123_handle *mh, unsigned long *header, unsigned char **bodydata, size_t *bodybytes) { if(mh == NULL) return MPG123_BAD_HANDLE; if(!mh->to_decode) return MPG123_ERR; if(header != NULL) *header = mh->oldhead; if(bodydata != NULL) *bodydata = mh->bsbuf; if(bodybytes != NULL) *bodybytes = mh->framesize; return MPG123_OK; } /* Fuzzy frame offset searching (guessing). When we don't have an accurate position, we may use an inaccurate one. Possibilities: - use approximate positions from Xing TOC (not yet parsed) - guess wildly from mean framesize and offset of first frame / beginning of file. */ static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame) { /* Default is to go to the beginning. */ off_t ret = fr->audio_start; *get_frame = 0; /* But we try to find something better. */ /* Xing VBR TOC works with relative positions, both in terms of audio frames and stream bytes. Thus, it only works when whe know the length of things. Oh... I assume the offsets are relative to the _total_ file length. */ if(fr->xing_toc != NULL && fr->track_frames > 0 && fr->rdat.filelen > 0) { /* One could round... */ int toc_entry = (int) ((double)want_frame*100./fr->track_frames); /* It is an index in the 100-entry table. */ if(toc_entry < 0) toc_entry = 0; if(toc_entry > 99) toc_entry = 99; /* Now estimate back what frame we get. */ *get_frame = (off_t) ((double)toc_entry/100. * fr->track_frames); fr->state_flags &= ~FRAME_ACCURATE; fr->silent_resync = 1; /* Question: Is the TOC for whole file size (with/without ID3) or the "real" audio data only? ID3v1 info could also matter. */ ret = (off_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen); } else if(fr->mean_framesize > 0) { /* Just guess with mean framesize (may be exact with CBR files). */ /* Query filelen here or not? */ fr->state_flags &= ~FRAME_ACCURATE; /* Fuzzy! */ fr->silent_resync = 1; *get_frame = want_frame; ret = (off_t) (fr->audio_start+fr->mean_framesize*want_frame); } debug5("fuzzy: want %li of %li, get %li at %li B of %li B", (long)want_frame, (long)fr->track_frames, (long)*get_frame, (long)ret, (long)(fr->rdat.filelen-fr->audio_start)); return ret; } /* find the best frame in index just before the wanted one, seek to there then step to just before wanted one with read_frame do not care tabout the stuff that was in buffer but not played back everything that left the decoder is counted as played Decide if you want low latency reaction and accurate timing info or stable long-time playback with buffer! */ off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame) { /* default is file start if no index position */ off_t gopos = 0; *get_frame = 0; #ifdef FRAME_INDEX /* Possibly use VBRI index, too? I'd need an example for this... */ if(fr->index.fill) { /* find in index */ size_t fi; /* at index fi there is frame step*fi... */ fi = want_frame/fr->index.step; if(fi >= fr->index.fill) /* If we are beyond the end of frame index...*/ { /* When fuzzy seek is allowed, we have some limited tolerance for the frames we want to read rather then jump over. */ if(fr->p.flags & MPG123_FUZZY && want_frame - (fr->index.fill-1)*fr->index.step > 10) { gopos = frame_fuzzy_find(fr, want_frame, get_frame); if(gopos > fr->audio_start) return gopos; /* Only in that case, we have a useful guess. */ /* Else... just continue, fuzzyness didn't help. */ } /* Use the last available position, slowly advancing from that one. */ fi = fr->index.fill - 1; } /* We have index position, that yields frame and byte offsets. */ *get_frame = fi*fr->index.step; gopos = fr->index.data[fi]; fr->state_flags |= FRAME_ACCURATE; /* When using the frame index, we are accurate. */ } else { #endif if(fr->p.flags & MPG123_FUZZY) return frame_fuzzy_find(fr, want_frame, get_frame); /* A bit hackish here... but we need to be fresh when looking for the first header again. */ fr->firsthead = 0; fr->oldhead = 0; #ifdef FRAME_INDEX } #endif debug2("index: 0x%lx for frame %li", (unsigned long)gopos, (long) *get_frame); return gopos; } off_t frame_ins2outs(mpg123_handle *fr, off_t ins) { off_t outs = 0; switch(fr->down_sample) { case 0: # ifndef NO_DOWNSAMPLE case 1: case 2: # endif outs = ins>>fr->down_sample; break; # ifndef NO_NTOM case 3: outs = ntom_ins2outs(fr, ins); break; # endif default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); } return outs; } off_t frame_outs(mpg123_handle *fr, off_t num) { off_t outs = 0; switch(fr->down_sample) { case 0: # ifndef NO_DOWNSAMPLE case 1: case 2: # endif outs = (fr->spf>>fr->down_sample)*num; break; #ifndef NO_NTOM case 3: outs = ntom_frmouts(fr, num); break; #endif default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); } return outs; } /* Compute the number of output samples we expect from this frame. This is either simple spf() or a tad more elaborate for ntom. */ off_t frame_expect_outsamples(mpg123_handle *fr) { off_t outs = 0; switch(fr->down_sample) { case 0: # ifndef NO_DOWNSAMPLE case 1: case 2: # endif outs = fr->spf>>fr->down_sample; break; #ifndef NO_NTOM case 3: outs = ntom_frame_outsamples(fr); break; #endif default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); } return outs; } off_t frame_offset(mpg123_handle *fr, off_t outs) { off_t num = 0; switch(fr->down_sample) { case 0: # ifndef NO_DOWNSAMPLE case 1: case 2: # endif num = outs/(fr->spf>>fr->down_sample); break; #ifndef NO_NTOM case 3: num = ntom_frameoff(fr, outs); break; #endif default: error("Bad down_sample ... should not be possible!!"); } return num; } #ifdef GAPLESS /* input in _input_ samples */ void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip) { debug3("frame_gapless_init: given %"OFF_P" frames, skip %"OFF_P" and %"OFF_P, (off_p)framecount, (off_p)bskip, (off_p)eskip); fr->gapless_frames = framecount; if(fr->gapless_frames > 0 && bskip >=0 && eskip >= 0) { fr->begin_s = bskip+GAPLESS_DELAY; fr->end_s = framecount*fr->spf-eskip+GAPLESS_DELAY; } else fr->begin_s = fr->end_s = 0; /* These will get proper values later, from above plus resampling info. */ fr->begin_os = 0; fr->end_os = 0; fr->fullend_os = 0; debug2("frame_gapless_init: from %"OFF_P" to %"OFF_P" samples", (off_p)fr->begin_s, (off_p)fr->end_s); } void frame_gapless_realinit(mpg123_handle *fr) { fr->begin_os = frame_ins2outs(fr, fr->begin_s); fr->end_os = frame_ins2outs(fr, fr->end_s); if(fr->gapless_frames > 0) fr->fullend_os = frame_ins2outs(fr, fr->gapless_frames*fr->spf); else fr->fullend_os = 0; debug4("frame_gapless_realinit: from %"OFF_P" to %"OFF_P" samples (%"OFF_P", %"OFF_P")", (off_p)fr->begin_os, (off_p)fr->end_os, (off_p)fr->fullend_os, (off_p)fr->gapless_frames); } /* At least note when there is trouble... */ void frame_gapless_update(mpg123_handle *fr, off_t total_samples) { off_t gapless_samples = fr->gapless_frames*fr->spf; if(fr->gapless_frames < 1) return; debug2("gapless update with new sample count %"OFF_P" as opposed to known %"OFF_P, total_samples, gapless_samples); if(NOQUIET && total_samples != gapless_samples) fprintf(stderr, "\nWarning: Real sample count %"OFF_P" differs from given gapless sample count %"OFF_P". Frankenstein stream?\n" , total_samples, gapless_samples); if(gapless_samples > total_samples) { if(NOQUIET) error2("End sample count smaller than gapless end! (%"OFF_P" < %"OFF_P"). Disabling gapless mode from now on.", (off_p)total_samples, (off_p)fr->end_s); /* This invalidates the current position... but what should I do? */ frame_gapless_init(fr, -1, 0, 0); frame_gapless_realinit(fr); fr->lastframe = -1; fr->lastoff = 0; } } #endif /* Compute the needed frame to ignore from, for getting accurate/consistent output for intended firstframe. */ static off_t ignoreframe(mpg123_handle *fr) { off_t preshift = fr->p.preframes; /* Layer 3 _really_ needs at least one frame before. */ if(fr->lay==3 && preshift < 1) preshift = 1; /* Layer 1 & 2 reall do not need more than 2. */ if(fr->lay!=3 && preshift > 2) preshift = 2; return fr->firstframe - preshift; } /* The frame seek... This is not simply the seek to fe*fr->spf samples in output because we think of _input_ frames here. Seek to frame offset 1 may be just seek to 200 samples offset in output since the beginning of first frame is delay/padding. Hm, is that right? OK for the padding stuff, but actually, should the decoder delay be better totally hidden or not? With gapless, even the whole frame position could be advanced further than requested (since Homey don't play dat). */ void frame_set_frameseek(mpg123_handle *fr, off_t fe) { fr->firstframe = fe; #ifdef GAPLESS if(fr->p.flags & MPG123_GAPLESS && fr->gapless_frames > 0) { /* Take care of the beginning... */ off_t beg_f = frame_offset(fr, fr->begin_os); if(fe <= beg_f) { fr->firstframe = beg_f; fr->firstoff = fr->begin_os - frame_outs(fr, beg_f); } else fr->firstoff = 0; /* The end is set once for a track at least, on the frame_set_frameseek called in get_next_frame() */ if(fr->end_os > 0) { fr->lastframe = frame_offset(fr,fr->end_os); fr->lastoff = fr->end_os - frame_outs(fr, fr->lastframe); } else {fr->lastframe = -1; fr->lastoff = 0; } } else { fr->firstoff = fr->lastoff = 0; fr->lastframe = -1; } #endif fr->ignoreframe = ignoreframe(fr); #ifdef GAPLESS debug5("frame_set_frameseek: begin at %li frames and %li samples, end at %li and %li; ignore from %li", (long) fr->firstframe, (long) fr->firstoff, (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe); #else debug3("frame_set_frameseek: begin at %li frames, end at %li; ignore from %li", (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe); #endif } void frame_skip(mpg123_handle *fr) { #ifndef NO_LAYER3 if(fr->lay == 3) set_pointer(fr, 512); #endif } /* Sample accurate seek prepare for decoder. */ /* This gets unadjusted output samples and takes resampling into account */ void frame_set_seek(mpg123_handle *fr, off_t sp) { fr->firstframe = frame_offset(fr, sp); debug1("frame_set_seek: from %"OFF_P, fr->num); #ifndef NO_NTOM if(fr->down_sample == 3) ntom_set_ntom(fr, fr->firstframe); #endif fr->ignoreframe = ignoreframe(fr); #ifdef GAPLESS /* The sample offset is used for non-gapless mode, too! */ fr->firstoff = sp - frame_outs(fr, fr->firstframe); debug5("frame_set_seek: begin at %li frames and %li samples, end at %li and %li; ignore from %li", (long) fr->firstframe, (long) fr->firstoff, (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe); #else debug3("frame_set_seek: begin at %li frames, end at %li; ignore from %li", (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe); #endif } int attribute_align_arg mpg123_volume_change(mpg123_handle *mh, double change) { if(mh == NULL) return MPG123_ERR; return mpg123_volume(mh, change + (double) mh->p.outscale); } int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol) { if(mh == NULL) return MPG123_ERR; if(vol >= 0) mh->p.outscale = vol; else mh->p.outscale = 0.; do_rva(mh); return MPG123_OK; } static int get_rva(mpg123_handle *fr, double *peak, double *gain) { double p = -1; double g = 0; int ret = 0; if(fr->p.rva) { int rt = 0; /* Should one assume a zero RVA as no RVA? */ if(fr->p.rva == 2 && fr->rva.level[1] != -1) rt = 1; if(fr->rva.level[rt] != -1) { p = fr->rva.peak[rt]; g = fr->rva.gain[rt]; ret = 1; /* Success. */ } } if(peak != NULL) *peak = p; if(gain != NULL) *gain = g; return ret; } /* adjust the volume, taking both fr->outscale and rva values into account */ void do_rva(mpg123_handle *fr) { double peak = 0; double gain = 0; double newscale; double rvafact = 1; if(get_rva(fr, &peak, &gain)) { if(NOQUIET && fr->p.verbose > 1) fprintf(stderr, "Note: doing RVA with gain %f\n", gain); rvafact = pow(10,gain/20); } newscale = fr->p.outscale*rvafact; /* if peak is unknown (== 0) this check won't hurt */ if((peak*newscale) > 1.0) { newscale = 1.0/peak; warning2("limiting scale value to %f to prevent clipping with indicated peak factor of %f", newscale, peak); } /* first rva setting is forced with fr->lastscale < 0 */ if(newscale != fr->lastscale || fr->decoder_change) { debug3("changing scale value from %f to %f (peak estimated to %f)", fr->lastscale != -1 ? fr->lastscale : fr->p.outscale, newscale, (double) (newscale*peak)); fr->lastscale = newscale; /* It may be too early, actually. */ if(fr->make_decode_tables != NULL) fr->make_decode_tables(fr); /* the actual work */ } } int attribute_align_arg mpg123_getvolume(mpg123_handle *mh, double *base, double *really, double *rva_db) { if(mh == NULL) return MPG123_ERR; if(base) *base = mh->p.outscale; if(really) *really = mh->lastscale; get_rva(mh, NULL, rva_db); return MPG123_OK; } off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh) { if(mh == NULL) return MPG123_ERR; return mh->input_offset; } welle.io-2.1/src/libs/mpg123/frame.h000066400000000000000000000301371357201522000170670ustar00rootroot00000000000000/* frame: Central data structures and opmitization hooks. copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #ifndef MPG123_FRAME_H #define MPG123_FRAME_H #include #include "config.h" #include "mpg123.h" #include "optimize.h" #include "id3.h" #include "icy.h" #include "reader.h" #ifdef FRAME_INDEX #include "index.h" #endif #include "synths.h" #ifdef OPT_DITHER #include "dither.h" int frame_dither_init(mpg123_handle *fr); #endif /* max = 1728 */ #define MAXFRAMESIZE 3456 struct al_table { short bits; short d; }; /* the output buffer, used to be pcm_sample, pcm_point and audiobufsize */ struct outbuffer { unsigned char *data; /* main data pointer, aligned */ unsigned char *p; /* read pointer */ size_t fill; /* fill from read pointer */ size_t size; unsigned char *rdata; /* unaligned base pointer */ }; struct audioformat { int encoding; /* Final encoding, after post-processing. */ int encsize; /* Size of one sample in bytes, plain int should be fine here... */ int dec_enc; /* Encoding of decoder synth. */ int dec_encsize; /* Size of one decoder sample. */ int channels; long rate; }; void invalidate_format(struct audioformat *af); struct mpg123_pars_struct { int verbose; /* verbose level */ long flags; /* combination of above */ #ifndef NO_NTOM long force_rate; #endif int down_sample; int rva; /* (which) rva to do: 0: nothing, 1: radio/mix/track 2: album/audiophile */ long halfspeed; long doublespeed; long timeout; #define NUM_CHANNELS 2 char audio_caps[NUM_CHANNELS][MPG123_RATES+1][MPG123_ENCODINGS]; /* long start_frame; */ /* frame offset to begin with */ /* long frame_number;*/ /* number of frames to decode */ #ifndef NO_ICY long icy_interval; #endif double outscale; long resync_limit; long index_size; /* Long, because: negative values have a meaning. */ long preframes; #ifndef NO_FEEDER long feedpool; long feedbuffer; #endif }; enum frame_state_flags { FRAME_ACCURATE = 0x1 /**< 0001 Positions are considered accurate. */ ,FRAME_FRANKENSTEIN = 0x2 /**< 0010 This stream is concatenated. */ ,FRAME_FRESH_DECODER = 0x4 /**< 0100 Decoder is fleshly initialized. */ }; /* There is a lot to condense here... many ints can be merged as flags; though the main space is still consumed by buffers. */ struct mpg123_handle_struct { int fresh; /* to be moved into flags */ int new_format; real hybrid_block[2][2][SBLIMIT*SSLIMIT]; int hybrid_blc[2]; /* the scratch vars for the decoders, sometimes real, sometimes short... sometimes int/long */ short *short_buffs[2][2]; real *real_buffs[2][2]; unsigned char *rawbuffs; int rawbuffss; #ifdef OPT_I486 int i486bo[2]; #endif int bo; /* Just have it always here. */ #ifdef OPT_DITHER int ditherindex; float *dithernoise; #endif unsigned char* rawdecwin; /* the block with all decwins */ int rawdecwins; /* size of rawdecwin memory */ real *decwin; /* _the_ decode table */ #ifdef OPT_MMXORSSE /* I am not really sure that I need both of them... used in assembler */ float *decwin_mmx; float *decwins; #endif #ifndef NO_EQUALIZER int have_eq_settings; real equalizer[2][32]; #endif /* for halfspeed mode */ unsigned char ssave[34]; int halfphase; #ifndef NO_8BIT /* a raw buffer and a pointer into the middle for signed short conversion, only allocated on demand */ unsigned char *conv16to8_buf; unsigned char *conv16to8; #endif /* There's some possible memory saving for stuff that is not _really_ dynamic. */ /* layer3 */ int longLimit[9][23]; int shortLimit[9][14]; real gainpow2[256+118+4]; /* not really dynamic, just different for mmx */ /* layer2 */ real muls[27][64]; /* also used by layer 1 */ #ifndef NO_NTOM /* decode_ntom */ unsigned long ntom_val[2]; unsigned long ntom_step; #endif /* special i486 fun */ #ifdef OPT_I486 int *int_buffs[2][2]; #endif /* special altivec... */ #ifdef OPT_ALTIVEC real *areal_buffs[4][4]; #endif struct synth_s synths; struct { #ifdef OPT_MULTI #ifndef NO_LAYER3 #if (defined OPT_3DNOW_VINTAGE || defined OPT_3DNOWEXT_VINTAGE || defined OPT_SSE || defined OPT_X86_64 || defined OPT_AVX || defined OPT_NEON || defined OPT_NEON64) void (*the_dct36)(real *,real *,real *,real *,real *); #endif #endif #endif enum optdec type; enum optcla class; } cpu_opts; int verbose; /* 0: nothing, 1: just print chosen decoder, 2: be verbose */ const struct al_table *alloc; /* The runtime-chosen decoding, based on input and output format. */ func_synth synth; func_synth_stereo synth_stereo; func_synth_mono synth_mono; /* Yes, this function is runtime-switched, too. */ void (*make_decode_tables)(mpg123_handle *fr); /* That is the volume control. */ int stereo; /* I _think_ 1 for mono and 2 for stereo */ int jsbound; #define SINGLE_STEREO -1 #define SINGLE_LEFT 0 #define SINGLE_RIGHT 1 #define SINGLE_MIX 3 int single; int II_sblimit; int down_sample_sblimit; int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ /* Many flags in disguise as integers... wasting bytes. */ int mpeg25; int down_sample; int header_change; int lay; long spf; /* cached count of samples per frame */ int (*do_layer)(mpg123_handle *); int error_protection; int bitrate_index; int sampling_frequency; int padding; int extension; int mode; int mode_ext; int copyright; int original; int emphasis; int framesize; /* computed framesize */ int freesize; /* free format frame size */ enum mpg123_vbr vbr; /* 1 if variable bitrate was detected */ off_t num; /* frame offset ... */ off_t input_offset; /* byte offset of this frame in input stream */ off_t playnum; /* playback offset... includes repetitions, reset at seeks */ off_t audio_start; /* The byte offset in the file where audio data begins. */ int state_flags; char silent_resync; /* Do not complain for the next n resyncs. */ unsigned char* xing_toc; /* The seek TOC from Xing header. */ int freeformat; long freeformat_framesize; /* bitstream info; bsi */ int bitindex; unsigned char *wordpointer; /* temporary storage for getbits stuff */ unsigned long ultmp; unsigned char uctmp; /* rva data, used in common.c, set in id3.c */ double maxoutburst; /* The maximum amplitude in current sample represenation. */ double lastscale; struct { int level[2]; float gain[2]; float peak[2]; } rva; /* input data */ off_t track_frames; off_t track_samples; double mean_framesize; off_t mean_frames; int fsizeold; int ssize; unsigned int bitreservoir; unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */ unsigned char *bsbuf; unsigned char *bsbufold; int bsnum; /* That is the header matching the last read frame body. */ unsigned long oldhead; /* That is the header that is supposedly the first of the stream. */ unsigned long firsthead; int abr_rate; #ifdef FRAME_INDEX struct frame_index index; #endif /* output data */ struct outbuffer buffer; struct audioformat af; int own_buffer; size_t outblock; /* number of bytes that this frame produces (upper bound) */ int to_decode; /* this frame holds data to be decoded */ int to_ignore; /* the same, somehow */ off_t firstframe; /* start decoding from here */ off_t lastframe; /* last frame to decode (for gapless or num_frames limit) */ off_t ignoreframe; /* frames to decode but discard before firstframe */ #ifdef GAPLESS off_t gapless_frames; /* frame count for the gapless part */ off_t firstoff; /* number of samples to ignore from firstframe */ off_t lastoff; /* number of samples to use from lastframe */ off_t begin_s; /* overall begin offset in samples */ off_t begin_os; off_t end_s; /* overall end offset in samples */ off_t end_os; off_t fullend_os; /* gapless_frames translated to output samples */ #endif unsigned int crc; /* Well, I need a safe 16bit type, actually. But wider doesn't hurt. */ struct reader *rd; /* pointer to the reading functions */ struct reader_data rdat; /* reader data and state info */ struct mpg123_pars_struct p; int err; int decoder_change; int delayed_change; long clip; /* the meta crap */ int metaflags; unsigned char id3buf[128]; #ifndef NO_ID3V2 mpg123_id3v2 id3v2; #endif #ifndef NO_ICY struct icy_meta icy; #endif /* More variables needed for decoders, layerX.c. This time it is not about static variables but about the need for alignment which cannot be guaranteed on the stack by certain compilers (Sun Studio). We do not require the compiler to align stuff for our hand-written assembly. We only hope that it's able to align stuff for SSE and similar ops it generates itself. */ /* Those layer-specific structs could actually share memory, as they are not in use simultaneously. One might allocate on decoder switch, too. They all reside in one lump of memory (after each other), allocated to layerscratch. */ real *layerscratch; #ifndef NO_LAYER1 struct { real (*fraction)[SBLIMIT]; /* ALIGNED(16) real fraction[2][SBLIMIT]; */ } layer1; #endif #ifndef NO_LAYER2 struct { real (*fraction)[4][SBLIMIT]; /* ALIGNED(16) real fraction[2][4][SBLIMIT] */ } layer2; #endif #ifndef NO_LAYER3 /* These are significant chunks of memory already... */ struct { real (*hybrid_in)[SBLIMIT][SSLIMIT]; /* ALIGNED(16) real hybridIn[2][SBLIMIT][SSLIMIT]; */ real (*hybrid_out)[SSLIMIT][SBLIMIT]; /* ALIGNED(16) real hybridOut[2][SSLIMIT][SBLIMIT]; */ } layer3; #endif /* A place for storing additional data for the large file wrapper. This is cruft! */ void *wrapperdata; /* A callback used to properly destruct the wrapper data. */ void (*wrapperclean)(void*); }; /* generic init, does not include dynamic buffers */ void frame_init(mpg123_handle *fr); void frame_init_par(mpg123_handle *fr, mpg123_pars *mp); /* output buffer and format */ int frame_outbuffer(mpg123_handle *fr); int frame_output_format(mpg123_handle *fr); int frame_buffers(mpg123_handle *fr); /* various decoder buffers, needed once */ int frame_reset(mpg123_handle* fr); /* reset for next track */ int frame_buffers_reset(mpg123_handle *fr); void frame_exit(mpg123_handle *fr); /* end, free all buffers */ /* Index functions... */ /* Well... print it... */ int mpg123_print_index(mpg123_handle *fr, FILE* out); /* Find a seek position in index. */ off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame); /* Apply index_size setting. */ int frame_index_setup(mpg123_handle *fr); void do_volume(mpg123_handle *fr, double factor); void do_rva(mpg123_handle *fr); /* samples per frame ... Layer I Layer II Layer III MPEG-1 384 1152 1152 MPEG-2 LSF 384 1152 576 MPEG 2.5 384 1152 576 */ #ifdef GAPLESS /* well, I take that one for granted... at least layer3 */ #define GAPLESS_DELAY 529 void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip); void frame_gapless_realinit(mpg123_handle *fr); void frame_gapless_update(mpg123_handle *mh, off_t total_samples); /*void frame_gapless_position(mpg123_handle* fr); void frame_gapless_bytify(mpg123_handle *fr); void frame_gapless_ignore(mpg123_handle *fr, off_t frames);*/ /* void frame_gapless_buffercheck(mpg123_handle *fr); */ #endif /* Number of samples the decoding of the current frame should yield. */ off_t frame_expect_outsamples(mpg123_handle *fr); /* Skip this frame... do some fake action to get away without actually decoding it. */ void frame_skip(mpg123_handle *fr); /* Seeking core functions: - convert input sample offset to output sample offset - convert frame offset to output sample offset - get leading frame offset for output sample offset The offsets are "unadjusted"/internal; resampling is being taken care of. */ off_t frame_ins2outs(mpg123_handle *fr, off_t ins); off_t frame_outs(mpg123_handle *fr, off_t num); /* This one just computes the expected sample count for _this_ frame. */ off_t frame_expect_outsampels(mpg123_handle *fr); off_t frame_offset(mpg123_handle *fr, off_t outs); void frame_set_frameseek(mpg123_handle *fr, off_t fe); void frame_set_seek(mpg123_handle *fr, off_t sp); off_t frame_tell_seek(mpg123_handle *fr); /* Take a copy of the Xing VBR TOC for fuzzy seeking. */ int frame_fill_toc(mpg123_handle *fr, unsigned char* in); #endif welle.io-2.1/src/libs/mpg123/gapless.h000066400000000000000000000103751357201522000174350ustar00rootroot00000000000000/* sampleadjust: gapless sample offset math copyright 1995-2012 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org This is no stand-alone header, precisely to be able to fool it into using fake handle types for testing the math. */ #include "debug.h" #ifdef GAPLESS /* From internal sample number to external. */ static off_t sample_adjust(mpg123_handle *mh, off_t x) { off_t s; if(mh->p.flags & MPG123_GAPLESS) { /* It's a bit tricky to do this computation for the padding samples. They are not there on the outside. */ if(x > mh->end_os) { if(x < mh->fullend_os) s = mh->end_os - mh->begin_os; else s = x - (mh->fullend_os - mh->end_os + mh->begin_os); } else s = x - mh->begin_os; } else s = x; return s; } /* from external samples to internal */ static off_t sample_unadjust(mpg123_handle *mh, off_t x) { off_t s; if(mh->p.flags & MPG123_GAPLESS) { s = x + mh->begin_os; /* There is a hole; we don't create sample positions in there. Jump from the end of the gapless track directly to after the padding. */ if(s >= mh->end_os) s += mh->fullend_os - mh->end_os; } else s = x; return s; } /* Take the buffer after a frame decode (strictly: it is the data from frame fr->num!) and cut samples out. fr->buffer.fill may then be smaller than before... */ static void frame_buffercheck(mpg123_handle *fr) { /* When we have no accurate position, gapless code does not make sense. */ if(!(fr->state_flags & FRAME_ACCURATE)) return; /* Get a grip on dirty streams that start with a gapless header. Simply accept all data from frames that are too much, they are supposedly attached to the stream after the fact. */ if(fr->gapless_frames > 0 && fr->num >= fr->gapless_frames) return; /* Important: We first cut samples from the end, then cut from beginning (including left-shift of the buffer). This order works also for the case where firstframe == lastframe. */ /* The last interesting (planned) frame: Only use some leading samples. Note a difference from the below: The last frame and offset are unchanges by seeks. The lastoff keeps being valid. */ if(fr->lastframe > -1 && fr->num >= fr->lastframe) { /* There can be more than one frame of padding at the end, so we ignore the whole frame if we are beyond lastframe. */ off_t byteoff = (fr->num == fr->lastframe) ? samples_to_bytes(fr, fr->lastoff) : 0; if((off_t)fr->buffer.fill > byteoff) { fr->buffer.fill = byteoff; } if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on end of stream to %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)(fr->num == fr->lastframe ? fr->lastoff : 0), (size_p)fr->buffer.fill); } /* The first interesting frame: Skip some leading samples. */ if(fr->firstoff && fr->num == fr->firstframe) { off_t byteoff = samples_to_bytes(fr, fr->firstoff); if((off_t)fr->buffer.fill > byteoff) { fr->buffer.fill -= byteoff; /* buffer.p != buffer.data only for own buffer */ debug6("cutting %li samples/%li bytes on begin, own_buffer=%i at %p=%p, buf[1]=%i", (long)fr->firstoff, (long)byteoff, fr->own_buffer, (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]); if(fr->own_buffer) fr->buffer.p = fr->buffer.data + byteoff; else memmove(fr->buffer.data, fr->buffer.data + byteoff, fr->buffer.fill); debug3("done cutting, buffer at %p =? %p, buf[1]=%i", (void*)fr->buffer.p, (void*)fr->buffer.data, ((short*)fr->buffer.p)[2]); } else fr->buffer.fill = 0; if(VERBOSE3) fprintf(stderr, "\nNote: Cut frame %"OFF_P" buffer on beginning of stream by %"OFF_P" samples, fill now %"SIZE_P" bytes.\n", (off_p)fr->num, (off_p)fr->firstoff, (size_p)fr->buffer.fill); /* We can only reach this frame again by seeking. And on seeking, firstoff will be recomputed. So it is safe to null it here (and it makes the if() decision abort earlier). */ fr->firstoff = 0; } } #define SAMPLE_ADJUST(mh,x) sample_adjust(mh,x) #define SAMPLE_UNADJUST(mh,x) sample_unadjust(mh,x) #define FRAME_BUFFERCHECK(mh) frame_buffercheck(mh) #else /* no gapless code included */ #define SAMPLE_ADJUST(mh,x) (x) #define SAMPLE_UNADJUST(mh,x) (x) #define FRAME_BUFFERCHECK(mh) #endif welle.io-2.1/src/libs/mpg123/getbits.h000066400000000000000000000055601357201522000174400ustar00rootroot00000000000000/* getbits copyright ?-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp All code is in the header to suggest/force inlining of these small often-used functions. This indeed has some impact on performance. */ #ifndef _MPG123_GETBITS_H_ #define _MPG123_GETBITS_H_ #include "mpg123lib_intern.h" #define backbits(fr,nob) ((void)( \ fr->bitindex -= nob, \ fr->wordpointer += (fr->bitindex>>3), \ fr->bitindex &= 0x7 )) #define getbitoffset(fr) ((-fr->bitindex)&0x7) #define getbyte(fr) (*fr->wordpointer++) /* There is something wrong with that macro... the function below works also for the layer1 test case. */ #define macro_getbits(fr, nob) ( \ fr->ultmp = fr->wordpointer[0],\ fr->ultmp <<= 8, \ fr->ultmp |= fr->wordpointer[1], \ fr->ultmp <<= 8, \ fr->ultmp |= fr->wordpointer[2], \ fr->ultmp <<= fr->bitindex, \ fr->ultmp &= 0xffffff, \ fr->bitindex += nob, \ fr->ultmp >>= (24-nob), \ fr->wordpointer += (fr->bitindex>>3), \ fr->bitindex &= 7, \ fr->ultmp) static unsigned int getbits(mpg123_handle *fr, int number_of_bits) { unsigned long rval; #ifdef DEBUG_GETBITS fprintf(stderr,"g%d",number_of_bits); #endif /* Safety catch until we got the nasty code fully figured out. */ /* No, that catch stays here, even if we think we got it figured out! */ if( (long)(fr->wordpointer-fr->bsbuf)*8 + fr->bitindex+number_of_bits > (long)fr->framesize*8 ) return 0; /* This is actually slow: if(!number_of_bits) return 0; */ #if 0 check_buffer_range(number_of_bits+fr->bitindex); #endif { rval = fr->wordpointer[0]; rval <<= 8; rval |= fr->wordpointer[1]; rval <<= 8; rval |= fr->wordpointer[2]; rval <<= fr->bitindex; rval &= 0xffffff; fr->bitindex += number_of_bits; rval >>= (24-number_of_bits); fr->wordpointer += (fr->bitindex>>3); fr->bitindex &= 7; } #ifdef DEBUG_GETBITS fprintf(stderr,":%lx\n",rval); #endif return rval; } #define skipbits(fr, nob) fr->ultmp = ( \ fr->ultmp = fr->wordpointer[0], fr->ultmp <<= 8, fr->ultmp |= fr->wordpointer[1], \ fr->ultmp <<= 8, fr->ultmp |= fr->wordpointer[2], fr->ultmp <<= fr->bitindex, \ fr->ultmp &= 0xffffff, fr->bitindex += nob, \ fr->ultmp >>= (24-nob), fr->wordpointer += (fr->bitindex>>3), \ fr->bitindex &= 7 ) #define getbits_fast(fr, nob) ( \ fr->ultmp = (unsigned char) (fr->wordpointer[0] << fr->bitindex), \ fr->ultmp |= ((unsigned long) fr->wordpointer[1]<bitindex)>>8, \ fr->ultmp <<= nob, fr->ultmp >>= 8, \ fr->bitindex += nob, fr->wordpointer += (fr->bitindex>>3), \ fr->bitindex &= 7, fr->ultmp ) #define get1bit(fr) ( \ fr->uctmp = *fr->wordpointer << fr->bitindex, fr->bitindex++, \ fr->wordpointer += (fr->bitindex>>3), fr->bitindex &= 7, fr->uctmp>>7 ) #endif welle.io-2.1/src/libs/mpg123/getcpuflags.S000066400000000000000000000047471357201522000202640ustar00rootroot00000000000000/* getcpucpuflags: get cpuflags for ia32 copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http:#mpg123.org initially written by KIMURA Takuhiro (for 3DNow!) extended for general use by Thomas Orgis extern int getcpuid(struct cpuflags*) or just extern int getcpuid(unsigned int*) where there is memory for 4 ints -> the first set of idflags (basic cpu family info) and the idflags, stdflags, std2flags, extflags written to the parameter -> 0x00000000 (CPUID instruction not supported) */ #include "mangle.h" .text ALIGN4 .globl ASM_NAME(getcpuflags) /* .type ASM_NAME(getcpuflags),@function */ ASM_NAME(getcpuflags): pushl %ebp movl %esp,%ebp pushl %edx pushl %ecx pushl %ebx pushl %esi /* get the int pointer for storing the flags */ movl 8(%ebp), %esi /* does that one make sense? */ movl $0x80000000,%eax /* now save the flags and do a check for cpuid availability */ pushfl pushfl popl %eax movl %eax,%ebx /* set that bit... */ xorl $0x00200000,%eax pushl %eax popfl /* ...and read back the flags to see if it is understood */ pushfl popl %eax popfl cmpl %ebx,%eax je .Lnocpuid /* In principle, I would have to check the CPU's identify first to be sure how to interpret the extended flags. */ /* now get the info, first extended */ movl $0x0, 12(%esi) /* clear value */ movl $0x0, 16(%esi) /* clear value */ /* only if supported... */ movl $0x80000000, %eax cpuid /* IDT CPUs should not change EAX, generally I hope that non-3DNow cpus do not set a bogus support level here. */ cmpl $0x80000001, %eax jb .Lnoextended /* Skip ext check without minimal support level. */ /* is supported, get flags value */ movl $0x80000001,%eax cpuid movl %edx,12(%esi) .Lnoextended: /* then the other ones, called last to get the id flags in %eax for ret */ movl $0x00000001,%eax cpuid movl %eax, (%esi) movl %ecx, 4(%esi) movl %edx, 8(%esi) /* check if xgetbv instruction is available */ test $0x04000000, %ecx jz .Lend test $0x08000000, %ecx jz .Lend xor %ecx, %ecx .byte 0x0f, 0x01, 0xd0 /* xgetbv instruction */ movl %eax, 16(%esi) movl (%esi), %eax jmp .Lend ALIGN4 .Lnocpuid: /* error: set everything to zero */ movl $0, %eax movl $0, (%esi) movl $0, 4(%esi) movl $0, 8(%esi) movl $0, 12(%esi) movl $0, 16(%esi) ALIGN4 .Lend: /* return value are the id flags, still stored in %eax */ popl %esi popl %ebx popl %ecx popl %edx movl %ebp,%esp popl %ebp ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/getcpuflags.h000066400000000000000000000037401357201522000203010ustar00rootroot00000000000000/* getcpucpuflags: get cpuflags for ia32 copyright ?-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http:#mpg123.org initially written by KIMURA Takuhiro (for 3DNow!) extended for general use by Thomas Orgis */ #ifndef MPG123_H_GETCPUFLAGS #define MPG123_H_GETCPUFLAGS /* standard level flags part 1 (ECX)*/ #define FLAG_SSE3 0x00000001 #define FLAG_SSSE3 0x00000200 #define FLAG_AVX 0x1C000000 /* standard level flags part 2 (EDX) */ #define FLAG2_MMX 0x00800000 #define FLAG2_SSE 0x02000000 #define FLAG2_SSE2 0x04000000 #define FLAG2_FPU 0x00000001 /* cpuid extended level 1 (AMD) */ #define XFLAG_MMX 0x00800000 #define XFLAG_3DNOW 0x80000000 #define XFLAG_3DNOWEXT 0x40000000 /* eXtended Control Register 0 */ #define XCR0FLAG_AVX 0x00000006 struct cpuflags { #if defined(OPT_ARM) || defined(OPT_NEON) || defined(OPT_NEON64) unsigned int has_neon; #else unsigned int id; unsigned int std; unsigned int std2; unsigned int ext; unsigned int xcr0_lo; #endif }; unsigned int getcpuflags(struct cpuflags* cf); /* checks the family */ #define cpu_i586(s) ( ((s.id & 0xf00)>>8) == 0 || ((s.id & 0xf00)>>8) > 4 ) /* checking some flags... */ #define cpu_fpu(s) (FLAG2_FPU & s.std2) #define cpu_mmx(s) (FLAG2_MMX & s.std2 || XFLAG_MMX & s.ext) #define cpu_3dnow(s) (XFLAG_3DNOW & s.ext) #define cpu_3dnowext(s) (XFLAG_3DNOWEXT & s.ext) #define cpu_sse(s) (FLAG2_SSE & s.std2) #define cpu_sse2(s) (FLAG2_SSE2 & s.std2) #define cpu_sse3(s) (FLAG_SSE3 & s.std) #define cpu_avx(s) ((FLAG_AVX & s.std) == FLAG_AVX && (XCR0FLAG_AVX & s.xcr0_lo) == XCR0FLAG_AVX) #define cpu_fast_sse(s) ((((s.id & 0xf00)>>8) == 6 && FLAG_SSSE3 & s.std) /* for Intel/VIA; family 6 CPUs with SSSE3 */ || \ (((s.id & 0xf00)>>8) == 0xf && (((s.id & 0x0ff00000)>>20) > 0 && ((s.id & 0x0ff00000)>>20) != 5))) /* for AMD; family > 0xF CPUs except Bobcat */ #define cpu_neon(s) (s.has_neon) #endif welle.io-2.1/src/libs/mpg123/getcpuflags_arm.c000066400000000000000000000021251357201522000211270ustar00rootroot00000000000000/* getcpuflags_arm: get cpuflags for ARM copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Momma */ #include #include #include "mpg123lib_intern.h" #include "getcpuflags.h" extern void check_neon(void); #ifndef _M_ARM static sigjmp_buf jmpbuf; #else static jmp_buf jmpbuf; #endif static void mpg123_arm_catch_sigill(int sig) { #ifndef _M_ARM siglongjmp(jmpbuf, 1); #else longjmp(jmpbuf, 1); #endif } unsigned int getcpuflags(struct cpuflags* cf) { #ifndef _M_ARM struct sigaction act, act_old; act.sa_handler = mpg123_arm_catch_sigill; act.sa_flags = SA_RESTART; sigemptyset(&act.sa_mask); sigaction(SIGILL, &act, &act_old); cf->has_neon = 0; if(!sigsetjmp(jmpbuf, 1)) { check_neon(); cf->has_neon = 1; } sigaction(SIGILL, &act_old, NULL); #else cf->has_neon = 0; if (!setjmp(jmpbuf)) { signal(SIGILL, mpg123_arm_catch_sigill); check_neon(); cf->has_neon = 1; } signal(SIGILL, SIG_DFL); #endif return 0; } welle.io-2.1/src/libs/mpg123/getcpuflags_x86_64.S000066400000000000000000000016571357201522000212770ustar00rootroot00000000000000/* getcpuflags_x86_64: get cpuflags for x86-64 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #include "mangle.h" .text ALIGN4 .globl ASM_NAME(getcpuflags) ASM_NAME(getcpuflags): push %rbp mov %rsp, %rbp push %rbx #ifdef IS_MSABI push %rdi mov %rcx, %rdi #endif movl $0, 12(%rdi) movl $0, 16(%rdi) mov $0x80000000, %eax cpuid cmp $0x80000001, %eax jb 1f mov $0x80000001, %eax cpuid movl %edx, 12(%rdi) 1: mov $0x00000001, %eax cpuid movl %eax, (%rdi) movl %ecx, 4(%rdi) movl %edx, 8(%rdi) test $0x04000000, %ecx jz 2f test $0x08000000, %ecx jz 2f xor %ecx, %ecx .byte 0x0f, 0x01, 0xd0 /* xgetbv instruction */ movl %eax, 16(%rdi) movl (%rdi), %eax 2: #ifdef IS_MSABI pop %rdi #endif pop %rbx mov %rbp, %rsp pop %rbp ret NONEXEC_STACK welle.io-2.1/src/libs/mpg123/huffman.h000066400000000000000000000377061357201522000174320ustar00rootroot00000000000000/* huffman.h: huffman tables ... recalcualted to work with optimized decoder scheme (MH) copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp probably we could save a few bytes of memory, because the smaller tables are often the part of a bigger table */ #ifndef _MPG123_HUFFMAN_H_ #define _MPG123_HUFFMAN_H_ struct newhuff { unsigned int linbits; const short *table; }; static const short tab0[] = { 0 }; static const short tab1[] = { -5, -3, -1, 17, 1, 16, 0 }; static const short tab2[] = { -15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1, 16, 0 }; static const short tab3[] = { -13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1, 1, 0 }; static const short tab5[] = { -29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19, 3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16, 0 }; static const short tab6[] = { -25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19, 49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16, 0 }; static const short tab7[] = { -69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83, -1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1, 80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65, 64, -11, -7, -3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1, 48, 34, 18, -5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0 }; static const short tab8[] = { -65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83, -3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52, 67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65, -3, -1, 4, 64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3, 48, 34, -1, 2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0 }; static const short tab9[] = { -63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1, 84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67, -1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1, 20, 65, -5, -3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3, -1, 34, 2, 18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0 }; static const short tab10[] = { -125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118, 87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3, -1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11, -5, -3, -1, 100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1, 83, 68, 23, -17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82, 21, -1, 81, -1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80, -19, -11, -7, -3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1, 64, 35, -1, 50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16, 0 }; static const short tab11[] = { -121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117, -3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55, -1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83, 39, -1, 114, -1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54, 99, -1, 96, -1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98, -3, -1, 38, 6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1, 67, 51, -1, 36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1, 18, -1, 2, 32, 17, -3, -1, 1, 16, 0 }; static const short tab12[] = { -115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87, 117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115, 85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1, 113, -1, 7, 112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68, -1, 6, 5, -1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53, 83, -1, 37, 82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3, -1, 80, 4, 36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11, -7, -5, -3, -1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7, -5, -3, -1, 2, 32, 0, 17, -1, 1, 16 }; static const short tab13[] = { -509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9, -7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238, 207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1, 175, 233, -1, 236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159, -3, -1, 249, 234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204, -1, 174, 158, -5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173, 188, -3, -1, 203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217, -3, -1, 245, 231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202, 230, 243, -1, 63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1, 110, 156, 15, -5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11, -5, -3, -1, 200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23, -13, -5, -1, 240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5, -1, 226, -1, 46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1, 213, 124, -3, -1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1, 169, 108, -1, 198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1, 210, 29, -5, -1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5, -3, -1, 167, 151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7, -3, -1, 76, 196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3, -1, 181, 137, 28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192, -1, 180, 106, -5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11, -5, -1, 43, -1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1, 119, 118, 178, -11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74, -7, -3, -1, 58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3, -1, 26, 161, -3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3, -1, 57, 88, -1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117, 56, -5, -1, 131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11, -3, -1, 25, 145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114, -1, 70, 100, 40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39, 23, -1, 113, -1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3, -1, 84, 38, -1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22, 97, -1, 6, 96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5, -1, 21, 81, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -19, -11, -5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3, -1, 49, 3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, 0 }; static const short tab15[] = { -495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239, -1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237, 191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1, 250, 190, -3, -1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234, -1, 189, 219, -3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127, -1, 247, 173, -3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3, -1, 203, 246, -3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1, 231, 172, -9, -3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244, 63, -1, 243, 216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110, 240, -3, -1, 31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186, 229, -3, -1, 125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1, 62, 109, -3, -1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1, 226, 30, -5, -1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7, -3, -1, 124, 199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1, 169, 108, -1, 198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29, -1, 123, 183, -5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3, -1, 168, 76, -1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195, -9, -3, -1, 122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91, -55, -29, -15, -7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75, -1, 180, 106, -5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43, 90, -11, -5, -1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3, -1, 150, 74, -1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1, 89, 149, -1, 42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7, -3, -1, 134, 73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88, 133, -53, -29, -13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1, 25, 144, -7, -3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 71, -7, -3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8, -1, 128, 86, -3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39, 114, -1, 100, 23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3, -1, 99, 69, -1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53, -33, -19, -9, -5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21, 81, -3, -1, 5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1, 65, -1, 20, 4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3, -1, 49, 48, 34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3, -1, 1, 16, 0 }; static const short tab16[] = { -509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3, -1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246, 255, -9, -5, -3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1, 63, -29, -19, -13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1, 234, 217, -1, 238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219, 174, -11, -5, -1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3, -1, 201, 125, 94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241, -49, -25, -13, -5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157, 231, -7, -3, -1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3, -1, 171, 186, -1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62, -1, 109, -1, 214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212, -1, 184, 169, -5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224, -1, 93, 213, -3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7, -3, -1, 154, 108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1, 138, 168, -1, 153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91, 137, 28, -1, 192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3, -1, 211, 45, -1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3, -1, 196, 107, -1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3, -1, 193, 12, -1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90, 165, 43, -1, 178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105, 150, -1, 74, 164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42, -97, -57, -33, -19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119, 148, -5, -3, -1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3, -1, 57, 147, -1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9, 25, -5, -1, 145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21, -11, -5, -3, -1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129, 128, -3, -1, 8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39, 114, -5, -3, -1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112, 54, -3, -1, 99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1, 6, 96, -9, -5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1, 21, 5, -33, -23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19, 49, -3, -1, 3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, 0 }; static const short tab24[] = { -451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9, -5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95, 245, -1, 79, 244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1, 241, -1, 31, 240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206, -7, -3, -1, 236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234, -15, -7, -3, -1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218, 188, -7, -3, -1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231, 172, 255,-235, -143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141, 216, -5, -3, -1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1, 94, 186, -9, -5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140, 200, -3, -1, 78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155, -3, -1, 185, 170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124, -3, -1, 199, 77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1, 169, 108, -3, -1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1, 123, 183, -3, -1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153, -1, 76, 196, -3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1, 195, 122, -1, 167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19, -7, -3, -1, 137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3, -1, 176, 10, 26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3, -1, 160, 9, 144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7, -3, -1, 165, 27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1, 74, 120, 135, -1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3, -1, 161, 104, -1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31, -15, -7, -3, -1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25, 145, -7, -3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 40, -17, -7, -3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8, 128, -1, 86, 101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55, 39, 114, -15, -7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99, -1, 69, 84, -7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6, 96, 53, -1, 83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1, 21, -1, 5, 80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51, 20, -9, -5, -1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7, -5, -3, -1, 3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17, 1, -1, 16, 0 }; static const short tab_c0[] = { -29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5, 9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8, 0 }; static const short tab_c1[] = { -15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9, 8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1, 0 }; static const struct newhuff ht[] = { { /* 0 */ 0 , tab0 } , { /* 2 */ 0 , tab1 } , { /* 3 */ 0 , tab2 } , { /* 3 */ 0 , tab3 } , { /* 0 */ 0 , tab0 } , { /* 4 */ 0 , tab5 } , { /* 4 */ 0 , tab6 } , { /* 6 */ 0 , tab7 } , { /* 6 */ 0 , tab8 } , { /* 6 */ 0 , tab9 } , { /* 8 */ 0 , tab10 } , { /* 8 */ 0 , tab11 } , { /* 8 */ 0 , tab12 } , { /* 16 */ 0 , tab13 } , { /* 0 */ 0 , tab0 } , { /* 16 */ 0 , tab15 } , { /* 16 */ 1 , tab16 } , { /* 16 */ 2 , tab16 } , { /* 16 */ 3 , tab16 } , { /* 16 */ 4 , tab16 } , { /* 16 */ 6 , tab16 } , { /* 16 */ 8 , tab16 } , { /* 16 */ 10, tab16 } , { /* 16 */ 13, tab16 } , { /* 16 */ 4 , tab24 } , { /* 16 */ 5 , tab24 } , { /* 16 */ 6 , tab24 } , { /* 16 */ 7 , tab24 } , { /* 16 */ 8 , tab24 } , { /* 16 */ 9 , tab24 } , { /* 16 */ 11, tab24 } , { /* 16 */ 13, tab24 } }; static const struct newhuff htc[] = { { /* 1 , 1 , */ 0 , tab_c0 } , { /* 1 , 1 , */ 0 , tab_c1 } }; #endif welle.io-2.1/src/libs/mpg123/icy.c000066400000000000000000000012371357201522000165530ustar00rootroot00000000000000/* icy: Puny code to pretend for a serious ICY data structure. copyright 2007-2015 by the mpg123 project -= free software under the terms of the LGPL 2.1 =- see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #include "intsym.h" #include "icy.h" void init_icy(struct icy_meta *icy) { icy->data = NULL; } void clear_icy(struct icy_meta *icy) { if(icy->data != NULL) free(icy->data); init_icy(icy); } void reset_icy(struct icy_meta *icy) { clear_icy(icy); init_icy(icy); } /*void set_icy(struct icy_meta *icy, char* new_data) { if(icy->data) free(icy->data); icy->data = new_data; icy->changed = 1; }*/ welle.io-2.1/src/libs/mpg123/icy.h000066400000000000000000000013251357201522000165560ustar00rootroot00000000000000/* icy: support for SHOUTcast ICY meta info, an attempt to keep it organized copyright 2006-7 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis and modelled after patch by Honza */ #ifndef MPG123_ICY_H #define MPG123_ICY_H #ifndef NO_ICY #include "compat.h" #include "mpg123.h" struct icy_meta { char* data; off_t interval; off_t next; }; void init_icy(struct icy_meta *); void clear_icy(struct icy_meta *); void reset_icy(struct icy_meta *); #else #undef init_icy #define init_icy(a) #undef clear_icy #define clear_icy(a) #undef reset_icy #define reset_icy(a) #endif /* NO_ICY */ #endif welle.io-2.1/src/libs/mpg123/icy2utf8.c000066400000000000000000000312131357201522000174410ustar00rootroot00000000000000/* mpg123 note: This is BSD-licensed code that is no problem for mpg123 usage under LGPL. It's Free, understood? ;-) */ /* Another note: This code is basically written by Thorsten Glaser, Thomas Orgis did just some rearrangements and comments. */ /*- * Copyright (c) 2008 * Thorsten Glaser * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission * is granted to deal in this work without restriction, including un- * limited rights to use, publicly perform, distribute, sell, modify, * merge, give away, or sublicence. * * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to * the utmost extent permitted by applicable law, neither express nor * implied; without malicious intent or gross negligence. In no event * may a licensor, author or contributor be held liable for indirect, * direct, other damage, loss, or other issues arising in any way out * of dealing in the work, even if advised of the possibility of such * damage or existence of a defect, except proven that it results out * of said person's immediate fault when using the work as intended. *- * Convert from ICY encoding (windows-1252 codepage) to UTF-8 */ #include "config.h" #include "intsym.h" /* Includes string and stdlib headers... */ #include "compat.h" /* ThOr: too lazy for this type check; also we use char/short all around anyway. Of cource, it would be the proper way to use _these_ kind of types all around. */ #define uint8_t unsigned char #define uint16_t unsigned short static const uint8_t cp1252_utf8[] = { /* 0x00 @ 0 */ 0x00, /* 0x01 @ 1 */ 0x01, /* 0x02 @ 2 */ 0x02, /* 0x03 @ 3 */ 0x03, /* 0x04 @ 4 */ 0x04, /* 0x05 @ 5 */ 0x05, /* 0x06 @ 6 */ 0x06, /* 0x07 @ 7 */ 0x07, /* 0x08 @ 8 */ 0x08, /* 0x09 @ 9 */ 0x09, /* 0x0A @ 10 */ 0x0A, /* 0x0B @ 11 */ 0x0B, /* 0x0C @ 12 */ 0x0C, /* 0x0D @ 13 */ 0x0D, /* 0x0E @ 14 */ 0x0E, /* 0x0F @ 15 */ 0x0F, /* 0x10 @ 16 */ 0x10, /* 0x11 @ 17 */ 0x11, /* 0x12 @ 18 */ 0x12, /* 0x13 @ 19 */ 0x13, /* 0x14 @ 20 */ 0x14, /* 0x15 @ 21 */ 0x15, /* 0x16 @ 22 */ 0x16, /* 0x17 @ 23 */ 0x17, /* 0x18 @ 24 */ 0x18, /* 0x19 @ 25 */ 0x19, /* 0x1A @ 26 */ 0x1A, /* 0x1B @ 27 */ 0x1B, /* 0x1C @ 28 */ 0x1C, /* 0x1D @ 29 */ 0x1D, /* 0x1E @ 30 */ 0x1E, /* 0x1F @ 31 */ 0x1F, /* 0x20 @ 32 */ 0x20, /* 0x21 @ 33 */ 0x21, /* 0x22 @ 34 */ 0x22, /* 0x23 @ 35 */ 0x23, /* 0x24 @ 36 */ 0x24, /* 0x25 @ 37 */ 0x25, /* 0x26 @ 38 */ 0x26, /* 0x27 @ 39 */ 0x27, /* 0x28 @ 40 */ 0x28, /* 0x29 @ 41 */ 0x29, /* 0x2A @ 42 */ 0x2A, /* 0x2B @ 43 */ 0x2B, /* 0x2C @ 44 */ 0x2C, /* 0x2D @ 45 */ 0x2D, /* 0x2E @ 46 */ 0x2E, /* 0x2F @ 47 */ 0x2F, /* 0x30 @ 48 */ 0x30, /* 0x31 @ 49 */ 0x31, /* 0x32 @ 50 */ 0x32, /* 0x33 @ 51 */ 0x33, /* 0x34 @ 52 */ 0x34, /* 0x35 @ 53 */ 0x35, /* 0x36 @ 54 */ 0x36, /* 0x37 @ 55 */ 0x37, /* 0x38 @ 56 */ 0x38, /* 0x39 @ 57 */ 0x39, /* 0x3A @ 58 */ 0x3A, /* 0x3B @ 59 */ 0x3B, /* 0x3C @ 60 */ 0x3C, /* 0x3D @ 61 */ 0x3D, /* 0x3E @ 62 */ 0x3E, /* 0x3F @ 63 */ 0x3F, /* 0x40 @ 64 */ 0x40, /* 0x41 @ 65 */ 0x41, /* 0x42 @ 66 */ 0x42, /* 0x43 @ 67 */ 0x43, /* 0x44 @ 68 */ 0x44, /* 0x45 @ 69 */ 0x45, /* 0x46 @ 70 */ 0x46, /* 0x47 @ 71 */ 0x47, /* 0x48 @ 72 */ 0x48, /* 0x49 @ 73 */ 0x49, /* 0x4A @ 74 */ 0x4A, /* 0x4B @ 75 */ 0x4B, /* 0x4C @ 76 */ 0x4C, /* 0x4D @ 77 */ 0x4D, /* 0x4E @ 78 */ 0x4E, /* 0x4F @ 79 */ 0x4F, /* 0x50 @ 80 */ 0x50, /* 0x51 @ 81 */ 0x51, /* 0x52 @ 82 */ 0x52, /* 0x53 @ 83 */ 0x53, /* 0x54 @ 84 */ 0x54, /* 0x55 @ 85 */ 0x55, /* 0x56 @ 86 */ 0x56, /* 0x57 @ 87 */ 0x57, /* 0x58 @ 88 */ 0x58, /* 0x59 @ 89 */ 0x59, /* 0x5A @ 90 */ 0x5A, /* 0x5B @ 91 */ 0x5B, /* 0x5C @ 92 */ 0x5C, /* 0x5D @ 93 */ 0x5D, /* 0x5E @ 94 */ 0x5E, /* 0x5F @ 95 */ 0x5F, /* 0x60 @ 96 */ 0x60, /* 0x61 @ 97 */ 0x61, /* 0x62 @ 98 */ 0x62, /* 0x63 @ 99 */ 0x63, /* 0x64 @ 100 */ 0x64, /* 0x65 @ 101 */ 0x65, /* 0x66 @ 102 */ 0x66, /* 0x67 @ 103 */ 0x67, /* 0x68 @ 104 */ 0x68, /* 0x69 @ 105 */ 0x69, /* 0x6A @ 106 */ 0x6A, /* 0x6B @ 107 */ 0x6B, /* 0x6C @ 108 */ 0x6C, /* 0x6D @ 109 */ 0x6D, /* 0x6E @ 110 */ 0x6E, /* 0x6F @ 111 */ 0x6F, /* 0x70 @ 112 */ 0x70, /* 0x71 @ 113 */ 0x71, /* 0x72 @ 114 */ 0x72, /* 0x73 @ 115 */ 0x73, /* 0x74 @ 116 */ 0x74, /* 0x75 @ 117 */ 0x75, /* 0x76 @ 118 */ 0x76, /* 0x77 @ 119 */ 0x77, /* 0x78 @ 120 */ 0x78, /* 0x79 @ 121 */ 0x79, /* 0x7A @ 122 */ 0x7A, /* 0x7B @ 123 */ 0x7B, /* 0x7C @ 124 */ 0x7C, /* 0x7D @ 125 */ 0x7D, /* 0x7E @ 126 */ 0x7E, /* 0x7F @ 127 */ 0x7F, /* 0x80 @ 128 */ 0xE2, 0x82, 0xAC, /* 0x81 @ 131 */ 0xEF, 0xBF, 0xBD, /* 0x82 @ 134 */ 0xE2, 0x80, 0x9A, /* 0x83 @ 137 */ 0xC6, 0x92, /* 0x84 @ 139 */ 0xE2, 0x80, 0x9E, /* 0x85 @ 142 */ 0xE2, 0x80, 0xA6, /* 0x86 @ 145 */ 0xE2, 0x80, 0xA0, /* 0x87 @ 148 */ 0xE2, 0x80, 0xA1, /* 0x88 @ 151 */ 0xCB, 0x86, /* 0x89 @ 153 */ 0xE2, 0x80, 0xB0, /* 0x8A @ 156 */ 0xC5, 0xA0, /* 0x8B @ 158 */ 0xE2, 0x80, 0xB9, /* 0x8C @ 161 */ 0xC5, 0x92, /* 0x8D @ 163 */ 0xEF, 0xBF, 0xBD, /* 0x8E @ 166 */ 0xC5, 0xBD, /* 0x8F @ 168 */ 0xEF, 0xBF, 0xBD, /* 0x90 @ 171 */ 0xEF, 0xBF, 0xBD, /* 0x91 @ 174 */ 0xE2, 0x80, 0x98, /* 0x92 @ 177 */ 0xE2, 0x80, 0x99, /* 0x93 @ 180 */ 0xE2, 0x80, 0x9C, /* 0x94 @ 183 */ 0xE2, 0x80, 0x9D, /* 0x95 @ 186 */ 0xE2, 0x80, 0xA2, /* 0x96 @ 189 */ 0xE2, 0x80, 0x93, /* 0x97 @ 192 */ 0xE2, 0x80, 0x94, /* 0x98 @ 195 */ 0xCB, 0x9C, /* 0x99 @ 197 */ 0xE2, 0x84, 0xA2, /* 0x9A @ 200 */ 0xC5, 0xA1, /* 0x9B @ 202 */ 0xE2, 0x80, 0xBA, /* 0x9C @ 205 */ 0xC5, 0x93, /* 0x9D @ 207 */ 0xEF, 0xBF, 0xBD, /* 0x9E @ 210 */ 0xC5, 0xBE, /* 0x9F @ 212 */ 0xC5, 0xB8, /* 0xA0 @ 214 */ 0xC2, 0xA0, /* 0xA1 @ 216 */ 0xC2, 0xA1, /* 0xA2 @ 218 */ 0xC2, 0xA2, /* 0xA3 @ 220 */ 0xC2, 0xA3, /* 0xA4 @ 222 */ 0xC2, 0xA4, /* 0xA5 @ 224 */ 0xC2, 0xA5, /* 0xA6 @ 226 */ 0xC2, 0xA6, /* 0xA7 @ 228 */ 0xC2, 0xA7, /* 0xA8 @ 230 */ 0xC2, 0xA8, /* 0xA9 @ 232 */ 0xC2, 0xA9, /* 0xAA @ 234 */ 0xC2, 0xAA, /* 0xAB @ 236 */ 0xC2, 0xAB, /* 0xAC @ 238 */ 0xC2, 0xAC, /* 0xAD @ 240 */ 0xC2, 0xAD, /* 0xAE @ 242 */ 0xC2, 0xAE, /* 0xAF @ 244 */ 0xC2, 0xAF, /* 0xB0 @ 246 */ 0xC2, 0xB0, /* 0xB1 @ 248 */ 0xC2, 0xB1, /* 0xB2 @ 250 */ 0xC2, 0xB2, /* 0xB3 @ 252 */ 0xC2, 0xB3, /* 0xB4 @ 254 */ 0xC2, 0xB4, /* 0xB5 @ 256 */ 0xC2, 0xB5, /* 0xB6 @ 258 */ 0xC2, 0xB6, /* 0xB7 @ 260 */ 0xC2, 0xB7, /* 0xB8 @ 262 */ 0xC2, 0xB8, /* 0xB9 @ 264 */ 0xC2, 0xB9, /* 0xBA @ 266 */ 0xC2, 0xBA, /* 0xBB @ 268 */ 0xC2, 0xBB, /* 0xBC @ 270 */ 0xC2, 0xBC, /* 0xBD @ 272 */ 0xC2, 0xBD, /* 0xBE @ 274 */ 0xC2, 0xBE, /* 0xBF @ 276 */ 0xC2, 0xBF, /* 0xC0 @ 278 */ 0xC3, 0x80, /* 0xC1 @ 280 */ 0xC3, 0x81, /* 0xC2 @ 282 */ 0xC3, 0x82, /* 0xC3 @ 284 */ 0xC3, 0x83, /* 0xC4 @ 286 */ 0xC3, 0x84, /* 0xC5 @ 288 */ 0xC3, 0x85, /* 0xC6 @ 290 */ 0xC3, 0x86, /* 0xC7 @ 292 */ 0xC3, 0x87, /* 0xC8 @ 294 */ 0xC3, 0x88, /* 0xC9 @ 296 */ 0xC3, 0x89, /* 0xCA @ 298 */ 0xC3, 0x8A, /* 0xCB @ 300 */ 0xC3, 0x8B, /* 0xCC @ 302 */ 0xC3, 0x8C, /* 0xCD @ 304 */ 0xC3, 0x8D, /* 0xCE @ 306 */ 0xC3, 0x8E, /* 0xCF @ 308 */ 0xC3, 0x8F, /* 0xD0 @ 310 */ 0xC3, 0x90, /* 0xD1 @ 312 */ 0xC3, 0x91, /* 0xD2 @ 314 */ 0xC3, 0x92, /* 0xD3 @ 316 */ 0xC3, 0x93, /* 0xD4 @ 318 */ 0xC3, 0x94, /* 0xD5 @ 320 */ 0xC3, 0x95, /* 0xD6 @ 322 */ 0xC3, 0x96, /* 0xD7 @ 324 */ 0xC3, 0x97, /* 0xD8 @ 326 */ 0xC3, 0x98, /* 0xD9 @ 328 */ 0xC3, 0x99, /* 0xDA @ 330 */ 0xC3, 0x9A, /* 0xDB @ 332 */ 0xC3, 0x9B, /* 0xDC @ 334 */ 0xC3, 0x9C, /* 0xDD @ 336 */ 0xC3, 0x9D, /* 0xDE @ 338 */ 0xC3, 0x9E, /* 0xDF @ 340 */ 0xC3, 0x9F, /* 0xE0 @ 342 */ 0xC3, 0xA0, /* 0xE1 @ 344 */ 0xC3, 0xA1, /* 0xE2 @ 346 */ 0xC3, 0xA2, /* 0xE3 @ 348 */ 0xC3, 0xA3, /* 0xE4 @ 350 */ 0xC3, 0xA4, /* 0xE5 @ 352 */ 0xC3, 0xA5, /* 0xE6 @ 354 */ 0xC3, 0xA6, /* 0xE7 @ 356 */ 0xC3, 0xA7, /* 0xE8 @ 358 */ 0xC3, 0xA8, /* 0xE9 @ 360 */ 0xC3, 0xA9, /* 0xEA @ 362 */ 0xC3, 0xAA, /* 0xEB @ 364 */ 0xC3, 0xAB, /* 0xEC @ 366 */ 0xC3, 0xAC, /* 0xED @ 368 */ 0xC3, 0xAD, /* 0xEE @ 370 */ 0xC3, 0xAE, /* 0xEF @ 372 */ 0xC3, 0xAF, /* 0xF0 @ 374 */ 0xC3, 0xB0, /* 0xF1 @ 376 */ 0xC3, 0xB1, /* 0xF2 @ 378 */ 0xC3, 0xB2, /* 0xF3 @ 380 */ 0xC3, 0xB3, /* 0xF4 @ 382 */ 0xC3, 0xB4, /* 0xF5 @ 384 */ 0xC3, 0xB5, /* 0xF6 @ 386 */ 0xC3, 0xB6, /* 0xF7 @ 388 */ 0xC3, 0xB7, /* 0xF8 @ 390 */ 0xC3, 0xB8, /* 0xF9 @ 392 */ 0xC3, 0xB9, /* 0xFA @ 394 */ 0xC3, 0xBA, /* 0xFB @ 396 */ 0xC3, 0xBB, /* 0xFC @ 398 */ 0xC3, 0xBC, /* 0xFD @ 400 */ 0xC3, 0xBD, /* 0xFE @ 402 */ 0xC3, 0xBE, /* 0xFF @ 404 */ 0xC3, 0xBF, }; static const uint16_t tblofs[257] = { /* 0x00 */ 0, 1, 2, 3, 4, 5, 6, 7, /* 0x08 */ 8, 9, 10, 11, 12, 13, 14, 15, /* 0x10 */ 16, 17, 18, 19, 20, 21, 22, 23, /* 0x18 */ 24, 25, 26, 27, 28, 29, 30, 31, /* 0x20 */ 32, 33, 34, 35, 36, 37, 38, 39, /* 0x28 */ 40, 41, 42, 43, 44, 45, 46, 47, /* 0x30 */ 48, 49, 50, 51, 52, 53, 54, 55, /* 0x38 */ 56, 57, 58, 59, 60, 61, 62, 63, /* 0x40 */ 64, 65, 66, 67, 68, 69, 70, 71, /* 0x48 */ 72, 73, 74, 75, 76, 77, 78, 79, /* 0x50 */ 80, 81, 82, 83, 84, 85, 86, 87, /* 0x58 */ 88, 89, 90, 91, 92, 93, 94, 95, /* 0x60 */ 96, 97, 98, 99, 100, 101, 102, 103, /* 0x68 */ 104, 105, 106, 107, 108, 109, 110, 111, /* 0x70 */ 112, 113, 114, 115, 116, 117, 118, 119, /* 0x78 */ 120, 121, 122, 123, 124, 125, 126, 127, /* 0x80 */ 128, 131, 134, 137, 139, 142, 145, 148, /* 0x88 */ 151, 153, 156, 158, 161, 163, 166, 168, /* 0x90 */ 171, 174, 177, 180, 183, 186, 189, 192, /* 0x98 */ 195, 197, 200, 202, 205, 207, 210, 212, /* 0xA0 */ 214, 216, 218, 220, 222, 224, 226, 228, /* 0xA8 */ 230, 232, 234, 236, 238, 240, 242, 244, /* 0xB0 */ 246, 248, 250, 252, 254, 256, 258, 260, /* 0xB8 */ 262, 264, 266, 268, 270, 272, 274, 276, /* 0xC0 */ 278, 280, 282, 284, 286, 288, 290, 292, /* 0xC8 */ 294, 296, 298, 300, 302, 304, 306, 308, /* 0xD0 */ 310, 312, 314, 316, 318, 320, 322, 324, /* 0xD8 */ 326, 328, 330, 332, 334, 336, 338, 340, /* 0xE0 */ 342, 344, 346, 348, 350, 352, 354, 356, /* 0xE8 */ 358, 360, 362, 364, 366, 368, 370, 372, /* 0xF0 */ 374, 376, 378, 380, 382, 384, 386, 388, /* 0xF8 */ 390, 392, 394, 396, 398, 400, 402, 404, /* sizeof (cp1252_utf8) */ 406 }; /* Check if a string qualifies as UTF-8. */ static int is_utf8(const char* src) { uint8_t ch; size_t i; const uint8_t* s = (const uint8_t*) src; /* We make a loop over every character, until we find a null one. Remember: The string is supposed to end with a NUL, so ahead checks are safe. */ while ((ch = *s++)) { /* Ye olde 7bit ASCII chars 'rr fine for anything */ if(ch < 0x80) continue; /* Now, we watch out for non-UTF conform sequences. */ else if ((ch < 0xC2) || (ch > 0xFD)) return 0; /* check for some misformed sequences */ if (((ch == 0xC2) && (s[0] < 0xA0)) || ((ch == 0xEF) && (s[0] == 0xBF) && (s[1] > 0xBD))) /* XXX add more for outside the BMP */ return 0; /* Check the continuation bytes. */ if (ch < 0xE0) i = 1; else if (ch < 0xF0) i = 2; else if (ch < 0xF8) i = 3; else if (ch < 0xFC) i = 4; else i = 5; while (i--) if ((*s++ & 0xC0) != 0x80) return 0; } /* If no check failed, the string indeed looks like valid UTF-8. */ return 1; } /* The main conversion routine. ICY in CP-1252 (or UTF-8 alreay) to UTF-8 encoded string. If force is applied, it will always encode to UTF-8, without checking. */ char * icy2utf8(const char *src, int force) { const uint8_t *s = (const uint8_t *)src; size_t srclen, dstlen, i, k; uint8_t ch, *d; char *dst; /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already. So, be prepared and don't try to re-encode such. Unless forced. */ if(!force && is_utf8(src)) return (compat_strdup(src)); srclen = strlen(src) + 1; /* allocate conservatively */ if ((d = malloc(srclen * 3)) == NULL) return (NULL); i = 0; dstlen = 0; while (i < srclen) { ch = s[i++]; k = tblofs[ch]; while (k < tblofs[ch + 1]) d[dstlen++] = cp1252_utf8[k++]; } /* dstlen includes trailing NUL since srclen also does */ if ((dst = realloc(d, dstlen)) == NULL) { free(d); return (NULL); } return (dst); } /* This stuff is for testing only. */ #ifdef TEST static const char intext[] = "\225 Gr\374\337e kosten 0,55 \200\205"; #include int main(void) { char *t, *t2; if ((t = icy2utf8(intext, 0)) == NULL) { fprintf(stderr, "out of memory\n"); return (1); } /* make sure it won't be converted twice */ if ((t2 = icy2utf8(t), 0) == NULL) { fprintf(stderr, "out of memory\n"); return (1); } printf("Result is:\t\343\200\214%s\343\200\215\n" "\t\t\343\200\214%s\343\200\215\n", t, t2); free(t); free(t2); return (0); } #endif welle.io-2.1/src/libs/mpg123/icy2utf8.h000066400000000000000000000003071357201522000174460ustar00rootroot00000000000000/* You expect a license plate for _this_ file? */ #ifndef MPG123_ICY2UTF_H #define MPG123_ICY2UTF_H #ifndef NO_ICY /* (string, force conversion) */ char *icy2utf8(const char *, int); #endif #endif welle.io-2.1/src/libs/mpg123/id3.c000066400000000000000000001151651357201522000164540ustar00rootroot00000000000000/* id3: ID3v2.3 and ID3v2.4 parsing (a relevant subset) copyright 2006-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #include "mpg123lib_intern.h" #include "id3.h" #include "debug.h" #ifndef NO_ID3V2 /* Only the main parsing routine will always be there. */ /* We know the usual text frames plus some specifics. */ #define KNOWN_FRAMES 5 static const char frame_type[KNOWN_FRAMES][5] = { "COMM", "TXXX", "RVA2", "USLT", "APIC" }; enum frame_types { unknown = -2, text = -1, comment, extra, rva2, uslt, picture }; /* UTF support definitions */ typedef void (*text_converter)(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); static void convert_latin1 (mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); static void convert_utf16bom(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); static void convert_utf8 (mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); static const text_converter text_converters[4] = { convert_latin1, /* We always check for (multiple) BOM in 16bit unicode. Without BOM, UTF16 BE is the default. Errors in encoding are detected anyway. */ convert_utf16bom, convert_utf16bom, convert_utf8 }; static const unsigned int encoding_widths[4] = { 1, 2, 2, 1 }; /* the code starts here... */ static void null_id3_links(mpg123_handle *fr) { fr->id3v2.title = NULL; fr->id3v2.artist = NULL; fr->id3v2.album = NULL; fr->id3v2.year = NULL; fr->id3v2.genre = NULL; fr->id3v2.comment = NULL; } void init_id3(mpg123_handle *fr) { fr->id3v2.version = 0; /* nothing there */ null_id3_links(fr); fr->id3v2.comments = 0; fr->id3v2.comment_list = NULL; fr->id3v2.texts = 0; fr->id3v2.text = NULL; fr->id3v2.extras = 0; fr->id3v2.extra = NULL; fr->id3v2.pictures = 0; fr->id3v2.picture = NULL; } /* Managing of the text, comment and extra lists. */ /* Initialize one element. */ static void init_mpg123_text(mpg123_text *txt) { mpg123_init_string(&txt->text); mpg123_init_string(&txt->description); txt->id[0] = 0; txt->id[1] = 0; txt->id[2] = 0; txt->id[3] = 0; txt->lang[0] = 0; txt->lang[1] = 0; txt->lang[2] = 0; } static void init_mpg123_picture(mpg123_picture *pic) { mpg123_init_string(&pic->mime_type); mpg123_init_string(&pic->description); pic->type = 0; pic->size = 0; pic->data = NULL; } /* Free memory of one element. */ static void free_mpg123_text(mpg123_text *txt) { mpg123_free_string(&txt->text); mpg123_free_string(&txt->description); } static void free_mpg123_picture(mpg123_picture * pic) { mpg123_free_string(&pic->mime_type); mpg123_free_string(&pic->description); if (pic->data != NULL) free(pic->data); } /* Free memory of whole list. */ #define free_comment(mh) free_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) #define free_text(mh) free_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) #define free_extra(mh) free_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) #define free_picture(mh) free_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) static void free_id3_text(mpg123_text **list, size_t *size) { size_t i; for(i=0; i<*size; ++i) free_mpg123_text(&((*list)[i])); free(*list); *list = NULL; *size = 0; } static void free_id3_picture(mpg123_picture **list, size_t *size) { size_t i; for(i=0; i<*size; ++i) free_mpg123_picture(&((*list)[i])); free(*list); *list = NULL; *size = 0; } /* Add items to the list. */ #define add_comment(mh) add_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) #define add_text(mh) add_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) #define add_extra(mh) add_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) #define add_picture(mh) add_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) static mpg123_text *add_id3_text(mpg123_text **list, size_t *size) { mpg123_text *x = safe_realloc(*list, sizeof(mpg123_text)*(*size+1)); if(x == NULL) return NULL; /* bad */ *list = x; *size += 1; init_mpg123_text(&((*list)[*size-1])); return &((*list)[*size-1]); /* Return pointer to the added text. */ } static mpg123_picture *add_id3_picture(mpg123_picture **list, size_t *size) { mpg123_picture *x = safe_realloc(*list, sizeof(mpg123_picture)*(*size+1)); if(x == NULL) return NULL; /* bad */ *list = x; *size += 1; init_mpg123_picture(&((*list)[*size-1])); return &((*list)[*size-1]); /* Return pointer to the added picture. */ } /* Remove the last item. */ #define pop_comment(mh) pop_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) #define pop_text(mh) pop_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) #define pop_extra(mh) pop_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) #define pop_picture(mh) pop_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) static void pop_id3_text(mpg123_text **list, size_t *size) { mpg123_text *x; if(*size < 1) return; free_mpg123_text(&((*list)[*size-1])); if(*size > 1) { x = safe_realloc(*list, sizeof(mpg123_text)*(*size-1)); if(x != NULL){ *list = x; *size -= 1; } } else { free(*list); *list = NULL; *size = 0; } } static void pop_id3_picture(mpg123_picture **list, size_t *size) { mpg123_picture *x; if(*size < 1) return; free_mpg123_picture(&((*list)[*size-1])); if(*size > 1) { x = safe_realloc(*list, sizeof(mpg123_picture)*(*size-1)); if(x != NULL){ *list = x; *size -= 1; } } else { free(*list); *list = NULL; *size = 0; } } /* OK, back to the higher level functions. */ void exit_id3(mpg123_handle *fr) { free_picture(fr); free_comment(fr); free_extra(fr); free_text(fr); } void reset_id3(mpg123_handle *fr) { exit_id3(fr); init_id3(fr); } /* Set the id3v2.artist id3v2.title ... links to elements of the array. */ void id3_link(mpg123_handle *fr) { size_t i; mpg123_id3v2 *v2 = &fr->id3v2; debug("linking ID3v2"); null_id3_links(fr); for(i=0; itexts; ++i) { mpg123_text *entry = &v2->text[i]; if (!strncmp("TIT2", entry->id, 4)) v2->title = &entry->text; else if(!strncmp("TALB", entry->id, 4)) v2->album = &entry->text; else if(!strncmp("TPE1", entry->id, 4)) v2->artist = &entry->text; else if(!strncmp("TYER", entry->id, 4)) v2->year = &entry->text; else if(!strncmp("TCON", entry->id, 4)) v2->genre = &entry->text; } for(i=0; icomments; ++i) { mpg123_text *entry = &v2->comment_list[i]; if(entry->description.fill == 0 || entry->description.p[0] == 0) v2->comment = &entry->text; } /* When no generic comment found, use the last non-generic one. */ if(v2->comment == NULL && v2->comments > 0) v2->comment = &v2->comment_list[v2->comments-1].text; } /* Store ID3 text data in an mpg123_string; either verbatim copy or everything translated to UTF-8 encoding. Preserve the zero string separator (I don't need strlen for the total size). ID3v2 standard says that there should be one text frame of specific type per tag, and subsequent tags overwrite old values. So, I always replace the text that may be stored already (perhaps with a list of zero-separated strings, though). */ static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t source_size, const int noquiet, const int notranslate) { unsigned char encoding; if(!source_size) { debug("Empty id3 data!"); return; } /* We shall just copy the data. Client wants to decode itself. */ if(notranslate) { /* Future: Add a path for ID3 errors. */ if(!mpg123_resize_string(sb, source_size)) { if(noquiet) error("Cannot resize target string, out of memory?"); return; } memcpy(sb->p, source, source_size); sb->fill = source_size; debug1("stored undecoded ID3 text of size %"SIZE_P, (size_p)source_size); return; } encoding = source[0]; if(encoding > mpg123_id3_enc_max) { if(noquiet) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); mpg123_free_string(sb); return; } id3_to_utf8(sb, encoding, source+1, source_size-1, noquiet); if(sb->fill) debug1("UTF-8 string (the first one): %s", sb->p); else if(noquiet) error("unable to convert string to UTF-8 (out of memory, junk input?)!"); } /* On error, sb->size is 0. */ /* Also, encoding has been checked already! */ void id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet) { unsigned int bwidth; debug1("encoding: %u", encoding); /* A note: ID3v2.3 uses UCS-2 non-variable 16bit encoding, v2.4 uses UTF16. UTF-16 uses a reserved/private range in UCS-2 to add the magic, so we just always treat it as UTF. */ bwidth = encoding_widths[encoding]; /* Hack! I've seen a stray zero byte before BOM. Is that supposed to happen? */ if(encoding != mpg123_id3_utf16be) /* UTF16be _can_ beging with a null byte! */ while(source_size > bwidth && source[0] == 0) { --source_size; ++source; debug("skipped leading zero"); } if(source_size % bwidth) { /* When we need two bytes for a character, it's strange to have an uneven bytestream length. */ if(noquiet) warning2("Weird tag size %d for encoding %u - I will probably trim too early or something but I think the MP3 is broken.", (int)source_size, encoding); source_size -= source_size % bwidth; } text_converters[encoding](sb, source, source_size, noquiet); } /* You have checked encoding to be in the range already. */ static unsigned char *next_text(unsigned char* prev, unsigned char encoding, size_t limit) { unsigned char *text = prev; size_t width = encoding_widths[encoding]; /* So I go lengths to find zero or double zero... Remember bug 2834636: Only check for aligned NULLs! */ while(text-prev < (ssize_t)limit) { if(text[0] == 0) { if(width <= limit-(text-prev)) { size_t i = 1; for(; i= limit) text = NULL; return text; } static const char *enc_name(unsigned char enc) { switch(enc) { case 0: return "Latin 1"; case 1: return "UTF-16 BOM"; case 2: return "UTF-16 BE"; case 3: return "UTF-8"; default: return "unknown!"; } } static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t realsize, char *id) { /* Text encoding $xx */ /* The text (encoded) ... */ mpg123_text *t = add_text(fr); if(VERBOSE4) fprintf(stderr, "Note: Storing text from %s encoding\n", enc_name(realdata[0])); if(t == NULL) { if(NOQUIET) error("Unable to attach new text!"); return; } memcpy(t->id, id, 4); store_id3_text(&t->text, realdata, realsize, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); if(VERBOSE4) fprintf(stderr, "Note: ID3v2 %c%c%c%c text frame: %s\n", id[0], id[1], id[2], id[3], t->text.p); } static void process_picture(mpg123_handle *fr, unsigned char *realdata, size_t realsize) { unsigned char encoding = realdata[0]; mpg123_picture *i = NULL; unsigned char* workpoint; if(realsize == 0) { debug("Empty id3 data!"); return; } if(encoding > mpg123_id3_enc_max) { if(NOQUIET) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); return; } if(VERBOSE4) fprintf(stderr, "Note: Storing picture from APIC frame.\n"); /* decompose realdata accordingly */ i = add_picture(fr); if(i == NULL) { if(NOQUIET) error("Unable to attach new picture!"); return; } realdata++; realsize--; /* get mime type (encoding is always latin-1) */ workpoint = next_text(realdata, 0, realsize); if (workpoint == NULL) { pop_picture(fr); if (NOQUIET) error("Unable to get mime type for picture; skipping picture."); return; } id3_to_utf8(&i->mime_type, 0, realdata, workpoint - realdata, NOQUIET); realsize -= workpoint - realdata; realdata = workpoint; /* get picture type */ i->type = realdata[0]; realdata++; realsize--; /* get description (encoding is encoding) */ workpoint = next_text(realdata, encoding, realsize); if (workpoint == NULL) { if (NOQUIET) error("Unable to get description for picture; skipping picture."); pop_picture(fr); return; } id3_to_utf8(&i->description, encoding, realdata, workpoint - realdata, NOQUIET); realsize -= workpoint - realdata; if (realsize == 0) { if (NOQUIET) error("No picture data defined; skipping picture."); pop_picture(fr); return; } /* store_id3_picture(i, picture, realsize, NOQUIET)) */ i->data = (unsigned char*)malloc(realsize); if (i->data == NULL) { if (NOQUIET) error("Unable to allocate memory for picture; skipping picture"); pop_picture(fr); return; } memcpy(i->data, workpoint, realsize); i->size = realsize; if(VERBOSE4) fprintf(stderr, "Note: ID3v2 APIC picture frame of type: %d\n", i->type); } /* Store a new comment that perhaps is a RVA / RVA_ALBUM/AUDIOPHILE / RVA_MIX/RADIO one Special gimmik: It also stores USLT to the texts. Stucture is the same as for comments. */ static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned char *realdata, size_t realsize, int rva_level, char *id) { /* Text encoding $xx */ /* Language $xx xx xx */ /* Short description (encoded!) $00 (00) */ /* Then the comment text (encoded) ... */ unsigned char encoding = realdata[0]; unsigned char *lang = realdata+1; /* I'll only use the 3 bytes! */ unsigned char *descr = realdata+4; unsigned char *text = NULL; mpg123_text *xcom = NULL; mpg123_text localcom; /* UTF-8 variant for local processing. */ if(realsize < (size_t)(descr-realdata)) { if(NOQUIET) error1("Invalid frame size of %"SIZE_P" (too small for anything).", (size_p)realsize); return; } if(encoding > mpg123_id3_enc_max) { if(NOQUIET) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); return; } xcom = (tt == uslt ? add_text(fr) : add_comment(fr)); if(VERBOSE4) fprintf(stderr, "Note: Storing comment from %s encoding\n", enc_name(realdata[0])); if(xcom == NULL) { if(NOQUIET) error("Unable to attach new comment!"); return; } memcpy(xcom->lang, lang, 3); memcpy(xcom->id, id, 4); /* Now I can abuse a byte from lang for the encoding. */ descr[-1] = encoding; /* Be careful with finding the end of description, I have to honor encoding here. */ text = next_text(descr, encoding, realsize-(descr-realdata)); if(text == NULL) { if(NOQUIET) error("No comment text / valid description?"); pop_comment(fr); return; } init_mpg123_text(&localcom); /* Store the text, without translation to UTF-8, but for comments always a local copy in UTF-8. Reminder: No bailing out from here on without freeing the local comment data! */ store_id3_text(&xcom->description, descr-1, text-descr+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); if(tt == comment) store_id3_text(&localcom.description, descr-1, text-descr+1, NOQUIET, 0); text[-1] = encoding; /* Byte abusal for encoding... */ store_id3_text(&xcom->text, text-1, realsize+1-(text-realdata), NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); /* Remember: I will probably decode the above (again) for rva comment checking. So no messing around, please. */ if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */ { fprintf(stderr, "Note: ID3 comm/uslt desc of length %"SIZE_P".\n", (size_p)xcom->description.fill); fprintf(stderr, "Note: ID3 comm/uslt text of length %"SIZE_P".\n", (size_p)xcom->text.fill); } /* Look out for RVA info only when we really deal with a straight comment. */ if(tt == comment && localcom.description.fill > 0) { int rva_mode = -1; /* mix / album */ if( !strcasecmp(localcom.description.p, "rva") || !strcasecmp(localcom.description.p, "rva_mix") || !strcasecmp(localcom.description.p, "rva_track") || !strcasecmp(localcom.description.p, "rva_radio") ) rva_mode = 0; else if( !strcasecmp(localcom.description.p, "rva_album") || !strcasecmp(localcom.description.p, "rva_audiophile") || !strcasecmp(localcom.description.p, "rva_user") ) rva_mode = 1; if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) { /* Only translate the contents in here where we really need them. */ store_id3_text(&localcom.text, text-1, realsize+1-(text-realdata), NOQUIET, 0); if(localcom.text.fill > 0) { fr->rva.gain[rva_mode] = (float) atof(localcom.text.p); if(VERBOSE3) fprintf(stderr, "Note: RVA value %fdB\n", fr->rva.gain[rva_mode]); fr->rva.peak[rva_mode] = 0; fr->rva.level[rva_mode] = rva_level; } } } /* Make sure to free the local memory... */ free_mpg123_text(&localcom); } static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t realsize, int rva_level, char *id) { /* Text encoding $xx */ /* Description ... $00 (00) */ /* Text ... */ unsigned char encoding = realdata[0]; unsigned char *descr = realdata+1; /* remember, the encoding is descr[-1] */ unsigned char *text; mpg123_text *xex; mpg123_text localex; if((int)realsize < descr-realdata) { if(NOQUIET) error1("Invalid frame size of %lu (too small for anything).", (unsigned long)realsize); return; } if(encoding > mpg123_id3_enc_max) { if(NOQUIET) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); return; } text = next_text(descr, encoding, realsize-(descr-realdata)); if(VERBOSE4) fprintf(stderr, "Note: Storing extra from %s encoding\n", enc_name(realdata[0])); if(text == NULL) { if(NOQUIET) error("No extra frame text / valid description?"); return; } xex = add_extra(fr); if(xex == NULL) { if(NOQUIET) error("Unable to attach new extra text!"); return; } memcpy(xex->id, id, 4); init_mpg123_text(&localex); /* For our local copy. */ /* The outside storage gets reencoded to UTF-8 only if not requested otherwise. Remember that we really need the -1 here to hand in the encoding byte!*/ store_id3_text(&xex->description, descr-1, text-descr+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); /* Our local copy is always stored in UTF-8! */ store_id3_text(&localex.description, descr-1, text-descr+1, NOQUIET, 0); /* At first, only store the outside copy of the payload. We may not need the local copy. */ text[-1] = encoding; store_id3_text(&xex->text, text-1, realsize-(text-realdata)+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); /* Now check if we would like to interpret this extra info for RVA. */ if(localex.description.fill > 0) { int is_peak = 0; int rva_mode = -1; /* mix / album */ if(!strncasecmp(localex.description.p, "replaygain_track_",17)) { if(VERBOSE3) fprintf(stderr, "Note: RVA ReplayGain track gain/peak\n"); rva_mode = 0; if(!strcasecmp(localex.description.p, "replaygain_track_peak")) is_peak = 1; else if(strcasecmp(localex.description.p, "replaygain_track_gain")) rva_mode = -1; } else if(!strncasecmp(localex.description.p, "replaygain_album_",17)) { if(VERBOSE3) fprintf(stderr, "Note: RVA ReplayGain album gain/peak\n"); rva_mode = 1; if(!strcasecmp(localex.description.p, "replaygain_album_peak")) is_peak = 1; else if(strcasecmp(localex.description.p, "replaygain_album_gain")) rva_mode = -1; } if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) { /* Now we need the translated copy of the data. */ store_id3_text(&localex.text, text-1, realsize-(text-realdata)+1, NOQUIET, 0); if(localex.text.fill > 0) { if(is_peak) { fr->rva.peak[rva_mode] = (float) atof(localex.text.p); if(VERBOSE3) fprintf(stderr, "Note: RVA peak %f\n", fr->rva.peak[rva_mode]); } else { fr->rva.gain[rva_mode] = (float) atof(localex.text.p); if(VERBOSE3) fprintf(stderr, "Note: RVA gain %fdB\n", fr->rva.gain[rva_mode]); } fr->rva.level[rva_mode] = rva_level; } } } free_mpg123_text(&localex); } /* Make a ID3v2.3+ 4-byte ID from a ID3v2.2 3-byte ID Note that not all frames survived to 2.4; the mapping goes to 2.3 . A notable miss is the old RVA frame, which is very unspecific anyway. This function returns -1 when a not known 3 char ID was encountered, 0 otherwise. */ static int promote_framename(mpg123_handle *fr, char *id) /* fr because of VERBOSE macros */ { size_t i; char *old[] = { "COM", "TAL", "TBP", "TCM", "TCO", "TCR", "TDA", "TDY", "TEN", "TFT", "TIM", "TKE", "TLA", "TLE", "TMT", "TOA", "TOF", "TOL", "TOR", "TOT", "TP1", "TP2", "TP3", "TP4", "TPA", "TPB", "TRC", "TDA", "TRK", "TSI", "TSS", "TT1", "TT2", "TT3", "TXT", "TXX", "TYE" }; char *new[] = { "COMM", "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDAT", "TDLY", "TENC", "TFLT", "TIME", "TKEY", "TLAN", "TLEN", "TMED", "TOPE", "TOFN", "TOLY", "TORY", "TOAL", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPUB", "TSRC", "TRDA", "TRCK", "TSIZ", "TSSE", "TIT1", "TIT2", "TIT3", "TEXT", "TXXX", "TYER" }; for(i=0; ird->read_frame_body(fr, buf, 6)) < 0) /* read more header information */ return ret2; if(buf[0] == 0xff) return 0; /* Revision, will never be 0xff. */ /* second new byte are some nice flags, if these are invalid skip the whole thing */ flags = buf[1]; debug1("ID3v2: flags 0x%08x", flags); /* use 4 bytes from buf to construct 28bit uint value and return 1; return 0 if bytes are not synchsafe */ #define synchsafe_to_long(buf,res) \ ( \ (((buf)[0]|(buf)[1]|(buf)[2]|(buf)[3]) & 0x80) ? 0 : \ (res = (((unsigned long) (buf)[0]) << 21) \ | (((unsigned long) (buf)[1]) << 14) \ | (((unsigned long) (buf)[2]) << 7) \ | ((unsigned long) (buf)[3]) \ ,1) \ ) /* id3v2.3 does not store synchsafe frame sizes, but synchsafe tag size - doh! */ /* Remember: bytes_to_long() can yield ULONG_MAX on 32 bit platforms! */ #define bytes_to_long(buf,res) \ ( \ major == 3 ? \ (res = (((unsigned long) (buf)[0]) << 24) \ | (((unsigned long) (buf)[1]) << 16) \ | (((unsigned long) (buf)[2]) << 8) \ | ((unsigned long) (buf)[3]) \ ,1) : synchsafe_to_long(buf,res) \ ) /* for id3v2.2 only */ #define threebytes_to_long(buf,res) \ ( \ res = (((unsigned long) (buf)[0]) << 16) \ | (((unsigned long) (buf)[1]) << 8) \ | ((unsigned long) (buf)[2]) \ ) /* length-10 or length-20 (footer present); 4 synchsafe integers == 28 bit number */ /* we have already read 10 bytes, so left are length or length+10 bytes belonging to tag */ /* Note: This is an 28 bit value in 32 bit storage, plenty of space for */ /* length+x for reasonable x. */ if(!synchsafe_to_long(buf+2,length)) { if(NOQUIET) error4("Bad tag length (not synchsafe): 0x%02x%02x%02x%02x; You got a bad ID3 tag here.", buf[2],buf[3],buf[4],buf[5]); return 0; } debug1("ID3v2: tag data length %lu", length); #ifndef NO_ID3V2 if(VERBOSE2) fprintf(stderr,"Note: ID3v2.%i rev %i tag of %lu bytes\n", major, buf[0], length); /* skip if unknown version/scary flags, parse otherwise */ if(fr->p.flags & MPG123_SKIP_ID3V2) { if(VERBOSE3) fprintf(stderr, "Note: Skipping ID3v2 tag per user request.\n"); skiptag = 1; } if((flags & UNKNOWN_FLAGS) || (major > 4) || (major < 2)) { if(NOQUIET) warning2( "ID3v2: Won't parse the ID3v2 tag with major version" " %u and flags 0x%xu - some extra code may be needed" , major, flags ); skiptag = 1; } if(length < 10) { if(NOQUIET) warning1("ID3v2: unrealistic small tag lengh %lu, skipping", length); skiptag = 1; } if(skiptag) { #endif if((ret2 = fr->rd->skip_bytes(fr,length)) < 0) /* will not store data in backbuff! */ ret = ret2; #ifndef NO_ID3V2 } else { unsigned char* tagdata = NULL; fr->id3v2.version = major; /* try to interpret that beast */ if((tagdata = (unsigned char*) malloc(length+1)) != NULL) { debug("ID3v2: analysing frames..."); if((ret2 = fr->rd->read_frame_body(fr,tagdata,length)) > 0) { unsigned long tagpos = 0; /* bytes of frame title and of framesize value */ unsigned int head_part = fr->id3v2.version > 2 ? 4 : 3; unsigned int flag_part = fr->id3v2.version > 2 ? 2 : 0; /* The amount of bytes that are unconditionally read for each frame: */ /* ID, size, flags. */ unsigned int framebegin = head_part+head_part+flag_part; debug1("ID3v2: have read at all %lu bytes for the tag now", (unsigned long)length+6); /* going to apply strlen for strings inside frames, make sure that it doesn't overflow! */ tagdata[length] = 0; if(flags & EXTHEAD_FLAG) { debug("ID3v2: skipping extended header"); if(!bytes_to_long(tagdata, tagpos) || tagpos >= length) { ret = 0; if(NOQUIET) error4( "Bad (non-synchsafe/too large) tag offset:" "0x%02x%02x%02x%02x" , tagdata[0], tagdata[1], tagdata[2], tagdata[3] ); } } if(ret > 0) { char id[5]; unsigned long framesize; unsigned long fflags; /* need 16 bits, actually */ id[4] = 0; /* Pos now advanced after ext head, now a frame has to follow. */ /* Note: tagpos <= length, which is 28 bit integer, so both */ /* far away from overflow for adding known small values. */ /* I want to read at least one full header now. */ while(length >= tagpos+framebegin) { int i = 0; unsigned long pos = tagpos; /* level 1,2,3 - 0 is info from lame/info tag! */ /* rva tags with ascending significance, then general frames */ enum frame_types tt = unknown; /* we may have entered the padding zone or any other strangeness: check if we have valid frame id characters */ for(i=0; i< head_part; ++i) if( !( ((tagdata[tagpos+i] > 47) && (tagdata[tagpos+i] < 58)) || ((tagdata[tagpos+i] > 64) && (tagdata[tagpos+i] < 91)) ) ) { debug5("ID3v2: real tag data apparently ended after %lu bytes with 0x%02x%02x%02x%02x", tagpos, tagdata[tagpos], tagdata[tagpos+1], tagdata[tagpos+2], tagdata[tagpos+3]); /* This is no hard error... let's just hope that we got something meaningful already (ret==1 in that case). */ goto tagparse_cleanup; /* Need to escape two loops here. */ } if(ret > 0) { /* 4 or 3 bytes id */ strncpy(id, (char*) tagdata+pos, head_part); id[head_part] = 0; /* terminate for 3 or 4 bytes */ pos += head_part; tagpos += head_part; /* size as 32 bits or 28 bits */ if(fr->id3v2.version == 2) threebytes_to_long(tagdata+pos, framesize); else if(!bytes_to_long(tagdata+pos, framesize)) { /* Just assume that up to now there was some good data. */ if(NOQUIET) error1("ID3v2: non-syncsafe size of %s frame, skipping the remainder of tag", id); break; } if(VERBOSE3) fprintf(stderr, "Note: ID3v2 %s frame of size %lu\n", id, framesize); tagpos += head_part; pos += head_part; if(fr->id3v2.version > 2) { fflags = (((unsigned long) tagdata[pos]) << 8) | ((unsigned long) tagdata[pos+1]); pos += 2; tagpos += 2; } else fflags = 0; if(length - tagpos < framesize) { if(NOQUIET) error("Whoa! ID3v2 frame claims to be larger than the whole rest of the tag."); break; } tagpos += framesize; /* the important advancement in whole tag */ /* for sanity, after full parsing tagpos should be == pos */ /* debug4("ID3v2: found %s frame, size %lu (as bytes: 0x%08lx), flags 0x%016lx", id, framesize, framesize, fflags); */ /* %0abc0000 %0h00kmnp */ #define BAD_FFLAGS (unsigned long) 36784 #define PRES_TAG_FFLAG 16384 #define PRES_FILE_FFLAG 8192 #define READ_ONLY_FFLAG 4096 #define GROUP_FFLAG 64 #define COMPR_FFLAG 8 #define ENCR_FFLAG 4 #define UNSYNC_FFLAG 2 #define DATLEN_FFLAG 1 if(head_part < 4 && promote_framename(fr, id) != 0) continue; /* shall not or want not handle these */ if(fflags & (BAD_FFLAGS | COMPR_FFLAG | ENCR_FFLAG)) { if(NOQUIET) warning("ID3v2: skipping invalid/unsupported frame"); continue; } for(i = 0; i < KNOWN_FRAMES; ++i) if(!strncmp(frame_type[i], id, 4)){ tt = i; break; } if(id[0] == 'T' && tt != extra) tt = text; if(tt != unknown) { int rva_mode = -1; /* mix / album */ unsigned long realsize = framesize; unsigned char* realdata = tagdata+pos; if((flags & UNSYNC_FLAG) || (fflags & UNSYNC_FFLAG)) { unsigned long ipos = 0; unsigned long opos = 0; debug("Id3v2: going to de-unsync the frame data"); /* de-unsync: FF00 -> FF; real FF00 is simply represented as FF0000 ... */ /* damn, that means I have to delete bytes from withing the data block... thus need temporal storage */ /* standard mandates that de-unsync should always be safe if flag is set */ realdata = (unsigned char*) malloc(framesize); /* will need <= bytes */ if(realdata == NULL) { if(NOQUIET) error("ID3v2: unable to allocate working buffer for de-unsync"); continue; } /* now going byte per byte through the data... */ realdata[0] = tagdata[pos]; opos = 1; for(ipos = pos+1; ipos < pos+framesize; ++ipos) { if(!((tagdata[ipos] == 0) && (tagdata[ipos-1] == 0xff))) { realdata[opos++] = tagdata[ipos]; } } realsize = opos; debug2("ID3v2: de-unsync made %lu out of %lu bytes", realsize, framesize); } pos = 0; /* now at the beginning again... */ /* Avoid reading over boundary, even if there is a */ /* zero byte of padding for safety. */ if(realsize) switch(tt) { case comment: case uslt: process_comment(fr, tt, realdata, realsize, comment+1, id); break; case extra: /* perhaps foobar2000's work */ process_extra(fr, realdata, realsize, extra+1, id); break; case rva2: /* "the" RVA tag */ { /* starts with null-terminated identification */ if(VERBOSE3) fprintf(stderr, "Note: RVA2 identification \"%s\"\n", realdata); /* default: some individual value, mix mode */ rva_mode = 0; if( !strncasecmp((char*)realdata, "album", 5) || !strncasecmp((char*)realdata, "audiophile", 10) || !strncasecmp((char*)realdata, "user", 4)) rva_mode = 1; if(fr->rva.level[rva_mode] <= rva2+1) { pos += strlen((char*) realdata) + 1; if(realdata[pos] == 1) { ++pos; /* only handle master channel */ debug("ID3v2: it is for the master channel"); /* two bytes adjustment, one byte for bits representing peak - n bytes, eh bits, for peak */ /* 16 bit signed integer = dB * 512 ... the double cast is needed to preserve the sign of negative values! */ fr->rva.gain[rva_mode] = (float) ( (((short)((signed char)realdata[pos])) << 8) | realdata[pos+1] ) / 512; pos += 2; if(VERBOSE3) fprintf(stderr, "Note: RVA value %fdB\n", fr->rva.gain[rva_mode]); /* heh, the peak value is represented by a number of bits - but in what manner? Skipping that part */ fr->rva.peak[rva_mode] = 0; fr->rva.level[rva_mode] = rva2+1; } } } break; /* non-rva metainfo, simply store... */ case text: process_text(fr, realdata, realsize, id); break; case picture: if (fr->p.flags & MPG123_PICTURE) process_picture(fr, realdata, realsize); break; default: if(NOQUIET) error1("ID3v2: unknown frame type %i", tt); } if((flags & UNSYNC_FLAG) || (fflags & UNSYNC_FFLAG)) free(realdata); } #undef BAD_FFLAGS #undef PRES_TAG_FFLAG #undef PRES_FILE_FFLAG #undef READ_ONLY_FFLAG #undef GROUP_FFLAG #undef COMPR_FFLAG #undef ENCR_FFLAG #undef UNSYNC_FFLAG #undef DATLEN_FFLAG } else break; #undef KNOWN_FRAMES } } } else { /* There are tags with zero length. Strictly not an error, then. */ if(length > 0 && NOQUIET && ret2 != MPG123_NEED_MORE) error("ID3v2: Duh, not able to read ID3v2 tag data."); ret = ret2; } tagparse_cleanup: free(tagdata); } else { if(NOQUIET) error1("ID3v2: Arrg! Unable to allocate %lu bytes for interpreting ID3v2 data - trying to skip instead.", length); if((ret2 = fr->rd->skip_bytes(fr,length)) < 0) ret = ret2; /* will not store data in backbuff! */ else ret = 0; } } #endif /* NO_ID3V2 */ /* skip footer if present */ if((ret > 0) && (flags & FOOTER_FLAG) && ((ret2 = fr->rd->skip_bytes(fr,length)) < 0)) ret = ret2; return ret; #undef UNSYNC_FLAG #undef EXTHEAD_FLAG #undef EXP_FLAG #undef FOOTER_FLAG #undef UNKOWN_FLAGS } #ifndef NO_ID3V2 /* Disabling all the rest... */ static void convert_latin1(mpg123_string *sb, const unsigned char* s, size_t l, const int noquiet) { size_t length = l; size_t i; unsigned char *p; /* determine real length, a latin1 character can at most take 2 in UTF8 */ for(i=0; i= 0x80) ++length; debug1("UTF-8 length: %lu", (unsigned long)length); /* one extra zero byte for paranoia */ if(!mpg123_resize_string(sb, length+1)){ mpg123_free_string(sb); return ; } p = (unsigned char*) sb->p; /* Signedness doesn't matter but it shows I thought about the non-issue */ for(i=0; i>6); *(p+1) = 0x80 | (s[i] & 0x3f); p+=2; } sb->p[length] = 0; sb->fill = length+1; } /* Check if we have a byte oder mark(s) there, return: -1: little endian 0: no BOM 1: big endian This modifies source and len to indicate the data _after_ the BOM(s). Note on nasty data: The last encountered BOM determines the endianness. I have seen data with multiple BOMS, namely from "the" id3v2 program. Not nice, but what should I do? */ static int check_bom(const unsigned char** source, size_t *len) { int this_bom = 0; int further_bom = 0; if(*len < 2) return 0; if((*source)[0] == 0xff && (*source)[1] == 0xfe) this_bom = -1; if((*source)[0] == 0xfe && (*source)[1] == 0xff) this_bom = 1; /* Skip the detected BOM. */ if(this_bom != 0) { *source += 2; *len -= 2; /* Check for following BOMs. The last one wins! */ further_bom = check_bom(source, len); if(further_bom == 0) return this_bom; /* End of the recursion. */ else return further_bom; } else return 0; } #define FULLPOINT(f,s) ( (((f)&0x3ff)<<10) + ((s)&0x3ff) + 0x10000 ) /* Remember: There's a limit at 0x1ffff. */ #define UTF8LEN(x) ( (x)<0x80 ? 1 : ((x)<0x800 ? 2 : ((x)<0x10000 ? 3 : 4))) static void convert_utf16bom(mpg123_string *sb, const unsigned char* s, size_t l, const int noquiet) { size_t i; size_t n; /* number bytes that make up full pairs */ unsigned char *p; size_t length = 0; /* the resulting UTF-8 length */ /* Determine real length... extreme case can be more than utf-16 length. */ size_t high = 0; size_t low = 1; int bom_endian; debug1("convert_utf16 with length %lu", (unsigned long)l); bom_endian = check_bom(&s, &l); debug1("UTF16 endianness check: %i", bom_endian); if(bom_endian == -1) /* little-endian */ { high = 1; /* The second byte is the high byte. */ low = 0; /* The first byte is the low byte. */ } n = (l/2)*2; /* number bytes that make up full pairs */ /* first: get length, check for errors -- stop at first one */ for(i=0; i < n; i+=2) { unsigned long point = ((unsigned long) s[i+high]<<8) + s[i+low]; if((point & 0xfc00) == 0xd800) /* lead surrogate */ { unsigned short second = (i+3 < l) ? (s[i+2+high]<<8) + s[i+2+low] : 0; if((second & 0xfc00) == 0xdc00) /* good... */ { point = FULLPOINT(point,second); length += UTF8LEN(point); /* possibly 4 bytes */ i+=2; /* We overstepped one word. */ } else /* if no valid pair, break here */ { if(noquiet) error2("Invalid UTF16 surrogate pair at %li (0x%04lx).", (unsigned long)i, point); n = i; /* Forget the half pair, END! */ break; } } else length += UTF8LEN(point); /* 1,2 or 3 bytes */ } if(!mpg123_resize_string(sb, length+1)){ mpg123_free_string(sb); return ; } /* Now really convert, skip checks as these have been done just before. */ p = (unsigned char*) sb->p; /* Signedness doesn't matter but it shows I thought about the non-issue */ for(i=0; i < n; i+=2) { unsigned long codepoint = ((unsigned long) s[i+high]<<8) + s[i+low]; if((codepoint & 0xfc00) == 0xd800) /* lead surrogate */ { unsigned short second = (s[i+2+high]<<8) + s[i+2+low]; codepoint = FULLPOINT(codepoint,second); i+=2; /* We overstepped one word. */ } if(codepoint < 0x80) *p++ = (unsigned char) codepoint; else if(codepoint < 0x800) { *p++ = (unsigned char) (0xc0 | (codepoint>>6)); *p++ = (unsigned char) (0x80 | (codepoint & 0x3f)); } else if(codepoint < 0x10000) { *p++ = (unsigned char) (0xe0 | (codepoint>>12)); *p++ = 0x80 | ((codepoint>>6) & 0x3f); *p++ = 0x80 | (codepoint & 0x3f); } else if (codepoint < 0x200000) { *p++ = (unsigned char) (0xf0 | codepoint>>18); *p++ = (unsigned char) (0x80 | ((codepoint>>12) & 0x3f)); *p++ = (unsigned char) (0x80 | ((codepoint>>6) & 0x3f)); *p++ = (unsigned char) (0x80 | (codepoint & 0x3f)); } /* ignore bigger ones (that are not possible here anyway) */ } sb->p[sb->size-1] = 0; /* paranoia... */ sb->fill = sb->size; } #undef UTF8LEN #undef FULLPOINT static void convert_utf8(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet) { if(mpg123_resize_string(sb, len+1)) { memcpy(sb->p, source, len); sb->p[len] = 0; sb->fill = len+1; } else mpg123_free_string(sb); } #endif welle.io-2.1/src/libs/mpg123/id3.h000066400000000000000000000021171357201522000164510ustar00rootroot00000000000000/* id3: ID3v2.3 and ID3v2.4 parsing (a relevant subset) copyright 2006-2007 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #ifndef MPG123_ID3_H #define MPG123_ID3_H /* really need it _here_! */ #include "frame.h" #ifdef NO_ID3V2 # ifdef init_id3 # undef init_id3 # endif # define init_id3(fr) # ifdef exit_id3 # undef exit_id3 # endif # define exit_id3(fr) # ifdef reset_id3 # undef reset_id3 # endif # define reset_id3(fr) # ifdef id3_link # undef id3_link # endif # define id3_link(fr) #else void init_id3(mpg123_handle *fr); void exit_id3(mpg123_handle *fr); void reset_id3(mpg123_handle *fr); void id3_link(mpg123_handle *fr); #endif int parse_new_id3(mpg123_handle *fr, unsigned long first4bytes); /* Convert text from some ID3 encoding to UTf-8. On error, sb->fill is 0. The noquiet flag enables warning/error messages. */ void id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet); #endif welle.io-2.1/src/libs/mpg123/index.c000066400000000000000000000071521357201522000171000ustar00rootroot00000000000000/* index: frame index data structure and functions copyright 2007-2015 by the mpg123 project -= free software under the terms of the LGPL 2.1 =- see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #include "intsym.h" #include "index.h" #include "debug.h" /* The next expected frame offset, one step ahead. */ static off_t fi_next(struct frame_index *fi) { return (off_t)fi->fill*fi->step; } /* Shrink down the used index to the half. Be careful with size = 1 ... there's no shrinking possible there. */ static void fi_shrink(struct frame_index *fi) { if(fi->fill < 2) return; /* Won't shrink below 1. */ else { /* Double the step, half the fill. Should work as well for fill%2 = 1 */ size_t c; debug2("shrink index with fill %lu and step %lu", (unsigned long)fi->fill, (unsigned long)fi->step); fi->step *= 2; fi->fill /= 2; /* Move the data down. */ for(c = 0; c < fi->fill; ++c) fi->data[c] = fi->data[2*c]; } fi->next = fi_next(fi); } void fi_init(struct frame_index *fi) { fi->data = NULL; fi->step = 1; fi->fill = 0; fi->size = 0; fi->grow_size = 0; fi->next = fi_next(fi); } void fi_exit(struct frame_index *fi) { debug2("fi_exit: %p and %lu", (void*)fi->data, (unsigned long)fi->size); if(fi->size && fi->data != NULL) free(fi->data); fi_init(fi); /* Be prepared for further fun, still. */ } int fi_resize(struct frame_index *fi, size_t newsize) { off_t *newdata = NULL; if(newsize == fi->size) return 0; if(newsize > 0 && newsize < fi->size) { /* When we reduce buffer size a bit, shrink stuff. */ while(fi->fill > newsize){ fi_shrink(fi); } } newdata = safe_realloc(fi->data, newsize*sizeof(off_t)); if(newsize == 0 || newdata != NULL) { fi->data = newdata; fi->size = newsize; if(fi->fill > fi->size) fi->fill = fi->size; fi->next = fi_next(fi); debug2("new index of size %lu at %p", (unsigned long)fi->size, (void*)fi->data); return 0; } else { error("failed to resize index!"); return -1; } } void fi_add(struct frame_index *fi, off_t pos) { debug3("wanting to add to fill %lu, step %lu, size %lu", (unsigned long)fi->fill, (unsigned long)fi->step, (unsigned long)fi->size); if(fi->fill == fi->size) { /* Index is full, we need to shrink... or grow. */ /* Store the current frame number to check later if we still want it. */ off_t framenum = fi->fill*fi->step; /* If we want not / cannot grow, we shrink. */ if( !(fi->grow_size && fi_resize(fi, fi->size+fi->grow_size)==0) ) fi_shrink(fi); /* Now check if we still want to add this frame (could be that not, because of changed step). */ if(fi->next != framenum) return; } /* When we are here, we want that frame. */ if(fi->fill < fi->size) /* safeguard for size=1, or just generally */ { debug1("adding to index at %p", (void*)(fi->data+fi->fill)); fi->data[fi->fill] = pos; ++fi->fill; fi->next = fi_next(fi); debug3("added pos %li to index with fill %lu and step %lu", (long) pos, (unsigned long)fi->fill, (unsigned long)fi->step); } } int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill) { if(fi_resize(fi, fill) == -1) return -1; fi->step = step; if(offsets != NULL) { memcpy(fi->data, offsets, fill*sizeof(off_t)); fi->fill = fill; } else { /* allocation only, no entries in index yet */ fi->fill = 0; } fi->next = fi_next(fi); debug3("set new index of fill %lu, size %lu at %p", (unsigned long)fi->fill, (unsigned long)fi->size, (void*)fi->data); return 0; } void fi_reset(struct frame_index *fi) { debug1("reset with size %"SIZE_P, (size_p)fi->size); fi->fill = 0; fi->step = 1; fi->next = fi_next(fi); } welle.io-2.1/src/libs/mpg123/index.h000066400000000000000000000042661357201522000171100ustar00rootroot00000000000000#ifndef MPG123_H_INDEX #define MPG123_H_INDEX /* index: frame index data structure and functions This is for keeping track of frame positions for accurate seeking. Now in it's own file, with initial code from frame.c and parse.c . The idea of the index with a certain amount of entries is to cover all yet-encountered frame positions with minimal coarseness. Meaning: At first every frame position is recorded, then, when the index is full, every second position is trown away to make space. Next time it is full, the same happens. And so on. In this manner we maintain a good resolution with the given maximum index size while covering the whole stream. copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis */ #include "config.h" #include "compat.h" struct frame_index { off_t *data; /* actual data, the frame positions */ off_t step; /* advancement in frame number per index point */ off_t next; /* frame offset supposed to come next into the index */ size_t size; /* total number of possible entries */ size_t fill; /* number of used entries */ size_t grow_size; /* if > 0: index allowed to grow on need with these steps, instead of lowering resolution */ }; /* The condition for a framenum to be appended to the index. if(FI_NEXT(fr->index, fr->num)) fi_add(offset); */ #define FI_NEXT(fi, framenum) ((fi).size && framenum == (fi).next) /* Initialize stuff, set things to zero and NULL... */ void fi_init(struct frame_index *fi); /* Deallocate/zero things. */ void fi_exit(struct frame_index *fi); /* Prepare a given size, preserving current fill, if possible. If the new size is smaller than fill, the entry density is reduced. Return 0 on success. */ int fi_resize(struct frame_index *fi, size_t newsize); /* Append a frame position, reducing index density if needed. */ void fi_add(struct frame_index *fi, off_t pos); /* Replace the frame index */ int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill); /* Empty the index (setting fill=0 and step=1), but keep current size. */ void fi_reset(struct frame_index *fi); #endif welle.io-2.1/src/libs/mpg123/intsym.h000066400000000000000000000420521357201522000173170ustar00rootroot00000000000000#ifndef MPG123_INTSYM_H #define MPG123_INTSYM_H /* Mapping of internal mpg123 symbols to something that is less likely to conflict in case of static linking. */ #include "config.h" #define COS9 INT123_COS9 #define tfcos36 INT123_tfcos36 #define pnts INT123_pnts #define catchsignal INT123_catchsignal #define safe_realloc INT123_safe_realloc #define compat_strdup INT123_compat_strdup #define compat_open INT123_compat_open #define compat_fopen INT123_compat_fopen #define compat_fdopen INT123_compat_fdopen #define compat_close INT123_compat_close #define compat_fclose INT123_compat_fclose #define win32_wide_utf8 INT123_win32_wide_utf8 #define win32_utf8_wide INT123_win32_utf8_wide #define unintr_write INT123_unintr_write #define unintr_read INT123_unintr_read #define ntom_set_ntom INT123_ntom_set_ntom #define synth_1to1 INT123_synth_1to1 #define synth_1to1_dither INT123_synth_1to1_dither #define synth_1to1_i386 INT123_synth_1to1_i386 #define synth_1to1_i586 INT123_synth_1to1_i586 #define synth_1to1_i586_dither INT123_synth_1to1_i586_dither #define synth_1to1_mmx INT123_synth_1to1_mmx #define synth_1to1_3dnow INT123_synth_1to1_3dnow #define synth_1to1_sse INT123_synth_1to1_sse #define synth_1to1_stereo_sse INT123_synth_1to1_stereo_sse #define synth_1to1_3dnowext INT123_synth_1to1_3dnowext #define synth_1to1_altivec INT123_synth_1to1_altivec #define synth_1to1_stereo_altivec INT123_synth_1to1_stereo_altivec #define synth_1to1_x86_64 INT123_synth_1to1_x86_64 #define synth_1to1_stereo_x86_64 INT123_synth_1to1_stereo_x86_64 #define synth_1to1_avx INT123_synth_1to1_avx #define synth_1to1_stereo_avx INT123_synth_1to1_stereo_avx #define synth_1to1_arm INT123_synth_1to1_arm #define synth_1to1_neon INT123_synth_1to1_neon #define synth_1to1_stereo_neon INT123_synth_1to1_stereo_neon #define synth_1to1_neon64 INT123_synth_1to1_neon64 #define synth_1to1_stereo_neon64 INT123_synth_1to1_stereo_neon64 #define absynth_1to1_i486 INT123_absynth_1to1_i486 #define synth_1to1_mono INT123_synth_1to1_mono #define synth_1to1_m2s INT123_synth_1to1_m2s #define synth_2to1 INT123_synth_2to1 #define synth_2to1_dither INT123_synth_2to1_dither #define synth_2to1_i386 INT123_synth_2to1_i386 #define synth_2to1_mono INT123_synth_2to1_mono #define synth_2to1_m2s INT123_synth_2to1_m2s #define synth_4to1 INT123_synth_4to1 #define synth_4to1_dither INT123_synth_4to1_dither #define synth_4to1_i386 INT123_synth_4to1_i386 #define synth_4to1_mono INT123_synth_4to1_mono #define synth_4to1_m2s INT123_synth_4to1_m2s #define synth_ntom INT123_synth_ntom #define synth_ntom_mono INT123_synth_ntom_mono #define synth_ntom_m2s INT123_synth_ntom_m2s #define synth_1to1_8bit INT123_synth_1to1_8bit #define synth_1to1_8bit_i386 INT123_synth_1to1_8bit_i386 #define synth_1to1_8bit_wrap INT123_synth_1to1_8bit_wrap #define synth_1to1_8bit_mono INT123_synth_1to1_8bit_mono #define synth_1to1_8bit_m2s INT123_synth_1to1_8bit_m2s #define synth_1to1_8bit_wrap_mono INT123_synth_1to1_8bit_wrap_mono #define synth_1to1_8bit_wrap_m2s INT123_synth_1to1_8bit_wrap_m2s #define synth_2to1_8bit INT123_synth_2to1_8bit #define synth_2to1_8bit_i386 INT123_synth_2to1_8bit_i386 #define synth_2to1_8bit_mono INT123_synth_2to1_8bit_mono #define synth_2to1_8bit_m2s INT123_synth_2to1_8bit_m2s #define synth_4to1_8bit INT123_synth_4to1_8bit #define synth_4to1_8bit_i386 INT123_synth_4to1_8bit_i386 #define synth_4to1_8bit_mono INT123_synth_4to1_8bit_mono #define synth_4to1_8bit_m2s INT123_synth_4to1_8bit_m2s #define synth_ntom_8bit INT123_synth_ntom_8bit #define synth_ntom_8bit_mono INT123_synth_ntom_8bit_mono #define synth_ntom_8bit_m2s INT123_synth_ntom_8bit_m2s #define synth_1to1_real INT123_synth_1to1_real #define synth_1to1_real_i386 INT123_synth_1to1_real_i386 #define synth_1to1_real_sse INT123_synth_1to1_real_sse #define synth_1to1_real_stereo_sse INT123_synth_1to1_real_stereo_sse #define synth_1to1_real_x86_64 INT123_synth_1to1_real_x86_64 #define synth_1to1_real_stereo_x86_64 INT123_synth_1to1_real_stereo_x86_64 #define synth_1to1_real_avx INT123_synth_1to1_real_avx #define synth_1to1_fltst_avx INT123_synth_1to1_fltst_avx #define synth_1to1_real_altivec INT123_synth_1to1_real_altivec #define synth_1to1_fltst_altivec INT123_synth_1to1_fltst_altivec #define synth_1to1_real_neon INT123_synth_1to1_real_neon #define synth_1to1_real_stereo_neon INT123_synth_1to1_real_stereo_neon #define synth_1to1_real_neon64 INT123_synth_1to1_real_neon64 #define synth_1to1_fltst_neon64 INT123_synth_1to1_fltst_neon64 #define synth_1to1_real_mono INT123_synth_1to1_real_mono #define synth_1to1_real_m2s INT123_synth_1to1_real_m2s #define synth_2to1_real INT123_synth_2to1_real #define synth_2to1_real_i386 INT123_synth_2to1_real_i386 #define synth_2to1_real_mono INT123_synth_2to1_real_mono #define synth_2to1_real_m2s INT123_synth_2to1_real_m2s #define synth_4to1_real INT123_synth_4to1_real #define synth_4to1_real_i386 INT123_synth_4to1_real_i386 #define synth_4to1_real_mono INT123_synth_4to1_real_mono #define synth_4to1_real_m2s INT123_synth_4to1_real_m2s #define synth_ntom_real INT123_synth_ntom_real #define synth_ntom_real_mono INT123_synth_ntom_real_mono #define synth_ntom_real_m2s INT123_synth_ntom_real_m2s #define synth_1to1_s32 INT123_synth_1to1_s32 #define synth_1to1_s32_i386 INT123_synth_1to1_s32_i386 #define synth_1to1_s32_sse INT123_synth_1to1_s32_sse #define synth_1to1_s32_stereo_sse INT123_synth_1to1_s32_stereo_sse #define synth_1to1_s32_x86_64 INT123_synth_1to1_s32_x86_64 #define synth_1to1_s32_stereo_x86_64 INT123_synth_1to1_s32_stereo_x86_64 #define synth_1to1_s32_avx INT123_synth_1to1_s32_avx #define synth_1to1_s32_stereo_avx INT123_synth_1to1_s32_stereo_avx #define synth_1to1_s32_altivec INT123_synth_1to1_s32_altivec #define synth_1to1_s32_stereo_altivec INT123_synth_1to1_s32_stereo_altivec #define synth_1to1_s32_neon INT123_synth_1to1_s32_neon #define synth_1to1_s32_stereo_neon INT123_synth_1to1_s32_stereo_neon #define synth_1to1_s32_neon64 INT123_synth_1to1_s32_neon64 #define synth_1to1_s32st_neon64 INT123_synth_1to1_s32st_neon64 #define synth_1to1_s32_mono INT123_synth_1to1_s32_mono #define synth_1to1_s32_m2s INT123_synth_1to1_s32_m2s #define synth_2to1_s32 INT123_synth_2to1_s32 #define synth_2to1_s32_i386 INT123_synth_2to1_s32_i386 #define synth_2to1_s32_mono INT123_synth_2to1_s32_mono #define synth_2to1_s32_m2s INT123_synth_2to1_s32_m2s #define synth_4to1_s32 INT123_synth_4to1_s32 #define synth_4to1_s32_i386 INT123_synth_4to1_s32_i386 #define synth_4to1_s32_mono INT123_synth_4to1_s32_mono #define synth_4to1_s32_m2s INT123_synth_4to1_s32_m2s #define synth_ntom_s32 INT123_synth_ntom_s32 #define synth_ntom_s32_mono INT123_synth_ntom_s32_mono #define synth_ntom_s32_m2s INT123_synth_ntom_s32_m2s #define dct64 INT123_dct64 #define dct64_i386 INT123_dct64_i386 #define dct64_altivec INT123_dct64_altivec #define dct64_i486 INT123_dct64_i486 #define dct36 INT123_dct36 #define dct36_3dnow INT123_dct36_3dnow #define dct36_3dnowext INT123_dct36_3dnowext #define dct36_x86_64 INT123_dct36_x86_64 #define dct36_sse INT123_dct36_sse #define dct36_avx INT123_dct36_avx #define dct36_neon INT123_dct36_neon #define dct36_neon64 INT123_dct36_neon64 #define synth_ntom_set_step INT123_synth_ntom_set_step #define ntom_val INT123_ntom_val #define ntom_frame_outsamples INT123_ntom_frame_outsamples #define ntom_frmouts INT123_ntom_frmouts #define ntom_ins2outs INT123_ntom_ins2outs #define ntom_frameoff INT123_ntom_frameoff #define init_layer3 INT123_init_layer3 #define init_layer3_gainpow2 INT123_init_layer3_gainpow2 #define init_layer3_stuff INT123_init_layer3_stuff #define init_layer12 INT123_init_layer12 #define init_layer12_table INT123_init_layer12_table #define init_layer12_stuff INT123_init_layer12_stuff #define prepare_decode_tables INT123_prepare_decode_tables #define make_decode_tables INT123_make_decode_tables #define make_decode_tables_mmx INT123_make_decode_tables_mmx #define init_layer3_gainpow2_mmx INT123_init_layer3_gainpow2_mmx #define init_layer12_table_mmx INT123_init_layer12_table_mmx #define make_conv16to8_table INT123_make_conv16to8_table #define do_layer3 INT123_do_layer3 #define do_layer2 INT123_do_layer2 #define do_layer1 INT123_do_layer1 #define do_equalizer INT123_do_equalizer #define dither_table_init INT123_dither_table_init #define frame_dither_init INT123_frame_dither_init #define invalidate_format INT123_invalidate_format #define frame_init INT123_frame_init #define frame_init_par INT123_frame_init_par #define frame_outbuffer INT123_frame_outbuffer #define frame_output_format INT123_frame_output_format #define frame_buffers INT123_frame_buffers #define frame_reset INT123_frame_reset #define frame_buffers_reset INT123_frame_buffers_reset #define frame_exit INT123_frame_exit #define frame_index_find INT123_frame_index_find #define frame_index_setup INT123_frame_index_setup #define do_volume INT123_do_volume #define do_rva INT123_do_rva #define frame_gapless_init INT123_frame_gapless_init #define frame_gapless_realinit INT123_frame_gapless_realinit #define frame_gapless_update INT123_frame_gapless_update #define frame_gapless_bytify INT123_frame_gapless_bytify #define frame_gapless_ignore INT123_frame_gapless_ignore #define frame_expect_outsamples INT123_frame_expect_outsamples #define frame_skip INT123_frame_skip #define frame_ins2outs INT123_frame_ins2outs #define frame_outs INT123_frame_outs #define frame_expect_outsampels INT123_frame_expect_outsampels #define frame_offset INT123_frame_offset #define frame_set_frameseek INT123_frame_set_frameseek #define frame_set_seek INT123_frame_set_seek #define frame_tell_seek INT123_frame_tell_seek #define frame_fill_toc INT123_frame_fill_toc #define getbits INT123_getbits #define getcpuflags INT123_getcpuflags #define icy2utf8 INT123_icy2utf8 #define init_icy INT123_init_icy #define clear_icy INT123_clear_icy #define reset_icy INT123_reset_icy #define init_id3 INT123_init_id3 #define exit_id3 INT123_exit_id3 #define reset_id3 INT123_reset_id3 #define id3_link INT123_id3_link #define parse_new_id3 INT123_parse_new_id3 #define id3_to_utf8 INT123_id3_to_utf8 #define fi_init INT123_fi_init #define fi_exit INT123_fi_exit #define fi_resize INT123_fi_resize #define fi_add INT123_fi_add #define fi_set INT123_fi_set #define fi_reset INT123_fi_reset #define double_to_long_rounded INT123_double_to_long_rounded #define scale_rounded INT123_scale_rounded #define decode_update INT123_decode_update #define decoder_synth_bytes INT123_decoder_synth_bytes #define samples_to_bytes INT123_samples_to_bytes #define bytes_to_samples INT123_bytes_to_samples #define outblock_bytes INT123_outblock_bytes #define postprocess_buffer INT123_postprocess_buffer #define frame_cpu_opt INT123_frame_cpu_opt #define set_synth_functions INT123_set_synth_functions #define dectype INT123_dectype #define defdec INT123_defdec #define decclass INT123_decclass #define check_decoders INT123_check_decoders #define read_frame_init INT123_read_frame_init #define frame_bitrate INT123_frame_bitrate #define frame_freq INT123_frame_freq #define read_frame_recover INT123_read_frame_recover #define read_frame INT123_read_frame #define set_pointer INT123_set_pointer #define position_info INT123_position_info #define compute_bpf INT123_compute_bpf #define time_to_frame INT123_time_to_frame #define get_songlen INT123_get_songlen #define bc_prepare INT123_bc_prepare #define bc_cleanup INT123_bc_cleanup #define bc_poolsize INT123_bc_poolsize #define bc_fill INT123_bc_fill #define open_stream INT123_open_stream #define open_stream_handle INT123_open_stream_handle #define open_feed INT123_open_feed #define feed_more INT123_feed_more #define feed_forget INT123_feed_forget #define feed_set_pos INT123_feed_set_pos #define open_bad INT123_open_bad #define open_module INT123_open_module #define close_module INT123_close_module #define list_modules INT123_list_modules #define buffer_init INT123_buffer_init #define buffer_exit INT123_buffer_exit #define buffer_sync_param INT123_buffer_sync_param #define buffer_open INT123_buffer_open #define buffer_encodings INT123_buffer_encodings #define buffer_formats INT123_buffer_formats #define buffer_start INT123_buffer_start #define buffer_ndrain INT123_buffer_ndrain #define buffer_stop INT123_buffer_stop #define buffer_close INT123_buffer_close #define buffer_continue INT123_buffer_continue #define buffer_ignore_lowmem INT123_buffer_ignore_lowmem #define buffer_drain INT123_buffer_drain #define buffer_end INT123_buffer_end #define buffer_pause INT123_buffer_pause #define buffer_drop INT123_buffer_drop #define buffer_write INT123_buffer_write #define buffer_fill INT123_buffer_fill #define read_buf INT123_read_buf #define xfer_write_string INT123_xfer_write_string #define xfer_read_string INT123_xfer_read_string #define xfermem_init INT123_xfermem_init #define xfermem_init_writer INT123_xfermem_init_writer #define xfermem_init_reader INT123_xfermem_init_reader #define xfermem_get_freespace INT123_xfermem_get_freespace #define xfermem_get_usedspace INT123_xfermem_get_usedspace #define xfermem_getcmd INT123_xfermem_getcmd #define xfermem_getcmds INT123_xfermem_getcmds #define xfermem_putcmd INT123_xfermem_putcmd #define xfermem_writer_block INT123_xfermem_writer_block #define xfermem_write INT123_xfermem_write #define xfermem_done INT123_xfermem_done #define au_open INT123_au_open #define cdr_open INT123_cdr_open #define raw_open INT123_raw_open #define wav_open INT123_wav_open #define wav_write INT123_wav_write #define wav_close INT123_wav_close #define au_close INT123_au_close #define raw_close INT123_raw_close #define cdr_formats INT123_cdr_formats #define au_formats INT123_au_formats #define raw_formats INT123_raw_formats #define wav_formats INT123_wav_formats #define wav_drain INT123_wav_drain #define write_parameters INT123_write_parameters #define read_parameters INT123_read_parameters #define stringlists_add INT123_stringlists_add #define check_neon INT123_check_neon #define dct64_3dnow INT123_dct64_3dnow #define dct64_3dnowext INT123_dct64_3dnowext #define dct64_avx INT123_dct64_avx #define dct64_real_avx INT123_dct64_real_avx #define dct64_mmx INT123_dct64_mmx #define dct64_MMX INT123_dct64_MMX #define dct64_neon INT123_dct64_neon #define dct64_neon64 INT123_dct64_neon64 #define dct64_real_neon64 INT123_dct64_real_neon64 #define dct64_real_neon INT123_dct64_real_neon #define dct64_sse INT123_dct64_sse #define dct64_real_sse INT123_dct64_real_sse #define dct64_x86_64 INT123_dct64_x86_64 #define dct64_real_x86_64 INT123_dct64_real_x86_64 #define do_equalizer_3dnow INT123_do_equalizer_3dnow #define synth_1to1_3dnow_asm INT123_synth_1to1_3dnow_asm #define synth_1to1_arm_asm INT123_synth_1to1_arm_asm #define synth_1to1_arm_accurate_asm INT123_synth_1to1_arm_accurate_asm #define synth_1to1_i586_asm INT123_synth_1to1_i586_asm #define synth_1to1_i586_asm_dither INT123_synth_1to1_i586_asm_dither #define synth_1to1_MMX INT123_synth_1to1_MMX #define synth_1to1_neon_asm INT123_synth_1to1_neon_asm #define synth_1to1_neon64_asm INT123_synth_1to1_neon64_asm #define synth_1to1_neon64_accurate_asm INT123_synth_1to1_neon64_accurate_asm #define synth_1to1_real_neon64_asm INT123_synth_1to1_real_neon64_asm #define synth_1to1_s32_neon64_asm INT123_synth_1to1_s32_neon64_asm #define synth_1to1_neon_accurate_asm INT123_synth_1to1_neon_accurate_asm #define synth_1to1_real_neon_asm INT123_synth_1to1_real_neon_asm #define synth_1to1_s32_neon_asm INT123_synth_1to1_s32_neon_asm #define synth_1to1_sse_accurate_asm INT123_synth_1to1_sse_accurate_asm #define synth_1to1_real_sse_asm INT123_synth_1to1_real_sse_asm #define synth_1to1_s32_sse_asm INT123_synth_1to1_s32_sse_asm #define synth_1to1_s_avx_asm INT123_synth_1to1_s_avx_asm #define synth_1to1_s_avx_accurate_asm INT123_synth_1to1_s_avx_accurate_asm #define synth_1to1_real_s_avx_asm INT123_synth_1to1_real_s_avx_asm #define synth_1to1_s32_s_avx_asm INT123_synth_1to1_s32_s_avx_asm #define synth_1to1_s_neon_asm INT123_synth_1to1_s_neon_asm #define synth_1to1_s_neon64_asm INT123_synth_1to1_s_neon64_asm #define synth_1to1_s_neon64_accurate_asm INT123_synth_1to1_s_neon64_accurate_asm #define synth_1to1_real_s_neon64_asm INT123_synth_1to1_real_s_neon64_asm #define synth_1to1_s32_s_neon64_asm INT123_synth_1to1_s32_s_neon64_asm #define synth_1to1_s_neon_accurate_asm INT123_synth_1to1_s_neon_accurate_asm #define synth_1to1_real_s_neon_asm INT123_synth_1to1_real_s_neon_asm #define synth_1to1_s32_s_neon_asm INT123_synth_1to1_s32_s_neon_asm #define synth_1to1_s_sse_accurate_asm INT123_synth_1to1_s_sse_accurate_asm #define synth_1to1_real_s_sse_asm INT123_synth_1to1_real_s_sse_asm #define synth_1to1_s32_s_sse_asm INT123_synth_1to1_s32_s_sse_asm #define synth_1to1_s_x86_64_asm INT123_synth_1to1_s_x86_64_asm #define synth_1to1_s_x86_64_accurate_asm INT123_synth_1to1_s_x86_64_accurate_asm #define synth_1to1_real_s_x86_64_asm INT123_synth_1to1_real_s_x86_64_asm #define synth_1to1_s32_s_x86_64_asm INT123_synth_1to1_s32_s_x86_64_asm #define synth_1to1_x86_64_asm INT123_synth_1to1_x86_64_asm #define synth_1to1_x86_64_accurate_asm INT123_synth_1to1_x86_64_accurate_asm #define synth_1to1_real_x86_64_asm INT123_synth_1to1_real_x86_64_asm #define synth_1to1_s32_x86_64_asm INT123_synth_1to1_s32_x86_64_asm #define costab_mmxsse INT123_costab_mmxsse #define make_decode_tables_mmx_asm INT123_make_decode_tables_mmx_asm #ifndef HAVE_STRERROR #define strerror INT123_strerror #endif #endif welle.io-2.1/src/libs/mpg123/l12_integer_tables.h000066400000000000000000000276241357201522000214510ustar00rootroot00000000000000/* l12_integer_tables.h: Layer1/2 Constant tables for integer decoders copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #ifndef MPG123_L12_INTEGER_TABLES_H #define MPG123_L12_INTEGER_TABLES_H static const real layer12_table[27][64] = { { /* C90 does not like empty initializer. Fill with junk. */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 , 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 , 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 , 57, 58, 59, 60, 61, 62, 63, 64 }, { -1431655765,-1136305934,-901886617,-715827883,-568152967,-450943309,-357913941,-284076483, -225471654,-178956971,-142038242,-112735827,-89478485,-71019121,-56367914,-44739243, -35509560,-28183957,-22369621,-17754780,-14091978,-11184811,-8877390,-7045989, -5592405,-4438695,-3522995,-2796203,-2219348,-1761497,-1398101,-1109674, -880749,-699051,-554837,-440374,-349525,-277418,-220187,-174763, -138709,-110094,-87381,-69355,-55047,-43691,-34677,-27523, -21845,-17339,-13762,-10923,-8669,-6881,-5461,-4335, -3440,-2731,-2167,-1720,-1365,-1084,-860,0 }, { 1431655765,1136305934,901886617,715827883,568152967,450943309,357913941,284076483, 225471654,178956971,142038242,112735827,89478485,71019121,56367914,44739243, 35509560,28183957,22369621,17754780,14091978,11184811,8877390,7045989, 5592405,4438695,3522995,2796203,2219348,1761497,1398101,1109674, 880749,699051,554837,440374,349525,277418,220187,174763, 138709,110094,87381,69355,55047,43691,34677,27523, 21845,17339,13762,10923,8669,6881,5461,4335, 3440,2731,2167,1720,1365,1084,860,0 }, { 613566757,486988257,386522836,306783378,243494129,193261418,153391689,121747064, 96630709,76695845,60873532,48315355,38347922,30436766,24157677,19173961, 15218383,12078839,9586981,7609192,6039419,4793490,3804596,3019710, 2396745,1902298,1509855,1198373,951149,754927,599186,475574, 377464,299593,237787,188732,149797,118894,94366,74898, 59447,47183,37449,29723,23591,18725,14862,11796, 9362,7431,5898,4681,3715,2949,2341,1858, 1474,1170,929,737,585,464,369,0 }, { 286331153,227261187,180377323,143165577,113630593,90188662,71582788,56815297, 45094331,35791394,28407648,22547165,17895697,14203824,11273583,8947849, 7101912,5636791,4473924,3550956,2818396,2236962,1775478,1409198, 1118481,887739,704599,559241,443870,352299,279620,221935, 176150,139810,110967,88075,69905,55484,44037,34953, 27742,22019,17476,13871,11009,8738,6935,5505, 4369,3468,2752,2185,1734,1376,1092,867, 688,546,433,344,273,217,172,0 }, { 138547332,109965090,87279350,69273666,54982545,43639675,34636833,27491273, 21819838,17318417,13745636,10909919,8659208,6872818,5454959,4329604, 3436409,2727480,2164802,1718205,1363740,1082401,859102,681870, 541201,429551,340935,270600,214776,170467,135300,107388, 85234,67650,53694,42617,33825,26847,21308,16913, 13423,10654,8456,6712,5327,4228,3356,2664, 2114,1678,1332,1057,839,666,529,419, 333,264,210,166,132,105,83,0 }, { 68174084,54109806,42946982,34087042,27054903,21473491,17043521,13527452, 10736745,8521761,6763726,5368373,4260880,3381863,2684186,2130440, 1690931,1342093,1065220,845466,671047,532610,422733,335523, 266305,211366,167762,133153,105683,83881,66576,52842, 41940,33288,26421,20970,16644,13210,10485,8322, 6605,5243,4161,3303,2621,2081,1651,1311, 1040,826,655,520,413,328,260,206, 164,130,103,82,65,52,41,0 }, { 33818640,26841872,21304408,16909320,13420936,10652204,8454660,6710468, 5326102,4227330,3355234,2663051,2113665,1677617,1331526,1056833, 838809,665763,528416,419404,332881,264208,209702,166441, 132104,104851,83220,66052,52426,41610,33026,26213, 20805,16513,13106,10403,8257,6553,5201,4128, 3277,2601,2064,1638,1300,1032,819,650, 516,410,325,258,205,163,129,102, 81,65,51,41,32,26,20,0 }, { 16843009,13368305,10610431,8421505,6684153,5305215,4210752,3342076, 2652608,2105376,1671038,1326304,1052688,835519,663152,526344, 417760,331576,263172,208880,165788,131586,104440,82894, 65793,52220,41447,32897,26110,20723,16448,13055, 10362,8224,6527,5181,4112,3264,2590,2056, 1632,1295,1028,816,648,514,408,324, 257,204,162,129,102,81,64,51, 40,32,25,20,16,13,10,0 }, { 8405024,6671072,5294833,4202512,3335536,2647417,2101256,1667768, 1323708,1050628,833884,661854,525314,416942,330927,262657, 208471,165464,131329,104236,82732,65664,52118,41366, 32832,26059,20683,16416,13029,10341,8208,6515, 5171,4104,3257,2585,2052,1629,1293,1026, 814,646,513,407,323,257,204,162, 128,102,81,64,51,40,32,25, 20,16,13,10,8,6,5,0 }, { 4198404,3332275,2644829,2099202,1666138,1322414,1049601,833069, 661207,524801,416534,330604,262400,208267,165302,131200, 104134,82651,65600,52067,41325,32800,26033,20663, 16400,13017,10331,8200,6508,5166,4100,3254, 2583,2050,1627,1291,1025,814,646,513, 407,323,256,203,161,128,102,81, 64,51,40,32,25,20,16,13, 10,8,6,5,4,3,3,0 }, { 2098177,1665324,1321768,1049088,832662,660884,524544,416331, 330442,262272,208165,165221,131136,104083,82611,65568, 52041,41305,32784,26021,20653,16392,13010,10326, 8196,6505,5163,4098,3253,2582,2049,1626, 1291,1025,813,645,512,407,323,256, 203,161,128,102,81,64,51,40, 32,25,20,16,13,10,8,6, 5,4,3,3,2,2,1,0 }, { 1048832,832459,660723,524416,416229,330361,262208,208115, 165181,131104,104057,82590,65552,52029,41295,32776, 26014,20648,16388,13007,10324,8194,6504,5162, 4097,3252,2581,2049,1626,1290,1024,813, 645,512,406,323,256,203,161,128, 102,81,64,51,40,32,25,20, 16,13,10,8,6,5,4,3, 3,2,2,1,1,1,1,0 }, { 524352,416178,330321,262176,208089,165161,131088,104045, 82580,65544,52022,41290,32772,26011,20645,16386, 13006,10323,8193,6503,5161,4097,3251,2581, 2048,1626,1290,1024,813,645,512,406, 323,256,203,161,128,102,81,64, 51,40,32,25,20,16,13,10, 8,6,5,4,3,3,2,2, 1,1,1,1,1,0,0,0 }, { 262160,208077,165150,131080,104038,82575,65540,52019, 41288,32770,26010,20644,16385,13005,10322,8193, 6502,5161,4096,3251,2580,2048,1626,1290, 1024,813,645,512,406,323,256,203, 161,128,102,81,64,51,40,32, 25,20,16,13,10,8,6,5, 4,3,3,2,2,1,1,1, 1,1,0,0,0,0,0,0 }, { 131076,104035,82573,65538,52018,41286,32769,26009, 20643,16385,13004,10322,8192,6502,5161,4096, 3251,2580,2048,1626,1290,1024,813,645, 512,406,323,256,203,161,128,102, 81,64,51,40,32,25,20,16, 13,10,8,6,5,4,3,3, 2,2,1,1,1,1,1,0, 0,0,0,0,0,0,0,0 }, { 65537,52017,41286,32769,26008,20643,16384,13004, 10321,8192,6502,5161,4096,3251,2580,2048, 1626,1290,1024,813,645,512,406,323, 256,203,161,128,102,81,64,51, 40,32,25,20,16,13,10,8, 6,5,4,3,3,2,2,1, 1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0 }, { -1717986918,-1363567121,-1082263941,-858993459,-681783560,-541131970,-429496730,-340891780, -270565985,-214748365,-170445890,-135282993,-107374182,-85222945,-67641496,-53687091, -42611473,-33820748,-26843546,-21305736,-16910374,-13421773,-10652868,-8455187, -6710886,-5326434,-4227594,-3355443,-2663217,-2113797,-1677722,-1331609, -1056898,-838861,-665804,-528449,-419430,-332902,-264225,-209715, -166451,-132112,-104858,-83226,-66056,-52429,-41613,-33028, -26214,-20806,-16514,-13107,-10403,-8257,-6554,-5202, -4129,-3277,-2601,-2064,-1638,-1300,-1032,0 }, { -858993459,-681783560,-541131970,-429496730,-340891780,-270565985,-214748365,-170445890, -135282993,-107374182,-85222945,-67641496,-53687091,-42611473,-33820748,-26843546, -21305736,-16910374,-13421773,-10652868,-8455187,-6710886,-5326434,-4227594, -3355443,-2663217,-2113797,-1677722,-1331609,-1056898,-838861,-665804, -528449,-419430,-332902,-264225,-209715,-166451,-132112,-104858, -83226,-66056,-52429,-41613,-33028,-26214,-20806,-16514, -13107,-10403,-8257,-6554,-5202,-4129,-3277,-2601, -2064,-1638,-1300,-1032,-819,-650,-516,0 }, { 858993459,681783560,541131970,429496730,340891780,270565985,214748365,170445890, 135282993,107374182,85222945,67641496,53687091,42611473,33820748,26843546, 21305736,16910374,13421773,10652868,8455187,6710886,5326434,4227594, 3355443,2663217,2113797,1677722,1331609,1056898,838861,665804, 528449,419430,332902,264225,209715,166451,132112,104858, 83226,66056,52429,41613,33028,26214,20806,16514, 13107,10403,8257,6554,5202,4129,3277,2601, 2064,1638,1300,1032,819,650,516,0 }, { 1717986918,1363567121,1082263941,858993459,681783560,541131970,429496730,340891780, 270565985,214748365,170445890,135282993,107374182,85222945,67641496,53687091, 42611473,33820748,26843546,21305736,16910374,13421773,10652868,8455187, 6710886,5326434,4227594,3355443,2663217,2113797,1677722,1331609, 1056898,838861,665804,528449,419430,332902,264225,209715, 166451,132112,104858,83226,66056,52429,41613,33028, 26214,20806,16514,13107,10403,8257,6554,5202, 4129,3277,2601,2064,1638,1300,1032,0 }, { -1908874354,-1515074579,-1202515490,-954437177,-757537289,-601257745,-477218588,-378768645, -300628872,-238609294,-189384322,-150314436,-119304647,-94692161,-75157218,-59652324, -47346081,-37578609,-29826162,-23673040,-18789305,-14913081,-11836520,-9394652, -7456540,-5918260,-4697326,-3728270,-2959130,-2348663,-1864135,-1479565, -1174332,-932068,-739783,-587166,-466034,-369891,-293583,-233017, -184946,-146791,-116508,-92473,-73396,-58254,-46236,-36698, -29127,-23118,-18349,-14564,-11559,-9174,-7282,-5780, -4587,-3641,-2890,-2294,-1820,-1445,-1147,0 }, { -954437177,-757537289,-601257745,-477218588,-378768645,-300628872,-238609294,-189384322, -150314436,-119304647,-94692161,-75157218,-59652324,-47346081,-37578609,-29826162, -23673040,-18789305,-14913081,-11836520,-9394652,-7456540,-5918260,-4697326, -3728270,-2959130,-2348663,-1864135,-1479565,-1174332,-932068,-739783, -587166,-466034,-369891,-293583,-233017,-184946,-146791,-116508, -92473,-73396,-58254,-46236,-36698,-29127,-23118,-18349, -14564,-11559,-9174,-7282,-5780,-4587,-3641,-2890, -2294,-1820,-1445,-1147,-910,-722,-573,0 }, { -477218588,-378768645,-300628872,-238609294,-189384322,-150314436,-119304647,-94692161, -75157218,-59652324,-47346081,-37578609,-29826162,-23673040,-18789305,-14913081, -11836520,-9394652,-7456540,-5918260,-4697326,-3728270,-2959130,-2348663, -1864135,-1479565,-1174332,-932068,-739783,-587166,-466034,-369891, -293583,-233017,-184946,-146791,-116508,-92473,-73396,-58254, -46236,-36698,-29127,-23118,-18349,-14564,-11559,-9174, -7282,-5780,-4587,-3641,-2890,-2294,-1820,-1445, -1147,-910,-722,-573,-455,-361,-287,0 }, { 477218588,378768645,300628872,238609294,189384322,150314436,119304647,94692161, 75157218,59652324,47346081,37578609,29826162,23673040,18789305,14913081, 11836520,9394652,7456540,5918260,4697326,3728270,2959130,2348663, 1864135,1479565,1174332,932068,739783,587166,466034,369891, 293583,233017,184946,146791,116508,92473,73396,58254, 46236,36698,29127,23118,18349,14564,11559,9174, 7282,5780,4587,3641,2890,2294,1820,1445, 1147,910,722,573,455,361,287,0 }, { 954437177,757537289,601257745,477218588,378768645,300628872,238609294,189384322, 150314436,119304647,94692161,75157218,59652324,47346081,37578609,29826162, 23673040,18789305,14913081,11836520,9394652,7456540,5918260,4697326, 3728270,2959130,2348663,1864135,1479565,1174332,932068,739783, 587166,466034,369891,293583,233017,184946,146791,116508, 92473,73396,58254,46236,36698,29127,23118,18349, 14564,11559,9174,7282,5780,4587,3641,2890, 2294,1820,1445,1147,910,722,573,0 }, { 1908874354,1515074579,1202515490,954437177,757537289,601257745,477218588,378768645, 300628872,238609294,189384322,150314436,119304647,94692161,75157218,59652324, 47346081,37578609,29826162,23673040,18789305,14913081,11836520,9394652, 7456540,5918260,4697326,3728270,2959130,2348663,1864135,1479565, 1174332,932068,739783,587166,466034,369891,293583,233017, 184946,146791,116508,92473,73396,58254,46236,36698, 29127,23118,18349,14564,11559,9174,7282,5780, 4587,3641,2890,2294,1820,1445,1147,0 }, }; #endif welle.io-2.1/src/libs/mpg123/l2tables.h000066400000000000000000000206571357201522000175130ustar00rootroot00000000000000/* l2tables.h: Layer 2 Alloc tables copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp most other tables are calculated on program start (which is (of course) not ISO-conform) Layer-3 huffman table is in huffman.h */ #ifndef _MPG123_L2TABLES_H_ #define _MPG123_L2TABLES_H_ static const struct al_table alloc_0[] = { {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767} }; static const struct al_table alloc_1[] = { {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767}, {2,0},{5,3},{7,5},{16,-32767} }; static const struct al_table alloc_2[] = { {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; static const struct al_table alloc_3[] = { {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; static const struct al_table alloc_4[] = { {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9} }; #endif welle.io-2.1/src/libs/mpg123/l3_integer_tables.h000066400000000000000000002613261357201522000213700ustar00rootroot00000000000000/* l3_integer_tables.h: Layer3 Constant tables for integer decoders copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Taihei Monma */ #ifndef MPG123_L3_INTEGER_TABLES_H #define MPG123_L3_INTEGER_TABLES_H #ifdef PRECALC_TABLES static const real ispow[8207] = { 0,8192,20643,35445,52016,70041,89315,109695,131072,153360, 176491,200407,225060,250408,276414,303048,330281,358087,386444,415331, 444730,474623,504995,535830,567116,598839,630988,663552,696521,729884, 763633,797760,832255,867112,902323,937880,973778,1010010,1046569,1083451, 1120650,1158160,1195976,1234093,1272507,1311213,1350207,1389485,1429042,1468875, 1508979,1549352,1589990,1630889,1672046,1713458,1755122,1797035,1839193,1881594, 1924236,1967115,2010229,2053576,2097152,2140956,2184985,2229238,2273710,2318402, 2363310,2408432,2453767,2499312,2545065,2591025,2637190,2683558,2730126,2776895, 2823861,2871023,2918379,2965929,3013670,3061600,3109719,3158025,3206517,3255192, 3304050,3353089,3402309,3451707,3501282,3551033,3600960,3651060,3701332,3751776, 3802390,3853172,3904123,3955241,4006524,4057972,4109583,4161357,4213293,4265389, 4317644,4370058,4422630,4475359,4528243,4581282,4634476,4687822,4741320,4794970, 4848770,4902720,4956819,5011066,5065460,5120000,5174686,5229517,5284492,5339610, 5394871,5450274,5505818,5561502,5617327,5673290,5729391,5785631,5842007,5898519, 5955168,6011951,6068869,6125920,6183105,6240422,6297871,6355451,6413162,6471004, 6528974,6587074,6645302,6703658,6762141,6820751,6879487,6938349,6997336,7056447, 7115683,7175042,7234524,7294129,7353855,7413703,7473672,7533762,7593972,7654301, 7714750,7775317,7836002,7896805,7957725,8018762,8079916,8141185,8202570,8264070, 8325685,8387413,8449256,8511212,8573281,8635462,8697756,8760161,8822678,8885305, 8948043,9010892,9073850,9136917,9200094,9263379,9326772,9390274,9453882,9517598, 9581421,9645351,9709386,9773527,9837774,9902125,9966582,10031143,10095807,10160576, 10225448,10290423,10355500,10420681,10485963,10551347,10616832,10682419,10748106,10813894, 10879782,10945770,11011857,11078044,11144330,11210715,11277198,11343779,11410458,11477234, 11544108,11611079,11678147,11745311,11812571,11879927,11947378,12014925,12082567,12150304, 12218135,12286061,12354081,12422194,12490401,12558701,12627094,12695580,12764158,12832829, 12901592,12970446,13039392,13108429,13177557,13246776,13316085,13385485,13454975,13524554, 13594224,13663982,13733830,13803767,13873792,13943906,14014108,14084398,14154776,14225242, 14295794,14366435,14437162,14507975,14578876,14649862,14720935,14792093,14863337,14934667, 15006082,15077582,15149167,15220837,15292591,15364429,15436351,15508358,15580448,15652621, 15724878,15797217,15869640,15942146,16014734,16087404,16160156,16232991,16305907,16378905, 16451984,16525145,16598386,16671709,16745112,16818596,16892160,16965804,17039528,17113332, 17187216,17261179,17335222,17409343,17483544,17557824,17632182,17706618,17781133,17855726, 17930397,18005146,18079973,18154877,18229858,18304917,18380052,18455265,18530554,18605920, 18681362,18756880,18832475,18908145,18983891,19059713,19135610,19211583,19287630,19363753, 19439951,19516223,19592571,19668992,19745488,19822058,19898702,19975420,20052211,20129076, 20206015,20283027,20360112,20437270,20514501,20591805,20669181,20746630,20824151,20901745, 20979410,21057148,21134957,21212838,21290791,21368815,21446910,21525076,21603314,21681622, 21760001,21838451,21916971,21995561,22074222,22152953,22231754,22310625,22389566,22468576, 22547656,22626806,22706024,22785312,22864669,22944094,23023589,23103152,23182783,23262484, 23342252,23422089,23501993,23581966,23662007,23742115,23822291,23902534,23982845,24063223, 24143669,24224181,24304761,24385407,24466120,24546899,24627745,24708658,24789637,24870682, 24951793,25032970,25114213,25195521,25276895,25358335,25439841,25521411,25603047,25684748, 25766514,25848345,25930241,26012201,26094226,26176316,26258469,26340688,26422970,26505317, 26587727,26670202,26752740,26835342,26918008,27000737,27083530,27166386,27249305,27332287, 27415332,27498440,27581611,27664845,27748142,27831501,27914922,27998406,28081952,28165561, 28249231,28332963,28416758,28500614,28584532,28668511,28752552,28836655,28920819,29005044, 29089330,29173677,29258086,29342555,29427085,29511676,29596328,29681040,29765813,29850646, 29935539,30020493,30105507,30190581,30275714,30360908,30446162,30531475,30616848,30702280, 30787772,30873323,30958934,31044604,31130332,31216120,31301967,31387873,31473838,31559862, 31645944,31732084,31818284,31904541,31990857,32077231,32163664,32250154,32336703,32423309, 32509974,32596696,32683476,32770313,32857208,32944161,33031171,33118238,33205363,33292544, 33379783,33467079,33554432,33641842,33729308,33816832,33904412,33992048,34079741,34167491, 34255297,34343159,34431078,34519052,34607083,34695170,34783312,34871511,34959765,35048075, 35136441,35224862,35313339,35401872,35490459,35579102,35667801,35756554,35845363,35934226, 36023145,36112118,36201147,36290230,36379367,36468560,36557807,36647108,36736464,36825875, 36915339,37004858,37094431,37184058,37273739,37363474,37453263,37543106,37633003,37722953, 37812957,37903015,37993126,38083291,38173509,38263780,38354105,38444483,38534914,38625398, 38715935,38806525,38897168,38987864,39078612,39169414,39260268,39351174,39442133,39533145, 39624209,39715325,39806494,39897714,39988987,40080312,40171690,40263119,40354600,40446133, 40537718,40629354,40721042,40812782,40904574,40996417,41088311,41180257,41272254,41364303, 41456402,41548553,41640755,41733008,41825313,41917668,42010074,42102530,42195038,42287596, 42380205,42472865,42565575,42658336,42751147,42844009,42936921,43029883,43122895,43215958, 43309070,43402233,43495446,43588709,43682022,43775384,43868797,43962259,44055771,44149332, 44242943,44336604,44430314,44524073,44617882,44711741,44805648,44899605,44993611,45087666, 45181770,45275923,45370126,45464377,45558677,45653025,45747423,45841869,45936364,46030908, 46125500,46220141,46314830,46409567,46504353,46599187,46694070,46789001,46883980,46979007, 47074082,47169205,47264376,47359595,47454862,47550177,47645540,47740950,47836408,47931914, 48027467,48123068,48218716,48314412,48410155,48505945,48601783,48697668,48793601,48889580, 48985607,49081681,49177802,49273969,49370184,49466446,49562754,49659109,49755511,49851960, 49948456,50044998,50141586,50238222,50334903,50431631,50528406,50625227,50722094,50819007, 50915967,51012973,51110025,51207123,51304267,51401457,51498694,51595976,51693304,51790677, 51888097,51985562,52083073,52180630,52278232,52375880,52473573,52571312,52669097,52766926, 52864801,52962722,53060688,53158699,53256755,53354856,53453002,53551194,53649430,53747712, 53846038,53944410,54042826,54141287,54239793,54338344,54436939,54535579,54634263,54732993, 54831766,54930585,55029447,55128354,55227306,55326302,55425342,55524426,55623555,55722728, 55821945,55921206,56020511,56119860,56219253,56318690,56418171,56517696,56617265,56716877, 56816534,56916234,57015977,57115764,57215595,57315470,57415388,57515349,57615354,57715403, 57815494,57915629,58015808,58116029,58216294,58316602,58416954,58517348,58617785,58718266, 58818789,58919356,59019965,59120617,59221312,59322050,59422831,59523654,59624521,59725429, 59826381,59927375,60028412,60129491,60230613,60331777,60432983,60534232,60635524,60736857, 60838233,60939651,61041112,61142614,61244159,61345746,61447375,61549046,61650759,61752513, 61854310,61956149,62058030,62159952,62261916,62363922,62465970,62568059,62670191,62772363, 62874578,62976833,63079131,63181470,63283850,63386272,63488735,63591239,63693785,63796372, 63899001,64001670,64104381,64207133,64309926,64412760,64515636,64618552,64721509,64824507, 64927546,65030627,65133747,65236909,65340112,65443355,65546639,65649964,65753329,65856735, 65960182,66063669,66167197,66270765,66374374,66478023,66581713,66685443,66789213,66893024, 66996875,67100766,67204698,67308669,67412681,67516733,67620825,67724957,67829130,67933342, 68037594,68141886,68246218,68350590,68455002,68559454,68663945,68768476,68873047,68977658, 69082308,69186998,69291728,69396497,69501306,69606154,69711042,69815969,69920936,70025942, 70130987,70236072,70341196,70446360,70551562,70656804,70762085,70867406,70972765,71078164, 71183601,71289078,71394594,71500149,71605742,71711375,71817046,71922757,72028506,72134294, 72240121,72345987,72451891,72557835,72663817,72769837,72875896,72981994,73088130,73194305, 73300519,73406770,73513061,73619389,73725757,73832162,73938606,74045088,74151609,74258168, 74364765,74471400,74578073,74684785,74791535,74898323,75005149,75112012,75218914,75325854, 75432832,75539848,75646902,75753994,75861123,75968291,76075496,76182739,76290020,76397338, 76504694,76612088,76719520,76826989,76934495,77042040,77149622,77257241,77364898,77472592, 77580324,77688093,77795899,77903743,78011625,78119543,78227499,78335492,78443522,78551590, 78659695,78767836,78876015,78984232,79092485,79200775,79309102,79417467,79525868,79634306, 79742781,79851293,79959842,80068428,80177050,80285710,80394406,80503139,80611908,80720715, 80829558,80938438,81047354,81156307,81265296,81374322,81483385,81592484,81701620,81810792, 81920000,82029245,82138526,82247844,82357198,82466588,82576014,82685477,82794976,82904512, 83014083,83123691,83233334,83343014,83452730,83562482,83672271,83782095,83891955,84001851, 84111783,84221751,84331755,84441795,84551870,84661982,84772129,84882312,84992531,85102786, 85213076,85323402,85433764,85544161,85654594,85765063,85875567,85986107,86096682,86207293, 86317939,86428621,86539338,86650091,86760879,86871702,86982561,87093455,87204384,87315349, 87426349,87537384,87648455,87759560,87870701,87981877,88093088,88204334,88315616,88426932, 88538283,88649670,88761091,88872548,88984039,89095565,89207126,89318723,89430353,89542019, 89653720,89765455,89877226,89989030,90100870,90212745,90324654,90436598,90548576,90660589, 90772637,90884719,90996836,91108987,91221173,91333394,91445648,91557938,91670262,91782620, 91895012,92007439,92119901,92232396,92344926,92457491,92570089,92682722,92795389,92908090, 93020826,93133595,93246399,93359237,93472109,93585015,93697955,93810929,93923937,94036980, 94150056,94263166,94376310,94489488,94602700,94715946,94829225,94942539,95055886,95169267, 95282682,95396131,95509613,95623129,95736679,95850263,95963880,96077530,96191215,96304933, 96418684,96532470,96646288,96760140,96874026,96987945,97101898,97215884,97329904,97443956, 97558043,97672162,97786315,97900502,98014721,98128974,98243260,98357580,98471933,98586318, 98700737,98815190,98929675,99044194,99158745,99273330,99387948,99502598,99617282,99731999, 99846749,99961532,100076348,100191197,100306078,100420993,100535940,100650921,100765934,100880980, 100996059,101111170,101226315,101341492,101456702,101571944,101687220,101802528,101917868,102033241, 102148647,102264086,102379557,102495061,102610597,102726166,102841767,102957401,103073067,103188765, 103304497,103420260,103536056,103651884,103767745,103883638,103999563,104115521,104231511,104347533, 104463588,104579675,104695794,104811945,104928128,105044344,105160592,105276871,105393183,105509527, 105625904,105742312,105858752,105975224,106091729,106208265,106324833,106441433,106558066,106674730, 106791426,106908154,107024913,107141705,107258528,107375384,107492271,107609190,107726140,107843123, 107960137,108077182,108194260,108311369,108428510,108545683,108662887,108780122,108897390,109014689, 109132019,109249381,109366775,109484200,109601656,109719144,109836664,109954215,110071797,110189411, 110307056,110424733,110542441,110660180,110777950,110895752,111013585,111131450,111249346,111367273, 111485231,111603220,111721241,111839292,111957375,112075489,112193635,112311811,112430018,112548257, 112666526,112784827,112903159,113021521,113139915,113258339,113376795,113495282,113613799,113732347, 113850927,113969537,114088178,114206850,114325552,114444286,114563050,114681845,114800671,114919528, 115038415,115157333,115276282,115395262,115514272,115633313,115752384,115871486,115990619,116109783, 116228976,116348201,116467456,116586742,116706058,116825404,116944781,117064189,117183627,117303095, 117422594,117542124,117661683,117781273,117900894,118020545,118140226,118259937,118379679,118499451, 118619253,118739086,118858948,118978842,119098765,119218718,119338702,119458716,119578759,119698834, 119818938,119939072,120059236,120179431,120299655,120419910,120540194,120660509,120780854,120901228, 121021633,121142067,121262532,121383026,121503550,121624105,121744689,121865303,121985946,122106620, 122227323,122348057,122468820,122589613,122710435,122831287,122952170,123073081,123194023,123314994, 123435995,123557025,123678085,123799175,123920295,124041444,124162622,124283830,124405068,124526335, 124647632,124768959,124890314,125011700,125133114,125254559,125376032,125497536,125619068,125740630, 125862221,125983842,126105492,126227171,126348880,126470618,126592386,126714182,126836008,126957863, 127079748,127201661,127323604,127445576,127567578,127689608,127811668,127933756,128055874,128178021, 128300197,128422403,128544637,128666900,128789193,128911514,129033865,129156244,129278652,129401090, 129523556,129646052,129768576,129891129,130013711,130136323,130258963,130381631,130504329,130627056, 130749811,130872595,130995408,131118250,131241120,131364020,131486948,131609905,131732890,131855904, 131978947,132102019,132225119,132348248,132471406,132594592,132717807,132841050,132964323,133087623, 133210952,133334310,133457696,133581111,133704554,133828026,133951527,134075055,134198613,134322198, 134445812,134569455,134693126,134816825,134940553,135064309,135188094,135311906,135435747,135559617, 135683515,135807441,135931395,136055378,136179388,136303427,136427495,136551590,136675714,136799866, 136924046,137048254,137172490,137296755,137421048,137545368,137669717,137794094,137918499,138042932, 138167393,138291882,138416400,138540945,138665518,138790119,138914748,139039405,139164090,139288803, 139413544,139538313,139663110,139787934,139912787,140037667,140162575,140287511,140412475,140537467, 140662486,140787533,140912608,141037711,141162842,141288000,141413186,141538399,141663641,141788910, 141914207,142039531,142164883,142290263,142415670,142541105,142666567,142792057,142917575,143043120, 143168693,143294294,143419921,143545577,143671260,143796970,143922708,144048473,144174266,144300086, 144425934,144551809,144677712,144803641,144929599,145055583,145181595,145307635,145433701,145559795, 145685917,145812065,145938241,146064445,146190675,146316933,146443218,146569530,146695869,146822236, 146948630,147075051,147201499,147327974,147454477,147581007,147707563,147834147,147960758,148087396, 148214061,148340754,148467473,148594219,148720993,148847793,148974620,149101475,149228356,149355264, 149482200,149609162,149736151,149863167,149990210,150117280,150244377,150371501,150498652,150625829, 150753033,150880265,151007523,151134807,151262119,151389457,151516823,151644215,151771633,151899079, 152026551,152154050,152281576,152409128,152536707,152664313,152791945,152919604,153047290,153175002, 153302741,153430507,153558299,153686118,153813963,153941835,154069734,154197659,154325610,154453588, 154581593,154709624,154837682,154965766,155093876,155222013,155350177,155478367,155606583,155734826, 155863095,155991391,156119713,156248061,156376436,156504837,156633264,156761718,156890198,157018704, 157147237,157275796,157404381,157532993,157661630,157790294,157918985,158047701,158176444,158305212, 158434008,158562829,158691676,158820550,158949449,159078375,159207327,159336305,159465310,159594340, 159723396,159852479,159981587,160110722,160239882,160369069,160498282,160627520,160756785,160886076, 161015392,161144735,161274103,161403498,161532918,161662365,161791837,161921335,162050859,162180409, 162309985,162439587,162569215,162698868,162828547,162958252,163087983,163217740,163347523,163477331, 163607165,163737025,163866910,163996822,164126759,164256722,164386710,164516724,164646764,164776830, 164906921,165037038,165167181,165297349,165427543,165557762,165688007,165818278,165948574,166078896, 166209243,166339616,166470015,166600439,166730888,166861363,166991864,167122390,167252942,167383519, 167514122,167644750,167775403,167906082,168036786,168167516,168298271,168429052,168559858,168690689, 168821546,168952428,169083335,169214268,169345226,169476210,169607219,169738253,169869312,170000397, 170131507,170262642,170393802,170524988,170656199,170787435,170918696,171049983,171181295,171312632, 171443994,171575381,171706793,171838231,171969694,172101182,172232695,172364233,172495796,172627384, 172758997,172890636,173022299,173153988,173285702,173417440,173549204,173680993,173812806,173944645, 174076509,174208397,174340311,174472249,174604213,174736201,174868215,175000253,175132316,175264404, 175396517,175528655,175660818,175793005,175925218,176057455,176189717,176322004,176454316,176586653, 176719014,176851400,176983811,177116247,177248708,177381193,177513703,177646237,177778797,177911381, 178043990,178176624,178309282,178441965,178574672,178707405,178840162,178972943,179105749,179238580, 179371435,179504316,179637220,179770149,179903103,180036082,180169084,180302112,180435164,180568240, 180701342,180834467,180967617,181100792,181233991,181367214,181500462,181633735,181767032,181900353, 182033699,182167069,182300464,182433883,182567326,182700794,182834286,182967803,183101344,183234909, 183368499,183502113,183635751,183769414,183903101,184036812,184170548,184304307,184438092,184571900, 184705732,184839589,184973470,185107376,185241305,185375259,185509237,185643239,185777266,185911316, 186045391,186179490,186313613,186447760,186581931,186716126,186850346,186984590,187118857,187253149, 187387465,187521805,187656169,187790557,187924969,188059405,188193866,188328350,188462858,188597390, 188731946,188866527,189001131,189135759,189270411,189405087,189539787,189674511,189809259,189944031, 190078827,190213646,190348490,190483357,190618249,190753164,190888103,191023066,191158052,191293063, 191428097,191563155,191698237,191833343,191968473,192103626,192238803,192374004,192509229,192644477, 192779749,192915045,193050365,193185708,193321075,193456466,193591881,193727319,193862781,193998266, 194133775,194269308,194404864,194540444,194676048,194811675,194947326,195083001,195218699,195354421, 195490166,195625935,195761727,195897543,196033383,196169246,196305132,196441042,196576976,196712933, 196848914,196984918,197120945,197256996,197393071,197529169,197665290,197801435,197937603,198073795, 198210010,198346249,198482510,198618796,198755104,198891437,199027792,199164171,199300573,199436998, 199573447,199709919,199846415,199982934,200119476,200256041,200392630,200529242,200665877,200802535, 200939217,201075922,201212650,201349402,201486176,201622974,201759795,201896639,202033507,202170398, 202307311,202444248,202581209,202718192,202855198,202992228,203129281,203266357,203403456,203540578, 203677723,203814891,203952082,204089297,204226534,204363795,204501078,204638385,204775715,204913067, 205050443,205187842,205325264,205462708,205600176,205737667,205875180,206012717,206150277,206287859, 206425465,206563093,206700745,206838419,206976116,207113836,207251579,207389345,207527134,207664946, 207802780,207940638,208078518,208216421,208354347,208492295,208630267,208768261,208906279,209044319, 209182381,209320467,209458575,209596706,209734860,209873037,210011236,210149458,210287703,210425971, 210564261,210702574,210840910,210979268,211117649,211256053,211394480,211532929,211671400,211809895, 211948412,212086952,212225514,212364099,212502706,212641337,212779989,212918665,213057363,213196083, 213334826,213473592,213612380,213751191,213890024,214028880,214167758,214306659,214445582,214584528, 214723497,214862488,215001501,215140537,215279595,215418676,215557779,215696904,215836053,215975223, 216114416,216253631,216392869,216532129,216671412,216810717,216950044,217089394,217228766,217368160, 217507577,217647016,217786477,217925961,218065467,218204996,218344546,218484119,218623715,218763332, 218902972,219042634,219182319,219322026,219461754,219601506,219741279,219881075,220020893,220160733, 220300595,220440479,220580386,220720315,220860266,221000239,221140235,221280252,221420292,221560354, 221700438,221840544,221980672,222120823,222260995,222401190,222541406,222681645,222821906,222962189, 223102494,223242821,223383170,223523541,223663934,223804350,223944787,224085246,224225728,224366231, 224506756,224647303,224787873,224928464,225069077,225209712,225350370,225491049,225631750,225772473, 225913218,226053985,226194773,226335584,226476417,226617271,226758148,226899046,227039966,227180908, 227321872,227462858,227603865,227744895,227885946,228027019,228168114,228309231,228450369,228591529, 228732712,228873916,229015141,229156389,229297658,229438949,229580262,229721596,229862953,230004331, 230145730,230287152,230428595,230570060,230711546,230853055,230994585,231136136,231277709,231419304, 231560921,231702559,231844219,231985901,232127604,232269329,232411076,232552844,232694633,232836445, 232978278,233120132,233262008,233403906,233545825,233687766,233829728,233971712,234113717,234255744, 234397793,234539863,234681954,234824068,234966202,235108358,235250536,235392735,235534955,235677197, 235819461,235961746,236104052,236246380,236388729,236531100,236673492,236815905,236958340,237100797, 237243274,237385774,237528294,237670836,237813399,237955984,238098590,238241217,238383866,238526536, 238669228,238811940,238954674,239097430,239240207,239383005,239525824,239668664,239811526,239954409, 240097314,240240240,240383187,240526155,240669144,240812155,240955187,241098240,241241314,241384410, 241527527,241670665,241813824,241957005,242100206,242243429,242386673,242529938,242673224,242816532, 242959860,243103210,243246581,243389973,243533386,243676820,243820276,243963752,244107249,244250768, 244394308,244537869,244681450,244825053,244968677,245112322,245255989,245399676,245543384,245687113, 245830863,245974635,246118427,246262240,246406074,246549930,246693806,246837703,246981621,247125560, 247269521,247413502,247557504,247701527,247845571,247989635,248133721,248277828,248421956,248566104, 248710273,248854464,248998675,249142907,249287160,249431434,249575729,249720044,249864381,250008738, 250153116,250297515,250441935,250586375,250730837,250875319,251019822,251164346,251308890,251453456, 251598042,251742649,251887277,252031925,252176594,252321284,252465995,252610727,252755479,252900252, 253045045,253189860,253334695,253479551,253624427,253769324,253914242,254059181,254204140,254349120, 254494121,254639142,254784184,254929246,255074329,255219433,255364558,255509703,255654868,255800054, 255945261,256090489,256235737,256381006,256526295,256671605,256816935,256962286,257107657,257253049, 257398462,257543895,257689349,257834823,257980318,258125833,258271369,258416925,258562502,258708099, 258853717,258999355,259145014,259290693,259436392,259582112,259727853,259873614,260019395,260165197, 260311019,260456862,260602725,260748609,260894513,261040437,261186382,261332347,261478333,261624339, 261770365,261916411,262062478,262208566,262354674,262500802,262646950,262793119,262939308,263085517, 263231747,263377997,263524267,263670558,263816869,263963200,264109551,264255923,264402315,264548728, 264695160,264841613,264988086,265134579,265281093,265427627,265574181,265720755,265867349,266013964, 266160599,266307254,266453929,266600625,266747340,266894076,267040832,267187608,267334404,267481221, 267628057,267774914,267921791,268068688,268215605,268362542,268509500,268656477,268803475,268950493, 269097530,269244588,269391666,269538764,269685882,269833021,269980179,270127357,270274555,270421774, 270569012,270716271,270863549,271010848,271158166,271305505,271452863,271600242,271747640,271895059, 272042497,272189956,272337434,272484933,272632451,272779990,272927548,273075126,273222724,273370342, 273517981,273665639,273813316,273961014,274108732,274256470,274404227,274552005,274699802,274847619, 274995456,275143313,275291190,275439087,275587003,275734940,275882896,276030872,276178868,276326884, 276474919,276622975,276771050,276919145,277067260,277215394,277363549,277511723,277659917,277808130, 277956364,278104617,278252890,278401183,278549496,278697828,278846180,278994552,279142943,279291354, 279439785,279588236,279736706,279885196,280033706,280182236,280330785,280479353,280627942,280776550, 280925178,281073825,281222493,281371179,281519886,281668612,281817358,281966123,282114908,282263713, 282412537,282561381,282710244,282859127,283008030,283156952,283305894,283454855,283603836,283752836, 283901856,284050896,284199955,284349034,284498132,284647250,284796387,284945544,285094721,285243917, 285393132,285542367,285691621,285840895,285990189,286139502,286288834,286438186,286587557,286736948, 286886358,287035788,287185237,287334706,287484194,287633701,287783228,287932774,288082340,288231925, 288381530,288531154,288680797,288830460,288980142,289129844,289279565,289429305,289579065,289728844, 289878642,290028460,290178297,290328153,290478029,290627924,290777839,290927773,291077726,291227698, 291377690,291527701,291677731,291827781,291977850,292127938,292278045,292428172,292578318,292728484, 292878668,293028872,293179095,293329337,293479599,293629880,293780180,293930499,294080837,294231195, 294381572,294531968,294682383,294832818,294983272,295133744,295284237,295434748,295585278,295735828, 295886396,296036984,296187591,296338218,296488863,296639527,296790211,296940914,297091636,297242377, 297393137,297543916,297694714,297845532,297996368,298147224,298298098,298448992,298599905,298750837, 298901788,299052758,299203747,299354755,299505782,299656829,299807894,299958978,300110081,300261204, 300412345,300563505,300714685,300865883,301017101,301168337,301319592,301470867,301622160,301773472, 301924804,302076154,302227523,302378911,302530318,302681744,302833189,302984653,303136136,303287638, 303439159,303590698,303742257,303893834,304045431,304197046,304348680,304500333,304652005,304803696, 304955405,305107134,305258881,305410648,305562433,305714237,305866060,306017901,306169762,306321641, 306473539,306625456,306777392,306929347,307081320,307233312,307385323,307537353,307689402,307841469, 307993555,308145660,308297784,308449927,308602088,308754268,308906467,309058684,309210921,309363176, 309515449,309667742,309820053,309972383,310124732,310277099,310429485,310581890,310734313,310886755, 311039216,311191696,311344194,311496711,311649247,311801801,311954374,312106965,312259575,312412204, 312564852,312717518,312870203,313022906,313175628,313328369,313481128,313633906,313786703,313939518, 314092351,314245204,314398074,314550964,314703872,314856799,315009744,315162708,315315690,315468691, 315621710,315774748,315927805,316080880,316233973,316387086,316540216,316693365,316846533,316999719, 317152924,317306147,317459389,317612649,317765928,317919225,318072541,318225875,318379228,318532599, 318685988,318839396,318992823,319146268,319299731,319453213,319606713,319760232,319913769,320067324, 320220898,320374491,320528101,320681731,320835378,320989044,321142729,321296431,321450153,321603892, 321757650,321911426,322065221,322219034,322372865,322526715,322680583,322834470,322988374,323142297, 323296239,323450199,323604177,323758173,323912188,324066221,324220272,324374342,324528430,324682536, 324836660,324990803,325144964,325299144,325453341,325607557,325761791,325916044,326070314,326224603, 326378910,326533236,326687579,326841941,326996321,327150720,327305136,327459571,327614024,327768495, 327922984,328077492,328232018,328386562,328541124,328695704,328850302,329004919,329159554,329314207, 329468878,329623567,329778275,329933000,330087744,330242506,330397286,330552084,330706900,330861735, 331016587,331171458,331326347,331481254,331636178,331791121,331946083,332101062,332256059,332411074, 332566108,332721159,332876229,333031317,333186422,333341546,333496688,333651848,333807026,333962221, 334117435,334272667,334427917,334583185,334738471,334893776,335049098,335204438,335359796,335515172, 335670566,335825978,335981408,336136856,336292322,336447806,336603308,336758828,336914365,337069921, 337225495,337381087,337536696,337692324,337847969,338003633,338159314,338315013,338470730,338626465, 338782218,338937989,339093778,339249585,339405409,339561252,339717112,339872990,340028886,340184800, 340340732,340496682,340652650,340808635,340964638,341120659,341276698,341432755,341588830,341744922, 341901032,342057161,342213306,342369470,342525652,342681851,342838068,342994303,343150556,343306826, 343463115,343619421,343775745,343932086,344088446,344244823,344401218,344557631,344714061,344870509, 345026975,345183459,345339960,345496480,345653016,345809571,345966143,346122733,346279341,346435967, 346592610,346749271,346905949,347062646,347219359,347376091,347532840,347689607,347846392,348003194, 348160014,348316852,348473707,348630580,348787471,348944379,349101305,349258249,349415210,349572189, 349729185,349886199,350043231,350200280,350357347,350514432,350671534,350828653,350985791,351142946, 351300118,351457308,351614516,351771741,351928984,352086244,352243522,352400817,352558130,352715461, 352872809,353030175,353187558,353344959,353502377,353659813,353817266,353974737,354132225,354289731, 354447254,354604795,354762354,354919929,355077523,355235134,355392762,355550408,355708071,355865752, 356023450,356181166,356338899,356496649,356654418,356812203,356970006,357127826,357285664,357443520, 357601392,357759282,357917190,358075115,358233057,358391017,358548994,358706989,358865001,359023030, 359181077,359339141,359497223,359655322,359813438,359971572,360129723,360287891,360446077,360604280, 360762501,360920738,361078994,361237266,361395556,361553863,361712188,361870530,362028889,362187265, 362345659,362504070,362662499,362820944,362979407,363137888,363296385,363454900,363613432,363771982, 363930549,364089133,364247734,364406353,364564988,364723642,364882312,365041000,365199704,365358426, 365517166,365675922,365834696,365993487,366152296,366311121,366469964,366628824,366787701,366946595, 367105507,367264435,367423381,367582344,367741325,367900322,368059337,368218369,368377418,368536484, 368695567,368854668,369013785,369172920,369332072,369491241,369650428,369809631,369968852,370128089, 370287344,370446616,370605905,370765211,370924535,371083875,371243232,371402607,371561999,371721408, 371880833,372040276,372199737,372359214,372518708,372678219,372837748,372997293,373156856,373316435, 373476032,373635645,373795276,373954924,374114589,374274270,374433969,374593685,374753418,374913168, 375072935,375232719,375392520,375552338,375712173,375872025,376031894,376191780,376351683,376511603, 376671540,376831494,376991465,377151453,377311458,377471479,377631518,377791574,377951647,378111736, 378271843,378431966,378592107,378752264,378912439,379072630,379232838,379393063,379553305,379713564, 379873840,380034133,380194443,380354769,380515113,380675473,380835850,380996244,381156655,381317083, 381477528,381637990,381798468,381958964,382119476,382280005,382440551,382601114,382761694,382922290, 383082903,383243534,383404181,383564844,383725525,383886223,384046937,384207668,384368416,384529181, 384689962,384850761,385011576,385172408,385333256,385494122,385655004,385815903,385976819,386137752, 386298701,386459667,386620650,386781650,386942667,387103700,387264750,387425816,387586900,387748000, 387909117,388070251,388231401,388392568,388553752,388714952,388876170,389037404,389198654,389359922, 389521206,389682507,389843824,390005158,390166509,390327877,390489261,390650662,390812079,390973513, 391134964,391296432,391457916,391619417,391780934,391942469,392104019,392265587,392427171,392588772, 392750389,392912023,393073674,393235341,393397025,393558725,393720442,393882176,394043926,394205693, 394367477,394529277,394691093,394852927,395014776,395176643,395338526,395500425,395662342,395824274, 395986224,396148189,396310172,396472171,396634186,396796218,396958267,397120332,397282414,397444512, 397606627,397768758,397930906,398093070,398255251,398417448,398579662,398741892,398904139,399066402, 399228682,399390979,399553291,399715621,399877966,400040329,400202707,400365103,400527514,400689943, 400852387,401014848,401177326,401339820,401502330,401664857,401827400,401989960,402152536,402315129, 402477738,402640363,402803005,402965664,403128338,403291030,403453737,403616461,403779201,403941958, 404104731,404267521,404430327,404593149,404755988,404918843,405081715,405244602,405407507,405570427, 405733364,405896317,406059287,406222273,406385275,406548294,406711329,406874381,407037448,407200532, 407363633,407526750,407689883,407853032,408016198,408179380,408342578,408505793,408669024,408832271, 408995534,409158814,409322110,409485423,409648751,409812096,409975457,410138835,410302229,410465639, 410629065,410792508,410955967,411119442,411282933,411446441,411609964,411773505,411937061,412100633, 412264222,412427827,412591449,412755086,412918740,413082410,413246096,413409798,413573517,413737251, 413901002,414064769,414228553,414392352,414556168,414720000,414883848,415047712,415211593,415375489, 415539402,415703331,415867276,416031238,416195215,416359209,416523218,416687244,416851286,417015344, 417179419,417343509,417507616,417671738,417835877,418000032,418164203,418328390,418492594,418656813, 418821048,418985300,419149568,419313852,419478151,419642467,419806800,419971148,420135512,420299892, 420464289,420628701,420793130,420957574,421122035,421286511,421451004,421615513,421780038,421944579, 422109136,422273709,422438298,422602903,422767524,422932161,423096814,423261483,423426168,423590870, 423755587,423920320,424085069,424249834,424414616,424579413,424744226,424909055,425073900,425238762, 425403639,425568532,425733441,425898366,426063307,426228264,426393237,426558226,426723231,426888252, 427053288,427218341,427383410,427548494,427713595,427878711,428043844,428208992,428374156,428539337, 428704533,428869745,429034973,429200217,429365476,429530752,429696043,429861351,430026674,430192013, 430357369,430522740,430688126,430853529,431018948,431184382,431349833,431515299,431680781,431846279, 432011793,432177323,432342868,432508430,432674007,432839600,433005209,433170834,433336474,433502131, 433667803,433833491,433999195,434164914,434330650,434496401,434662168,434827951,434993750,435159565, 435325395,435491241,435657103,435822981,435988874,436154784,436320709,436486650,436652606,436818579, 436984567,437150571,437316590,437482626,437648677,437814744,437980827,438146925,438313039,438479169, 438645315,438811476,438977653,439143846,439310055,439476279,439642519,439808775,439975046,440141333, 440307636,440473955,440640289,440806639,440973005,441139386,441305783,441472196,441638624,441805068, 441971528,442138004,442304495,442471002,442637524,442804062,442970616,443137185,443303770,443470371, 443636988,443803620,443970267,444136931,444303610,444470304,444637014,444803740,444970482,445137239, 445304012,445470800,445637604,445804423,445971259,446138109,446304976,446471858,446638755,446805668, 446972597,447139542,447306501,447473477,447640468,447807475,447974497,448141535,448308588,448475657, 448642742,448809842,448976957,449144088,449311235,449478397,449645575,449812768,449979977,450147202, 450314442,450481697,450648968,450816255,450983557,451150874,451318207,451485556,451652920,451820300, 451987695,452155105,452322531,452489973,452657430,452824903,452992391,453159894,453327413,453494948, 453662498,453830063,453997644,454165240,454332852,454500480,454668122,454835781,455003454,455171143, 455338848,455506568,455674303,455842054,456009821,456177602,456345399,456513212,456681040,456848884, 457016742,457184617,457352506,457520411,457688332,457856268,458024219,458192186,458360168,458528165, 458696178,458864207,459032250,459200309,459368384,459536474,459704579,459872699,460040835,460208986, 460377153,460545335,460713532,460881745,461049973,461218216,461386475,461554749,461723039,461891343, 462059663,462227999,462396350,462564716,462733097,462901494,463069906,463238333,463406776,463575234, 463743707,463912196,464080699,464249219,464417753,464586303,464754868,464923448,465092044,465260655, 465429281,465597922,465766579,465935251,466103938,466272641,466441358,466610091,466778840,466947603, 467116382,467285176,467453985,467622810,467791650,467960505,468129375,468298260,468467161,468636077, 468805008,468973954,469142916,469311893,469480885,469649892,469818914,469987952,470157005,470326073, 470495156,470664254,470833368,471002497,471171641,471340800,471509974,471679164,471848368,472017588, 472186823,472356073,472525339,472694619,472863915,473033226,473202552,473371893,473541249,473710620, 473880007,474049409,474218825,474388257,474557704,474727167,474896644,475066136,475235644,475405167, 475574704,475744257,475913825,476083408,476253007,476422620,476592248,476761892,476931550,477101224, 477270913,477440617,477610336,477780070,477949819,478119583,478289362,478459157,478628966,478798790, 478968630,479138484,479308354,479478239,479648138,479818053,479987983,480157928,480327888,480497863, 480667853,480837858,481007878,481177913,481347963,481518028,481688108,481858203,482028313,482198438, 482368578,482538734,482708904,482879089,483049289,483219504,483389734,483559979,483730240,483900515, 484070805,484241110,484411430,484581765,484752115,484922480,485092860,485263254,485433664,485604089, 485774529,485944983,486115453,486285938,486456437,486626952,486797481,486968025,487138585,487309159, 487479748,487650352,487820971,487991605,488162254,488332917,488503596,488674290,488844998,489015721, 489186460,489357213,489527981,489698764,489869562,490040374,490211202,490382044,490552902,490723774, 490894661,491065563,491236480,491407412,491578358,491749320,491920296,492091287,492262294,492433314, 492604350,492775401,492946466,493117547,493288642,493459752,493630876,493802016,493973171,494144340, 494315524,494486723,494657937,494829165,495000409,495171667,495342940,495514228,495685530,495856848, 496028180,496199527,496370889,496542265,496713657,496885063,497056484,497227919,497399370,497570835, 497742315,497913810,498085320,498256844,498428383,498599937,498771506,498943089,499114687,499286300, 499457928,499629570,499801227,499972899,500144586,500316287,500488003,500659734,500831480,501003240, 501175015,501346805,501518609,501690428,501862262,502034111,502205974,502377852,502549745,502721652, 502893574,503065511,503237462,503409429,503581409,503753405,503925415,504097440,504269480,504441534, 504613603,504785686,504957785,505129897,505302025,505474167,505646324,505818496,505990682,506162883, 506335098,506507328,506679573,506851833,507024107,507196395,507368699,507541017,507713349,507885697, 508058058,508230435,508402826,508575232,508747652,508920087,509092536,509265000,509437479,509609972, 509782480,509955003,510127540,510300092,510472658,510645239,510817834,510990444,511163069,511335708, 511508362,511681030,511853713,512026411,512199123,512371849,512544590,512717346,512890116,513062901, 513235701,513408514,513581343,513754186,513927043,514099916,514272802,514445703,514618619,514791549, 514964494,515137453,515310427,515483415,515656418,515829435,516002467,516175513,516348574,516521649, 516694739,516867844,517040962,517214096,517387243,517560406,517733582,517906774,518079979,518253200, 518426434,518599683,518772947,518946225,519119518,519292825,519466146,519639482,519812833,519986197, 520159577,520332970,520506379,520679801,520853238,521026690,521200156,521373636,521547131,521720640, 521894164,522067702,522241255,522414822,522588403,522761999,522935609,523109234,523282873,523456526, 523630194,523803876,523977573,524151284,524325009,524498749,524672503,524846272,525020055,525193852, 525367664,525541490,525715330,525889185,526063054,526236938,526410836,526584748,526758675,526932616, 527106571,527280541,527454525,527628524,527802536,527976563,528150605,528324661,528498731,528672815, 528846914,529021027,529195155,529369297,529543453,529717623,529891808,530066007,530240220,530414448, 530588690,530762946,530937217,531111502,531285801,531460115,531634442,531808785,531983141,532157512, 532331897,532506296,532680709,532855137,533029579,533204036,533378506,533552991,533727490,533902004, 534076531,534251073,534425630,534600200,534774785,534949384,535123997,535298624,535473266,535647922, 535822592,535997276,536171975,536346688,536521415,536696156,536870912,537045682,537220466,537395264, 537570076,537744903,537919744,538094599,538269468,538444352,538619249,538794161,538969087,539144028, 539318982,539493951,539668934,539843931,540018942,540193967,540369007,540544060,540719128,540894210, 541069307,541244417,541419542,541594680,541769833,541945000,542120182,542295377,542470587,542645810, 542821048,542996300,543171566,543346846,543522141,543697449,543872772,544048109,544223460,544398825, 544574204,544749597,544925004,545100426,545275862,545451311,545626775,545802253,545977745,546153251, 546328772,546504306,546679854,546855417,547030994,547206584,547382189,547557808,547733441,547909088, 548084749,548260425,548436114,548611817,548787535,548963266,549139012,549314771,549490545,549666333, 549842135,550017950,550193780,550369624,550545482,550721354,550897241,551073141,551249055,551424983, 551600925,551776882,551952852,552128836,552304835,552480847,552656873,552832914,553008968,553185037, 553361119,553537215,553713326,553889450,554065589,554241741,554417908,554594088,554770283,554946491, 555122714,555298950,555475201,555651465,555827743,556004036,556180342,556356662,556532997,556709345, 556885707,557062083,557238473,557414877,557591295,557767727,557944173,558120633,558297107,558473595, 558650097,558826612,559003142,559179686,559356243,559532814,559709400,559885999,560062612,560239240, 560415881,560592536,560769205,560945887,561122584,561299295,561476019,561652758,561829510,562006276, 562183057,562359851,562536659,562713480,562890316,563067166,563244029,563420907,563597798,563774703, 563951622,564128555,564305502,564482463,564659437,564836426,565013428,565190444,565367474,565544518, 565721576,565898647,566075733,566252832,566429945,566607072,566784213,566961368,567138536,567315719, 567492915,567670125,567847349,568024586,568201838,568379103,568556382,568733675,568910982,569088303, 569265637,569442985,569620347,569797723,569975113,570152516,570329933,570507365,570684809,570862268, 571039740,571217227,571394727,571572240,571749768,571927309,572104865,572282433,572460016,572637613, 572815223,572992847,573170485,573348136,573525802,573703481,573881173,574058880,574236600,574414334, 574592082,574769844,574947619,575125408,575303211,575481028,575658858,575836702,576014560,576192431, 576370316,576548215,576726128,576904054,577081994,577259948,577437916,577615897,577793892,577971901, 578149923,578327959,578506009,578684072,578862149,579040240,579218345,579396463,579574595,579752741, 579930900,580109073,580287260,580465460,580643674,580821902,581000143,581178399,581356667,581534950, 581713246,581891555,582069879,582248216,582426567,582604931,582783309,582961701,583140106,583318525, 583496958,583675404,583853864,584032337,584210825,584389325,584567840,584746368,584924910,585103465, 585282034,585460616,585639213,585817822,585996446,586175083,586353733,586532398,586711076,586889767, 587068472,587247191,587425923,587604669,587783428,587962201,588140988,588319788,588498602,588677429, 588856270,589035125,589213993,589392875,589571770,589750679,589929601,590108537,590287487,590466450, 590645427,590824417,591003421,591182438,591361469,591540513,591719571,591898643,592077728,592256827, 592435939,592615065,592794204,592973357,593152523,593331703,593510896,593690103,593869324,594048558, 594227805,594407066,594586341,594765629,594944930,595124245,595303574,595482916,595662271,595841640, 596021023,596200419,596379829,596559252,596738688,596918138,597097602,597277079,597456569,597636073, 597815591,597995122,598174666,598354224,598533795,598713380,598892979,599072590,599252216,599431854, 599611506,599791172,599970851,600150544,600330250,600509969,600689702,600869448,601049208,601228981, 601408768,601588568,601768381,601948208,602128049,602307902,602487770,602667650,602847544,603027452, 603207373,603387307,603567255,603747216,603927191,604107179,604287180,604467195,604647223,604827265, 605007320,605187388,605367470,605547565,605727674,605907796,606087931,606268080,606448242,606628417, 606808606,606988808,607169024,607349253,607529496,607709751,607890020,608070303,608250599,608430908, 608611231,608791566,608971916,609152278,609332654,609513044,609693446,609873862,610054292,610234735, 610415191,610595660,610776143,610956639,611137148,611317671,611498207,611678756,611859319,612039895, 612220484,612401087,612581703,612762332,612942975,613123631,613304300,613484983,613665679,613846388, 614027110,614207846,614388595,614569357,614750133,614930922,615111724,615292540,615473368,615654210, 615835066,616015934,616196816,616377712,616558620,616739542,616920477,617101425,617282386,617463361, 617644349,617825351,618006365,618187393,618368434,618549488,618730556,618911637,619092731,619273838, 619454959,619636093,619817240,619998400,620179573,620360760,620541960,620723173,620904400,621085639, 621266892,621448158,621629438,621810730,621992036,622173355,622354687,622536032,622717391,622898763, 623080148,623261546,623442957,623624382,623805820,623987271,624168735,624350212,624531703,624713207, 624894724,625076254,625257797,625439354,625620923,625802506,625984102,626165711,626347334,626528969, 626710618,626892280,627073955,627255643,627437344,627619058,627800786,627982527,628164281,628346048, 628527828,628709621,628891428,629073248,629255080,629436926,629618785,629800658,629982543,630164441, 630346353,630528278,630710215,630892166,631074130,631256108,631438098,631620101,631802118,631984147, 632166190,632348246,632530315,632712397,632894492,633076600,633258722,633440856,633623004,633805164, 633987338,634169525,634351725,634533938,634716164,634898403,635080655,635262921,635445199,635627490, 635809795,635992113,636174443,636356787,636539144,636721514,636903896,637086292,637268701,637451123, 637633559,637816007,637998468,638180942,638363430,638545930,638728443,638910970,639093509,639276062, 639458627,639641206,639823797,640006402,640189020,640371650,640554294,640736951,640919621,641102303, 641284999,641467708,641650430,641833165,642015912,642198673,642381447,642564234,642747034,642929846, 643112672,643295511,643478363,643661228,643844105,644026996,644209900,644392817,644575746,644758689, 644941645,645124613,645307595,645490590,645673597,645856618,646039651,646222698,646405757,646588830, 646771915,646955013,647138125,647321249,647504386,647687536,647870699,648053875,648237064,648420266, 648603481,648786709,648969949,649153203,649336470,649519749,649703042,649886347,650069665,650252997, 650436341,650619698,650803068,650986451,651169847,651353255,651536677,651720112,651903559,652087020, 652270493,652453979,652637478,652820990,653004515,653188053,653371604,653555167,653738744,653922333, 654105935,654289550,654473178,654656819,654840473,655024140,655207819,655391512,655575217,655758935, 655942666,656126410,656310167,656493936,656677719,656861514,657045322,657229143,657412977,657596824, 657780683,657964556,658148441,658332339,658516250,658700174,658884111,659068060,659252023,659435998, 659619986,659803987,659988000,660172027,660356066,660540118,660724183,660908261,661092351,661276455, 661460571,661644700,661828842,662012997,662197164,662381344,662565538,662749743,662933962,663118194, 663302438,663486695,663670965,663855247,664039543,664223851,664408172,664592506,664776853,664961212, 665145584,665329969,665514367,665698777,665883200,666067636,666252085,666436547,666621021,666805508, 666990008,667174521,667359046,667543584,667728135,667912699,668097275,668281864,668466466,668651081, 668835708,669020348,669205001,669389667,669574345,669759036,669943740,670128456,670313185,670497927, 670682682,670867450,671052230,671237023,671421828,671606647,671791478,671976321,672161178,672346047, 672530929,672715823,672900731,673085651,673270583,673455529,673640487,673825458,674010441,674195437, 674380446,674565468,674750502,674935549,675120609,675305681,675490766,675675863,675860974,676046097, 676231232,676416381,676601542,676786716,676971902,677157101,677342313,677527537,677712774,677898024, 678083286,678268561,678453849,678639149,678824462,679009787,679195126,679380477,679565840,679751216, 679936605,680122006,680307421,680492847,680678287,680863739,681049203,681234680,681420170,681605673, 681791188,681976716,682162256,682347809,682533374,682718953,682904543,683090147,683275763,683461391, 683647033,683832687,684018353,684204032,684389724,684575428,684761145,684946874,685132616,685318371, 685504138,685689918,685875710,686061515,686247332,686433163,686619005,686804861,686990728,687176609, 687362502,687548407,687734325,687920256,688106199,688292155,688478123,688664104,688850098,689036104, 689222122,689408154,689594197,689780254,689966322,690152404,690338498,690524604,690710723,690896854, 691082998,691269155,691455324,691641506,691827700,692013907,692200126,692386358,692572602,692758859, 692945128,693131410,693317704,693504011,693690330,693876662,694063007,694249364,694435733,694622115, 694808509,694994916,695181336,695367768,695554212,695740669,695927138,696113620,696300115,696486621, 696673141,696859673,697046217,697232774,697419343,697605925,697792519,697979126,698165745,698352377, 698539021,698725677,698912347,699099028,699285722,699472429,699659147,699845879,700032623,700219379, 700406148,700592929,700779723,700966529,701153347,701340178,701527022,701713878,701900746,702087627, 702274520,702461425,702648343,702835274,703022217,703209172,703396140,703583120,703770113,703957118, 704144135,704331165,704518208,704705262,704892329,705079409,705266501,705453605,705640722,705827851, 706014993,706202147,706389313,706576492,706763683,706950887,707138103,707325331,707512572,707699825, 707887090,708074368,708261659,708448961,708636276,708823604,709010944,709198296,709385660,709573037, 709760427,709947828,710135242,710322669,710510107,710697559,710885022,711072498,711259986,711447487, 711635000,711822525,712010063,712197613,712385175,712572750,712760337,712947936,713135548,713323172, 713510808,713698457,713886118,714073791,714261477,714449175,714636885,714824608,715012343,715200090, 715387850,715575622,715763406,715951203,716139012,716326833,716514667,716702513,716890371,717078242, 717266124,717454019,717641927,717829847,718017779,718205723,718393680,718581648,718769630,718957623, 719145629,719333647,719521677,719709720,719897775,720085842,720273922,720462013,720650117,720838234, 721026362,721214503,721402656,721590822,721778999,721967189,722155392,722343606,722531833,722720072, 722908323,723096587,723284862,723473150,723661451,723849763,724038088,724226425,724414774,724603136, 724791509,724979895,725168294,725356704,725545127,725733562,725922009,726110468,726298940,726487424, 726675920,726864428,727052949,727241481,727430026,727618583,727807153,727995734,728184328,728372934, 728561553,728750183,728938826,729127480,729316148,729504827,729693518,729882222,730070938,730259666, 730448406,730637159,730825923,731014700,731203489,731392290,731581104,731769929,731958767,732147617, 732336479,732525353,732714240,732903139,733092049,733280972,733469908,733658855,733847814,734036786, 734225770,734414766,734603774,734792794,734981827,735170871,735359928,735548997,735738078,735927171, 736116277,736305394,736494524,736683666,736872820,737061986,737251164,737440354,737629557,737818771, 738007998,738197237,738386488,738575751,738765026,738954314,739143613,739332925,739522249,739711585, 739900933,740090293,740279665,740469049,740658446,740847854,741037275,741226708,741416152,741605609, 741795078,741984560,742174053,742363558,742553076,742742605,742932147,743121701,743311266,743500844, 743690434,743880036,744069651,744259277,744448915,744638566,744828228,745017903,745207589,745397288, 745586999,745776721,745966456,746156203,746345962,746535733,746725517,746915312,747105119,747294938, 747484770,747674613,747864469,748054336,748244216,748434107,748624011,748813927,749003855,749193794, 749383746,749573710,749763686,749953674,750143674,750333686,750523710,750713746,750903794,751093854, 751283926,751474011,751664107,751854215,752044335,752234467,752424612,752614768,752804936,752995117, 753185309,753375513,753565729,753755958,753946198,754136450,754326715,754516991,754707279,754897580, 755087892,755278216,755468553,755658901,755849261,756039633,756230018,756420414,756610822,756801242, 756991675,757182119,757372575,757563043,757753523,757944015,758134519,758325035,758515563,758706103, 758896655,759087219,759277794,759468382,759658982,759849593,760040217,760230853,760421500,760612160, 760802831,760993514,761184210,761374917,761565636,761756367,761947110,762137866,762328632,762519411, 762710202,762901005,763091820,763282646,763473485,763664335,763855198,764046072,764236958,764427856, 764618767,764809689,765000622,765191568,765382526,765573496,765764477,765955471,766146476,766337493, 766528523,766719564,766910617,767101682,767292758,767483847,767674948,767866060,768057185,768248321, 768439469,768630629,768821801,769012985,769204180,769395388,769586607,769777839,769969082,770160337, 770351604,770542883,770734174,770925476,771116791,771308117,771499455,771690805,771882167,772073541, 772264926,772456324,772647733,772839155,773030588,773222032,773413489,773604958,773796438,773987931, 774179435,774370951,774562479,774754018,774945570,775137133,775328708,775520295,775711894,775903505, 776095127,776286762,776478408,776670066,776861736,777053417,777245111,777436816,777628533,777820262, 778012003,778203755,778395520,778587296,778779084,778970884,779162695,779354519,779546354,779738201, 779930060,780121930,780313813,780505707,780697613,780889531,781081460,781273402,781465355,781657320, 781849297,782041285,782233285,782425297,782617321,782809357,783001404,783193464,783385535,783577617, 783769712,783961818,784153936,784346066,784538208,784730361,784922526,785114703,785306892,785499092, 785691304,785883528,786075764,786268012,786460271,786652542,786844824,787037119,787229425,787421743, 787614073,787806414,787998767,788191132,788383509,788575897,788768297,788960709,789153133,789345568, 789538015,789730474,789922944,790115426,790307920,790500426,790692943,790885472,791078013,791270566, 791463130,791655706,791848294,792040893,792233504,792426127,792618762,792811408,793004066,793196735, 793389417,793582110,793774814,793967531,794160259,794352999,794545750,794738513,794931288,795124075, 795316873,795509683,795702505,795895338,796088183,796281039,796473908,796666788,796859680,797052583, 797245498,797438425,797631363,797824313,798017275,798210248,798403233,798596230,798789238,798982258, 799175290,799368333,799561388,799754455,799947533,800140623,800333725,800526838,800719963,800913099, 801106248,801299407,801492579,801685762,801878957,802072163,802265381,802458611,802651852,802845105, 803038370,803231646,803424934,803618233,803811544,804004867,804198201,804391547,804584905,804778274, 804971654,805165047,805358451,805551866,805745294,805938733,806132183,806325645,806519119,806712604, 806906101,807099609,807293129,807486661,807680204,807873759,808067326,808260904,808454493,808648094, 808841707,809035332,809228968,809422615,809616274,809809945,810003627,810197321,810391027,810584744, 810778472,810972213,811165964,811359728,811553503,811747289,811941087,812134897,812328718,812522551, 812716395,812910251,813104118,813297997,813491888,813685790,813879703,814073628,814267565,814461513, 814655473,814849445,815043427,815237422,815431428,815625445,815819475,816013515,816207567,816401631, 816595706,816789793,816983891,817178001,817372122,817566255,817760400,817954555,818148723,818342902, 818537092,818731294,818925508,819119733,819313969,819508217,819702477,819896748,820091031,820285325, 820479630,820673947,820868276,821062616,821256968,821451331,821645705,821840091,822034489,822228898, 822423319,822617751,822812194,823006649,823201116,823395594,823590083,823784584,823979097,824173621, 824368156,824562703,824757261,824951831,825146413,825341005,825535610,825730225,825924853,826119491, 826314141,826508803,826703476,826898160,827092856,827287564,827482283,827677013,827871755,828066508, 828261273,828456049,828650837,828845636,829040446,829235268,829430102,829624946,829819803,830014670, 830209550,830404440,830599342,830794256,830989181,831184117,831379065,831574024,831768994,831963976, 832158970,832353975,832548991,832744019,832939058,833134109,833329170,833524244,833719329,833914425, 834109533,834304652,834499782,834694924,834890077,835085242,835280418,835475605,835670804,835866015, 836061236,836256469,836451714,836646970,836842237,837037516,837232806,837428107,837623420,837818744, 838014080,838209427,838404785,838600155,838795536,838990928,839186332,839381747,839577174,839772612, 839968061,840163522,840358994,840554478,840749972,840945479,841140996,841336525,841532065,841727617, 841923180,842118754,842314340,842509937,842705546,842901165,843096797,843292439,843488093,843683758, 843879435,844075122,844270822,844466532,844662254,844857987,845053732,845249488,845445255,845641034, 845836823,846032625,846228437,846424261,846620096,846815943,847011801,847207670,847403550,847599442, 847795345,847991260,848187186,848383123,848579071,848775031,848971002,849166984,849362978,849558983, 849754999,849951027,850147065,850343116,850539177,850735250,850931334,851127429,851323536,851519654, 851715783,851911924,852108076,852304239,852500413,852696599,852892796,853089004,853285224,853481454, 853677697,853873950,854070215,854266491,854462778,854659076,854855386,855051707,855248039,855444383, 855640738,855837104,856033481,856229870,856426270,856622681,856819103,857015537,857211982,857408438, 857604905,857801384,857997874,858194375,858390888,858587411,858783946,858980492,859177050,859373619, 859570198,859766790,859963392,860160006,860356630,860553267,860749914,860946572,861143242,861339923, 861536615,861733319,861930034,862126760,862323497,862520245,862717005,862913775,863110557,863307351, 863504155,863700971,863897798,864094636,864291485,864488346,864685217,864882100,865078994,865275900, 865472816,865669744,865866683,866063633,866260595,866457567,866654551,866851546,867048552,867245569, 867442598,867639637,867836688,868033750,868230823,868427908,868625004,868822110,869019228,869216357, 869413498,869610649,869807812,870004986,870202171,870399367,870596574,870793793,870991023,871188264, 871385516,871582779,871780053,871977339,872174635,872371943,872569262,872766592,872963934,873161286, 873358650,873556024,873753410,873950807,874148216,874345635,874543065,874740507,874937960,875135424, 875332899,875530385,875727882,875925391,876122910,876320441,876517983,876715536,876913100,877110675, 877308262,877505859,877703468,877901088,878098719,878296361,878494014,878691678,878889353,879087040, 879284737,879482446,879680166,879877897,880075639,880273392,880471156,880668932,880866718,881064516, 881262324,881460144,881657975,881855817,882053670,882251534,882449409,882647296,882845193,883043102, 883241021,883438952,883636894,883834847,884032811,884230786,884428772,884626769,884824777,885022797, 885220827,885418869,885616921,885814985,886013060,886211145,886409242,886607350,886805469,887003599, 887201741,887399893,887598056,887796230,887994416,888192612,888390820,888589038,888787268,888985509, 889183760,889382023,889580297,889778582,889976878,890175185,890373503,890571832,890770172,890968523, 891166885,891365258,891563643,891762038,891960444,892158862,892357290,892555729,892754180,892952641, 893151114,893349597,893548092,893746597,893945114,894143642,894342180,894540730,894739291,894937862, 895136445,895335039,895533644,895732259,895930886,896129524,896328173,896526833,896725503,896924185, 897122878,897321582,897520297,897719022,897917759,898116507,898315266,898514036,898712816,898911608, 899110411,899309225,899508050,899706885,899905732,900104590,900303458,900502338,900701229,900900130, 901099043,901297967,901496901,901695847,901894803,902093771,902292749,902491739,902690739,902889750, 903088773,903287806,903486850,903685906,903884972,904084049,904283137,904482236,904681346,904880467, 905079599,905278742,905477896,905677061,905876237,906075423,906274621,906473829,906673049,906872279, 907071521,907270773,907470037,907669311,907868596,908067892,908267199,908466517,908665846,908865186, 909064537,909263899,909463271,909662655,909862049,910061455,910260871,910460298,910659737,910859186, 911058646,911258117,911457599,911657091,911856595,912056110,912255635,912455172,912654719,912854277, 913053846,913253426,913453017,913652619,913852232,914051856,914251490,914451136,914650792,914850459, 915050138,915249827,915449527,915649237,915848959,916048692,916248435,916448190,916647955,916847731, 917047518,917247316,917447125,917646945,917846775,918046617,918246469,918446332,918646206,918846091, 919045987,919245894,919445811,919645740,919845679,920045629,920245590,920445562,920645545,920845538, 921045543,921245558,921445584,921645621,921845669,922045728,922245797,922445878,922645969,922846071, 923046184,923246308,923446443,923646588,923846745,924046912,924247090,924447279,924647479,924847689, 925047911,925248143,925448386,925648640,925848904,926049180,926249466,926449764,926650072,926850391, 927050720,927251061,927451412,927651774,927852147,928052531,928252926,928453331,928653747,928854174, 929054612,929255061,929455521,929655991,929856472,930056964,930257467,930457980,930658504,930859040, 931059586,931260142,931460710,931661288,931861877,932062477,932263088,932463709,932664342,932864985, 933065639,933266303,933466979,933667665,933868362,934069070,934269789,934470518,934671258,934872009, 935072771,935273543,935474326,935675120,935875925,936076741,936277567,936478404,936679252,936880111, 937080980,937281861,937482751,937683653,937884566,938085489,938286423,938487368,938688323,938889289, 939090266,939291254,939492253,939693262,939894282,940095313,940296354,940497407,940698470,940899543, 941100628,941301723,941502829,941703946,941905073,942106212,942307361,942508520,942709691,942910872, 943112064,943313266,943514480,943715704,943916938,944118184,944319440,944520707,944721985,944923273, 945124572,945325882,945527203,945728534,945929876,946131229,946332592,946533966,946735351,946936747, 947138153,947339570,947540998,947742436,947943885,948145345,948346815,948548297,948749789,948951291, 949152804,949354328,949555863,949757409,949958965,950160531,950362109,950563697,950765296,950966905, 951168526,951370156,951571798,951773450,951975113,952176787,952378471,952580166,952781872,952983588, 953185315,953387053,953588801,953790560,953992330,954194110,954395901,954597703,954799515,955001338, 955203172,955405016,955606871,955808737,956010613,956212500,956414398,956616306,956818225,957020155, 957222095,957424046,957626008,957827980,958029963,958231956,958433960,958635975,958838001,959040037, 959242083,959444141,959646209,959848287,960050377,960252477,960454587,960656708,960858840,961060983, 961263136,961465299,961667474,961869659,962071854,962274060,962476277,962678505,962880743,963082991, 963285251,963487521,963689801,963892092,964094394,964296707,964499030,964701363,964903707,965106062, 965308428,965510804,965713190,965915588,966117995,966320414,966522843,966725283,966927733,967130194, 967332665,967535147,967737640,967940143,968142657,968345181,968547716,968750262,968952818,969155385, 969357962,969560550,969763149,969965758,970168378,970371008,970573649,970776300,970978962,971181635, 971384318,971587011,971789716,971992431,972195156,972397892,972600639,972803396,973006163,973208942, 973411731,973614530,973817340,974020160,974222991,974425833,974628685,974831548,975034421,975237305, 975440200,975643105,975846020,976048946,976251883,976454830,976657788,976860756,977063735,977266724, 977469724,977672734,977875755,978078787,978281829,978484881,978687944,978891018,979094102,979297197, 979500302,979703418,979906544,980109681,980312828,980515986,980719154,980922333,981125523,981328723, 981531933,981735154,981938386,982141628,982344880,982548143,982751417,982954701,983157995,983361300, 983564616,983767942,983971279,984174626,984377983,984581352,984784730,984988119,985191519,985394929, 985598350,985801781,986005222,986208675,986412137,986615610,986819094,987022588,987226092,987429608, 987633133,987836669,988040216,988243773,988447340,988650918,988854506,989058105,989261715,989465335, 989668965,989872606,990076257,990279919,990483591,990687274,990890967,991094671,991298385,991502109, 991705844,991909590,992113346,992317112,992520889,992724677,992928475,993132283,993336102,993539931, 993743770,993947620,994151481,994355352,994559234,994763125,994967028,995170941,995374864,995578798, 995782742,995986696,996190661,996394637,996598623,996802619,997006626,997210643,997414671,997618709, 997822757,998026816,998230886,998434965,998639056,998843156,999047267,999251389,999455521,999659663, 999863816,1000067979,1000272153,1000476337,1000680531,1000884736,1001088952,1001293177,1001497413,1001701660, 1001905917,1002110184,1002314462,1002518750,1002723049,1002927358,1003131677,1003336007,1003540347,1003744698, 1003949059,1004153430,1004357812,1004562204,1004766607,1004971020,1005175443,1005379877,1005584321,1005788776, 1005993241,1006197716,1006402202,1006606698,1006811205,1007015722,1007220249,1007424787,1007629335,1007833893, 1008038462,1008243041,1008447631,1008652231,1008856841,1009061462,1009266093,1009470734,1009675386,1009880048, 1010084721,1010289404,1010494097,1010698801,1010903515,1011108239,1011312974,1011517719,1011722475,1011927241, 1012132017,1012336803,1012541600,1012746407,1012951225,1013156053,1013360891,1013565740,1013770599,1013975469, 1014180348,1014385238,1014590139,1014795050,1014999971,1015204902,1015409844,1015614796,1015819759,1016024732, 1016229715,1016434708,1016639712,1016844726,1017049751,1017254786,1017459831,1017664886,1017869952,1018075028, 1018280115,1018485212,1018690319,1018895436,1019100564,1019305702,1019510851,1019716009,1019921179,1020126358, 1020331548,1020536748,1020741958,1020947179,1021152410,1021357651,1021562903,1021768165,1021973437,1022178719, 1022384012,1022589315,1022794629,1022999953,1023205287,1023410631,1023615986,1023821351,1024026726,1024232111, 1024437507,1024642913,1024848330,1025053757,1025259194,1025464641,1025670099,1025875566,1026081045,1026286533, 1026492032,1026697541,1026903060,1027108590,1027314130,1027519680,1027725240,1027930811,1028136392,1028341984, 1028547585,1028753197,1028958819,1029164451,1029370094,1029575747,1029781410,1029987084,1030192768,1030398462, 1030604166,1030809880,1031015605,1031221340,1031427086,1031632841,1031838607,1032044383,1032250170,1032455966, 1032661773,1032867590,1033073418,1033279255,1033485103,1033690961,1033896830,1034102708,1034308597,1034514496, 1034720406,1034926325,1035132255,1035338195,1035544146,1035750106,1035956077,1036162058,1036368050,1036574051, 1036780063,1036986085,1037192117,1037398160,1037604212,1037810275,1038016348,1038222432,1038428526,1038634629, 1038840743,1039046868,1039253002,1039459147,1039665302,1039871467,1040077643,1040283828,1040490024,1040696230, 1040902446,1041108673,1041314910,1041521157,1041727414,1041933681,1042139959,1042346246,1042552544,1042758852, 1042965171,1043171499,1043377838,1043584187,1043790546,1043996916,1044203295,1044409685,1044616085,1044822495, 1045028916,1045235346,1045441787,1045648238,1045854699,1046061170,1046267652,1046474144,1046680645,1046887158, 1047093680,1047300212,1047506755,1047713308,1047919871,1048126444,1048333027,1048539621,1048746224,1048952838, 1049159462,1049366097,1049572741,1049779396,1049986060,1050192735,1050399420,1050606116,1050812821,1051019537, 1051226262,1051432998,1051639744,1051846500,1052053267,1052260043,1052466830,1052673627,1052880434,1053087251, 1053294079,1053500916,1053707764,1053914622,1054121489,1054328368,1054535256,1054742154,1054949063,1055155981, 1055362910,1055569849,1055776798,1055983758,1056190727,1056397707,1056604696,1056811696,1057018706,1057225726, 1057432756,1057639797,1057846847,1058053908,1058260979,1058468059,1058675150,1058882252,1059089363,1059296484, 1059503616,1059710757,1059917909,1060125071,1060332243,1060539425,1060746617,1060953820,1061161032,1061368255, 1061575488,1061782730,1061989983,1062197246,1062404520,1062611803,1062819096,1063026400,1063233713,1063441037, 1063648371,1063855715,1064063069,1064270433,1064477807,1064685192,1064892586,1065099990,1065307405,1065514830, 1065722265,1065929709,1066137164,1066344630,1066552105,1066759590,1066967085,1067174591,1067382106,1067589632, 1067797168,1068004714,1068212269,1068419835,1068627411,1068834998,1069042594,1069250200,1069457816,1069665443, 1069873079,1070080726,1070288383,1070496049,1070703726,1070911413,1071119110,1071326817,1071534534,1071742261, 1071949998,1072157746,1072365503,1072573270,1072781048,1072988835,1073196633,1073404441,1073612258,1073820086, 1074027924,1074235772,1074443630,1074651498,1074859376,1075067264,1075275162,1075483070,1075690988,1075898917, 1076106855,1076314803,1076522762,1076730730,1076938709,1077146697,1077354696,1077562705,1077770723,1077978752, 1078186791,1078394839,1078602898,1078810967,1079019046,1079227135,1079435234,1079643343,1079851462,1080059591, 1080267730,1080475879,1080684038,1080892207,1081100386,1081308576,1081516775,1081724984,1081933203,1082141432, 1082349672,1082557921,1082766180,1082974450,1083182729,1083391018,1083599318,1083807627,1084015947,1084224276, 1084432615,1084640965,1084849324,1085057694,1085266073,1085474462,1085682862,1085891271,1086099691,1086308120, 1086516560,1086725009,1086933468,1087141938,1087350417,1087558907,1087767406,1087975915,1088184435,1088392964, 1088601503,1088810053,1089018612,1089227181,1089435761,1089644350,1089852949,1090061559,1090270178,1090478807, 1090687446,1090896095,1091104754,1091313424,1091522103,1091730792,1091939491,1092148200,1092356919,1092565648, 1092774387,1092983136,1093191894,1093400663,1093609442,1093818231,1094027030,1094235838,1094444657,1094653486, 1094862324,1095071173,1095280031,1095488900,1095697778,1095906666,1096115565,1096324473,1096533391,1096742319, 1096951257,1097160206,1097369164,1097578132,1097787109,1097996097,1098205095,1098414103,1098623121,1098832148, 1099041186,1099250233,1099459291,1099668358,1099877435,1100086523,1100295620,1100504727,1100713844,1100922971, 1101132108,1101341255,1101550412,1101759578,1101968755,1102177942,1102387138,1102596345,1102805561,1103014787, 1103224023,1103433270,1103642526,1103851792,1104061067,1104270353,1104479649,1104688955,1104898270,1105107596, 1105316931,1105526276,1105735631,1105944997,1106154372,1106363756,1106573151,1106782556,1106991971,1107201395, 1107410830,1107620274,1107829728,1108039192,1108248667,1108458150,1108667644,1108877148,1109086662,1109296185, 1109505719,1109715262,1109924815,1110134378,1110343951,1110553534,1110763127,1110972730,1111182342,1111391965, 1111601597,1111811239,1112020891,1112230553,1112440225,1112649907,1112859598,1113069300,1113279011,1113488733, 1113698464,1113908205,1114117956,1114327716,1114537487,1114747267,1114957058,1115166858,1115376668,1115586488, 1115796318,1116006157,1116216007,1116425866,1116635736,1116845615,1117055504,1117265403,1117475311,1117685230, 1117895158,1118105097,1118315045,1118525003,1118734971,1118944948,1119154936,1119364933,1119574941,1119784958, 1119994985,1120205022,1120415068,1120625125,1120835191,1121045267,1121255353,1121465449,1121675555,1121885670, 1122095796,1122305931,1122516076,1122726231,1122936396,1123146570,1123356755,1123566949,1123777153,1123987367, 1124197590,1124407824,1124618067,1124828321,1125038584,1125248856,1125459139,1125669432,1125879734,1126090046, 1126300368,1126510700,1126721041,1126931393,1127141754,1127352125,1127562506,1127772897,1127983297,1128193707, 1128404127,1128614557,1128824997,1129035447,1129245906,1129456375,1129666854,1129877343,1130087841,1130298350, 1130508868,1130719396,1130929934,1131140481,1131351039,1131561606,1131772183,1131982769,1132193366,1132403972, 1132614588,1132825214,1133035850,1133246496,1133457151,1133667816,1133878491,1134089176,1134299870,1134510574, 1134721288,1134932012,1135142746,1135353489,1135564242,1135775005,1135985778,1136196560,1136407352,1136618154, 1136828966,1137039788,1137250619,1137461460,1137672311,1137883172,1138094042,1138304922,1138515812,1138726712, 1138937622,1139148541,1139359470,1139570409,1139781357,1139992315,1140203284,1140414261,1140625249,1140836246, 1141047253,1141258270,1141469297,1141680333,1141891379,1142102435,1142313501,1142524576,1142735661,1142946756, 1143157861,1143368975,1143580099,1143791233,1144002377,1144213530,1144424693,1144635866,1144847048,1145058241, 1145269443,1145480655,1145691876,1145903107,1146114348,1146325599,1146536859,1146748130,1146959410,1147170699, 1147381999,1147593308,1147804626,1148015955,1148227293,1148438641,1148649999,1148861367,1149072744,1149284131, 1149495527,1149706934,1149918350,1150129775,1150341211,1150552656,1150764111,1150975576,1151187050,1151398534, 1151610028,1151821531,1152033044,1152244567,1152456100,1152667642,1152879194,1153090756,1153302327,1153513909, 1153725499,1153937100,1154148710,1154360330,1154571960,1154783599,1154995248,1155206907,1155418575,1155630253, 1155841941,1156053639,1156265346,1156477063,1156688789,1156900526,1157112272,1157324027,1157535793,1157747568, 1157959352,1158171147,1158382951,1158594765,1158806588,1159018421,1159230264,1159442116,1159653979,1159865850, 1160077732,1160289623,1160501524,1160713435,1160925355,1161137285,1161349224,1161561173,1161773132,1161985101, 1162197079,1162409067,1162621064,1162833072,1163045089,1163257115,1163469151,1163681197,1163893253,1164105318, 1164317393,1164529477,1164741571,1164953675,1165165789,1165377912,1165590045,1165802187,1166014339,1166226501, 1166438672,1166650853,1166863044,1167075244,1167287454,1167499674,1167711903,1167924142,1168136390,1168348649, 1168560916,1168773194,1168985481,1169197778,1169410084,1169622400,1169834726,1170047061,1170259406,1170471761, 1170684125,1170896499,1171108882,1171321275,1171533678,1171746090,1171958512,1172170944,1172383385,1172595836, 1172808296,1173020766,1173233246,1173445735,1173658234,1173870743,1174083261,1174295789,1174508326,1174720873, 1174933430,1175145996,1175358572,1175571158,1175783753,1175996357,1176208972,1176421596,1176634229,1176846872, 1177059525,1177272187,1177484859,1177697541,1177910232,1178122933,1178335643,1178548363,1178761093,1178973832, 1179186581,1179399339,1179612107,1179824884,1180037672,1180250468,1180463275,1180676090,1180888916,1181101751, 1181314596,1181527450,1181740314,1181953187,1182166070,1182378963,1182591865,1182804777,1183017698,1183230629, 1183443570,1183656520,1183869480,1184082449,1184295428,1184508416,1184721414,1184934422,1185147439,1185360465, 1185573502,1185786548,1185999603,1186212668,1186425743,1186638827,1186851920,1187065024,1187278136,1187491259, 1187704391,1187917532,1188130683,1188343844,1188557014,1188770194,1188983383,1189196582,1189409790,1189623008, 1189836236,1190049473,1190262720,1190475976,1190689242,1190902517,1191115802,1191329096,1191542400,1191755713, 1191969036,1192182369,1192395711,1192609063,1192822424,1193035795,1193249175,1193462565,1193675964,1193889373, 1194102791,1194316219,1194529657,1194743104,1194956561,1195170027,1195383502,1195596987,1195810482,1196023986, 1196237500,1196451023,1196664556,1196878099,1197091650,1197305212,1197518783,1197732363,1197945953,1198159553, 1198373162,1198586780,1198800408,1199014046,1199227693,1199441349,1199655015,1199868691,1200082376,1200296071, 1200509775,1200723489,1200937212,1201150944,1201364687,1201578438,1201792200,1202005970,1202219750,1202433540, 1202647339,1202861148,1203074966,1203288794,1203502631,1203716478,1203930334,1204144200,1204358075,1204571960, 1204785854,1204999758,1205213671,1205427594,1205641526,1205855467,1206069419,1206283379,1206497349,1206711329, 1206925318,1207139317,1207353325,1207567342,1207781369,1207995406,1208209452,1208423507,1208637572,1208851647, 1209065731,1209279824,1209493927,1209708039,1209922161,1210136293,1210350433,1210564584,1210778743,1210992912, 1211207091,1211421279,1211635477,1211849684,1212063900,1212278126,1212492362,1212706607,1212920861,1213135125, 1213349398,1213563681,1213777973,1213992275,1214206586,1214420907,1214635237,1214849576,1215063925,1215278284, 1215492652,1215707029,1215921416,1216135812,1216350218,1216564633,1216779057,1216993491,1217207935,1217422388, 1217636850,1217851322,1218065803,1218280294,1218494794,1218709304,1218923823,1219138351,1219352889,1219567436, 1219781993,1219996559,1220211135,1220425720,1220640314,1220854918,1221069532,1221284154,1221498787,1221713428, 1221928079,1222142740,1222357410,1222572089,1222786778,1223001476,1223216184,1223430901,1223645627,1223860363, 1224075109,1224289863,1224504627,1224719401,1224934184,1225148976,1225363778,1225578589,1225793410,1226008240, 1226223080,1226437928,1226652787,1226867654,1227082531,1227297418,1227512314,1227727219,1227942134,1228157058, 1228371992,1228586934,1228801887,1229016849,1229231820,1229446800,1229661790,1229876789,1230091798,1230306816, 1230521844,1230736881,1230951927,1231166983,1231382048,1231597122,1231812206,1232027299,1232242402,1232457514, 1232672636,1232887766,1233102907,1233318056,1233533215,1233748383,1233963561,1234178748,1234393945,1234609151, 1234824366,1235039590,1235254824,1235470068,1235685321,1235900583,1236115854,1236331135,1236546425,1236761725, 1236977034,1237192352,1237407680,1237623017,1237838364,1238053719,1238269085,1238484459,1238699843,1238915236, 1239130639,1239346051,1239561472,1239776903,1239992343,1240207793,1240423251,1240638720,1240854197,1241069684, 1241285180,1241500686,1241716201,1241931725,1242147259,1242362802,1242578354,1242793916,1243009487,1243225067, 1243440657,1243656256,1243871864,1244087482,1244303109,1244518745,1244734391,1244950046,1245165711,1245381385, 1245597068,1245812760,1246028462,1246244173,1246459894,1246675623,1246891363,1247107111,1247322869,1247538636, 1247754413,1247970198,1248185993,1248401798,1248617612,1248833435,1249049267,1249265109,1249480960,1249696820, 1249912690,1250128569,1250344458,1250560355,1250776262,1250992179,1251208104,1251424039,1251639983,1251855937, 1252071900,1252287872,1252503854,1252719845,1252935845,1253151854,1253367873,1253583901,1253799938,1254015985, 1254232041,1254448106,1254664181,1254880265,1255096358,1255312461,1255528572,1255744693,1255960824,1256176964, 1256393113,1256609271,1256825438,1257041615,1257257802,1257473997,1257690202,1257906416,1258122639,1258338872, 1258555114,1258771365,1258987626,1259203895,1259420174,1259636463,1259852760,1260069067,1260285384,1260501709, 1260718044,1260934388,1261150741,1261367104,1261583476,1261799857,1262016248,1262232647,1262449056,1262665475, 1262881902,1263098339,1263314785,1263531241,1263747705,1263964179,1264180662,1264397155,1264613657,1264830168, 1265046688,1265263217,1265479756,1265696304,1265912861,1266129428,1266346004,1266562589,1266779183,1266995787, 1267212400,1267429022,1267645653,1267862294,1268078944,1268295603,1268512271,1268728949,1268945636,1269162332, 1269379038,1269595752,1269812476,1270029209,1270245952,1270462703,1270679464,1270896234,1271113014,1271329802, 1271546600,1271763407,1271980224,1272197049,1272413884,1272630728,1272847582,1273064444,1273281316,1273498197, 1273715087,1273931987,1274148895,1274365813,1274582740,1274799677,1275016622,1275233577,1275450541,1275667515, 1275884497,1276101489,1276318490,1276535500,1276752520,1276969548,1277186586,1277403633,1277620690,1277837755, 1278054830,1278271914,1278489007,1278706110,1278923221,1279140342,1279357472,1279574611,1279791760,1280008918, 1280226085,1280443261,1280660446,1280877641,1281094844,1281312057,1281529279,1281746511,1281963751,1282181001, 1282398260,1282615528,1282832806,1283050092,1283267388,1283484693,1283702007,1283919331,1284136663,1284354005, 1284571356,1284788716,1285006085,1285223464,1285440852,1285658249,1285875655,1286093070,1286310494,1286527928, 1286745371,1286962823,1287180284,1287397755,1287615234,1287832723,1288050221,1288267728,1288485245,1288702770, 1288920305,1289137849,1289355402,1289572964,1289790535,1290008116,1290225706,1290443305,1290660913,1290878530, 1291096157,1291313792,1291531437,1291749091,1291966754,1292184426,1292402108,1292619799,1292837498,1293055207, 1293272925,1293490653,1293708389,1293926135,1294143890,1294361654,1294579427,1294797209,1295015000,1295232801, 1295450611,1295668430,1295886258,1296104095,1296321941,1296539797,1296757661,1296975535,1297193418,1297411310, 1297629211,1297847122,1298065041,1298282970,1298500908,1298718855,1298936811,1299154776,1299372751,1299590734, 1299808727,1300026729,1300244740,1300462760,1300680789,1300898828,1301116875,1301334932,1301552998,1301771072, 1301989157,1302207250,1302425352,1302643464,1302861584,1303079714,1303297853,1303516001,1303734158,1303952324, 1304170499,1304388684,1304606878,1304825080,1305043292,1305261513,1305479743,1305697982,1305916231,1306134488, 1306352755,1306571030,1306789315,1307007609,1307225912,1307444224,1307662546,1307880876,1308099216,1308317564, 1308535922,1308754289,1308972665,1309191050,1309409444,1309627847,1309846259,1310064681,1310283112,1310501551, 1310720000,1310938458,1311156925,1311375401,1311593886,1311812380,1312030884,1312249396,1312467918,1312686449, 1312904988,1313123537,1313342095,1313560662,1313779238,1313997824,1314216418,1314435021,1314653634,1314872255, 1315090886,1315309526,1315528175,1315746833,1315965500,1316184176,1316402861,1316621555,1316840259,1317058971, 1317277693,1317496423,1317715163,1317933912,1318152669,1318371436,1318590212,1318808997,1319027792,1319246595, 1319465407,1319684228,1319903059,1320121898,1320340747,1320559605,1320778471,1320997347,1321216232,1321435126, 1321654029,1321872941,1322091862,1322310792,1322529731,1322748679,1322967637,1323186603,1323405579,1323624563, 1323843557,1324062559,1324281571,1324500592,1324719622,1324938661,1325157708,1325376765,1325595831,1325814906, 1326033991,1326253084,1326472186,1326691297,1326910418,1327129547,1327348685,1327567833,1327786989,1328006155, 1328225329,1328444513,1328663706,1328882907,1329102118,1329321338,1329540567,1329759804,1329979051,1330198307, 1330417572,1330636846,1330856129,1331075421,1331294722,1331514033,1331733352,1331952680,1332172017,1332391363, 1332610719,1332830083,1333049456,1333268839,1333488230,1333707630,1333927040,1334146458,1334365886,1334585322, 1334804768,1335024222,1335243686,1335463158,1335682640,1335902131,1336121630,1336341139,1336560657,1336780183, 1336999719,1337219264,1337438817,1337658380,1337877952,1338097532,1338317122,1338536721,1338756329,1338975945, 1339195571,1339415206,1339634850,1339854503,1340074164,1340293835,1340513515,1340733204,1340952901,1341172608, 1341392324,1341612049,1341831783,1342051525,1342271277,1342491038,1342710808,1342930586,1343150374,1343370171, 1343589977,1343809791,1344029615,1344249448,1344469289,1344689140,1344909000,1345128868,1345348746,1345568633, 1345788528,1346008433,1346228346,1346448269,1346668200,1346888141,1347108090,1347328049,1347548016,1347767993, 1347987978,1348207972,1348427976,1348647988,1348868009,1349088040,1349308079,1349528127,1349748184,1349968250, 1350188326,1350408410,1350628503,1350848605,1351068716,1351288836,1351508965,1351729102,1351949249,1352169405, 1352389570,1352609744,1352829926,1353050118,1353270318,1353490528,1353710747,1353930974,1354151210,1354371456, 1354591710,1354811973,1355032246,1355252527,1355472817,1355693116,1355913424, }; static real aa_cs[8] = { 14386344,14793176,15932125,16497281,16702017,16763133,16775525,16777101 }; static real aa_ca[8] = { -8631806,-7914349,-5257601,-3051997,-1586692,-687288,-238212,-62075 }; static real win[4][36] = { { 541609,1798624,3379171,5462936,8388608,12881122,20824265,39123649,129925287,-141788570,-50986933,-32687548, -24744405,-20251891,-17326219,-15242454,-13661907,-12404893,-11366990,-10483150,-9710514,-9019459,-8388608,-7801881, -7246655,-6712557,-6190623,-5672661,-5150726,-4616628,-4061402,-3474675,-2843824,-2152769,-1380133,-496293 }, { 541609,1798624,3379171,5462936,8388608,12881122,20824265,39123649,129925287,-141788570,-50986933,-32687548, -24744405,-20251891,-17326219,-15242454,-13661907,-12404893,-11377819,-10573609,-9946281,-9457165,-9079764,-8795700, -8518771,-7816938,-6661470,-5111526,-3237882,-1121518, }, { 1798624,8388608,39123649,-50986933,-20251891,-13661907,-10483150,-8388608,-6712557,-5150726,-3474675,-1380133, }, { 0,0,0,0,0,0,5058839,24594154,117073194,-152572757,-59375541,-38425694, -27896396,-21920489,-18167045,-15612533,-13779795,-12416710,-11366990,-10483150,-9710514,-9019459,-8388608,-7801881, -7246655,-6712557,-6190623,-5672661,-5150726,-4616628,-4061402,-3474675,-2843824,-2152769,-1380133,-496293 } }; const real COS9[9] = { 16777216,16522332,15765426,14529495,12852093,10784187,8388608,5738146,2913333 }; static const real COS6_1 = 14529495; static const real COS6_2 = 8388608; const real tfcos36[9] = { 8420651,8684526,9255805,10240599,11863283,14625092,19849138,32411092,96248483 }; static const real tfcos12[3] = { 8684526,11863283,32411092 }; #ifdef NEW_DCT9 static const real cos9[3] = { 15765426,-2913333,-12852093 }; static const real cos18[3] = { 16522332,-5738146,-10784187 }; #endif static const real tan1_1[16] = { 0,6925,11994,16384,20774,25843,32768,44762,77530,2147483647,-44762,-11994,0,6925,11994,16384 }; static const real tan2_1[16] = { 32768,25843,20774,16384,11994,6925,0,-11994,-44762,2147483647,77530,44762,32768,25843,20774,16384 }; static const real tan1_2[16] = { 0,9793,16962,23170,29379,36548,46341,63303,109644,2147483647,-63303,-16962,0,9793,16962,23170 }; static real tan2_2[16] = { 46341,36548,29379,23170,16962,9793,0,-16962,-63303,2147483647,109644,63303,46341,36548,29379,23170 }; static const real pow1_1[2][16] = { {32768,27554,32768,23170,32768,19484,32768,16384,32768,13777,32768,11585,32768,9742,32768,8192}, {32768,23170,32768,16384,32768,11585,32768,8192,32768,5793,32768,4096,32768,2896,32768,2048} }; static const real pow2_1[2][16] = { {32768,32768,27554,32768,23170,32768,19484,32768,16384,32768,13777,32768,11585,32768,9742,32768}, {32768,32768,23170,32768,16384,32768,11585,32768,8192,32768,5793,32768,4096,32768,2896,32768} }; static const real pow1_2[2][16] = { {46341,38968,46341,32768,46341,27554,46341,23170,46341,19484,46341,16384,46341,13777,46341,11585}, {46341,32768,46341,23170,46341,16384,46341,11585,46341,8192,46341,5793,46341,4096,46341,2896} }; static const real pow2_2[2][16] = { {46341,46341,38968,46341,32768,46341,27554,46341,23170,46341,19484,46341,16384,46341,13777,46341}, {46341,46341,32768,46341,23170,46341,16384,46341,11585,46341,8192,46341,5793,46341,4096,46341} }; static const real gainpow2[256+118+4] = { 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, 1518500250,1276901417,1073741824,902905651,759250125,638450708,536870912,451452825,379625062,319225354, 268435456,225726413,189812531,159612677,134217728,112863206,94906266,79806339,67108864,56431603, 47453133,39903169,33554432,28215802,23726566,19951585,16777216,14107901,11863283,9975792, 8388608,7053950,5931642,4987896,4194304,3526975,2965821,2493948,2097152,1763488, 1482910,1246974,1048576,881744,741455,623487,524288,440872,370728,311744, 262144,220436,185364,155872,131072,110218,92682,77936,65536,55109, 46341,38968,32768,27554,23170,19484,16384,13777,11585,9742, 8192,6889,5793,4871,4096,3444,2896,2435,2048,1722, 1448,1218,1024,861,724,609,512,431,362,304, 256,215,181,152,128,108,91,76,64,54, 45,38,32,27,23,19,16,13,11,10, 8,7,6,5,4,3,3,2,2,2, 1,1,1,1,1,1,1, }; #else static real ispow[8207]; static real aa_ca[8],aa_cs[8]; static real win[4][36]; static real win1[4][36]; real COS9[9]; /* dct36_3dnow wants to use that */ static real COS6_1,COS6_2; real tfcos36[9]; /* dct36_3dnow wants to use that */ static real tfcos12[3]; #ifdef NEW_DCT9 static real cos9[3],cos18[3]; static real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16]; static real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16]; #endif #endif static real win1[4][36]; static const char gainpow2_scale[256+118+4+1] = { 19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27, 27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,0 }; #endif welle.io-2.1/src/libs/mpg123/layer1.c000066400000000000000000000111121357201522000171550ustar00rootroot00000000000000/* layer1.c: the layer 1 decoder copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp may have a few bugs after last optimization ... */ #include "mpg123lib_intern.h" #include "getbits.h" #include "debug.h" /* Allocation value is not allowed to be 15. Initially, libmad showed me the error that mpg123 used to ignore. Then, I found a quote on that in Shlien, S. (1994): Guide to MPEG-1 Audio Standard. IEEE Transactions on Broadcasting 40, 4 "To avoid conflicts with the synchronization code, code '1111' is defined to be illegal." */ static int check_balloc(mpg123_handle *fr, unsigned int *balloc, unsigned int *end) { unsigned int *ba; for(ba=balloc; ba != end; ++ba) if(*ba == 15) { if(NOQUIET) error("Illegal bit allocation value."); return -1; } return 0; } static int I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],mpg123_handle *fr) { unsigned int *ba=balloc; unsigned int *sca = (unsigned int *) scale_index; if(fr->stereo == 2) { int i; int jsbound = fr->jsbound; for(i=0;istereo == 2) { int jsbound = fr->jsbound; register real *f0 = fraction[0]; register real *f1 = fraction[1]; ba = balloc; for(sample=smpb,i=0;imuls[n+1][*sca++]); else *f0++ = DOUBLE_TO_REAL(0.0); if((n=*ba++)) *f1++ = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15(MINUS_SHIFT(n) + (*sample++) + 1), fr->muls[n+1][*sca++]); else *f1++ = DOUBLE_TO_REAL(0.0); } for(i=jsbound;imuls[n+1][*sca++]); *f1++ = REAL_MUL_SCALE_LAYER12(samp, fr->muls[n+1][*sca++]); } else *f0++ = *f1++ = DOUBLE_TO_REAL(0.0); } for(i=fr->down_sample_sblimit;i<32;i++) fraction[0][i] = fraction[1][i] = 0.0; } else { register real *f0 = fraction[0]; ba = balloc; for(sample=smpb,i=0;imuls[n+1][*sca++]); else *f0++ = DOUBLE_TO_REAL(0.0); } for(i=fr->down_sample_sblimit;i<32;i++) fraction[0][i] = DOUBLE_TO_REAL(0.0); } } int do_layer1(mpg123_handle *fr) { int clip=0; int i,stereo = fr->stereo; unsigned int balloc[2*SBLIMIT]; unsigned int scale_index[2][SBLIMIT]; real (*fraction)[SBLIMIT] = fr->layer1.fraction; /* fraction[2][SBLIMIT] */ int single = fr->single; fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */ single = SINGLE_LEFT; if(I_step_one(balloc,scale_index,fr)) { if(NOQUIET) error("Aborting layer I decoding after step one.\n"); return clip; } for(i=0;isynth_mono)(fraction[single], fr); else clip += (fr->synth_stereo)(fraction[0], fraction[1], fr); } return clip; } welle.io-2.1/src/libs/mpg123/layer2.c000066400000000000000000000230651357201522000171700ustar00rootroot00000000000000/* layer2.c: the layer 2 decoder, root of mpg123 copyright 1994-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp mpg123 started as mp2 decoder a long time ago... part of this file is required for layer 1, too. */ #include "mpg123lib_intern.h" #ifndef NO_LAYER2 #include "l2tables.h" #endif #include "getbits.h" #ifndef NO_LAYER12 /* Stuff needed for layer I and II. */ static int grp_3tab[32 * 3] = { 0, }; /* used: 27 */ static int grp_5tab[128 * 3] = { 0, }; /* used: 125 */ static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */ #if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) #include "l12_integer_tables.h" #else static const double mulmul[27] = { 0.0 , -2.0/3.0 , 2.0/3.0 , 2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 , 2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 , 2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 , -4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 , -8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 }; #endif void init_layer12(void) { const int base[3][9] = { { 1 , 0, 2 , } , { 17, 18, 0 , 19, 20 , } , { 21, 1, 22, 23, 0, 24, 25, 2, 26 } }; int i,j,k,l,len; const int tablen[3] = { 3 , 5 , 9 }; int *itable; int *tables[3] = { grp_3tab , grp_5tab , grp_9tab }; for(i=0;i<3;i++) { itable = tables[i]; len = tablen[i]; for(j=0;jmuls[k], k); *table++ = 0.0; } } real* init_layer12_table(mpg123_handle *fr, real *table, int m) { #if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) int i; for(i=0;i<63;i++) *table++ = layer12_table[m][i]; #else int i,j; for(j=3,i=0;i<63;i++,j--) *table++ = DOUBLE_TO_REAL_SCALE_LAYER12(mulmul[m] * pow(2.0,(double) j / 3.0)); #endif return table; } #ifdef OPT_MMXORSSE real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m) { int i,j; if(!fr->p.down_sample) { for(j=3,i=0;i<63;i++,j--) *table++ = DOUBLE_TO_REAL(16384 * mulmul[m] * pow(2.0,(double) j / 3.0)); } else { for(j=3,i=0;i<63;i++,j--) *table++ = DOUBLE_TO_REAL(mulmul[m] * pow(2.0,(double) j / 3.0)); } return table; } #endif #endif /* NO_LAYER12 */ /* The rest is the actual decoding of layer II data. */ #ifndef NO_LAYER2 static void II_step_one(unsigned int *bit_alloc,int *scale,mpg123_handle *fr) { int stereo = fr->stereo-1; int sblimit = fr->II_sblimit; int jsbound = fr->jsbound; int sblimit2 = fr->II_sblimit<alloc; int i; unsigned int scfsi_buf[64]; unsigned int *scfsi,*bita; int sc,step; bita = bit_alloc; if(stereo) { for(i=jsbound;i;i--,alloc1+=(1<bits; *bita++ = (char) getbits(fr, step); *bita++ = (char) getbits(fr, step); } for(i=sblimit-jsbound;i;i--,alloc1+=(1<bits; bita[0] = (char) getbits(fr, step); bita[1] = bita[0]; bita+=2; } bita = bit_alloc; scfsi=scfsi_buf; for(i=sblimit2;i;i--) if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2); } else /* mono */ { for(i=sblimit;i;i--,alloc1+=(1<bits; *bita++ = (char) getbits(fr, step); } bita = bit_alloc; scfsi=scfsi_buf; for(i=sblimit;i;i--) if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2); } bita = bit_alloc; scfsi=scfsi_buf; for(i=sblimit2;i;i--) if(*bita++) switch(*scfsi++) { case 0: *scale++ = getbits_fast(fr, 6); *scale++ = getbits_fast(fr, 6); *scale++ = getbits_fast(fr, 6); break; case 1 : *scale++ = sc = getbits_fast(fr, 6); *scale++ = sc; *scale++ = getbits_fast(fr, 6); break; case 2: *scale++ = sc = getbits_fast(fr, 6); *scale++ = sc; *scale++ = sc; break; default: /* case 3 */ *scale++ = getbits_fast(fr, 6); *scale++ = sc = getbits_fast(fr, 6); *scale++ = sc; break; } } static void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,mpg123_handle *fr,int x1) { int i,j,k,ba; int stereo = fr->stereo; int sblimit = fr->II_sblimit; int jsbound = fr->jsbound; const struct al_table *alloc2,*alloc1 = fr->alloc; unsigned int *bita=bit_alloc; int d1,step; for(i=0;ibits; for(j=0;jbits; if( (d1=alloc2->d) < 0) { real cm=fr->muls[k][scale[x1]]; fraction[j][0][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); fraction[j][1][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); fraction[j][2][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); } else { const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab }; unsigned int idx,*tab,m=scale[x1]; idx = (unsigned int) getbits(fr, k); tab = (unsigned int *) (table[d1] + idx + idx + idx); fraction[j][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]); fraction[j][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]); fraction[j][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m]); } scale+=3; } else fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = DOUBLE_TO_REAL(0.0); } } for(i=jsbound;ibits; bita++; /* channel 1 and channel 2 bitalloc are the same */ if( (ba=*bita++) ) { k=(alloc2 = alloc1+ba)->bits; if( (d1=alloc2->d) < 0) { real cm; cm=fr->muls[k][scale[x1+3]]; fraction[0][0][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); fraction[0][1][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); fraction[0][2][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); fraction[1][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm); fraction[1][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm); fraction[1][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm); cm=fr->muls[k][scale[x1]]; fraction[0][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm); fraction[0][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm); fraction[0][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm); } else { const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab }; unsigned int idx,*tab,m1,m2; m1 = scale[x1]; m2 = scale[x1+3]; idx = (unsigned int) getbits(fr, k); tab = (unsigned int *) (table[d1] + idx + idx + idx); fraction[0][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]); fraction[0][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]); fraction[0][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m2]); } scale+=6; } else { fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] = fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = DOUBLE_TO_REAL(0.0); } /* Historic comment... should we use individual scalefac for channel 2 or is the current way the right one , where we just copy channel 1 to channel 2 ?? The current 'strange' thing is, that we throw away the scalefac values for the second channel ...!! -> changed .. now we use the scalefac values of channel one !! */ } if(sblimit > (fr->down_sample_sblimit) ) sblimit = fr->down_sample_sblimit; for(i=sblimit;isampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ table = 4; else table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; sblim = sblims[table]; fr->alloc = tables[table]; fr->II_sblimit = sblim; } int do_layer2(mpg123_handle *fr) { int clip=0; int i,j; int stereo = fr->stereo; /* pick_table clears unused subbands */ /* replacement for real fraction[2][4][SBLIMIT], needs alignment. */ real (*fraction)[4][SBLIMIT] = fr->layer2.fraction; unsigned int bit_alloc[64]; int scale[192]; int single = fr->single; II_select_table(fr); fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : fr->II_sblimit; if(fr->jsbound > fr->II_sblimit) { fprintf(stderr, "Truncating stereo boundary to sideband limit.\n"); fr->jsbound=fr->II_sblimit; } /* TODO: What happens with mono mixing, actually? */ if(stereo == 1 || single == SINGLE_MIX) /* also, mix not really handled */ single = SINGLE_LEFT; II_step_one(bit_alloc, scale, fr); for(i=0;i>2); for(j=0;j<3;j++) { if(single != SINGLE_STEREO) clip += (fr->synth_mono)(fraction[single][j], fr); else clip += (fr->synth_stereo)(fraction[0][j], fraction[1][j], fr); } } return clip; } #endif /* NO_LAYER2 */ welle.io-2.1/src/libs/mpg123/layer3.c000066400000000000000000001474471357201522000172040ustar00rootroot00000000000000/* layer3.c: the layer 3 decoder copyright 1995-2017 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp Dear visitor: If you feel you don't understand fully the works of this file, your feeling might be correct. Optimize-TODO: put short bands into the band-field without the stride of 3 reals Length-optimze: unify long and short band code where it is possible The int-vs-pointer situation has to be cleaned up. */ #include "mpg123lib_intern.h" #ifdef USE_NEW_HUFFTABLE #include "newhuffman.h" #else #include "huffman.h" #endif #include "getbits.h" #include "debug.h" /* define CUT_SFB21 if you want to cut-off the frequency above 16kHz */ #if 0 #define CUT_SFB21 #endif #ifdef REAL_IS_FIXED #define NEW_DCT9 #include "l3_integer_tables.h" #else /* static one-time calculated tables... or so */ static real ispow[8207]; static real aa_ca[8],aa_cs[8]; static ALIGNED(16) real win[4][36]; static ALIGNED(16) real win1[4][36]; real COS9[9]; /* dct36_3dnow wants to use that */ static real COS6_1,COS6_2; real tfcos36[9]; /* dct36_3dnow wants to use that */ static real tfcos12[3]; #define NEW_DCT9 #ifdef NEW_DCT9 static real cos9[3],cos18[3]; static real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16]; static real pow1_1[2][32],pow2_1[2][32],pow1_2[2][32],pow2_2[2][32]; #endif #endif /* Decoder state data, living on the stack of do_layer3. */ struct gr_info_s { int scfsi; unsigned part2_3_length; unsigned big_values; unsigned scalefac_compress; unsigned block_type; unsigned mixed_block_flag; unsigned table_select[3]; /* Making those two signed int as workaround for open64/pathscale/sun compilers, and also for consistency, since they're worked on together with other signed variables. */ int maxband[3]; int maxbandl; unsigned maxb; unsigned region1start; unsigned region2start; unsigned preflag; unsigned scalefac_scale; unsigned count1table_select; real *full_gain[3]; real *pow2gain; }; struct III_sideinfo { unsigned main_data_begin; unsigned private_bits; /* Hm, funny... struct inside struct... */ struct { struct gr_info_s gr[2]; } ch[2]; }; struct bandInfoStruct { unsigned short longIdx[23]; unsigned char longDiff[22]; unsigned short shortIdx[14]; unsigned char shortDiff[13]; }; /* Techy details about our friendly MPEG data. Fairly constant over the years;-) */ static const struct bandInfoStruct bandInfo[9] = { { /* MPEG 1.0 */ {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3}, {4,4,4,4,6,8,10,12,14,18,22,30,56} }, { {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576}, {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3}, {4,4,4,4,6,6,10,12,14,16,20,26,66} }, { {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576}, {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26}, {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3}, {4,4,4,4,6,8,12,16,20,26,34,42,12} }, { /* MPEG 2.0 */ {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } , {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} , {4,4,4,6,6,8,10,14,18,26,32,42,18 } }, { /* Twiddling 3 values here (not just 330->332!) fixed bug 1895025. */ {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576}, {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,54,62,70,76,36 }, {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,136*3,180*3,192*3}, {4,4,4,6,8,10,12,14,18,24,32,44,12 } }, { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 }, {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,134*3,174*3,192*3}, {4,4,4,6,8,10,12,14,18,24,30,40,18 } }, { /* MPEG 2.5 */ {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, {4,4,4,6,8,10,12,14,18,24,30,40,18} }, { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, {4,4,4,6,8,10,12,14,18,24,30,40,18} }, { {0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576}, {12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2}, {0, 24, 48, 72,108,156,216,288,372,480,486,492,498,576}, {8,8,8,12,16,20,24,28,36,2,2,2,26} } }; static int mapbuf0[9][152]; static int mapbuf1[9][156]; static int mapbuf2[9][44]; static int *map[9][3]; static int *mapend[9][3]; static unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */ static unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */ /* Some helpers used in init_layer3 */ #ifdef OPT_MMXORSSE real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i) { if(!fr->p.down_sample) return DOUBLE_TO_REAL(16384.0 * pow((double)2.0,-0.25 * (double) (i+210) )); else return DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210))); } #endif real init_layer3_gainpow2(mpg123_handle *fr, int i) { #if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) return gainpow2[i+256]; #else return DOUBLE_TO_REAL_SCALE_LAYER3(pow((double)2.0,-0.25 * (double) (i+210)),i+256); #endif } /* init tables for layer-3 ... specific with the downsampling... */ void init_layer3(void) { int i,j,k,l; #if !defined(REAL_IS_FIXED) || !defined(PRECALC_TABLES) for(i=0;i<8207;i++) ispow[i] = DOUBLE_TO_REAL_POW43(pow((double)i,(double)4.0/3.0)); for(i=0;i<8;i++) { const double Ci[8] = {-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; double sq = sqrt(1.0+Ci[i]*Ci[i]); aa_cs[i] = DOUBLE_TO_REAL(1.0/sq); aa_ca[i] = DOUBLE_TO_REAL(Ci[i]/sq); } for(i=0;i<18;i++) { win[0][i] = win[1][i] = DOUBLE_TO_REAL( 0.5*sin(M_PI/72.0 * (double)(2*(i+0) +1)) / cos(M_PI * (double)(2*(i+0) +19) / 72.0) ); win[0][i+18] = win[3][i+18] = DOUBLE_TO_REAL( 0.5*sin(M_PI/72.0 * (double)(2*(i+18)+1)) / cos(M_PI * (double)(2*(i+18)+19) / 72.0) ); } for(i=0;i<6;i++) { win[1][i+18] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); win[3][i+12] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 )); win[1][i+24] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 )); win[1][i+30] = win[3][i] = DOUBLE_TO_REAL(0.0); win[3][i+6 ] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1 ) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 )); } for(i=0;i<9;i++) COS9[i] = DOUBLE_TO_REAL(cos( M_PI / 18.0 * (double) i)); for(i=0;i<9;i++) tfcos36[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 )); for(i=0;i<3;i++) tfcos12[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 )); COS6_1 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 1)); COS6_2 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 2)); #ifdef NEW_DCT9 cos9[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/9.0)); cos9[1] = DOUBLE_TO_REAL(cos(5.0*M_PI/9.0)); cos9[2] = DOUBLE_TO_REAL(cos(7.0*M_PI/9.0)); cos18[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/18.0)); cos18[1] = DOUBLE_TO_REAL(cos(11.0*M_PI/18.0)); cos18[2] = DOUBLE_TO_REAL(cos(13.0*M_PI/18.0)); #endif for(i=0;i<12;i++) { win[2][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 )); } for(i=0;i<16;i++) { double t = tan( (double) i * M_PI / 12.0 ); tan1_1[i] = DOUBLE_TO_REAL_15(t / (1.0+t)); tan2_1[i] = DOUBLE_TO_REAL_15(1.0 / (1.0 + t)); tan1_2[i] = DOUBLE_TO_REAL_15(M_SQRT2 * t / (1.0+t)); tan2_2[i] = DOUBLE_TO_REAL_15(M_SQRT2 / (1.0 + t)); } for(i=0;i<32;i++) { for(j=0;j<2;j++) { double base = pow(2.0,-0.25*(j+1.0)); double p1=1.0,p2=1.0; if(i > 0) { if( i & 1 ) p1 = pow(base,(i+1.0)*0.5); else p2 = pow(base,i*0.5); } pow1_1[j][i] = DOUBLE_TO_REAL_15(p1); pow2_1[j][i] = DOUBLE_TO_REAL_15(p2); pow1_2[j][i] = DOUBLE_TO_REAL_15(M_SQRT2 * p1); pow2_2[j][i] = DOUBLE_TO_REAL_15(M_SQRT2 * p2); } } #endif for(j=0;j<4;j++) { const int len[4] = { 36,36,12,36 }; for(i=0;ilongDiff; switch_idx = (j < 3) ? 8 : 6; for(i=0,cb = 0; cb < switch_idx ; cb++,i+=*bdf++) { *mp++ = (*bdf) >> 1; *mp++ = i; *mp++ = 3; *mp++ = cb; } bdf = bi->shortDiff+3; for(cb=3;cb<13;cb++) { int l = (*bdf++) >> 1; for(lwin=0;lwin<3;lwin++) { *mp++ = l; *mp++ = i + lwin; *mp++ = lwin; *mp++ = cb; } i += 6*l; } mapend[j][0] = mp; mp = map[j][1] = mapbuf1[j]; bdf = bi->shortDiff+0; for(i=0,cb=0;cb<13;cb++) { int l = (*bdf++) >> 1; for(lwin=0;lwin<3;lwin++) { *mp++ = l; *mp++ = i + lwin; *mp++ = lwin; *mp++ = cb; } i += 6*l; } mapend[j][1] = mp; mp = map[j][2] = mapbuf2[j]; bdf = bi->longDiff; for(cb = 0; cb < 22 ; cb++) { *mp++ = (*bdf++) >> 1; *mp++ = cb; } mapend[j][2] = mp; } /* Now for some serious loopings! */ for(i=0;i<5;i++) for(j=0;j<6;j++) for(k=0;k<6;k++) { int n = k + j * 6 + i * 36; i_slen2[n] = i|(j<<3)|(k<<6)|(3<<12); } for(i=0;i<4;i++) for(j=0;j<4;j++) for(k=0;k<4;k++) { int n = k + j * 4 + i * 16; i_slen2[n+180] = i|(j<<3)|(k<<6)|(4<<12); } for(i=0;i<4;i++) for(j=0;j<3;j++) { int n = j + i * 3; i_slen2[n+244] = i|(j<<3) | (5<<12); n_slen2[n+500] = i|(j<<3) | (2<<12) | (1<<15); } for(i=0;i<5;i++) for(j=0;j<5;j++) for(k=0;k<4;k++) for(l=0;l<4;l++) { int n = l + k * 4 + j * 16 + i * 80; n_slen2[n] = i|(j<<3)|(k<<6)|(l<<9)|(0<<12); } for(i=0;i<5;i++) for(j=0;j<5;j++) for(k=0;k<4;k++) { int n = k + j * 4 + i * 20; n_slen2[n+400] = i|(j<<3)|(k<<6)|(1<<12); } } void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i)) { int i,j; for(i=-256;i<118+4;i++) fr->gainpow2[i+256] = gainpow2(fr,i); for(j=0;j<9;j++) { for(i=0;i<23;i++) { fr->longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1; if(fr->longLimit[j][i] > (fr->down_sample_sblimit) ) fr->longLimit[j][i] = fr->down_sample_sblimit; } for(i=0;i<14;i++) { fr->shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; if(fr->shortLimit[j][i] > (fr->down_sample_sblimit) ) fr->shortLimit[j][i] = fr->down_sample_sblimit; } } } /* Observe! Now come the actualy decoding routines. */ /* read additional side information (for MPEG 1 and MPEG 2) */ static int III_get_side_info(mpg123_handle *fr, struct III_sideinfo *si,int stereo, int ms_stereo,long sfreq,int single) { int ch, gr; int powdiff = (single == SINGLE_MIX) ? 4 : 0; const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } }; const int *tab = tabs[fr->lsf]; si->main_data_begin = getbits(fr, tab[1]); if(si->main_data_begin > fr->bitreservoir) { if(!fr->to_ignore && VERBOSE2) fprintf(stderr, "Note: missing %d bytes in bit reservoir for frame %li\n", (int)(si->main_data_begin - fr->bitreservoir), (long)fr->num); /* overwrite main_data_begin for the really available bit reservoir */ backbits(fr, tab[1]); if(fr->lsf == 0) { fr->wordpointer[0] = (unsigned char) (fr->bitreservoir >> 1); fr->wordpointer[1] = (unsigned char) ((fr->bitreservoir & 1) << 7); } else fr->wordpointer[0] = (unsigned char) fr->bitreservoir; /* zero "side-info" data for a silence-frame without touching audio data used as bit reservoir for following frame */ memset(fr->wordpointer+2, 0, fr->ssize-2); /* reread the new bit reservoir offset */ si->main_data_begin = getbits(fr, tab[1]); } /* Keep track of the available data bytes for the bit reservoir. Think: Substract the 2 crc bytes in parser already? */ fr->bitreservoir = fr->bitreservoir + fr->framesize - fr->ssize - (fr->error_protection ? 2 : 0); /* Limit the reservoir to the max for MPEG 1.0 or 2.x . */ if(fr->bitreservoir > (unsigned int) (fr->lsf == 0 ? 511 : 255)) fr->bitreservoir = (fr->lsf == 0 ? 511 : 255); /* Now back into less commented territory. It's code. It works. */ if (stereo == 1) si->private_bits = getbits_fast(fr, tab[2]); else si->private_bits = getbits_fast(fr, tab[3]); if(!fr->lsf) for(ch=0; chch[ch].gr[0].scfsi = -1; si->ch[ch].gr[1].scfsi = getbits_fast(fr, 4); } for (gr=0; grch[ch].gr[gr]); gr_info->part2_3_length = getbits(fr, 12); gr_info->big_values = getbits(fr, 9); if(gr_info->big_values > 288) { if(NOQUIET) error("big_values too large!"); gr_info->big_values = 288; } gr_info->pow2gain = fr->gainpow2+256 - getbits_fast(fr, 8) + powdiff; if(ms_stereo) gr_info->pow2gain += 2; gr_info->scalefac_compress = getbits(fr, tab[4]); if(gr_info->part2_3_length == 0) { if(gr_info->scalefac_compress > 0) debug1( "scalefac_compress _should_ be zero instead of %i" , gr_info->scalefac_compress ); gr_info->scalefac_compress = 0; } if(get1bit(fr)) { /* window switch flag */ int i; gr_info->block_type = getbits_fast(fr, 2); gr_info->mixed_block_flag = get1bit(fr); gr_info->table_select[0] = getbits_fast(fr, 5); gr_info->table_select[1] = getbits_fast(fr, 5); /* table_select[2] not needed, because there is no region2, but to satisfy some verification tools we set it either. */ gr_info->table_select[2] = 0; for(i=0;i<3;i++) gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(fr, 3)<<3); if(gr_info->block_type == 0) { if(NOQUIET) error("Blocktype == 0 and window-switching == 1 not allowed."); return 1; } /* region_count/start parameters are implicit in this case. */ if( (!fr->lsf || (gr_info->block_type == 2)) && !fr->mpeg25) { gr_info->region1start = 36>>1; gr_info->region2start = 576>>1; } else { if(fr->mpeg25) { int r0c,r1c; if((gr_info->block_type == 2) && (!gr_info->mixed_block_flag) ) r0c = 5; else r0c = 7; /* r0c+1+r1c+1 == 22, always. */ r1c = 20 - r0c; gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; } else { gr_info->region1start = 54>>1; gr_info->region2start = 576>>1; } } } else { int i,r0c,r1c; for (i=0; i<3; i++) gr_info->table_select[i] = getbits_fast(fr, 5); r0c = getbits_fast(fr, 4); /* 0 .. 15 */ r1c = getbits_fast(fr, 3); /* 0 .. 7 */ gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; /* max(r0c+r1c+2) = 15+7+2 = 24 */ if(r0c+1+r1c+1 > 22) gr_info->region2start = 576>>1; else gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; gr_info->block_type = 0; gr_info->mixed_block_flag = 0; } if(!fr->lsf) gr_info->preflag = get1bit(fr); gr_info->scalefac_scale = get1bit(fr); gr_info->count1table_select = get1bit(fr); } return 0; } /* read scalefactors */ static int III_get_scale_factors_1(mpg123_handle *fr, int *scf,struct gr_info_s *gr_info,int ch,int gr) { const unsigned char slen[2][16] = { {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3} }; int numbits; int num0 = slen[0][gr_info->scalefac_compress]; int num1 = slen[1][gr_info->scalefac_compress]; if(gr_info->part2_3_length == 0) { int i; for(i=0;i<39;i++) *scf++ = 0; return 0; } if(gr_info->block_type == 2) { int i=18; numbits = (num0 + num1) * 18; if(gr_info->mixed_block_flag) { for (i=8;i;i--) *scf++ = getbits_fast(fr, num0); i = 9; numbits -= num0; /* num0 * 17 + num1 * 18 */ } for(;i;i--) *scf++ = getbits_fast(fr, num0); for(i = 18; i; i--) *scf++ = getbits_fast(fr, num1); *scf++ = 0; *scf++ = 0; *scf++ = 0; /* short[13][0..2] = 0 */ } else { int i; int scfsi = gr_info->scfsi; if(scfsi < 0) { /* scfsi < 0 => granule == 0 */ for(i=11;i;i--) *scf++ = getbits_fast(fr, num0); for(i=10;i;i--) *scf++ = getbits_fast(fr, num1); numbits = (num0 + num1) * 10 + num0; *scf++ = 0; } else { numbits = 0; if(!(scfsi & 0x8)) { for (i=0;i<6;i++) *scf++ = getbits_fast(fr, num0); numbits += num0 * 6; } else scf += 6; if(!(scfsi & 0x4)) { for (i=0;i<5;i++) *scf++ = getbits_fast(fr, num0); numbits += num0 * 5; } else scf += 5; if(!(scfsi & 0x2)) { for(i=0;i<5;i++) *scf++ = getbits_fast(fr, num1); numbits += num1 * 5; } else scf += 5; if(!(scfsi & 0x1)) { for (i=0;i<5;i++) *scf++ = getbits_fast(fr, num1); numbits += num1 * 5; } else scf += 5; *scf++ = 0; /* no l[21] in original sources */ } } return numbits; } static int III_get_scale_factors_2(mpg123_handle *fr, int *scf,struct gr_info_s *gr_info,int i_stereo) { const unsigned char *pnt; int i,j,n=0,numbits=0; unsigned int slen; const unsigned char stab[3][6][4] = { { { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0}, { 7, 7, 7,0 } , { 6, 6, 6,3 } , { 8, 8,5,0} }, { { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0}, {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} }, { { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0}, { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} } }; if(i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */ slen = i_slen2[gr_info->scalefac_compress>>1]; else slen = n_slen2[gr_info->scalefac_compress]; gr_info->preflag = (slen>>15) & 0x1; n = 0; if( gr_info->block_type == 2 ) { n++; if(gr_info->mixed_block_flag) n++; } pnt = stab[n][(slen>>12)&0x7]; if(gr_info->part2_3_length == 0) { int i; for(i=0;i<39;i++) *scf++ = 0; return 0; } for(i=0;i<4;i++) { int num = slen & 0x7; slen >>= 3; if(num) { for(j=0;j<(int)(pnt[i]);j++) *scf++ = getbits_fast(fr, num); numbits += pnt[i] * num; } else for(j=0;j<(int)(pnt[i]);j++) *scf++ = 0; } n = (n << 1) + 1; for(i=0;iscalefac_scale; real *xrpnt = (real *) xr; int l[3],l3; int part2remain = gr_info->part2_3_length - part2bits; int *me; #ifdef REAL_IS_FIXED int gainpow2_scale_idx = 378; #endif /* Assumption: If there is some part2_3_length at all, there should be enough of it to work with properly. In case of zero length we silently zero things. */ if(gr_info->part2_3_length > 0) { /* mhipp tree has this split up a bit... */ int num=getbitoffset(fr); MASK_TYPE mask; /* We must split this, because for num==0 the shift is undefined if you do it in one step. */ mask = ((MASK_UTYPE) getbits(fr, num))<big_values; int region1 = gr_info->region1start; int region2 = gr_info->region2start; l3 = ((576>>1)-bv)>>1; /* we may lose the 'odd' bit here !! check this later again */ if(bv <= region1) { l[0] = bv; l[1] = 0; l[2] = 0; } else { l[0] = region1; if(bv <= region2) { l[1] = bv - l[0]; l[2] = 0; } else { l[1] = region2 - l[0]; l[2] = bv - region2; } } } #define CHECK_XRPNT if(xrpnt >= &xr[SBLIMIT][0]) \ { \ if(NOQUIET) \ error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) &xr[SBLIMIT][0]); \ return 1; \ } if(gr_info->block_type == 2) { /* decoding with short or mixed mode BandIndex table */ int i,max[4]; int step=0,lwin=3,cb=0; register real v = 0.0; register int *m,mc; if(gr_info->mixed_block_flag) { max[3] = -1; max[0] = max[1] = max[2] = 2; m = map[sfreq][0]; me = mapend[sfreq][0]; } else { max[0] = max[1] = max[2] = max[3] = -1; /* max[3] not really needed in this case */ m = map[sfreq][1]; me = mapend[sfreq][1]; } mc = 0; for(i=0;i<2;i++) { int lp = l[i]; const struct newhuff *h = ht+gr_info->table_select[i]; for(;lp;lp--,mc--) { register MASK_STYPE x,y; if( (!mc) ) { mc = *m++; xrpnt = ((real *) xr) + (*m++); lwin = *m++; cb = *m++; if(lwin == 3) { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); #endif v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } else { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->full_gain[lwin] + (*scf << shift) - fr->gainpow2); #endif v = gr_info->full_gain[lwin][(*scf++) << shift]; step = 3; } } { const short *val = h->table; REFRESH_MASK; #ifdef USE_NEW_HUFFTABLE while((y=val[(MASK_UTYPE)mask>>(BITSHIFT+4)])<0) { val -= y; num -= 4; mask <<= 4; } num -= (y >> 8); mask <<= (y >> 8); x = (y >> 4) & 0xf; y &= 0xf; #else while((y=*val++)<0) { if (MSB_MASK) val -= y; num--; mask <<= 1; } x = y >> 4; y &= 0xf; #endif } CHECK_XRPNT; if(x == 15 && h->linbits) { max[lwin] = cb; REFRESH_MASK; x += ((MASK_UTYPE) mask) >> (BITSHIFT+8-h->linbits); num -= h->linbits+1; mask <<= h->linbits; if(MSB_MASK) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); mask <<= 1; } else if(x) { max[lwin] = cb; if(MSB_MASK) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; CHECK_XRPNT; if(y == 15 && h->linbits) { max[lwin] = cb; REFRESH_MASK; y += ((MASK_UTYPE) mask) >> (BITSHIFT+8-h->linbits); num -= h->linbits+1; mask <<= h->linbits; if(MSB_MASK) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); mask <<= 1; } else if(y) { max[lwin] = cb; if(MSB_MASK) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; } } for(;l3 && (part2remain+num > 0);l3--) { const struct newhuff* h; const short* val; register short a; h = htc+gr_info->count1table_select; val = h->table; REFRESH_MASK; while((a=*val++)<0) { if(MSB_MASK) val -= a; num--; mask <<= 1; } if(part2remain+num <= 0) { num -= part2remain+num; break; } for(i=0;i<4;i++) { if(!(i & 1)) { if(!mc) { mc = *m++; xrpnt = ((real *) xr) + (*m++); lwin = *m++; cb = *m++; if(lwin == 3) { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); #endif v = gr_info->pow2gain[(*scf++) << shift]; step = 1; } else { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->full_gain[lwin] + (*scf << shift) - fr->gainpow2); #endif v = gr_info->full_gain[lwin][(*scf++) << shift]; step = 3; } } mc--; } CHECK_XRPNT; if( (a & (0x8>>i)) ) { max[lwin] = cb; if(part2remain+num <= 0) break; if(MSB_MASK) *xrpnt = -REAL_SCALE_LAYER3(v, gainpow2_scale_idx); else *xrpnt = REAL_SCALE_LAYER3(v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += step; } } if(lwin < 3) { /* short band? */ while(1) { for(;mc > 0;mc--) { CHECK_XRPNT; *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; /* short band -> step=3 */ *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; } if(m >= me) break; mc = *m++; xrpnt = ((real *) xr) + *m++; if(*m++ == 0) break; /* optimize: field will be set to zero at the end of the function */ m++; /* cb */ } } gr_info->maxband[0] = max[0]+1; gr_info->maxband[1] = max[1]+1; gr_info->maxband[2] = max[2]+1; gr_info->maxbandl = max[3]+1; { int rmax = max[0] > max[1] ? max[0] : max[1]; rmax = (rmax > max[2] ? rmax : max[2]) + 1; gr_info->maxb = rmax ? fr->shortLimit[sfreq][rmax] : fr->longLimit[sfreq][max[3]+1]; } } else { /* decoding with 'long' BandIndex table (block_type != 2) */ const unsigned char *pretab = pretab_choice[gr_info->preflag]; int i,max = -1; int cb = 0; int *m = map[sfreq][2]; register real v = 0.0; int mc = 0; /* long hash table values */ for(i=0;i<3;i++) { int lp = l[i]; const struct newhuff *h = ht+gr_info->table_select[i]; for(;lp;lp--,mc--) { MASK_STYPE x,y; if(!mc) { mc = *m++; cb = *m++; #ifdef CUT_SFB21 if(cb == 21) v = 0.0; else #endif { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); #endif v = gr_info->pow2gain[(*(scf++) + (*pretab++)) << shift]; } } { const short *val = h->table; REFRESH_MASK; #ifdef USE_NEW_HUFFTABLE while((y=val[(MASK_UTYPE)mask>>(BITSHIFT+4)])<0) { val -= y; num -= 4; mask <<= 4; } num -= (y >> 8); mask <<= (y >> 8); x = (y >> 4) & 0xf; y &= 0xf; #else while((y=*val++)<0) { if (MSB_MASK) val -= y; num--; mask <<= 1; } x = y >> 4; y &= 0xf; #endif } CHECK_XRPNT; if(x == 15 && h->linbits) { max = cb; REFRESH_MASK; x += ((MASK_UTYPE) mask) >> (BITSHIFT+8-h->linbits); num -= h->linbits+1; mask <<= h->linbits; if(MSB_MASK) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); mask <<= 1; } else if(x) { max = cb; if(MSB_MASK) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt++ = DOUBLE_TO_REAL(0.0); CHECK_XRPNT; if(y == 15 && h->linbits) { max = cb; REFRESH_MASK; y += ((MASK_UTYPE) mask) >> (BITSHIFT+8-h->linbits); num -= h->linbits+1; mask <<= h->linbits; if(MSB_MASK) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); mask <<= 1; } else if(y) { max = cb; if(MSB_MASK) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt++ = DOUBLE_TO_REAL(0.0); } } /* short (count1table) values */ for(;l3 && (part2remain+num > 0);l3--) { const struct newhuff *h = htc+gr_info->count1table_select; const short *val = h->table; register short a; REFRESH_MASK; while((a=*val++)<0) { if (MSB_MASK) val -= a; num--; mask <<= 1; } if(part2remain+num <= 0) { num -= part2remain+num; break; } for(i=0;i<4;i++) { if(!(i & 1)) { if(!mc) { mc = *m++; cb = *m++; #ifdef CUT_SFB21 if(cb == 21) v = 0.0; else #endif { #ifdef REAL_IS_FIXED gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); #endif v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; } } mc--; } CHECK_XRPNT; if( (a & (0x8>>i)) ) { max = cb; if(part2remain+num <= 0) break; if(MSB_MASK) *xrpnt++ = -REAL_SCALE_LAYER3(v, gainpow2_scale_idx); else *xrpnt++ = REAL_SCALE_LAYER3(v, gainpow2_scale_idx); num--; mask <<= 1; } else *xrpnt++ = DOUBLE_TO_REAL(0.0); } } gr_info->maxbandl = max+1; gr_info->maxb = fr->longLimit[sfreq][gr_info->maxbandl]; } part2remain += num; backbits(fr, num); num = 0; } else { part2remain = 0; /* Not entirely sure what good values are, must be > 0. */ gr_info->maxband[0] = gr_info->maxband[1] = gr_info->maxband[2] = gr_info->maxbandl = 1; /* sfb=maxband[lwin]*3 + lwin - mixed_block_flag must be >= 0 */ gr_info->maxb = 1; } while(xrpnt < &xr[SBLIMIT][0]) *xrpnt++ = DOUBLE_TO_REAL(0.0); while( part2remain > 16 ) { skipbits(fr, 16); /* Dismiss stuffing Bits */ part2remain -= 16; } if(part2remain > 0) skipbits(fr, part2remain); else if(part2remain < 0) { debug1("Can't rewind stream by %d bits!",-part2remain); return 1; /* -> error */ } return 0; } /* calculate real channel values for Joint-I-Stereo-mode */ static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT],int *scalefac, struct gr_info_s *gr_info,int sfreq,int ms_stereo,int lsf) { real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf; const struct bandInfoStruct *bi = &bandInfo[sfreq]; const real *tab1,*tab2; #if 1 int tab; /* TODO: optimize as static */ const real *tabs[3][2][2] = { { { tan1_1,tan2_1 } , { tan1_2,tan2_2 } }, { { pow1_1[0],pow2_1[0] } , { pow1_2[0],pow2_2[0] } }, { { pow1_1[1],pow2_1[1] } , { pow1_2[1],pow2_2[1] } } }; tab = lsf + (gr_info->scalefac_compress & lsf); tab1 = tabs[tab][ms_stereo][0]; tab2 = tabs[tab][ms_stereo][1]; #else if(lsf) { int p = gr_info->scalefac_compress & 0x1; if(ms_stereo) { tab1 = pow1_2[p]; tab2 = pow2_2[p]; } else { tab1 = pow1_1[p]; tab2 = pow2_1[p]; } } else { if(ms_stereo) { tab1 = tan1_2; tab2 = tan2_2; } else { tab1 = tan1_1; tab2 = tan2_1; } } #endif if(gr_info->block_type == 2) { int lwin,do_l = 0; if( gr_info->mixed_block_flag ) do_l = 1; for(lwin=0;lwin<3;lwin++) { /* process each window */ /* get first band with zero values */ int is_p,sb,idx,sfb = gr_info->maxband[lwin]; /* sfb is minimal 3 for mixed mode */ if(sfb > 3) do_l = 0; for(;sfb<12;sfb++) { is_p = scalefac[sfb*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ if(is_p != 7) { real t1,t2; sb = bi->shortDiff[sfb]; idx = bi->shortIdx[sfb] + lwin; t1 = tab1[is_p]; t2 = tab2[is_p]; for (; sb > 0; sb--,idx+=3) { real v = xr[0][idx]; xr[0][idx] = REAL_MUL_15(v, t1); xr[1][idx] = REAL_MUL_15(v, t2); } } } #if 1 /* in the original: copy 10 to 11 , here: copy 11 to 12 maybe still wrong??? (copy 12 to 13?) */ is_p = scalefac[11*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ sb = bi->shortDiff[12]; idx = bi->shortIdx[12] + lwin; #else is_p = scalefac[10*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ sb = bi->shortDiff[11]; idx = bi->shortIdx[11] + lwin; #endif if(is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; for( ; sb > 0; sb--,idx+=3 ) { real v = xr[0][idx]; xr[0][idx] = REAL_MUL_15(v, t1); xr[1][idx] = REAL_MUL_15(v, t2); } } } /* end for(lwin; .. ; . ) */ /* also check l-part, if ALL bands in the three windows are 'empty' and mode = mixed_mode */ if(do_l) { int sfb = gr_info->maxbandl; int idx; if(sfb > 21) return; /* similarity fix related to CVE-2006-1655 */ idx = bi->longIdx[sfb]; for( ; sfb<8; sfb++ ) { int sb = bi->longDiff[sfb]; int is_p = scalefac[sfb]; /* scale: 0-15 */ if(is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; for( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; xr[0][idx] = REAL_MUL_15(v, t1); xr[1][idx] = REAL_MUL_15(v, t2); } } else idx += sb; } } } else { /* ((gr_info->block_type != 2)) */ int sfb = gr_info->maxbandl; int is_p,idx; if(sfb > 21) return; /* tightened fix for CVE-2006-1655 */ idx = bi->longIdx[sfb]; for ( ; sfb<21; sfb++) { int sb = bi->longDiff[sfb]; is_p = scalefac[sfb]; /* scale: 0-15 */ if(is_p != 7) { real t1,t2; t1 = tab1[is_p]; t2 = tab2[is_p]; for( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; xr[0][idx] = REAL_MUL_15(v, t1); xr[1][idx] = REAL_MUL_15(v, t2); } } else idx += sb; } is_p = scalefac[20]; if(is_p != 7) { /* copy l-band 20 to l-band 21 */ int sb; real t1 = tab1[is_p],t2 = tab2[is_p]; for( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) { real v = xr[0][idx]; xr[0][idx] = REAL_MUL_15(v, t1); xr[1][idx] = REAL_MUL_15(v, t2); } } } } static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_info) { int sblim; if(gr_info->block_type == 2) { if(!gr_info->mixed_block_flag) return; sblim = 1; } else sblim = gr_info->maxb-1; /* 31 alias-reduction operations between each pair of sub-bands */ /* with 8 butterflies between each pair */ { int sb; real *xr1=(real *) xr[1]; for(sb=sblim; sb; sb--,xr1+=10) { int ss; real *cs=aa_cs,*ca=aa_ca; real *xr2 = xr1; for(ss=7;ss>=0;ss--) { /* upper and lower butterfly inputs */ register real bu = *--xr2,bd = *xr1; *xr2 = REAL_MUL(bu, *cs) - REAL_MUL(bd, *ca); *xr1++ = REAL_MUL(bd, *cs++) + REAL_MUL(bu, *ca++); } } } } /* This is an optimized DCT from Jeff Tsay's maplay 1.2+ package. Saved one multiplication by doing the 'twiddle factor' stuff together with the window mul. (MH) This uses Byeong Gi Lee's Fast Cosine Transform algorithm, but the 9 point IDCT needs to be reduced further. Unfortunately, I don't know how to do that, because 9 is not an even number. - Jeff. Original Message: 9 Point Inverse Discrete Cosine Transform This piece of code is Copyright 1997 Mikko Tommila and is freely usable by anybody. The algorithm itself is of course in the public domain. Again derived heuristically from the 9-point WFTA. The algorithm is optimized (?) for speed, not for small rounding errors or good readability. 36 additions, 11 multiplications Again this is very likely sub-optimal. The code is optimized to use a minimum number of temporary variables, so it should compile quite well even on 8-register Intel x86 processors. This makes the code quite obfuscated and very difficult to understand. References: [1] S. Winograd: "On Computing the Discrete Fourier Transform", Mathematics of Computation, Volume 32, Number 141, January 1978, Pages 175-199 */ /* Calculation of the inverse MDCT used to be static without 3dnow - does that really matter? */ void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf) { #ifdef NEW_DCT9 real tmp[18]; #endif { register real *in = inbuf; in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14]; in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11]; in[11]+=in[10]; in[10]+=in[9]; in[9] +=in[8]; in[8] +=in[7]; in[7] +=in[6]; in[6] +=in[5]; in[5] +=in[4]; in[4] +=in[3]; in[3] +=in[2]; in[2] +=in[1]; in[1] +=in[0]; in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9]; in[9] +=in[7]; in[7] +=in[5]; in[5] +=in[3]; in[3] +=in[1]; #ifdef NEW_DCT9 #if 1 { real t3; { real t0, t1, t2; t0 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); t1 = REAL_MUL(COS6_2, in[12]); t3 = in[0]; t2 = t3 - t1 - t1; tmp[1] = tmp[7] = t2 - t0; tmp[4] = t2 + t0 + t0; t3 += t1; t2 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); tmp[1] -= t2; tmp[7] += t2; } { real t0, t1, t2; t0 = REAL_MUL(cos9[0], (in[4] + in[8] )); t1 = REAL_MUL(cos9[1], (in[8] - in[16])); t2 = REAL_MUL(cos9[2], (in[4] + in[16])); tmp[2] = tmp[6] = t3 - t0 - t2; tmp[0] = tmp[8] = t3 + t0 + t1; tmp[3] = tmp[5] = t3 - t1 + t2; } } { real t1, t2, t3; t1 = REAL_MUL(cos18[0], (in[2] + in[10])); t2 = REAL_MUL(cos18[1], (in[10] - in[14])); t3 = REAL_MUL(COS6_1, in[6]); { real t0 = t1 + t2 + t3; tmp[0] += t0; tmp[8] -= t0; } t2 -= t3; t1 -= t3; t3 = REAL_MUL(cos18[2], (in[2] + in[14])); t1 += t3; tmp[3] += t1; tmp[5] -= t1; t2 -= t3; tmp[2] += t2; tmp[6] -= t2; } #else { real t0, t1, t2, t3, t4, t5, t6, t7; t1 = REAL_MUL(COS6_2, in[12]); t2 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); t3 = in[0] + t1; t4 = in[0] - t1 - t1; t5 = t4 - t2; tmp[4] = t4 + t2 + t2; t0 = REAL_MUL(cos9[0], (in[4] + in[8])); t1 = REAL_MUL(cos9[1], (in[8] - in[16])); t2 = REAL_MUL(cos9[2], (in[4] + in[16])); t6 = t3 - t0 - t2; t0 += t3 + t1; t3 += t2 - t1; t2 = REAL_MUL(cos18[0], (in[2] + in[10])); t4 = REAL_MUL(cos18[1], (in[10] - in[14])); t7 = REAL_MUL(COS6_1, in[6]); t1 = t2 + t4 + t7; tmp[0] = t0 + t1; tmp[8] = t0 - t1; t1 = REAL_MUL(cos18[2], (in[2] + in[14])); t2 += t1 - t7; tmp[3] = t3 + t2; t0 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); tmp[5] = t3 - t2; t4 -= t1 + t7; tmp[1] = t5 - t0; tmp[7] = t5 + t0; tmp[2] = t6 + t4; tmp[6] = t6 - t4; } #endif { real t0, t1, t2, t3, t4, t5, t6, t7; t1 = REAL_MUL(COS6_2, in[13]); t2 = REAL_MUL(COS6_2, (in[9] + in[17] - in[5])); t3 = in[1] + t1; t4 = in[1] - t1 - t1; t5 = t4 - t2; t0 = REAL_MUL(cos9[0], (in[5] + in[9])); t1 = REAL_MUL(cos9[1], (in[9] - in[17])); tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]); t2 = REAL_MUL(cos9[2], (in[5] + in[17])); t6 = t3 - t0 - t2; t0 += t3 + t1; t3 += t2 - t1; t2 = REAL_MUL(cos18[0], (in[3] + in[11])); t4 = REAL_MUL(cos18[1], (in[11] - in[15])); t7 = REAL_MUL(COS6_1, in[7]); t1 = t2 + t4 + t7; tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]); tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]); t1 = REAL_MUL(cos18[2], (in[3] + in[15])); t2 += t1 - t7; tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]); t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3])); tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]); t4 -= t1 + t7; tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]); tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]); tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]); tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]); } #define MACRO(v) { \ real tmpval; \ tmpval = tmp[(v)] + tmp[17-(v)]; \ out2[9+(v)] = REAL_MUL(tmpval, w[27+(v)]); \ out2[8-(v)] = REAL_MUL(tmpval, w[26-(v)]); \ tmpval = tmp[(v)] - tmp[17-(v)]; \ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(tmpval, w[8-(v)]); \ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(tmpval, w[9+(v)]); } { register real *out2 = o2; register real *w = wintab; register real *out1 = o1; register real *ts = tsbuf; MACRO(0); MACRO(1); MACRO(2); MACRO(3); MACRO(4); MACRO(5); MACRO(6); MACRO(7); MACRO(8); } #else { #define MACRO0(v) { \ real tmp; \ out2[9+(v)] = REAL_MUL((tmp = sum0 + sum1), w[27+(v)]); \ out2[8-(v)] = REAL_MUL(tmp, w[26-(v)]); } \ sum0 -= sum1; \ ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(sum0, w[8-(v)]); \ ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(sum0, w[9+(v)]); #define MACRO1(v) { \ real sum0,sum1; \ sum0 = tmp1a + tmp2a; \ sum1 = REAL_MUL((tmp1b + tmp2b), tfcos36[(v)]); \ MACRO0(v); } #define MACRO2(v) { \ real sum0,sum1; \ sum0 = tmp2a - tmp1a; \ sum1 = REAL_MUL((tmp2b - tmp1b), tfcos36[(v)]); \ MACRO0(v); } register const real *c = COS9; register real *out2 = o2; register real *w = wintab; register real *out1 = o1; register real *ts = tsbuf; real ta33,ta66,tb33,tb66; ta33 = REAL_MUL(in[2*3+0], c[3]); ta66 = REAL_MUL(in[2*6+0], c[6]); tb33 = REAL_MUL(in[2*3+1], c[3]); tb66 = REAL_MUL(in[2*6+1], c[6]); { real tmp1a,tmp2a,tmp1b,tmp2b; tmp1a = REAL_MUL(in[2*1+0], c[1]) + ta33 + REAL_MUL(in[2*5+0], c[5]) + REAL_MUL(in[2*7+0], c[7]); tmp1b = REAL_MUL(in[2*1+1], c[1]) + tb33 + REAL_MUL(in[2*5+1], c[5]) + REAL_MUL(in[2*7+1], c[7]); tmp2a = REAL_MUL(in[2*2+0], c[2]) + REAL_MUL(in[2*4+0], c[4]) + ta66 + REAL_MUL(in[2*8+0], c[8]); tmp2b = REAL_MUL(in[2*2+1], c[2]) + REAL_MUL(in[2*4+1], c[4]) + tb66 + REAL_MUL(in[2*8+1], c[8]); MACRO1(0); MACRO2(8); } { real tmp1a,tmp2a,tmp1b,tmp2b; tmp1a = REAL_MUL(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]); tmp1b = REAL_MUL(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]); tmp2a = REAL_MUL(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0]; tmp2b = REAL_MUL(( in[2*2+1] - in[2*4+1] - in[2*8+1] ), c[6]) - in[2*6+1] + in[2*0+1]; MACRO1(1); MACRO2(7); } { real tmp1a,tmp2a,tmp1b,tmp2b; tmp1a = REAL_MUL(in[2*1+0], c[5]) - ta33 - REAL_MUL(in[2*5+0], c[7]) + REAL_MUL(in[2*7+0], c[1]); tmp1b = REAL_MUL(in[2*1+1], c[5]) - tb33 - REAL_MUL(in[2*5+1], c[7]) + REAL_MUL(in[2*7+1], c[1]); tmp2a = - REAL_MUL(in[2*2+0], c[8]) - REAL_MUL(in[2*4+0], c[2]) + ta66 + REAL_MUL(in[2*8+0], c[4]); tmp2b = - REAL_MUL(in[2*2+1], c[8]) - REAL_MUL(in[2*4+1], c[2]) + tb66 + REAL_MUL(in[2*8+1], c[4]); MACRO1(2); MACRO2(6); } { real tmp1a,tmp2a,tmp1b,tmp2b; tmp1a = REAL_MUL(in[2*1+0], c[7]) - ta33 + REAL_MUL(in[2*5+0], c[1]) - REAL_MUL(in[2*7+0], c[5]); tmp1b = REAL_MUL(in[2*1+1], c[7]) - tb33 + REAL_MUL(in[2*5+1], c[1]) - REAL_MUL(in[2*7+1], c[5]); tmp2a = - REAL_MUL(in[2*2+0], c[4]) + REAL_MUL(in[2*4+0], c[8]) + ta66 - REAL_MUL(in[2*8+0], c[2]); tmp2b = - REAL_MUL(in[2*2+1], c[4]) + REAL_MUL(in[2*4+1], c[8]) + tb66 - REAL_MUL(in[2*8+1], c[2]); MACRO1(3); MACRO2(5); } { real sum0,sum1; sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; sum1 = REAL_MUL((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]); MACRO0(4); } } #endif } } /* new DCT12 */ static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,register real *ts) { #define DCT12_PART1 \ in5 = in[5*3]; \ in5 += (in4 = in[4*3]); \ in4 += (in3 = in[3*3]); \ in3 += (in2 = in[2*3]); \ in2 += (in1 = in[1*3]); \ in1 += (in0 = in[0*3]); \ \ in5 += in3; in3 += in1; \ \ in2 = REAL_MUL(in2, COS6_1); \ in3 = REAL_MUL(in3, COS6_1); #define DCT12_PART2 \ in0 += REAL_MUL(in4, COS6_2); \ \ in4 = in0 + in2; \ in0 -= in2; \ \ in1 += REAL_MUL(in5, COS6_2); \ \ in5 = REAL_MUL((in1 + in3), tfcos12[0]); \ in1 = REAL_MUL((in1 - in3), tfcos12[2]); \ \ in3 = in4 + in5; \ in4 -= in5; \ \ in2 = in0 + in1; \ in0 -= in1; { real in0,in1,in2,in3,in4,in5; register real *out1 = rawout1; ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2]; ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5]; DCT12_PART1 { real tmp0,tmp1 = (in0 - in4); { real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } ts[(17-1)*SBLIMIT] = out1[17-1] + REAL_MUL(tmp0, wi[11-1]); ts[(12+1)*SBLIMIT] = out1[12+1] + REAL_MUL(tmp0, wi[6+1]); ts[(6 +1)*SBLIMIT] = out1[6 +1] + REAL_MUL(tmp1, wi[1]); ts[(11-1)*SBLIMIT] = out1[11-1] + REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 ts[(17-0)*SBLIMIT] = out1[17-0] + REAL_MUL(in2, wi[11-0]); ts[(12+0)*SBLIMIT] = out1[12+0] + REAL_MUL(in2, wi[6+0]); ts[(12+2)*SBLIMIT] = out1[12+2] + REAL_MUL(in3, wi[6+2]); ts[(17-2)*SBLIMIT] = out1[17-2] + REAL_MUL(in3, wi[11-2]); ts[(6 +0)*SBLIMIT] = out1[6+0] + REAL_MUL(in0, wi[0]); ts[(11-0)*SBLIMIT] = out1[11-0] + REAL_MUL(in0, wi[5-0]); ts[(6 +2)*SBLIMIT] = out1[6+2] + REAL_MUL(in4, wi[2]); ts[(11-2)*SBLIMIT] = out1[11-2] + REAL_MUL(in4, wi[5-2]); } in++; { real in0,in1,in2,in3,in4,in5; register real *out2 = rawout2; DCT12_PART1 { real tmp0,tmp1 = (in0 - in4); { real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } out2[5-1] = REAL_MUL(tmp0, wi[11-1]); out2[0+1] = REAL_MUL(tmp0, wi[6+1]); ts[(12+1)*SBLIMIT] += REAL_MUL(tmp1, wi[1]); ts[(17-1)*SBLIMIT] += REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 out2[5-0] = REAL_MUL(in2, wi[11-0]); out2[0+0] = REAL_MUL(in2, wi[6+0]); out2[0+2] = REAL_MUL(in3, wi[6+2]); out2[5-2] = REAL_MUL(in3, wi[11-2]); ts[(12+0)*SBLIMIT] += REAL_MUL(in0, wi[0]); ts[(17-0)*SBLIMIT] += REAL_MUL(in0, wi[5-0]); ts[(12+2)*SBLIMIT] += REAL_MUL(in4, wi[2]); ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]); } in++; { real in0,in1,in2,in3,in4,in5; register real *out2 = rawout2; out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0; DCT12_PART1 { real tmp0,tmp1 = (in0 - in4); { real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); tmp0 = tmp1 + tmp2; tmp1 -= tmp2; } out2[11-1] = REAL_MUL(tmp0, wi[11-1]); out2[6 +1] = REAL_MUL(tmp0, wi[6+1]); out2[0+1] += REAL_MUL(tmp1, wi[1]); out2[5-1] += REAL_MUL(tmp1, wi[5-1]); } DCT12_PART2 out2[11-0] = REAL_MUL(in2, wi[11-0]); out2[6 +0] = REAL_MUL(in2, wi[6+0]); out2[6 +2] = REAL_MUL(in3, wi[6+2]); out2[11-2] = REAL_MUL(in3, wi[11-2]); out2[0+0] += REAL_MUL(in0, wi[0]); out2[5-0] += REAL_MUL(in0, wi[5-0]); out2[0+2] += REAL_MUL(in4, wi[2]); out2[5-2] += REAL_MUL(in4, wi[5-2]); } } static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT], int ch,struct gr_info_s *gr_info, mpg123_handle *fr) { real (*block)[2][SBLIMIT*SSLIMIT] = fr->hybrid_block; int *blc = fr->hybrid_blc; real *tspnt = (real *) tsOut; real *rawout1,*rawout2; int bt = 0; size_t sb = 0; { int b = blc[ch]; rawout1=block[b][ch]; b=-b+1; rawout2=block[b][ch]; blc[ch] = b; } if(gr_info->mixed_block_flag) { sb = 2; opt_dct36(fr)(fsIn[0],rawout1,rawout2,win[0],tspnt); opt_dct36(fr)(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1); rawout1 += 36; rawout2 += 36; tspnt += 2; } bt = gr_info->block_type; if(bt == 2) { for(; sbmaxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) { dct12(fsIn[sb] ,rawout1 ,rawout2 ,win[2] ,tspnt); dct12(fsIn[sb+1],rawout1+18,rawout2+18,win1[2],tspnt+1); } } else { for(; sbmaxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) { opt_dct36(fr)(fsIn[sb],rawout1,rawout2,win[bt],tspnt); opt_dct36(fr)(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1); } } for(;sbstereo; int single = fr->single; int ms_stereo,i_stereo; int sfreq = fr->sampling_frequency; int stereo1,granules; if(stereo == 1) { /* stream is mono */ stereo1 = 1; single = SINGLE_LEFT; } else if(single != SINGLE_STEREO) /* stream is stereo, but force to mono */ stereo1 = 1; else stereo1 = 2; if(fr->mode == MPG_MD_JOINT_STEREO) { ms_stereo = (fr->mode_ext & 0x2)>>1; i_stereo = fr->mode_ext & 0x1; } else ms_stereo = i_stereo = 0; granules = fr->lsf ? 1 : 2; /* quick hack to keep the music playing */ /* after having seen this nasty test file... */ if(III_get_side_info(fr, &sideinfo,stereo,ms_stereo,sfreq,single)) { if(NOQUIET) error("bad frame - unable to get valid sideinfo"); return clip; } set_pointer(fr,sideinfo.main_data_begin); for(gr=0;grlayer3.hybrid_in; /* hybridOut[2][SSLIMIT][SBLIMIT] */ real (*hybridOut)[SSLIMIT][SBLIMIT] = fr->layer3.hybrid_out; { struct gr_info_s *gr_info = &(sideinfo.ch[0].gr[gr]); long part2bits; if(fr->lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[0],gr_info,0); else part2bits = III_get_scale_factors_1(fr, scalefacs[0],gr_info,0,gr); if(III_dequantize_sample(fr, hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits)) { if(VERBOSE2) error("dequantization failed!"); return clip; } } if(stereo == 2) { struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]); long part2bits; if(fr->lsf) part2bits = III_get_scale_factors_2(fr, scalefacs[1],gr_info,i_stereo); else part2bits = III_get_scale_factors_1(fr, scalefacs[1],gr_info,1,gr); if(III_dequantize_sample(fr, hybridIn[1],scalefacs[1],gr_info,sfreq,part2bits)) { if(VERBOSE2) error("dequantization failed!"); return clip; } if(ms_stereo) { int i; unsigned int maxb = sideinfo.ch[0].gr[gr].maxb; if(sideinfo.ch[1].gr[gr].maxb > maxb) maxb = sideinfo.ch[1].gr[gr].maxb; for(i=0;ilsf); if(ms_stereo || i_stereo || (single == SINGLE_MIX) ) { if(gr_info->maxb > sideinfo.ch[0].gr[gr].maxb) sideinfo.ch[0].gr[gr].maxb = gr_info->maxb; else gr_info->maxb = sideinfo.ch[0].gr[gr].maxb; } switch(single) { case SINGLE_MIX: { register int i; register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; for(i=0;imaxb;i++,in0++) *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */ } break; case SINGLE_RIGHT: { register int i; register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; for(i=0;imaxb;i++) *in0++ = *in1++; } break; } } for(ch=0;chaf.encoding != MPG123_ENC_SIGNED_16 || fr->down_sample != 0) { #endif for(ss=0;sssynth_mono)(hybridOut[0][ss], fr); else clip += (fr->synth_stereo)(hybridOut[0][ss], hybridOut[1][ss], fr); } #ifdef OPT_I486 } else { /* Only stereo, 16 bits benefit from the 486 optimization. */ ss=0; while(ss < SSLIMIT) { int n; n=(fr->buffer.size - fr->buffer.fill) / (2*2*32); if(n > (SSLIMIT-ss)) n=SSLIMIT-ss; /* Clip counting makes no sense with this function. */ absynth_1to1_i486(hybridOut[0][ss], 0, fr, n); absynth_1to1_i486(hybridOut[1][ss], 1, fr, n); ss+=n; fr->buffer.fill+=(2*2*32)*n; } } #endif } return clip; } welle.io-2.1/src/libs/mpg123/lfs_alias.c000066400000000000000000000221641357201522000177260ustar00rootroot00000000000000/* lfs_alias: Aliases to the small/native API functions with the size of long int as suffix. copyright 2010-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Thomas Orgis Use case: Client code on Linux/x86-64 that defines _FILE_OFFSET_BITS to 64, which is the only choice on that platform anyway. It should be no-op, but prompts the platform-agnostic header of mpg123 to define API calls with the corresponding suffix. This file provides the names for this case. It's cruft, but glibc does it, too -- so people rely on it. Oh, and it also caters for the lunatics that define _FILE_OFFSET_BITS=32 on 32 bit platforms. In addition, it's needed for platforms that always have off_t /= long, and clients still insisting on defining _FILE_OFFSET_BITS. Depending on use case, the aliases map to 32 (small) or 64 bit (large) offset functions, to the ones from libmpg123 or the ones from lfs_wrap. So, two basic cases: 1. mpg123_bla_32 alias for mpg123_bla (native) 2. mpg123_bla alias for mpg123_bla_32 (wrapper) Same for 64 bits. Confusing, I know. It sucks. Note that the mpg123 header is _not_ used here to avoid definition with whacky off_t. The aliases are always about arguments of native alias_t type. This can be off_t, but on Linux/x86, this is long int. The off_t declarations in mpg123.h confuse things, so reproduce definitions for the wrapper functions in that case. The definitions are pulled by an inline Perl script in any case ... no need to copy anything manually! As a benefit, one can skip undefining possible largefile namings. */ #include "config.h" /* Hack for Solaris: Some system headers included from compat.h might force _FILE_OFFSET_BITS. Need to follow that here. Also, want it around to have types defined. */ #include "compat.h" #ifndef LFS_ALIAS_BITS #error "I need the count of alias bits here." #endif #define MACROCAT_REALLY(a, b) a ## b #define MACROCAT(a, b) MACROCAT_REALLY(a, b) /* This is wicked switchery: Decide which way the aliases are facing. */ #if _FILE_OFFSET_BITS+0 == LFS_ALIAS_BITS /* The native functions have suffix, the aliases not. */ #define NATIVE_SUFFIX MACROCAT(_, _FILE_OFFSET_BITS) #define NATIVE_NAME(func) MACROCAT(func, NATIVE_SUFFIX) #define ALIAS_NAME(func) func #else /* The alias functions have suffix, the native ones not. */ #define ALIAS_SUFFIX MACROCAT(_, LFS_ALIAS_BITS) #define ALIAS_NAME(func) MACROCAT(func, ALIAS_SUFFIX) #define NATIVE_NAME(func) func #endif /* Copy of necessary definitions, actually just forward declarations. */ struct mpg123_handle_struct; typedef struct mpg123_handle_struct mpg123_handle; /* Get attribute_align_arg, to stay safe. */ #include "abi_align.h" /* Extract the list of functions we need wrappers for, pregenerating the wrappers for simple cases (inline script for nedit): perl -ne ' if(/^\s*MPG123_EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/) { my $type = $1; my $name = $2; my $args = $3; next unless ($type =~ /off_t/ or $args =~ /off_t/ or ($name =~ /open/ and $name ne mpg123_open_feed)); $type =~ s/off_t/lfs_alias_t/g; my @nargs = (); $args =~ s/off_t/lfs_alias_t/g; foreach my $a (split(/,/, $args)) { $a =~ s/^.*\s\**([a-z_]+)$/$1/; push(@nargs, $a); } my $nargs = join(", ", @nargs); $nargs = "Human: figure me out." if($nargs =~ /\(/); print < #include #include #include "compat.h" #include "debug.h" /* Now, start off easy... translate simple API calls. I need to deal with these here: perl -ne ' if(/^\s*MPG123_EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/) { $type = $1; $name = $2; $args = $3; next unless ($type =~ /off_t/ or $args =~ /off_t/); print "$name\n" unless grep {$_ eq $name} ("mpg123_open", "mpg123_open_fd", "mpg123_open_handle", "mpg123_replace_reader", "mpg123_replace_reader_handle"); }' < mpg123.h.in mpg123_decode_frame mpg123_framebyframe_decode mpg123_framepos mpg123_tell mpg123_tellframe mpg123_tell_stream mpg123_seek mpg123_feedseek mpg123_seek_frame mpg123_timeframe mpg123_index mpg123_set_index mpg123_position mpg123_length mpg123_set_filesize mpg123_decode_raw ... that's experimental. Let's work on them in that order. */ /* I see that I will need custom data storage. Main use is for the replaced I/O later, but the seek table for small file offsets needs extra storage, too. */ /* The wrapper handle for descriptor and handle I/O. */ /* The handle is used for nothing (0), or one of these two modes of operation: */ #define IO_FD 1 /* Wrapping over callbacks operation on integer file descriptor. */ #define IO_HANDLE 2 /* Wrapping over custom handle callbacks. */ struct wrap_data { /* Storage for small offset index table. */ long *indextable; /* I/O handle stuff */ int iotype; /* IO_FD or IO_HANDLE */ /* Data for IO_FD. */ int fd; int my_fd; /* A descriptor that the wrapper code opened itself. */ /* The actual callbacks from the outside. */ ssize_t (*r_read) (int, void *, size_t); long (*r_lseek)(int, long, int); /* Data for IO_HANDLE. */ void* handle; ssize_t (*r_h_read)(void *, void *, size_t); long (*r_h_lseek)(void*, long, int); void (*h_cleanup)(void*); }; /* Cleanup I/O part of the handle handle... but not deleting the wrapper handle itself. That is stored in the frame and only deleted on mpg123_delete(). */ static void wrap_io_cleanup(void *handle) { struct wrap_data *ioh = handle; if(ioh->iotype == IO_HANDLE) { if(ioh->h_cleanup != NULL && ioh->handle != NULL) ioh->h_cleanup(ioh->handle); ioh->handle = NULL; } if(ioh->my_fd >= 0) { close(ioh->my_fd); ioh->my_fd = -1; } } /* Really finish off the handle... freeing all memory. */ static void wrap_destroy(void *handle) { struct wrap_data *wh = handle; wrap_io_cleanup(handle); if(wh->indextable != NULL) free(wh->indextable); free(wh); } /* More helper code... extract the special wrapper handle, possible allocate and initialize it. */ static struct wrap_data* wrap_get(mpg123_handle *mh) { struct wrap_data* whd; if(mh == NULL) return NULL; /* Access the private storage inside the mpg123 handle. The real callback functions and handles are stored there. */ if(mh->wrapperdata == NULL) { /* Create a new one. */ mh->wrapperdata = malloc(sizeof(struct wrap_data)); if(mh->wrapperdata == NULL) { mh->err = MPG123_OUT_OF_MEM; return NULL; } /* When we have wrapper data present, the callback for its proper cleanup is needed. */ mh->wrapperclean = wrap_destroy; whd = mh->wrapperdata; whd->indextable = NULL; whd->iotype = 0; whd->fd = -1; whd->my_fd = -1; whd->r_read = NULL; whd->r_lseek = NULL; whd->handle = NULL; whd->r_h_read = NULL; whd->r_h_lseek = NULL; whd->h_cleanup = NULL; } else whd = mh->wrapperdata; return whd; } /* After settling the data... start with some simple wrappers. */ #undef mpg123_decode_frame /* int mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes) */ int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes) { off_t largenum; int err; err = MPG123_LARGENAME(mpg123_decode_frame)(mh, &largenum, audio, bytes); if(err == MPG123_OK && num != NULL) { *num = largenum; if(*num != largenum) { mh->err = MPG123_LFS_OVERFLOW; err = MPG123_ERR; } } return err; } #undef mpg123_framebyframe_decode /* int mpg123_framebyframe_decode(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes); */ int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes) { off_t largenum; int err; err = MPG123_LARGENAME(mpg123_framebyframe_decode)(mh, &largenum, audio, bytes); if(err == MPG123_OK && num != NULL) { *num = largenum; if(*num != largenum) { mh->err = MPG123_LFS_OVERFLOW; err = MPG123_ERR; } } return err; } #undef mpg123_framepos /* off_t mpg123_framepos(mpg123_handle *mh); */ long attribute_align_arg mpg123_framepos(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_framepos)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_tell /* off_t mpg123_tell(mpg123_handle *mh); */ long attribute_align_arg mpg123_tell(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_tell)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_tellframe /* off_t mpg123_tellframe(mpg123_handle *mh); */ long attribute_align_arg mpg123_tellframe(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_tellframe)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_tell_stream /* off_t mpg123_tell_stream(mpg123_handle *mh); */ long attribute_align_arg mpg123_tell_stream(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_tell_stream)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_seek /* off_t mpg123_seek(mpg123_handle *mh, off_t sampleoff, int whence); */ long attribute_align_arg mpg123_seek(mpg123_handle *mh, long sampleoff, int whence) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_seek)(mh, sampleoff, whence); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_feedseek /* off_t mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset); */ long attribute_align_arg mpg123_feedseek(mpg123_handle *mh, long sampleoff, int whence, long *input_offset) { long val; off_t largeioff; off_t largeval; largeval = MPG123_LARGENAME(mpg123_feedseek)(mh, sampleoff, whence, &largeioff); /* Error/message codes are small... */ if(largeval < 0) return (long)largeval; val = largeval; *input_offset = largeioff; if(val != largeval || *input_offset != largeioff) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_seek_frame /* off_t mpg123_seek_frame(mpg123_handle *mh, off_t frameoff, int whence); */ long attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, long frameoff, int whence) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_seek_frame)(mh, frameoff, whence); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_timeframe /* off_t mpg123_timeframe(mpg123_handle *mh, double sec); */ long attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double sec) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_timeframe)(mh, sec); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } /* Now something less simple: Index retrieval and manipulation. The index is an _array_ of off_t, which means that I need to construct a copy with translated long values. */ #undef mpg123_index /* int mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill) */ int attribute_align_arg mpg123_index(mpg123_handle *mh, long **offsets, long *step, size_t *fill) { int err; size_t i; long smallstep; size_t thefill; off_t largestep; off_t *largeoffsets; struct wrap_data *whd; whd = wrap_get(mh); if(whd == NULL) return MPG123_ERR; err = MPG123_LARGENAME(mpg123_index)(mh, &largeoffsets, &largestep, &thefill); if(err != MPG123_OK) return err; /* For a _very_ large file, even the step could overflow. */ smallstep = largestep; if(smallstep != largestep) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } if(step != NULL) *step = smallstep; /* When there are no values stored, there is no table content to take care of. Table pointer does not matter. Mission completed. */ if(thefill == 0) return MPG123_OK; if(fill != NULL) *fill = thefill; /* Construct a copy of the index to hand over to the small-minded client. */ *offsets = safe_realloc(whd->indextable, (*fill)*sizeof(long)); if(*offsets == NULL) { mh->err = MPG123_OUT_OF_MEM; return MPG123_ERR; } whd->indextable = *offsets; /* Elaborate conversion of each index value, with overflow check. */ for(i=0; i<*fill; ++i) { whd->indextable[i] = largeoffsets[i]; if(whd->indextable[i] != largeoffsets[i]) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } } /* If we came that far... there should be a valid copy of the table now. */ return MPG123_OK; } /* The writing does basically the same than the above, just the opposite. Oh, and the overflow checks are not needed -- off_t is bigger than long. */ #undef mpg123_set_index /* int mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill); */ int attribute_align_arg mpg123_set_index(mpg123_handle *mh, long *offsets, long step, size_t fill) { int err; size_t i; struct wrap_data *whd; off_t *indextmp; whd = wrap_get(mh); if(whd == NULL) return MPG123_ERR; /* Expensive temporary storage... for staying outside at the API layer. */ indextmp = malloc(fill*sizeof(off_t)); if(indextmp == NULL) { mh->err = MPG123_OUT_OF_MEM; return MPG123_ERR; } if(fill > 0 && offsets == NULL) { mh->err = MPG123_BAD_INDEX_PAR; err = MPG123_ERR; } else { /* Fill the large-file copy of the provided index, then feed it to mpg123. */ for(i=0; ierr = MPG123_LFS_OVERFLOW; return MPG123_ERR; } if(current_frame != NULL) *current_frame = small_curframe; if(frames_left != NULL) *frames_left = small_frameleft; return MPG123_OK; } #undef mpg123_framelength /* off_t mpg123_framelength(mpg123_handle *mh); */ long attribute_align_arg mpg123_framelength(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_framelength)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } #undef mpg123_length /* off_t mpg123_length(mpg123_handle *mh); */ long attribute_align_arg mpg123_length(mpg123_handle *mh) { long val; off_t largeval; largeval = MPG123_LARGENAME(mpg123_length)(mh); val = largeval; if(val != largeval) { mh->err = MPG123_LFS_OVERFLOW; return MPG123_ERR; } return val; } /* The simplest wrapper of all... */ #undef mpg123_set_filesize /* int mpg123_set_filesize(mpg123_handle *mh, off_t size); */ int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, long size) { return MPG123_LARGENAME(mpg123_set_filesize)(mh, size); } /* ========================================= THE BOUNDARY OF SANITY Behold, stranger! ========================================= */ /* The messy part: Replacement of I/O core (actally, this is only due to lseek()). Both descriptor and handle replaced I/O are mapped to replaced handle I/O, the handle wrapping over the actual callbacks and the actual handle/descriptor. You got multiple levels of handles and callbacks to think about. Have fun reading and comprehending. */ /* Could go into compat.h ... Windows needs that flag. */ #ifndef O_BINARY #define O_BINARY 0 #endif /* Read callback needs nothing special. */ ssize_t wrap_read(void* handle, void *buf, size_t count) { struct wrap_data *ioh = handle; switch(ioh->iotype) { case IO_FD: return ioh->r_read(ioh->fd, buf, count); case IO_HANDLE: return ioh->r_h_read(ioh->handle, buf, count); } error("Serious breakage - bad IO type in LFS wrapper!"); return -1; } /* Seek callback needs protection from too big offsets. */ off_t wrap_lseek(void *handle, off_t offset, int whence) { struct wrap_data *ioh = handle; long smalloff = offset; if(smalloff == offset) { switch(ioh->iotype) { case IO_FD: return ioh->r_lseek(ioh->fd, smalloff, whence); case IO_HANDLE: return ioh->r_h_lseek(ioh->handle, smalloff, whence); } error("Serious breakage - bad IO type in LFS wrapper!"); return -1; } else { errno = EOVERFLOW; return -1; } } /* Now, let's replace the API dealing with replacement I/O. Start with undefining the renames... */ #undef mpg123_replace_reader #undef mpg123_replace_reader_handle #undef mpg123_open #undef mpg123_open_fd #undef mpg123_open_handle /* Normal reader replacement needs fallback implementations. */ static ssize_t fallback_read(int fd, void *buf, size_t count) { return read(fd, buf, count); } static long fallback_lseek(int fd, long offset, int whence) { /* Since the offset is long int already, the returned value really should fit into a long... but whatever. */ long newpos_long; off_t newpos; newpos = lseek(fd, offset, whence); newpos_long = newpos; if(newpos_long == newpos) return newpos_long; else { errno = EOVERFLOW; return -1; } } /* Reader replacement prepares the hidden handle storage for next mpg123_open_fd() or plain mpg123_open(). */ int attribute_align_arg mpg123_replace_reader(mpg123_handle *mh, ssize_t (*r_read) (int, void *, size_t), long (*r_lseek)(int, long, int) ) { struct wrap_data* ioh; if(mh == NULL) return MPG123_ERR; mpg123_close(mh); ioh = wrap_get(mh); if(ioh == NULL) return MPG123_ERR; /* If both callbacks are NULL, switch totally to internal I/O, else just use fallback for at most half of them. */ if(r_read == NULL && r_lseek == NULL) { /* Only the type is actually important to disable the code. */ ioh->iotype = 0; ioh->fd = -1; ioh->r_read = NULL; ioh->r_lseek = NULL; } else { ioh->iotype = IO_FD; ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */ ioh->r_read = r_read != NULL ? r_read : fallback_read; ioh->r_lseek = r_lseek != NULL ? r_lseek : fallback_lseek; } /* The real reader replacement will happen while opening. */ return MPG123_OK; } int attribute_align_arg mpg123_replace_reader_handle(mpg123_handle *mh, ssize_t (*r_read) (void*, void *, size_t), long (*r_lseek)(void*, long, int), void (*cleanup)(void*)) { struct wrap_data* ioh; if(mh == NULL) return MPG123_ERR; mpg123_close(mh); ioh = wrap_get(mh); if(ioh == NULL) return MPG123_ERR; ioh->iotype = IO_HANDLE; ioh->handle = NULL; ioh->r_h_read = r_read; ioh->r_h_lseek = r_lseek; ioh->h_cleanup = cleanup; /* The real reader replacement will happen while opening. */ return MPG123_OK; } /* The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. Two cases to consider: 1. Plain normal open using internal I/O. 2. Client called mpg123_replace_reader() before. The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it. */ int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path) { struct wrap_data* ioh; if(mh == NULL) return MPG123_ERR; ioh = mh->wrapperdata; /* Mimic the use of mpg123_replace_reader() functions by lower levels... IO_HANDLE is not valid here, though. Only IO_FD. */ if(ioh != NULL && ioh->iotype == IO_FD) { int err; err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); if(err != MPG123_OK) return MPG123_ERR; /* The above call implied mpg123_close() already */ /* I really need to open the file here... to be able to use the replacer handle I/O ... my_fd is used to indicate closing of the descriptor on cleanup. */ ioh->my_fd = compat_open(path, O_RDONLY|O_BINARY); if(ioh->my_fd < 0) { if(!(mh->p.flags & MPG123_QUIET)) error2("Cannot open file %s: %s", path, strerror(errno)); mh->err = MPG123_BAD_FILE; return MPG123_ERR; } /* Store a copy of the descriptor where it is actually used. */ ioh->fd = ioh->my_fd; /* Initiate I/O operating on my handle now. */ err = open_stream_handle(mh, ioh); if(err != MPG123_OK) { wrap_io_cleanup(ioh); return MPG123_ERR; } /* All fine... */ return MPG123_OK; } else return MPG123_LARGENAME(mpg123_open)(mh, path); } /* This is in fact very similar to the above: The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. Two cases to consider: 1. Plain normal open_fd using internal I/O. 2. Client called mpg123_replace_reader() before. The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it. */ int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) { struct wrap_data* ioh; if(mh == NULL) return MPG123_ERR; mpg123_close(mh); ioh = mh->wrapperdata; if(ioh != NULL && ioh->iotype == IO_FD) { int err; err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); if(err != MPG123_OK) return MPG123_ERR; /* The above call implied mpg123_close() already */ /* Store the real file descriptor inside the handle. */ ioh->fd = fd; /* Initiate I/O operating on my handle now. */ err = open_stream_handle(mh, ioh); if(err != MPG123_OK) { wrap_io_cleanup(ioh); return MPG123_ERR; } /* All fine... */ return MPG123_OK; } else return MPG123_LARGENAME(mpg123_open_fd)(mh, fd); } int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *handle) { struct wrap_data* ioh; if(mh == NULL) return MPG123_ERR; mpg123_close(mh); ioh = mh->wrapperdata; if(ioh != NULL && ioh->iotype == IO_HANDLE && ioh->r_h_read != NULL) { /* Wrap the custom handle into my handle. */ int err; err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); if(err != MPG123_OK) return MPG123_ERR; ioh->handle = handle; /* No extra error handling, keep behaviour of the original open_handle. */ return open_stream_handle(mh, ioh); } else { /* This is an error ... you need to prepare the I/O before using it. */ mh->err = MPG123_BAD_CUSTOM_IO; return MPG123_ERR; } } welle.io-2.1/src/libs/mpg123/libmpg123.c000066400000000000000000001404441357201522000174730ustar00rootroot00000000000000/* libmpg123: MPEG Audio Decoder library copyright 1995-2014 by the mpg123 project - free software under the terms of the LGPL 2.1 see COPYING and AUTHORS files in distribution or http://mpg123.org */ #include "mpg123lib_intern.h" #include "icy2utf8.h" #include "debug.h" #include "gapless.h" /* Want accurate rounding function regardless of decoder setup. */ #define FORCE_ACCURATE #include "sample.h" #define SEEKFRAME(mh) ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe) static int initialized = 0; int attribute_align_arg mpg123_init(void) { if((sizeof(short) != 2) || (sizeof(long) < 4)) return MPG123_BAD_TYPES; if(initialized) return MPG123_OK; /* no need to initialize twice */ #ifndef NO_LAYER12 init_layer12(); /* inits also shared tables with layer1 */ #endif #ifndef NO_LAYER3 init_layer3(); #endif prepare_decode_tables(); check_decoders(); initialized = 1; #if (defined REAL_IS_FLOAT) && (defined IEEE_FLOAT) /* This is rather pointless but it eases my mind to check that we did not enable the special rounding on a VAX or something. */ if(12346 != REAL_TO_SHORT_ACCURATE(12345.67f)) { error("Bad IEEE 754 rounding. Re-build libmpg123 properly."); return MPG123_ERR; } #endif return MPG123_OK; } void attribute_align_arg mpg123_exit(void) { /* nothing yet, but something later perhaps */ } /* create a new handle with specified decoder, decoder can be "", "auto" or NULL for auto-detection */ mpg123_handle attribute_align_arg *mpg123_new(const char* decoder, int *error) { return mpg123_parnew(NULL, decoder, error); } /* ...the full routine with optional initial parameters to override defaults. */ mpg123_handle attribute_align_arg *mpg123_parnew(mpg123_pars *mp, const char* decoder, int *error) { mpg123_handle *fr = NULL; int err = MPG123_OK; if(initialized) fr = (mpg123_handle*) malloc(sizeof(mpg123_handle)); else err = MPG123_NOT_INITIALIZED; if(fr != NULL) { frame_init_par(fr, mp); debug("cpu opt setting"); if(frame_cpu_opt(fr, decoder) != 1) { err = MPG123_BAD_DECODER; frame_exit(fr); free(fr); fr = NULL; } } if(fr != NULL) { fr->decoder_change = 1; } else if(err == MPG123_OK) err = MPG123_OUT_OF_MEM; if(error != NULL) *error = err; return fr; } int attribute_align_arg mpg123_decoder(mpg123_handle *mh, const char* decoder) { enum optdec dt = dectype(decoder); if(mh == NULL) return MPG123_BAD_HANDLE; if(dt == nodec) { mh->err = MPG123_BAD_DECODER; return MPG123_ERR; } if(dt == mh->cpu_opts.type) return MPG123_OK; /* Now really change. */ /* frame_exit(mh); frame_init(mh); */ debug("cpu opt setting"); if(frame_cpu_opt(mh, decoder) != 1) { mh->err = MPG123_BAD_DECODER; frame_exit(mh); return MPG123_ERR; } /* New buffers for decoder are created in frame_buffers() */ if((frame_outbuffer(mh) != 0)) { mh->err = MPG123_NO_BUFFERS; frame_exit(mh); return MPG123_ERR; } /* Do _not_ call decode_update here! That is only allowed after a first MPEG frame has been met. */ mh->decoder_change = 1; return MPG123_OK; } int attribute_align_arg mpg123_param(mpg123_handle *mh, enum mpg123_parms key, long val, double fval) { int r; if(mh == NULL) return MPG123_BAD_HANDLE; r = mpg123_par(&mh->p, key, val, fval); if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } else { /* Special treatment for some settings. */ #ifdef FRAME_INDEX if(key == MPG123_INDEX_SIZE) { /* Apply frame index size and grow property on the fly. */ r = frame_index_setup(mh); if(r != MPG123_OK) mh->err = MPG123_INDEX_FAIL; } #endif #ifndef NO_FEEDER /* Feeder pool size is applied right away, reader will react to that. */ if(key == MPG123_FEEDPOOL || key == MPG123_FEEDBUFFER) bc_poolsize(&mh->rdat.buffer, mh->p.feedpool, mh->p.feedbuffer); #endif } return r; } int attribute_align_arg mpg123_par(mpg123_pars *mp, enum mpg123_parms key, long val, double fval) { int ret = MPG123_OK; if(mp == NULL) return MPG123_BAD_PARS; switch(key) { case MPG123_VERBOSE: mp->verbose = val; break; case MPG123_FLAGS: #ifndef GAPLESS if(val & MPG123_GAPLESS) ret = MPG123_NO_GAPLESS; #endif if(ret == MPG123_OK) mp->flags = val; debug1("set flags to 0x%lx", (unsigned long) mp->flags); break; case MPG123_ADD_FLAGS: #ifndef GAPLESS /* Enabling of gapless mode doesn't work when it's not there, but disabling (below) is no problem. */ if(val & MPG123_GAPLESS) ret = MPG123_NO_GAPLESS; else #endif mp->flags |= val; debug1("set flags to 0x%lx", (unsigned long) mp->flags); break; case MPG123_REMOVE_FLAGS: mp->flags &= ~val; debug1("set flags to 0x%lx", (unsigned long) mp->flags); break; case MPG123_FORCE_RATE: /* should this trigger something? */ #ifdef NO_NTOM if(val > 0) ret = MPG123_BAD_RATE; #else if(val > 96000) ret = MPG123_BAD_RATE; else mp->force_rate = val < 0 ? 0 : val; /* >0 means enable, 0 disable */ #endif break; case MPG123_DOWN_SAMPLE: #ifdef NO_DOWNSAMPLE if(val != 0) ret = MPG123_BAD_RATE; #else if(val < 0 || val > 2) ret = MPG123_BAD_RATE; else mp->down_sample = (int)val; #endif break; case MPG123_RVA: if(val < 0 || val > MPG123_RVA_MAX) ret = MPG123_BAD_RVA; else mp->rva = (int)val; break; case MPG123_DOWNSPEED: mp->halfspeed = val < 0 ? 0 : val; break; case MPG123_UPSPEED: mp->doublespeed = val < 0 ? 0 : val; break; case MPG123_ICY_INTERVAL: #ifndef NO_ICY mp->icy_interval = val > 0 ? val : 0; #else if(val > 0) ret = MPG123_BAD_PARAM; #endif break; case MPG123_OUTSCALE: /* Choose the value that is non-zero, if any. Downscaling integers to 1.0 . */ mp->outscale = val == 0 ? fval : (double)val/SHORT_SCALE; break; case MPG123_TIMEOUT: #ifdef TIMEOUT_READ mp->timeout = val >= 0 ? val : 0; #else if(val > 0) ret = MPG123_NO_TIMEOUT; #endif break; case MPG123_RESYNC_LIMIT: mp->resync_limit = val; break; case MPG123_INDEX_SIZE: #ifdef FRAME_INDEX mp->index_size = val; #else ret = MPG123_NO_INDEX; #endif break; case MPG123_PREFRAMES: if(val >= 0) mp->preframes = val; else ret = MPG123_BAD_VALUE; break; case MPG123_FEEDPOOL: #ifndef NO_FEEDER if(val >= 0) mp->feedpool = val; else ret = MPG123_BAD_VALUE; #else ret = MPG123_MISSING_FEATURE; #endif break; case MPG123_FEEDBUFFER: #ifndef NO_FEEDER if(val > 0) mp->feedbuffer = val; else ret = MPG123_BAD_VALUE; #else ret = MPG123_MISSING_FEATURE; #endif break; default: ret = MPG123_BAD_PARAM; } return ret; } int attribute_align_arg mpg123_getparam(mpg123_handle *mh, enum mpg123_parms key, long *val, double *fval) { int r; if(mh == NULL) return MPG123_BAD_HANDLE; r = mpg123_getpar(&mh->p, key, val, fval); if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } return r; } int attribute_align_arg mpg123_getpar(mpg123_pars *mp, enum mpg123_parms key, long *val, double *fval) { int ret = 0; if(mp == NULL) return MPG123_BAD_PARS; switch(key) { case MPG123_VERBOSE: if(val) *val = mp->verbose; break; case MPG123_FLAGS: case MPG123_ADD_FLAGS: if(val) *val = mp->flags; break; case MPG123_FORCE_RATE: if(val) #ifdef NO_NTOM *val = 0; #else *val = mp->force_rate; #endif break; case MPG123_DOWN_SAMPLE: if(val) *val = mp->down_sample; break; case MPG123_RVA: if(val) *val = mp->rva; break; case MPG123_DOWNSPEED: if(val) *val = mp->halfspeed; break; case MPG123_UPSPEED: if(val) *val = mp->doublespeed; break; case MPG123_ICY_INTERVAL: #ifndef NO_ICY if(val) *val = (long)mp->icy_interval; #else if(val) *val = 0; #endif break; case MPG123_OUTSCALE: if(fval) *fval = mp->outscale; if(val) *val = (long)(mp->outscale*SHORT_SCALE); break; case MPG123_RESYNC_LIMIT: if(val) *val = mp->resync_limit; break; case MPG123_INDEX_SIZE: if(val) #ifdef FRAME_INDEX *val = mp->index_size; #else *val = 0; /* graceful fallback: no index is index of zero size */ #endif break; case MPG123_PREFRAMES: *val = mp->preframes; break; case MPG123_FEEDPOOL: #ifndef NO_FEEDER *val = mp->feedpool; #else ret = MPG123_MISSING_FEATURE; #endif break; case MPG123_FEEDBUFFER: #ifndef NO_FEEDER *val = mp->feedbuffer; #else ret = MPG123_MISSING_FEATURE; #endif break; default: ret = MPG123_BAD_PARAM; } return ret; } int attribute_align_arg mpg123_getstate(mpg123_handle *mh, enum mpg123_state key, long *val, double *fval) { int ret = MPG123_OK; long theval = 0; double thefval = 0.; if(mh == NULL) return MPG123_BAD_HANDLE; switch(key) { case MPG123_ACCURATE: theval = mh->state_flags & FRAME_ACCURATE; break; case MPG123_FRANKENSTEIN: theval = mh->state_flags & FRAME_FRANKENSTEIN; break; case MPG123_BUFFERFILL: #ifndef NO_FEEDER { size_t sval = bc_fill(&mh->rdat.buffer); theval = (long)sval; if(theval < 0 || (size_t)theval != sval) { mh->err = MPG123_INT_OVERFLOW; ret = MPG123_ERR; } } #else mh->err = MPG123_MISSING_FEATURE; ret = MPG123_ERR; #endif break; case MPG123_FRESH_DECODER: theval = mh->state_flags & FRAME_FRESH_DECODER; mh->state_flags &= ~FRAME_FRESH_DECODER; break; default: mh->err = MPG123_BAD_KEY; ret = MPG123_ERR; } if(val != NULL) *val = theval; if(fval != NULL) *fval = thefval; return ret; } int attribute_align_arg mpg123_eq(mpg123_handle *mh, enum mpg123_channels channel, int band, double val) { #ifndef NO_EQUALIZER if(mh == NULL) return MPG123_BAD_HANDLE; if(band < 0 || band > 31){ mh->err = MPG123_BAD_BAND; return MPG123_ERR; } switch(channel) { case MPG123_LEFT|MPG123_RIGHT: mh->equalizer[0][band] = mh->equalizer[1][band] = DOUBLE_TO_REAL(val); break; case MPG123_LEFT: mh->equalizer[0][band] = DOUBLE_TO_REAL(val); break; case MPG123_RIGHT: mh->equalizer[1][band] = DOUBLE_TO_REAL(val); break; default: mh->err=MPG123_BAD_CHANNEL; return MPG123_ERR; } mh->have_eq_settings = TRUE; #endif return MPG123_OK; } double attribute_align_arg mpg123_geteq(mpg123_handle *mh, enum mpg123_channels channel, int band) { double ret = 0.; #ifndef NO_EQUALIZER /* Handle this gracefully. When there is no band, it has no volume. */ if(mh != NULL && band > -1 && band < 32) switch(channel) { case MPG123_LEFT|MPG123_RIGHT: ret = 0.5*(REAL_TO_DOUBLE(mh->equalizer[0][band])+REAL_TO_DOUBLE(mh->equalizer[1][band])); break; case MPG123_LEFT: ret = REAL_TO_DOUBLE(mh->equalizer[0][band]); break; case MPG123_RIGHT: ret = REAL_TO_DOUBLE(mh->equalizer[1][band]); break; /* Default case is already handled: ret = 0 */ } #endif return ret; } /* plain file access, no http! */ int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); return open_stream(mh, path, -1); } int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); return open_stream(mh, NULL, fd); } int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); if(mh->rdat.r_read_handle == NULL) { mh->err = MPG123_BAD_CUSTOM_IO; return MPG123_ERR; } return open_stream_handle(mh, iohandle); } int attribute_align_arg mpg123_open_feed(mpg123_handle *mh) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); return open_feed(mh); } int attribute_align_arg mpg123_replace_reader( mpg123_handle *mh, ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) ) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); mh->rdat.r_read = r_read; mh->rdat.r_lseek = r_lseek; return MPG123_OK; } int attribute_align_arg mpg123_replace_reader_handle( mpg123_handle *mh, ssize_t (*r_read) (void*, void *, size_t), off_t (*r_lseek)(void*, off_t, int), void (*cleanup)(void*) ) { if(mh == NULL) return MPG123_BAD_HANDLE; mpg123_close(mh); mh->rdat.r_read_handle = r_read; mh->rdat.r_lseek_handle = r_lseek; mh->rdat.cleanup_handle = cleanup; return MPG123_OK; } /* Update decoding engine for a) a new choice of decoder b) a changed native format of the MPEG stream ... calls are only valid after parsing some MPEG frame! */ int decode_update(mpg123_handle *mh) { long native_rate; int b; if(mh->num < 0) { if(!(mh->p.flags & MPG123_QUIET)) error("decode_update() has been called before reading the first MPEG frame! Internal programming error."); mh->err = MPG123_BAD_DECODER_SETUP; return MPG123_ERR; } mh->state_flags |= FRAME_FRESH_DECODER; native_rate = frame_freq(mh); b = frame_output_format(mh); /* Select the new output format based on given constraints. */ if(b < 0) return MPG123_ERR; if(b == 1) mh->new_format = 1; /* Store for later... */ debug3("updating decoder structure with native rate %li and af.rate %li (new format: %i)", native_rate, mh->af.rate, mh->new_format); if(mh->af.rate == native_rate) mh->down_sample = 0; else if(mh->af.rate == native_rate>>1) mh->down_sample = 1; else if(mh->af.rate == native_rate>>2) mh->down_sample = 2; else mh->down_sample = 3; /* flexible (fixed) rate */ switch(mh->down_sample) { case 0: case 1: case 2: mh->down_sample_sblimit = SBLIMIT>>(mh->down_sample); /* With downsampling I get less samples per frame */ mh->outblock = outblock_bytes(mh, (mh->spf>>mh->down_sample)); break; #ifndef NO_NTOM case 3: { if(synth_ntom_set_step(mh) != 0) return -1; if(frame_freq(mh) > mh->af.rate) { mh->down_sample_sblimit = SBLIMIT * mh->af.rate; mh->down_sample_sblimit /= frame_freq(mh); } else mh->down_sample_sblimit = SBLIMIT; mh->outblock = outblock_bytes(mh, ( ( NTOM_MUL-1+mh->spf * (((size_t)NTOM_MUL*mh->af.rate)/frame_freq(mh)) )/NTOM_MUL )); } break; #endif } if(!(mh->p.flags & MPG123_FORCE_MONO)) { if(mh->af.channels == 1) mh->single = SINGLE_MIX; else mh->single = SINGLE_STEREO; } else mh->single = (mh->p.flags & MPG123_FORCE_MONO)-1; if(set_synth_functions(mh) != 0) return -1;; /* The needed size of output buffer may have changed. */ if(frame_outbuffer(mh) != MPG123_OK) return -1; do_rva(mh); debug3("done updating decoder structure with native rate %li and af.rate %li and down_sample %i", frame_freq(mh), mh->af.rate, mh->down_sample); return 0; } size_t attribute_align_arg mpg123_safe_buffer(void) { /* real is the largest possible output (it's 32bit float, 32bit int or 64bit double). */ return sizeof(real)*2*1152*NTOM_MAX; } size_t attribute_align_arg mpg123_outblock(mpg123_handle *mh) { /* Try to be helpful and never return zero output block size. */ if(mh != NULL && mh->outblock > 0) return mh->outblock; else return mpg123_safe_buffer(); } /* Read in the next frame we actually want for decoding. This includes skipping/ignoring frames, in additon to skipping junk in the parser. */ static int get_next_frame(mpg123_handle *mh) { int change = mh->decoder_change; /* Ensure we got proper decoder for ignoring frames. Header can be changed from seeking around. But be careful: Only after at least one frame got read, decoder update makes sense. */ if(mh->header_change > 1 && mh->num >= 0) { change = 1; mh->header_change = 0; debug("starting with big header change"); if(decode_update(mh) < 0) return MPG123_ERR; } do { int b; /* Decode & discard some frame(s) before beginning. */ if(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe) { debug1("ignoring frame %li", (long)mh->num); /* Decoder structure must be current! decode_update has been called before... */ (mh->do_layer)(mh); mh->buffer.fill = 0; #ifndef NO_NTOM /* The ignored decoding may have failed. Make sure ntom stays consistent. */ if(mh->down_sample == 3) ntom_set_ntom(mh, mh->num+1); #endif mh->to_ignore = mh->to_decode = FALSE; } /* Read new frame data; possibly breaking out here for MPG123_NEED_MORE. */ debug("read frame"); mh->to_decode = FALSE; b = read_frame(mh); /* That sets to_decode only if a full frame was read. */ debug4("read of frame %li returned %i (to_decode=%i) at sample %li", (long)mh->num, b, mh->to_decode, (long)mpg123_tell(mh)); if(b == MPG123_NEED_MORE) return MPG123_NEED_MORE; /* need another call with data */ else if(b <= 0) { /* More sophisticated error control? */ if(b==0 || (mh->rdat.filelen >= 0 && mh->rdat.filepos == mh->rdat.filelen)) { /* We simply reached the end. */ mh->track_frames = mh->num + 1; debug("What about updating/checking gapless sample count here?"); return MPG123_DONE; } else return MPG123_ERR; /* Some real error. */ } /* Now, there should be new data to decode ... and also possibly new stream properties */ if(mh->header_change > 1) { debug("big header change"); change = 1; mh->header_change = 0; /* Need to update decoder structure right away since frame might need to be decoded on next loop iteration for properly ignoring its output. */ if(decode_update(mh) < 0) return MPG123_ERR; } /* Now some accounting: Look at the numbers and decide if we want this frame. */ ++mh->playnum; /* Plain skipping without decoding, only when frame is not ignored on next cycle. */ if(mh->num < mh->firstframe || (mh->p.doublespeed && (mh->playnum % mh->p.doublespeed))) { if(!(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe)) { frame_skip(mh); /* Should one fix NtoM here or not? It is not work the trouble for doublespeed, but what with leading frames? */ } } /* Or, we are finally done and have a new frame. */ else break; } while(1); /* If we reach this point, we got a new frame ready to be decoded. All other situations resulted in returns from the loop. */ if(change) { mh->decoder_change = 0; if(mh->fresh) { #ifdef GAPLESS int b=0; /* Prepare offsets for gapless decoding. */ debug1("preparing gapless stuff with native rate %li", frame_freq(mh)); frame_gapless_realinit(mh); frame_set_frameseek(mh, mh->num); #endif mh->fresh = 0; #ifdef GAPLESS /* Could this possibly happen? With a real big gapless offset... */ if(mh->num < mh->firstframe) b = get_next_frame(mh); if(b < 0) return b; /* Could be error, need for more, new format... */ #endif } } return MPG123_OK; } /* Assumption: A buffer full of zero samples can be constructed by repetition of this byte. Oh, and it handles some format conversion. Only to be used by decode_the_frame() ... */ static int zero_byte(mpg123_handle *fr) { #ifndef NO_8BIT return fr->af.encoding & MPG123_ENC_8 ? fr->conv16to8[0] : 0; #else return 0; /* All normal signed formats have the zero here (even in byte form -- that may be an assumption for your funny machine...). */ #endif } /* Not part of the api. This just decodes the frame and fills missing bits with zeroes. There can be frames that are broken and thus make do_layer() fail. */ static void decode_the_frame(mpg123_handle *fr) { size_t needed_bytes = decoder_synth_bytes(fr, frame_expect_outsamples(fr)); fr->clip += (fr->do_layer)(fr); /*fprintf(stderr, "frame %"OFF_P": got %"SIZE_P" / %"SIZE_P"\n", fr->num,(size_p)fr->buffer.fill, (size_p)needed_bytes);*/ /* There could be less data than promised. Also, then debugging, we look out for coding errors that could result in _more_ data than expected. */ #ifdef DEBUG if(fr->buffer.fill != needed_bytes) { #endif if(fr->buffer.fill < needed_bytes) { if(VERBOSE2) fprintf(stderr, "Note: broken frame %li, filling up with %"SIZE_P" zeroes, from %"SIZE_P"\n", (long)fr->num, (size_p)(needed_bytes-fr->buffer.fill), (size_p)fr->buffer.fill); /* One could do a loop with individual samples instead... but zero is zero Actually, that is wrong: zero is mostly a series of null bytes, but we have funny 8bit formats that have a different opinion on zero... Unsigned 16 or 32 bit formats are handled later. */ memset( fr->buffer.data + fr->buffer.fill, zero_byte(fr), needed_bytes - fr->buffer.fill ); fr->buffer.fill = needed_bytes; #ifndef NO_NTOM /* ntom_val will be wrong when the decoding wasn't carried out completely */ ntom_set_ntom(fr, fr->num+1); #endif } #ifdef DEBUG else { if(NOQUIET) error2("I got _more_ bytes than expected (%"SIZE_P" / %"SIZE_P"), that should not be possible!", (size_p)fr->buffer.fill, (size_p)needed_bytes); } } #endif postprocess_buffer(fr); } /* Decode the current frame into the frame structure's buffer, accessible at the location stored in