diff --git a/ci_config.json b/ci_config.json index 6e242fcce..48dad0916 100644 --- a/ci_config.json +++ b/ci_config.json @@ -1605,6 +1605,23 @@ "liblzma-dev" ] }, + "xvidcore" : { + "alpine_packages": [ + "nasm" + ], + "brew_packages": [ + "nasm" + ], + "debian_packages": [ + "nasm" + ], + "choco_packages": [ + "nasm" + ], + "msys_packages": [ + "nasm" + ] + }, "yaml-cpp": { "build_options": [ "yaml-cpp:tests=enabled" diff --git a/releases.json b/releases.json index 720632233..eebd84f66 100644 --- a/releases.json +++ b/releases.json @@ -4823,6 +4823,14 @@ "0.6.12-1" ] }, + "xvidcore": { + "dependency_names": [ + "xvidcore" + ], + "versions": [ + "1.3.7-1" + ] + }, "xxhash": { "dependency_names": [ "libxxhash" diff --git a/subprojects/packagefiles/xvidcore/meson.build b/subprojects/packagefiles/xvidcore/meson.build new file mode 100644 index 000000000..05eeeb807 --- /dev/null +++ b/subprojects/packagefiles/xvidcore/meson.build @@ -0,0 +1,269 @@ +project( + 'xvidcore', + 'c', + version: '1.3.7', + license: 'GPL-2.0-or-later', + meson_version: '>= 1.3.0', + default_options: ['warning_level=2', 'c_std=gnu99,c99'], +) + +cc = meson.get_compiler('c') +m_dep = cc.find_library( + 'm', + required: false, +) +thread_dep = dependency( + 'threads', + required: false, +) +cpu_family = host_machine.cpu_family() +host_os = host_machine.system() +endian = host_machine.endian() +sources = [] +includes = [] +nasm_args = [] +c_args = [] + +if cpu_family == 'x86' or cpu_family == 'x86_64' + add_languages( + 'nasm', + native: false, + ) +endif + +if endian == 'big' + c_args += ['-DARCH_IS_BIG_ENDIAN'] +else + c_args += ['-DARCH_IS_LITTLE_ENDIAN'] +endif + +if cc.sizeof('void*') == 8 + c_args += ['-DARCH_IS_64BIT'] +else + c_args += ['-DARCH_IS_32BIT'] +endif + +if cc.has_header('stdint.h') + c_args += ['-DHAVE_STDINT_H'] +endif + +if cc.has_header('inttypes.h') + c_args += ['-DHAVE_INTTYPES_H'] +endif + +if cc.has_header( + 'pthread.h', + dependencies: thread_dep, +) + c_args += ['-DHAVE_PTHREAD'] +endif + +if cpu_family == 'x86_64' + c_args += ['-DARCH_IS_X86_64'] + nasm_args += ['-DARCH_IS_X86_64'] + add_project_arguments( + nasm_args, + language: 'nasm', + ) +elif cpu_family == 'x86' + c_args += ['-DARCH_IS_IA32'] + nasm_args += ['-DARCH_IS_IA32'] + add_project_arguments( + nasm_args, + language: 'nasm', + ) +elif (cpu_family == 'ppc' or cpu_family == 'ppc64') and endian == 'big' + c_args += ['-DARCH_IS_PPC', '-maltivec', '-mabi=altivec'] +else + c_args += ['-DARCH_IS_GENERIC'] +endif + +if host_os == 'darwin' or (host_os == 'windows' and cpu_family == 'x86') + nasm_args += ['-DPREFIX'] + + if host_os == 'linux' + nasm_args += ['-DMARK_FUNCS'] + endif + + if (cpu_family == 'x86' or cpu_family == 'x86_64') + add_project_arguments( + nasm_args, + language: 'nasm', + ) + endif + +endif +if host_os == 'windows' + c_args += [ + '-DWIN32', + '-DHAVE_STDINT_H', + '-DHAVE_INTTYPES_H', + '-DHAVE_SYS_TYPES_H', + ] + if cc.get_argument_syntax() == 'msvc' + c_args += [ + '/FIstdint.h', + '-D_try=__try', + '-D_except=__except', + '/EHa', + '/wd4996', + ] + endif +endif + +add_project_arguments( + c_args, + language: 'c', +) + +sources += files( + 'src/bitstream/bitstream.c', + 'src/bitstream/cbp.c', + 'src/bitstream/mbcoding.c', + 'src/dct/fdct.c', + 'src/dct/idct.c', + 'src/dct/simple_idct.c', + 'src/decoder.c', + 'src/encoder.c', + 'src/image/colorspace.c', + 'src/image/font.c', + 'src/image/image.c', + 'src/image/interpolate8x8.c', + 'src/image/postprocessing.c', + 'src/image/qpel.c', + 'src/image/reduced.c', + 'src/motion/estimation_bvop.c', + 'src/motion/estimation_common.c', + 'src/motion/estimation_gmc.c', + 'src/motion/estimation_pvop.c', + 'src/motion/estimation_rd_based.c', + 'src/motion/estimation_rd_based_bvop.c', + 'src/motion/motion_comp.c', + 'src/motion/sad.c', + 'src/motion/vop_type_decision.c', + 'src/plugins/plugin_2pass1.c', + 'src/plugins/plugin_2pass2.c', + 'src/plugins/plugin_dump.c', + 'src/plugins/plugin_lumimasking.c', + 'src/plugins/plugin_psnr.c', + 'src/plugins/plugin_psnrhvsm.c', + 'src/plugins/plugin_single.c', + 'src/plugins/plugin_ssim.c', + 'src/prediction/mbprediction.c', + 'src/quant/quant_h263.c', + 'src/quant/quant_matrix.c', + 'src/quant/quant_mpeg.c', + 'src/utils/emms.c', + 'src/utils/mbtransquant.c', + 'src/utils/mem_align.c', + 'src/utils/mem_transfer.c', + 'src/utils/timer.c', + 'src/xvid.c', +) + +if (cpu_family == 'ppc' or cpu_family == 'ppc64') and endian == 'big' + sources += files( + 'src/dct/ppc_asm/idct_altivec.c', + 'src/image/ppc_asm/colorspace_altivec.c', + 'src/image/ppc_asm/interpolate8x8_altivec.c', + 'src/image/ppc_asm/qpel_altivec.c', + 'src/motion/ppc_asm/sad_altivec.c', + 'src/quant/ppc_asm/quant_h263_altivec.c', + 'src/quant/ppc_asm/quant_mpeg_altivec.c', + 'src/utils/ppc_asm/altivec_trigger.c', + 'src/utils/ppc_asm/mem_transfer_altivec.c', + ) +elif cpu_family == 'x86' or cpu_family == 'x86_64' + includes += [include_directories('src/image/x86_asm')] + sources += files( + 'src/bitstream/x86_asm/cbp_mmx.asm', + 'src/bitstream/x86_asm/cbp_sse2.asm', + 'src/dct/x86_asm/fdct_mmx_ffmpeg.asm', + 'src/dct/x86_asm/fdct_mmx_skal.asm', + 'src/dct/x86_asm/fdct_sse2_skal.asm', + 'src/dct/x86_asm/idct_3dne.asm', + 'src/dct/x86_asm/idct_mmx.asm', + 'src/dct/x86_asm/idct_sse2_dmitry.asm', + 'src/image/x86_asm/colorspace_rgb_mmx.asm', + 'src/image/x86_asm/colorspace_yuv_mmx.asm', + 'src/image/x86_asm/colorspace_yuyv_mmx.asm', + 'src/image/x86_asm/deintl_sse.asm', + 'src/image/x86_asm/gmc_mmx.asm', + 'src/image/x86_asm/interpolate8x8_3dn.asm', + 'src/image/x86_asm/interpolate8x8_3dne.asm', + 'src/image/x86_asm/interpolate8x8_mmx.asm', + 'src/image/x86_asm/interpolate8x8_xmm.asm', + 'src/image/x86_asm/postprocessing_mmx.asm', + 'src/image/x86_asm/postprocessing_sse2.asm', + 'src/image/x86_asm/qpel_mmx.asm', + 'src/image/x86_asm/reduced_mmx.asm', + 'src/motion/x86_asm/sad_3dn.asm', + 'src/motion/x86_asm/sad_3dne.asm', + 'src/motion/x86_asm/sad_mmx.asm', + 'src/motion/x86_asm/sad_sse2.asm', + 'src/motion/x86_asm/sad_xmm.asm', + 'src/plugins/x86_asm/plugin_ssim-a.asm', + 'src/quant/x86_asm/quantize_h263_3dne.asm', + 'src/quant/x86_asm/quantize_h263_mmx.asm', + 'src/quant/x86_asm/quantize_mpeg_mmx.asm', + 'src/quant/x86_asm/quantize_mpeg_xmm.asm', + 'src/utils/x86_asm/cpuid.asm', + 'src/utils/x86_asm/interlacing_mmx.asm', + 'src/utils/x86_asm/mem_transfer_3dne.asm', + 'src/utils/x86_asm/mem_transfer_mmx.asm', + ) +endif + +includes += [ + include_directories('src'), + include_directories('src/bitstream'), + include_directories('src/dct'), + include_directories('src/image'), + include_directories('src/motion'), + include_directories('src/plugins'), + include_directories('src/prediction'), + include_directories('src/quant'), + include_directories('src/utils'), +] + +if cpu_family == 'aarch64' and cc.get_id() == 'msvc' + prog_python = import('python').find_installation() + gmc_patched = custom_target( + 'gmc_patched', + input: 'src/motion/gmc.c', + output: 'gmc_patched.c', + command: [ + prog_python, + '-c', + 'import sys; open(sys.argv[2], "w", encoding="utf-8").write(open(sys.argv[1], "r", encoding="utf-8").read().replace("defined(_MSC_VER)", "0"))', + '@INPUT@', + '@OUTPUT@', + ], + ) + sources += [gmc_patched] +else + sources += files('src/motion/gmc.c') +endif + +# Install header 'xvid.h' +subdir('src') + +xvidcore = library( + 'xvidcore', + sources, + install: true, + dependencies: [m_dep, thread_dep], + include_directories: includes, + vs_module_defs: 'build/generic/libxvidcore.def', +) + +pkg = import('pkgconfig') + +pkg.generate(xvidcore) + +xvidcore_dep = declare_dependency( + include_directories: includes, + link_with: xvidcore, +) +meson.override_dependency('xvidcore', xvidcore_dep) + diff --git a/subprojects/packagefiles/xvidcore/src/meson.build b/subprojects/packagefiles/xvidcore/src/meson.build new file mode 100644 index 000000000..c614967ea --- /dev/null +++ b/subprojects/packagefiles/xvidcore/src/meson.build @@ -0,0 +1 @@ +install_headers('xvid.h') diff --git a/subprojects/xvidcore.wrap b/subprojects/xvidcore.wrap new file mode 100644 index 000000000..6bfb1930a --- /dev/null +++ b/subprojects/xvidcore.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = xvidcore +source_url = https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz +source_filename = xvidcore-1.3.7.tar.gz +source_hash = abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce2d +patch_directory = xvidcore + +[provide] +dependency_names = xvidcore