diff options
-rw-r--r-- | .gitmodules | 8 | ||||
m--------- | externals/opus | 0 | ||||
-rw-r--r-- | externals/opus/CMakeLists.txt | 250 | ||||
m--------- | externals/opus/opus | 0 | ||||
-rw-r--r-- | src/video_core/morton.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.cpp | 1 | ||||
-rw-r--r-- | src/video_core/surface.cpp | 8 | ||||
-rw-r--r-- | src/video_core/surface.h | 16 |
8 files changed, 276 insertions, 9 deletions
diff --git a/.gitmodules b/.gitmodules index 35e0d1240..ee0dc6c19 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,11 +26,11 @@ path = externals/mbedtls url = https://github.com/DarkLordZach/mbedtls [submodule "opus"] - path = externals/opus - url = https://github.com/ogniK5377/opus.git + path = externals/opus/opus + url = https://github.com/xiph/opus.git [submodule "soundtouch"] - path = externals/soundtouch - url = https://github.com/citra-emu/ext-soundtouch.git + path = externals/soundtouch + url = https://github.com/citra-emu/ext-soundtouch.git [submodule "libressl"] path = externals/libressl url = https://github.com/citra-emu/ext-libressl-portable.git diff --git a/externals/opus b/externals/opus deleted file mode 160000 -Subproject 562f8ba555c4181e1b57e82e496e4a959b9c019 diff --git a/externals/opus/CMakeLists.txt b/externals/opus/CMakeLists.txt new file mode 100644 index 000000000..cbb393272 --- /dev/null +++ b/externals/opus/CMakeLists.txt @@ -0,0 +1,250 @@ +cmake_minimum_required(VERSION 3.8) + +project(opus) + +option(OPUS_STACK_PROTECTOR "Use stack protection" OFF) +option(OPUS_USE_ALLOCA "Use alloca for stack arrays (on non-C99 compilers)" OFF) +option(OPUS_CUSTOM_MODES "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames" OFF) +option(OPUS_FIXED_POINT "Compile as fixed-point (for machines without a fast enough FPU)" OFF) +option(OPUS_ENABLE_FLOAT_API "Compile with the floating point API (for machines with float library" ON) + +include(opus/opus_functions.cmake) + +if(OPUS_STACK_PROTECTOR) + if(NOT MSVC) # GC on by default on MSVC + check_and_set_flag(STACK_PROTECTION_STRONG -fstack-protector-strong) + endif() +else() + if(MSVC) + check_and_set_flag(BUFFER_SECURITY_CHECK /GS-) + endif() +endif() + +add_library(opus STATIC + # CELT sources + opus/celt/bands.c + opus/celt/celt.c + opus/celt/celt_decoder.c + opus/celt/celt_encoder.c + opus/celt/celt_lpc.c + opus/celt/cwrs.c + opus/celt/entcode.c + opus/celt/entdec.c + opus/celt/entenc.c + opus/celt/kiss_fft.c + opus/celt/laplace.c + opus/celt/mathops.c + opus/celt/mdct.c + opus/celt/modes.c + opus/celt/pitch.c + opus/celt/quant_bands.c + opus/celt/rate.c + opus/celt/vq.c + + # SILK sources + opus/silk/A2NLSF.c + opus/silk/CNG.c + opus/silk/HP_variable_cutoff.c + opus/silk/LPC_analysis_filter.c + opus/silk/LPC_fit.c + opus/silk/LPC_inv_pred_gain.c + opus/silk/LP_variable_cutoff.c + opus/silk/NLSF2A.c + opus/silk/NLSF_VQ.c + opus/silk/NLSF_VQ_weights_laroia.c + opus/silk/NLSF_decode.c + opus/silk/NLSF_del_dec_quant.c + opus/silk/NLSF_encode.c + opus/silk/NLSF_stabilize.c + opus/silk/NLSF_unpack.c + opus/silk/NSQ.c + opus/silk/NSQ_del_dec.c + opus/silk/PLC.c + opus/silk/VAD.c + opus/silk/VQ_WMat_EC.c + opus/silk/ana_filt_bank_1.c + opus/silk/biquad_alt.c + opus/silk/bwexpander.c + opus/silk/bwexpander_32.c + opus/silk/check_control_input.c + opus/silk/code_signs.c + opus/silk/control_SNR.c + opus/silk/control_audio_bandwidth.c + opus/silk/control_codec.c + opus/silk/dec_API.c + opus/silk/decode_core.c + opus/silk/decode_frame.c + opus/silk/decode_indices.c + opus/silk/decode_parameters.c + opus/silk/decode_pitch.c + opus/silk/decode_pulses.c + opus/silk/decoder_set_fs.c + opus/silk/enc_API.c + opus/silk/encode_indices.c + opus/silk/encode_pulses.c + opus/silk/gain_quant.c + opus/silk/init_decoder.c + opus/silk/init_encoder.c + opus/silk/inner_prod_aligned.c + opus/silk/interpolate.c + opus/silk/lin2log.c + opus/silk/log2lin.c + opus/silk/pitch_est_tables.c + opus/silk/process_NLSFs.c + opus/silk/quant_LTP_gains.c + opus/silk/resampler.c + opus/silk/resampler_down2.c + opus/silk/resampler_down2_3.c + opus/silk/resampler_private_AR2.c + opus/silk/resampler_private_IIR_FIR.c + opus/silk/resampler_private_down_FIR.c + opus/silk/resampler_private_up2_HQ.c + opus/silk/resampler_rom.c + opus/silk/shell_coder.c + opus/silk/sigm_Q15.c + opus/silk/sort.c + opus/silk/stereo_LR_to_MS.c + opus/silk/stereo_MS_to_LR.c + opus/silk/stereo_decode_pred.c + opus/silk/stereo_encode_pred.c + opus/silk/stereo_find_predictor.c + opus/silk/stereo_quant_pred.c + opus/silk/sum_sqr_shift.c + opus/silk/table_LSF_cos.c + opus/silk/tables_LTP.c + opus/silk/tables_NLSF_CB_NB_MB.c + opus/silk/tables_NLSF_CB_WB.c + opus/silk/tables_gain.c + opus/silk/tables_other.c + opus/silk/tables_pitch_lag.c + opus/silk/tables_pulses_per_block.c + + # Opus sources + opus/src/analysis.c + opus/src/mapping_matrix.c + opus/src/mlp.c + opus/src/mlp_data.c + opus/src/opus.c + opus/src/opus_decoder.c + opus/src/opus_encoder.c + opus/src/opus_multistream.c + opus/src/opus_multistream_decoder.c + opus/src/opus_multistream_encoder.c + opus/src/opus_projection_decoder.c + opus/src/opus_projection_encoder.c + opus/src/repacketizer.c +) + +if (DEBUG) + target_sources(opus PRIVATE opus/silk/debug.c) +endif() + +if (OPUS_FIXED_POINT) + target_sources(opus PRIVATE + opus/silk/fixed/LTP_analysis_filter_FIX.c + opus/silk/fixed/LTP_scale_ctrl_FIX.c + opus/silk/fixed/apply_sine_window_FIX.c + opus/silk/fixed/autocorr_FIX.c + opus/silk/fixed/burg_modified_FIX.c + opus/silk/fixed/corrMatrix_FIX.c + opus/silk/fixed/encode_frame_FIX.c + opus/silk/fixed/find_LPC_FIX.c + opus/silk/fixed/find_LTP_FIX.c + opus/silk/fixed/find_pitch_lags_FIX.c + opus/silk/fixed/find_pred_coefs_FIX.c + opus/silk/fixed/k2a_FIX.c + opus/silk/fixed/k2a_Q16_FIX.c + opus/silk/fixed/noise_shape_analysis_FIX.c + opus/silk/fixed/pitch_analysis_core_FIX.c + opus/silk/fixed/prefilter_FIX.c + opus/silk/fixed/process_gains_FIX.c + opus/silk/fixed/regularize_correlations_FIX.c + opus/silk/fixed/residual_energy16_FIX.c + opus/silk/fixed/residual_energy_FIX.c + opus/silk/fixed/schur64_FIX.c + opus/silk/fixed/schur_FIX.c + opus/silk/fixed/solve_LS_FIX.c + opus/silk/fixed/vector_ops_FIX.c + opus/silk/fixed/warped_autocorrelation_FIX.c + ) +else() + target_sources(opus PRIVATE + opus/silk/float/LPC_analysis_filter_FLP.c + opus/silk/float/LPC_inv_pred_gain_FLP.c + opus/silk/float/LTP_analysis_filter_FLP.c + opus/silk/float/LTP_scale_ctrl_FLP.c + opus/silk/float/apply_sine_window_FLP.c + opus/silk/float/autocorrelation_FLP.c + opus/silk/float/burg_modified_FLP.c + opus/silk/float/bwexpander_FLP.c + opus/silk/float/corrMatrix_FLP.c + opus/silk/float/encode_frame_FLP.c + opus/silk/float/energy_FLP.c + opus/silk/float/find_LPC_FLP.c + opus/silk/float/find_LTP_FLP.c + opus/silk/float/find_pitch_lags_FLP.c + opus/silk/float/find_pred_coefs_FLP.c + opus/silk/float/inner_product_FLP.c + opus/silk/float/k2a_FLP.c + opus/silk/float/noise_shape_analysis_FLP.c + opus/silk/float/pitch_analysis_core_FLP.c + opus/silk/float/process_gains_FLP.c + opus/silk/float/regularize_correlations_FLP.c + opus/silk/float/residual_energy_FLP.c + opus/silk/float/scale_copy_vector_FLP.c + opus/silk/float/scale_vector_FLP.c + opus/silk/float/schur_FLP.c + opus/silk/float/sort_FLP.c + opus/silk/float/warped_autocorrelation_FLP.c + opus/silk/float/wrappers_FLP.c + ) +endif() + +target_compile_definitions(opus PRIVATE OPUS_BUILD ENABLE_HARDENING) + +if(NOT MSVC) + target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=2) +endif() + +# It is strongly recommended to uncomment one of these VAR_ARRAYS: Use C99 +# variable-length arrays for stack allocation USE_ALLOCA: Use alloca() for stack +# allocation If none is defined, then the fallback is a non-threadsafe global +# array +if(OPUS_USE_ALLOCA OR MSVC) + target_compile_definitions(opus PRIVATE USE_ALLOCA) +else() + target_compile_definitions(opus PRIVATE VAR_ARRAYS) +endif() + +if(OPUS_CUSTOM_MODES) + target_compile_definitions(opus PRIVATE CUSTOM_MODES) +endif() + +if(NOT OPUS_ENABLE_FLOAT_API) + target_compile_definitions(opus PRIVATE DISABLE_FLOAT_API) +endif() + +target_compile_definitions(opus +PUBLIC + -DOPUS_VERSION="\\"1.3.1\\"" + +PRIVATE + # Use C99 intrinsics to speed up float-to-int conversion + HAVE_LRINTF +) + +if (FIXED_POINT) + target_compile_definitions(opus PRIVATE -DFIXED_POINT=1 -DDISABLE_FLOAT_API) +endif() + +target_include_directories(opus +PUBLIC + opus/include + +PRIVATE + opus/celt + opus/silk + opus/silk/fixed + opus/silk/float + opus/src +) diff --git a/externals/opus/opus b/externals/opus/opus new file mode 160000 +Subproject ad8fe90db79b7d2a135e3dfd2ed6631b0c5662a diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index fe5f08ace..2f2fe6859 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp @@ -112,6 +112,7 @@ static constexpr ConversionArray morton_to_linear_fns = { MortonCopy<true, PixelFormat::ASTC_2D_8X6_SRGB>, MortonCopy<true, PixelFormat::ASTC_2D_6X5>, MortonCopy<true, PixelFormat::ASTC_2D_6X5_SRGB>, + MortonCopy<true, PixelFormat::E5B9G9R9F>, MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z24S8>, @@ -192,6 +193,7 @@ static constexpr ConversionArray linear_to_morton_fns = { nullptr, nullptr, nullptr, + MortonCopy<false, PixelFormat::E5B9G9R9F>, MortonCopy<false, PixelFormat::Z32F>, MortonCopy<false, PixelFormat::Z16>, MortonCopy<false, PixelFormat::Z24S8>, diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 2f9bfd7e4..55b3e58b2 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -131,6 +131,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_8X6_SRGB {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_6X5_SRGB + {GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, ComponentType::Float, false}, // E5B9G9R9F // Depth formats {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 9a3c05288..621136b6e 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp @@ -315,6 +315,14 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format, break; } break; + case Tegra::Texture::TextureFormat::E5B9G9R9_SHAREDEXP: + switch (component_type) { + case Tegra::Texture::ComponentType::FLOAT: + return PixelFormat::E5B9G9R9F; + default: + break; + } + break; case Tegra::Texture::TextureFormat::ZF32: return PixelFormat::Z32F; case Tegra::Texture::TextureFormat::Z16: diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 97668f802..d3bcd38c5 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h @@ -86,19 +86,20 @@ enum class PixelFormat { ASTC_2D_8X6_SRGB = 68, ASTC_2D_6X5 = 69, ASTC_2D_6X5_SRGB = 70, + E5B9G9R9F = 71, MaxColorFormat, // Depth formats - Z32F = 71, - Z16 = 72, + Z32F = 72, + Z16 = 73, MaxDepthFormat, // DepthStencil formats - Z24S8 = 73, - S8Z24 = 74, - Z32FS8 = 75, + Z24S8 = 74, + S8Z24 = 75, + Z32FS8 = 76, MaxDepthStencilFormat, @@ -207,6 +208,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{ 2, // ASTC_2D_8X6_SRGB 2, // ASTC_2D_6X5 2, // ASTC_2D_6X5_SRGB + 0, // E5B9G9R9F 0, // Z32F 0, // Z16 0, // Z24S8 @@ -302,6 +304,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ 8, // ASTC_2D_8X6_SRGB 6, // ASTC_2D_6X5 6, // ASTC_2D_6X5_SRGB + 1, // E5B9G9R9F 1, // Z32F 1, // Z16 1, // Z24S8 @@ -389,6 +392,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ 6, // ASTC_2D_8X6_SRGB 5, // ASTC_2D_6X5 5, // ASTC_2D_6X5_SRGB + 1, // E5B9G9R9F 1, // Z32F 1, // Z16 1, // Z24S8 @@ -476,6 +480,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ 128, // ASTC_2D_8X6_SRGB 128, // ASTC_2D_6X5 128, // ASTC_2D_6X5_SRGB + 32, // E5B9G9R9F 32, // Z32F 16, // Z16 32, // Z24S8 @@ -578,6 +583,7 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table SurfaceCompression::Converted, // ASTC_2D_8X6_SRGB SurfaceCompression::Converted, // ASTC_2D_6X5 SurfaceCompression::Converted, // ASTC_2D_6X5_SRGB + SurfaceCompression::None, // E5B9G9R9F SurfaceCompression::None, // Z32F SurfaceCompression::None, // Z16 SurfaceCompression::None, // Z24S8 |