@scrypted/libav 1.0.179 → 1.0.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_openh264install/include/wels/codec_api.h +592 -0
- package/_openh264install/include/wels/codec_app_def.h +820 -0
- package/_openh264install/include/wels/codec_def.h +216 -0
- package/_openh264install/include/wels/codec_ver.h +15 -0
- package/_openh264install/lib/libopenh264.a +0 -0
- package/_openh264install/lib/pkgconfig/openh264.pc +10 -0
- package/binding.gyp +4 -0
- package/openh264/.reviewboardrc +3 -0
- package/openh264/.travis.yml +42 -0
- package/openh264/CODING_STYLE +8 -0
- package/openh264/CONTRIBUTORS +55 -0
- package/openh264/LICENSE +23 -0
- package/openh264/Makefile +408 -0
- package/openh264/README.md +197 -0
- package/openh264/RELEASES +467 -0
- package/openh264/SECURITY.md +16 -0
- package/openh264/autotest/codec_comparision/run_MultiCodecComparision.sh +431 -0
- package/openh264/autotest/performanceTest/android/run_AutoTest_android.sh +180 -0
- package/openh264/autotest/performanceTest/ios/fruitstrap +0 -0
- package/openh264/autotest/performanceTest/ios/iFileTransfer +0 -0
- package/openh264/autotest/performanceTest/ios/run_AutoTest_ios.sh +193 -0
- package/openh264/autotest/performanceTest/ios/uiascript.js +19 -0
- package/openh264/autotest/performanceTest/parsePerfData.sh +107 -0
- package/openh264/autotest/performanceTest/run_perfTest.sh +122 -0
- package/openh264/autotest/unitTest/android/run_AutoTest_android.sh +112 -0
- package/openh264/autotest/unitTest/ios/run_AutoTest_ios.sh +167 -0
- package/openh264/autotest/unitTest/run_ParseUTxml.sh +70 -0
- package/openh264/autotest/unitTest/run_unitTest.sh +98 -0
- package/openh264/build.gradle +30 -0
- package/openh264/code-coverage.sh +6 -0
- package/openh264/codec/api/meson.build +1 -0
- package/openh264/codec/api/wels/codec_api.h +592 -0
- package/openh264/codec/api/wels/codec_app_def.h +820 -0
- package/openh264/codec/api/wels/codec_def.h +216 -0
- package/openh264/codec/api/wels/codec_ver.h +15 -0
- package/openh264/codec/api/wels/meson.build +9 -0
- package/openh264/codec/common/arm/arm_arch_common_macro.S +83 -0
- package/openh264/codec/common/arm/copy_mb_neon.S +161 -0
- package/openh264/codec/common/arm/deblocking_neon.S +857 -0
- package/openh264/codec/common/arm/expand_picture_neon.S +154 -0
- package/openh264/codec/common/arm/intra_pred_common_neon.S +82 -0
- package/openh264/codec/common/arm/mc_neon.S +2283 -0
- package/openh264/codec/common/arm64/arm_aarch64_common.h +85 -0
- package/openh264/codec/common/arm64/arm_arch64_common_macro.S +79 -0
- package/openh264/codec/common/arm64/copy_mb_aarch64_neon.S +202 -0
- package/openh264/codec/common/arm64/deblocking_aarch64_neon.S +852 -0
- package/openh264/codec/common/arm64/expand_picture_aarch64_neon.S +150 -0
- package/openh264/codec/common/arm64/intra_pred_common_aarch64_neon.S +58 -0
- package/openh264/codec/common/arm64/mc_aarch64_neon.S +2614 -0
- package/openh264/codec/common/generate_version.sh +28 -0
- package/openh264/codec/common/inc/WelsList.h +287 -0
- package/openh264/codec/common/inc/WelsLock.h +97 -0
- package/openh264/codec/common/inc/WelsTask.h +75 -0
- package/openh264/codec/common/inc/WelsTaskThread.h +83 -0
- package/openh264/codec/common/inc/WelsThread.h +106 -0
- package/openh264/codec/common/inc/WelsThreadLib.h +151 -0
- package/openh264/codec/common/inc/WelsThreadPool.h +124 -0
- package/openh264/codec/common/inc/asmdefs_mmi.h +345 -0
- package/openh264/codec/common/inc/copy_mb.h +103 -0
- package/openh264/codec/common/inc/cpu.h +81 -0
- package/openh264/codec/common/inc/cpu_core.h +103 -0
- package/openh264/codec/common/inc/crt_util_safe_x.h +104 -0
- package/openh264/codec/common/inc/deblocking_common.h +124 -0
- package/openh264/codec/common/inc/expand_pic.h +107 -0
- package/openh264/codec/common/inc/golomb_common.h +166 -0
- package/openh264/codec/common/inc/intra_pred_common.h +86 -0
- package/openh264/codec/common/inc/loongson_intrinsics.h +1919 -0
- package/openh264/codec/common/inc/ls_defines.h +130 -0
- package/openh264/codec/common/inc/macros.h +329 -0
- package/openh264/codec/common/inc/mc.h +407 -0
- package/openh264/codec/common/inc/measure_time.h +88 -0
- package/openh264/codec/common/inc/memory_align.h +116 -0
- package/openh264/codec/common/inc/msa_macros.h +2393 -0
- package/openh264/codec/common/inc/sad_common.h +139 -0
- package/openh264/codec/common/inc/typedefs.h +86 -0
- package/openh264/codec/common/inc/utils.h +95 -0
- package/openh264/codec/common/inc/version.h +10 -0
- package/openh264/codec/common/inc/version_gen.h.template +6 -0
- package/openh264/codec/common/inc/welsCodecTrace.h +64 -0
- package/openh264/codec/common/inc/wels_common_defs.h +373 -0
- package/openh264/codec/common/inc/wels_const_common.h +63 -0
- package/openh264/codec/common/loongarch/copy_mb_lsx.c +194 -0
- package/openh264/codec/common/loongarch/deblock_lsx.c +1489 -0
- package/openh264/codec/common/loongarch/intra_pred_com_lasx.c +112 -0
- package/openh264/codec/common/loongarch/intra_pred_com_lsx.c +91 -0
- package/openh264/codec/common/loongarch/mc_chroma_lsx.c +192 -0
- package/openh264/codec/common/loongarch/mc_horver_lsx.c +654 -0
- package/openh264/codec/common/loongarch/satd_sad_lasx.c +568 -0
- package/openh264/codec/common/meson.build +84 -0
- package/openh264/codec/common/mips/copy_mb_mmi.c +477 -0
- package/openh264/codec/common/mips/copy_mb_msa.c +80 -0
- package/openh264/codec/common/mips/deblock_mmi.c +2826 -0
- package/openh264/codec/common/mips/deblock_msa.c +1024 -0
- package/openh264/codec/common/mips/expand_picture_mmi.c +673 -0
- package/openh264/codec/common/mips/intra_pred_com_mmi.c +548 -0
- package/openh264/codec/common/mips/satd_sad_mmi.c +2154 -0
- package/openh264/codec/common/targets.mk +136 -0
- package/openh264/codec/common/x86/asm_inc.asm +743 -0
- package/openh264/codec/common/x86/cpuid.asm +263 -0
- package/openh264/codec/common/x86/dct.asm +1036 -0
- package/openh264/codec/common/x86/deblock.asm +848 -0
- package/openh264/codec/common/x86/expand_picture.asm +728 -0
- package/openh264/codec/common/x86/intra_pred_com.asm +117 -0
- package/openh264/codec/common/x86/mb_copy.asm +615 -0
- package/openh264/codec/common/x86/mc_chroma.asm +313 -0
- package/openh264/codec/common/x86/mc_luma.asm +4490 -0
- package/openh264/codec/common/x86/satd_sad.asm +2734 -0
- package/openh264/codec/common/x86/vaa.asm +411 -0
- package/openh264/codec/console/common/inc/read_config.h +68 -0
- package/openh264/codec/console/common/meson.build +12 -0
- package/openh264/codec/console/common/targets.mk +20 -0
- package/openh264/codec/console/dec/inc/d3d9_utils.h +148 -0
- package/openh264/codec/console/dec/meson.build +15 -0
- package/openh264/codec/console/dec/targets.mk +20 -0
- package/openh264/codec/console/enc/meson.build +9 -0
- package/openh264/codec/console/enc/targets.mk +19 -0
- package/openh264/codec/console/meson.build +3 -0
- package/openh264/codec/decoder/core/arm/block_add_neon.S +129 -0
- package/openh264/codec/decoder/core/arm/intra_pred_neon.S +635 -0
- package/openh264/codec/decoder/core/arm64/block_add_aarch64_neon.S +131 -0
- package/openh264/codec/decoder/core/arm64/intra_pred_aarch64_neon.S +524 -0
- package/openh264/codec/decoder/core/inc/au_parser.h +199 -0
- package/openh264/codec/decoder/core/inc/bit_stream.h +62 -0
- package/openh264/codec/decoder/core/inc/cabac_decoder.h +111 -0
- package/openh264/codec/decoder/core/inc/deblocking.h +118 -0
- package/openh264/codec/decoder/core/inc/dec_frame.h +156 -0
- package/openh264/codec/decoder/core/inc/dec_golomb.h +344 -0
- package/openh264/codec/decoder/core/inc/decode_mb_aux.h +83 -0
- package/openh264/codec/decoder/core/inc/decode_slice.h +104 -0
- package/openh264/codec/decoder/core/inc/decoder.h +186 -0
- package/openh264/codec/decoder/core/inc/decoder_context.h +590 -0
- package/openh264/codec/decoder/core/inc/decoder_core.h +206 -0
- package/openh264/codec/decoder/core/inc/error_code.h +222 -0
- package/openh264/codec/decoder/core/inc/error_concealment.h +68 -0
- package/openh264/codec/decoder/core/inc/fmo.h +114 -0
- package/openh264/codec/decoder/core/inc/get_intra_predictor.h +191 -0
- package/openh264/codec/decoder/core/inc/manage_dec_ref.h +62 -0
- package/openh264/codec/decoder/core/inc/mb_cache.h +80 -0
- package/openh264/codec/decoder/core/inc/memmgr_nal_unit.h +66 -0
- package/openh264/codec/decoder/core/inc/mv_pred.h +195 -0
- package/openh264/codec/decoder/core/inc/nal_prefix.h +56 -0
- package/openh264/codec/decoder/core/inc/nalu.h +79 -0
- package/openh264/codec/decoder/core/inc/parameter_sets.h +217 -0
- package/openh264/codec/decoder/core/inc/parse_mb_syn_cabac.h +89 -0
- package/openh264/codec/decoder/core/inc/parse_mb_syn_cavlc.h +137 -0
- package/openh264/codec/decoder/core/inc/pic_queue.h +62 -0
- package/openh264/codec/decoder/core/inc/picture.h +112 -0
- package/openh264/codec/decoder/core/inc/rec_mb.h +104 -0
- package/openh264/codec/decoder/core/inc/slice.h +208 -0
- package/openh264/codec/decoder/core/inc/vlc_decoder.h +177 -0
- package/openh264/codec/decoder/core/inc/wels_common_basis.h +317 -0
- package/openh264/codec/decoder/core/inc/wels_const.h +65 -0
- package/openh264/codec/decoder/core/inc/wels_decoder_thread.h +170 -0
- package/openh264/codec/decoder/core/loongarch/mb_aux_lsx.c +296 -0
- package/openh264/codec/decoder/core/mips/dct_mmi.c +786 -0
- package/openh264/codec/decoder/core/x86/dct.asm +72 -0
- package/openh264/codec/decoder/core/x86/intra_pred.asm +1456 -0
- package/openh264/codec/decoder/meson.build +69 -0
- package/openh264/codec/decoder/plus/inc/welsDecoderExt.h +170 -0
- package/openh264/codec/decoder/targets.mk +115 -0
- package/openh264/codec/encoder/core/arm/intra_pred_neon.S +589 -0
- package/openh264/codec/encoder/core/arm/intra_pred_sad_3_opt_neon.S +735 -0
- package/openh264/codec/encoder/core/arm/memory_neon.S +62 -0
- package/openh264/codec/encoder/core/arm/pixel_neon.S +882 -0
- package/openh264/codec/encoder/core/arm/reconstruct_neon.S +903 -0
- package/openh264/codec/encoder/core/arm/svc_motion_estimation.S +366 -0
- package/openh264/codec/encoder/core/arm64/intra_pred_aarch64_neon.S +505 -0
- package/openh264/codec/encoder/core/arm64/intra_pred_sad_3_opt_aarch64_neon.S +611 -0
- package/openh264/codec/encoder/core/arm64/memory_aarch64_neon.S +63 -0
- package/openh264/codec/encoder/core/arm64/pixel_aarch64_neon.S +621 -0
- package/openh264/codec/encoder/core/arm64/reconstruct_aarch64_neon.S +717 -0
- package/openh264/codec/encoder/core/arm64/svc_motion_estimation_aarch64_neon.S +350 -0
- package/openh264/codec/encoder/core/inc/as264_common.h +138 -0
- package/openh264/codec/encoder/core/inc/au_set.h +152 -0
- package/openh264/codec/encoder/core/inc/deblocking.h +92 -0
- package/openh264/codec/encoder/core/inc/decode_mb_aux.h +112 -0
- package/openh264/codec/encoder/core/inc/dq_map.h +58 -0
- package/openh264/codec/encoder/core/inc/encode_mb_aux.h +199 -0
- package/openh264/codec/encoder/core/inc/encoder.h +148 -0
- package/openh264/codec/encoder/core/inc/encoder_context.h +240 -0
- package/openh264/codec/encoder/core/inc/extern.h +124 -0
- package/openh264/codec/encoder/core/inc/get_intra_predictor.h +186 -0
- package/openh264/codec/encoder/core/inc/mb_cache.h +141 -0
- package/openh264/codec/encoder/core/inc/md.h +181 -0
- package/openh264/codec/encoder/core/inc/mt_defs.h +91 -0
- package/openh264/codec/encoder/core/inc/mv_pred.h +191 -0
- package/openh264/codec/encoder/core/inc/nal_encap.h +143 -0
- package/openh264/codec/encoder/core/inc/param_svc.h +576 -0
- package/openh264/codec/encoder/core/inc/parameter_sets.h +181 -0
- package/openh264/codec/encoder/core/inc/paraset_strategy.h +310 -0
- package/openh264/codec/encoder/core/inc/picture.h +137 -0
- package/openh264/codec/encoder/core/inc/picture_handle.h +66 -0
- package/openh264/codec/encoder/core/inc/rc.h +284 -0
- package/openh264/codec/encoder/core/inc/ref_list_mgr_svc.h +148 -0
- package/openh264/codec/encoder/core/inc/sample.h +154 -0
- package/openh264/codec/encoder/core/inc/set_mb_syn_cabac.h +127 -0
- package/openh264/codec/encoder/core/inc/set_mb_syn_cavlc.h +92 -0
- package/openh264/codec/encoder/core/inc/slice.h +212 -0
- package/openh264/codec/encoder/core/inc/slice_multi_threading.h +97 -0
- package/openh264/codec/encoder/core/inc/stat.h +102 -0
- package/openh264/codec/encoder/core/inc/svc_base_layer_md.h +102 -0
- package/openh264/codec/encoder/core/inc/svc_enc_frame.h +136 -0
- package/openh264/codec/encoder/core/inc/svc_enc_golomb.h +123 -0
- package/openh264/codec/encoder/core/inc/svc_enc_macroblock.h +82 -0
- package/openh264/codec/encoder/core/inc/svc_enc_slice_segment.h +212 -0
- package/openh264/codec/encoder/core/inc/svc_encode_mb.h +63 -0
- package/openh264/codec/encoder/core/inc/svc_encode_slice.h +184 -0
- package/openh264/codec/encoder/core/inc/svc_mode_decision.h +94 -0
- package/openh264/codec/encoder/core/inc/svc_motion_estimate.h +369 -0
- package/openh264/codec/encoder/core/inc/svc_set_mb_syn.h +70 -0
- package/openh264/codec/encoder/core/inc/svc_set_mb_syn_cavlc.h +67 -0
- package/openh264/codec/encoder/core/inc/vlc_encoder.h +92 -0
- package/openh264/codec/encoder/core/inc/wels_common_basis.h +160 -0
- package/openh264/codec/encoder/core/inc/wels_const.h +174 -0
- package/openh264/codec/encoder/core/inc/wels_func_ptr_def.h +300 -0
- package/openh264/codec/encoder/core/inc/wels_preprocess.h +251 -0
- package/openh264/codec/encoder/core/inc/wels_task_base.h +79 -0
- package/openh264/codec/encoder/core/inc/wels_task_encoder.h +142 -0
- package/openh264/codec/encoder/core/inc/wels_task_management.h +135 -0
- package/openh264/codec/encoder/core/inc/wels_transpose_matrix.h +58 -0
- package/openh264/codec/encoder/core/loongarch/dct_lasx.c +452 -0
- package/openh264/codec/encoder/core/loongarch/get_intra_predictor_lsx.c +166 -0
- package/openh264/codec/encoder/core/loongarch/quant_lsx.c +153 -0
- package/openh264/codec/encoder/core/loongarch/sample_lasx.c +87 -0
- package/openh264/codec/encoder/core/loongarch/svc_motion_estimate_lsx.c +104 -0
- package/openh264/codec/encoder/core/mips/dct_mmi.c +529 -0
- package/openh264/codec/encoder/core/mips/quant_mmi.c +553 -0
- package/openh264/codec/encoder/core/mips/score_mmi.c +324 -0
- package/openh264/codec/encoder/core/x86/coeff.asm +695 -0
- package/openh264/codec/encoder/core/x86/dct.asm +108 -0
- package/openh264/codec/encoder/core/x86/intra_pred.asm +1129 -0
- package/openh264/codec/encoder/core/x86/matrix_transpose.asm +395 -0
- package/openh264/codec/encoder/core/x86/memzero.asm +132 -0
- package/openh264/codec/encoder/core/x86/quant.asm +507 -0
- package/openh264/codec/encoder/core/x86/sample_sc.asm +1829 -0
- package/openh264/codec/encoder/core/x86/score.asm +363 -0
- package/openh264/codec/encoder/meson.build +98 -0
- package/openh264/codec/encoder/plus/inc/welsEncoderExt.h +129 -0
- package/openh264/codec/encoder/targets.mk +146 -0
- package/openh264/codec/meson.build +9 -0
- package/openh264/codec/processing/interface/IWelsVP.h +310 -0
- package/openh264/codec/processing/meson.build +71 -0
- package/openh264/codec/processing/targets.mk +117 -0
- package/openh264/docs/doxygen/Doxyfile +1865 -0
- package/openh264/docs/doxygen/Home.rest +25 -0
- package/openh264/docs/doxygen/ISVCDecoder.rest +19 -0
- package/openh264/docs/doxygen/ISVCEncoder.rest +16 -0
- package/openh264/docs/doxygen/UsageExampleForDecoder.rest +10 -0
- package/openh264/docs/doxygen/UsageExampleForEncoder.rest +15 -0
- package/openh264/docs/doxygen2rst.py +619 -0
- package/openh264/gmpopenh264.info +4 -0
- package/openh264/gradlew +172 -0
- package/openh264/meson.build +218 -0
- package/openh264/meson_options.txt +1 -0
- package/openh264/module/RefCounted.h +141 -0
- package/openh264/module/gmp-openh264.cpp +1196 -0
- package/openh264/module/targets.mk +14 -0
- package/openh264/module/task_utils.h +38 -0
- package/openh264/module/task_utils.py +207 -0
- package/openh264/module/task_utils_generated.h +2087 -0
- package/openh264/openh264.def +7 -0
- package/openh264/openh264.pc.in +10 -0
- package/openh264/openh264.rc +61 -0
- package/openh264/openh264.rc.template +61 -0
- package/openh264/res/Adobe_PDF_sample_a_1024x768_50Frms.264 +0 -0
- package/openh264/res/BA1_FT_C.264 +0 -0
- package/openh264/res/BA1_Sony_D.jsv +0 -0
- package/openh264/res/BAMQ1_JVC_C.264 +0 -0
- package/openh264/res/BAMQ2_JVC_C.264 +0 -0
- package/openh264/res/BANM_MW_D.264 +0 -0
- package/openh264/res/BASQP1_Sony_C.jsv +0 -0
- package/openh264/res/BA_MW_D.264 +0 -0
- package/openh264/res/BA_MW_D_IDR_LOST.264 +0 -0
- package/openh264/res/BA_MW_D_P_LOST.264 +0 -0
- package/openh264/res/CI1_FT_B.264 +0 -0
- package/openh264/res/CI_MW_D.264 +0 -0
- package/openh264/res/CVFC1_Sony_C.jsv +0 -0
- package/openh264/res/CVPCMNL1_SVA_C.264 +0 -0
- package/openh264/res/CiscoVT2people_160x96_6fps.yuv +1 -0
- package/openh264/res/CiscoVT2people_320x192_12fps.yuv +1 -0
- package/openh264/res/Cisco_Absolute_Power_1280x720_30fps.yuv +3607 -0
- package/openh264/res/Cisco_Adobe_PDF_sample_a_1024x768_CAVLC_Bframe_9.264 +0 -0
- package/openh264/res/Cisco_Men_whisper_640x320_CABAC_Bframe_9.264 +0 -0
- package/openh264/res/Cisco_Men_whisper_640x320_CAVLC_Bframe_9.264 +0 -0
- package/openh264/res/Error_I_P.264 +0 -0
- package/openh264/res/LS_SVA_D.264 +0 -0
- package/openh264/res/MIDR_MW_D.264 +0 -0
- package/openh264/res/MPS_MW_A.264 +0 -0
- package/openh264/res/MR1_BT_A.h264 +0 -0
- package/openh264/res/MR1_MW_A.264 +0 -0
- package/openh264/res/MR2_MW_A.264 +0 -0
- package/openh264/res/MR2_TANDBERG_E.264 +0 -0
- package/openh264/res/NL1_Sony_D.jsv +0 -0
- package/openh264/res/NLMQ1_JVC_C.264 +0 -0
- package/openh264/res/NLMQ2_JVC_C.264 +0 -0
- package/openh264/res/NRF_MW_E.264 +0 -0
- package/openh264/res/QCIF_2P_I_allIPCM.264 +0 -0
- package/openh264/res/SVA_BA1_B.264 +0 -0
- package/openh264/res/SVA_BA2_D.264 +0 -0
- package/openh264/res/SVA_Base_B.264 +0 -0
- package/openh264/res/SVA_CL1_E.264 +0 -0
- package/openh264/res/SVA_FM1_E.264 +0 -0
- package/openh264/res/SVA_NL1_B.264 +0 -0
- package/openh264/res/SVA_NL2_E.264 +0 -0
- package/openh264/res/SarVui.264 +0 -0
- package/openh264/res/Static.264 +0 -0
- package/openh264/res/Static_152_100.yuv +1 -0
- package/openh264/res/VID_1280x544_cabac_temporal_direct.264 +0 -0
- package/openh264/res/VID_1280x544_cavlc_temporal_direct.264 +0 -0
- package/openh264/res/VID_1280x720_cabac_temporal_direct.264 +0 -0
- package/openh264/res/VID_1280x720_cavlc_temporal_direct.264 +0 -0
- package/openh264/res/VID_1920x1080_cabac_temporal_direct.264 +0 -0
- package/openh264/res/VID_1920x1080_cavlc_temporal_direct.264 +0 -0
- package/openh264/res/Zhling_1280x720.264 +0 -0
- package/openh264/res/jm_1080p_allslice.264 +0 -0
- package/openh264/res/sps_subsetsps_bothVUI.264 +0 -0
- package/openh264/res/test_cif_I_CABAC_PCM.264 +0 -0
- package/openh264/res/test_cif_I_CABAC_slice.264 +0 -0
- package/openh264/res/test_cif_P_CABAC_slice.264 +0 -0
- package/openh264/res/test_qcif_cabac.264 +0 -0
- package/openh264/res/test_scalinglist_jm.264 +0 -0
- package/openh264/res/test_vd_1d.264 +0 -0
- package/openh264/res/test_vd_rc.264 +0 -0
- package/openh264/run_Test.sh +91 -0
- package/openh264/settings.gradle +4 -0
- package/openh264/subprojects/gtest.wrap +10 -0
- package/openh264/testbin/AutoBuild_Windows_VS2008.bat +59 -0
- package/openh264/testbin/CmdLineExample.sh +7 -0
- package/openh264/testbin/CmdLineReadMe +22 -0
- package/openh264/testbin/layer2.cfg +37 -0
- package/openh264/testbin/layer2_arbitrary_res.cfg +37 -0
- package/openh264/testbin/layer2_vd.cfg +38 -0
- package/openh264/testbin/layer2_vd_rc.cfg +38 -0
- package/openh264/testbin/welsenc.cfg +71 -0
- package/openh264/testbin/welsenc_arbitrary_res.cfg +70 -0
- package/openh264/testbin/welsenc_ios.cfg +71 -0
- package/openh264/testbin/welsenc_vd_1d.cfg +70 -0
- package/openh264/testbin/welsenc_vd_rc.cfg +69 -0
- package/openh264/ut.def +2 -0
- package/package.json +1 -1
package/openh264/gradlew
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
##############################################################################
|
|
4
|
+
##
|
|
5
|
+
## Gradle start up script for UN*X
|
|
6
|
+
##
|
|
7
|
+
##############################################################################
|
|
8
|
+
|
|
9
|
+
# Attempt to set APP_HOME
|
|
10
|
+
# Resolve links: $0 may be a link
|
|
11
|
+
PRG="$0"
|
|
12
|
+
# Need this for relative symlinks.
|
|
13
|
+
while [ -h "$PRG" ] ; do
|
|
14
|
+
ls=`ls -ld "$PRG"`
|
|
15
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
16
|
+
if expr "$link" : '/.*' > /dev/null; then
|
|
17
|
+
PRG="$link"
|
|
18
|
+
else
|
|
19
|
+
PRG=`dirname "$PRG"`"/$link"
|
|
20
|
+
fi
|
|
21
|
+
done
|
|
22
|
+
SAVED="`pwd`"
|
|
23
|
+
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
24
|
+
APP_HOME="`pwd -P`"
|
|
25
|
+
cd "$SAVED" >/dev/null
|
|
26
|
+
|
|
27
|
+
APP_NAME="Gradle"
|
|
28
|
+
APP_BASE_NAME=`basename "$0"`
|
|
29
|
+
|
|
30
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
31
|
+
DEFAULT_JVM_OPTS=""
|
|
32
|
+
|
|
33
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
34
|
+
MAX_FD="maximum"
|
|
35
|
+
|
|
36
|
+
warn () {
|
|
37
|
+
echo "$*"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
die () {
|
|
41
|
+
echo
|
|
42
|
+
echo "$*"
|
|
43
|
+
echo
|
|
44
|
+
exit 1
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# OS specific support (must be 'true' or 'false').
|
|
48
|
+
cygwin=false
|
|
49
|
+
msys=false
|
|
50
|
+
darwin=false
|
|
51
|
+
nonstop=false
|
|
52
|
+
case "`uname`" in
|
|
53
|
+
CYGWIN* )
|
|
54
|
+
cygwin=true
|
|
55
|
+
;;
|
|
56
|
+
Darwin* )
|
|
57
|
+
darwin=true
|
|
58
|
+
;;
|
|
59
|
+
MINGW* )
|
|
60
|
+
msys=true
|
|
61
|
+
;;
|
|
62
|
+
NONSTOP* )
|
|
63
|
+
nonstop=true
|
|
64
|
+
;;
|
|
65
|
+
esac
|
|
66
|
+
|
|
67
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
68
|
+
|
|
69
|
+
# Determine the Java command to use to start the JVM.
|
|
70
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
71
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
72
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
73
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
74
|
+
else
|
|
75
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
76
|
+
fi
|
|
77
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
78
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
79
|
+
|
|
80
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
81
|
+
location of your Java installation."
|
|
82
|
+
fi
|
|
83
|
+
else
|
|
84
|
+
JAVACMD="java"
|
|
85
|
+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
86
|
+
|
|
87
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
88
|
+
location of your Java installation."
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Increase the maximum file descriptors if we can.
|
|
92
|
+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
93
|
+
MAX_FD_LIMIT=`ulimit -H -n`
|
|
94
|
+
if [ $? -eq 0 ] ; then
|
|
95
|
+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
96
|
+
MAX_FD="$MAX_FD_LIMIT"
|
|
97
|
+
fi
|
|
98
|
+
ulimit -n $MAX_FD
|
|
99
|
+
if [ $? -ne 0 ] ; then
|
|
100
|
+
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
101
|
+
fi
|
|
102
|
+
else
|
|
103
|
+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
104
|
+
fi
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# For Darwin, add options to specify how the application appears in the dock
|
|
108
|
+
if $darwin; then
|
|
109
|
+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# For Cygwin, switch paths to Windows format before running java
|
|
113
|
+
if $cygwin ; then
|
|
114
|
+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
115
|
+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
116
|
+
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
117
|
+
|
|
118
|
+
# We build the pattern for arguments to be converted via cygpath
|
|
119
|
+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
120
|
+
SEP=""
|
|
121
|
+
for dir in $ROOTDIRSRAW ; do
|
|
122
|
+
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
123
|
+
SEP="|"
|
|
124
|
+
done
|
|
125
|
+
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
126
|
+
# Add a user-defined pattern to the cygpath arguments
|
|
127
|
+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
128
|
+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
129
|
+
fi
|
|
130
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
131
|
+
i=0
|
|
132
|
+
for arg in "$@" ; do
|
|
133
|
+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
134
|
+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
135
|
+
|
|
136
|
+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
137
|
+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
138
|
+
else
|
|
139
|
+
eval `echo args$i`="\"$arg\""
|
|
140
|
+
fi
|
|
141
|
+
i=$((i+1))
|
|
142
|
+
done
|
|
143
|
+
case $i in
|
|
144
|
+
(0) set -- ;;
|
|
145
|
+
(1) set -- "$args0" ;;
|
|
146
|
+
(2) set -- "$args0" "$args1" ;;
|
|
147
|
+
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
148
|
+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
149
|
+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
150
|
+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
151
|
+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
152
|
+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
153
|
+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
154
|
+
esac
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# Escape application args
|
|
158
|
+
save () {
|
|
159
|
+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
160
|
+
echo " "
|
|
161
|
+
}
|
|
162
|
+
APP_ARGS=$(save "$@")
|
|
163
|
+
|
|
164
|
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
165
|
+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
166
|
+
|
|
167
|
+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
168
|
+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
169
|
+
cd "$(dirname "$0")"
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
project('openh264', ['c', 'cpp'],
|
|
2
|
+
version : '2.6.0',
|
|
3
|
+
meson_version : '>= 0.52',
|
|
4
|
+
default_options : [ 'warning_level=1',
|
|
5
|
+
'buildtype=debugoptimized' ])
|
|
6
|
+
|
|
7
|
+
major_version = '8'
|
|
8
|
+
|
|
9
|
+
cpp = meson.get_compiler('cpp')
|
|
10
|
+
|
|
11
|
+
inc = include_directories([
|
|
12
|
+
join_paths('codec', 'api', 'wels'),
|
|
13
|
+
join_paths('codec', 'common', 'inc'),
|
|
14
|
+
])
|
|
15
|
+
|
|
16
|
+
processing_inc = include_directories([
|
|
17
|
+
join_paths('codec', 'processing', 'interface'),
|
|
18
|
+
join_paths('codec', 'processing', 'src', 'common'),
|
|
19
|
+
join_paths('codec', 'processing', 'src', 'adaptivequantization'),
|
|
20
|
+
join_paths('codec', 'processing', 'src', 'downsample'),
|
|
21
|
+
join_paths('codec', 'processing', 'src', 'scrolldetection'),
|
|
22
|
+
join_paths('codec', 'processing', 'src', 'vaacalc'),
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
console_common_inc = include_directories([
|
|
26
|
+
join_paths('codec', 'console', 'common', 'inc')
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
decoder_inc = include_directories([
|
|
30
|
+
join_paths('codec', 'decoder', 'core', 'inc'),
|
|
31
|
+
join_paths('codec', 'decoder', 'plus', 'inc'),
|
|
32
|
+
])
|
|
33
|
+
|
|
34
|
+
encoder_inc = include_directories([
|
|
35
|
+
join_paths('codec', 'encoder', 'core', 'inc'),
|
|
36
|
+
join_paths('codec', 'encoder', 'plus', 'inc'),
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
system = host_machine.system()
|
|
40
|
+
cpu_family = host_machine.cpu_family()
|
|
41
|
+
|
|
42
|
+
supported_arguments = cpp.get_supported_arguments([
|
|
43
|
+
'-Wno-non-virtual-dtor',
|
|
44
|
+
'-Wunused-but-set-variable',
|
|
45
|
+
'-Wno-strict-aliasing'])
|
|
46
|
+
|
|
47
|
+
add_project_arguments(supported_arguments, language: 'cpp')
|
|
48
|
+
|
|
49
|
+
deps = [dependency('threads')]
|
|
50
|
+
c_args = []
|
|
51
|
+
cpp_args = []
|
|
52
|
+
asm_args = []
|
|
53
|
+
asm_inc = []
|
|
54
|
+
casm_inc = []
|
|
55
|
+
cpp_lib = '-lstdc++'
|
|
56
|
+
|
|
57
|
+
libm_dep = cpp.find_library('m', required : false)
|
|
58
|
+
deps += [libm_dep]
|
|
59
|
+
|
|
60
|
+
if ['linux', 'android', 'ios', 'darwin'].contains(system)
|
|
61
|
+
asm_format32 = 'elf'
|
|
62
|
+
asm_format64 = 'elf64'
|
|
63
|
+
if ['ios', 'darwin'].contains(system)
|
|
64
|
+
asm_format32 = 'macho32'
|
|
65
|
+
asm_format64 = 'macho64'
|
|
66
|
+
endif
|
|
67
|
+
if cpu_family == 'x86'
|
|
68
|
+
asm_format = asm_format32
|
|
69
|
+
asm_args += ['-DX86_32', '-DX86_32_PICASM', '-DHAVE_AVX2']
|
|
70
|
+
add_project_arguments('-DHAVE_AVX2', language: 'cpp')
|
|
71
|
+
add_project_arguments('-DHAVE_AVX2', '-DX86_ASM', '-DX86_32_ASM', language: 'c')
|
|
72
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
|
|
73
|
+
elif cpu_family == 'x86_64'
|
|
74
|
+
asm_format = asm_format64
|
|
75
|
+
asm_args += ['-DUNIX64', '-DHAVE_AVX2']
|
|
76
|
+
add_project_arguments('-DHAVE_AVX2', language: 'cpp')
|
|
77
|
+
add_project_arguments('-DHAVE_AVX2', '-DX86_ASM', language: 'c')
|
|
78
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
|
|
79
|
+
elif cpu_family == 'arm'
|
|
80
|
+
asm_format = asm_format32
|
|
81
|
+
add_project_arguments('-DHAVE_NEON', language: 'c')
|
|
82
|
+
add_project_arguments('-DHAVE_NEON', language: 'c')
|
|
83
|
+
casm_inc = include_directories(join_paths('codec', 'common', 'arm'))
|
|
84
|
+
elif cpu_family == 'aarch64'
|
|
85
|
+
asm_format = asm_format64
|
|
86
|
+
add_project_arguments('-DHAVE_NEON_AARCH64', language: 'c')
|
|
87
|
+
add_project_arguments('-DHAVE_NEON_AARCH64', language: 'cpp')
|
|
88
|
+
casm_inc = include_directories(join_paths('codec', 'common', 'arm64'))
|
|
89
|
+
elif cpu_family == 'loongarch32'
|
|
90
|
+
asm_format = asm_format32
|
|
91
|
+
add_project_arguments('-mlsx', '-DHAVE_LSX', '-mlasx', '-DHAVE_LASX', language: 'c')
|
|
92
|
+
add_project_arguments('-DHAVE_LSX', '-DHAVE_LASX', language: 'cpp')
|
|
93
|
+
casm_inc = include_directories(join_paths('codec', 'common', 'loongarch'))
|
|
94
|
+
elif cpu_family == 'loongarch64'
|
|
95
|
+
asm_format = asm_format64
|
|
96
|
+
add_project_arguments('-mlsx', '-DHAVE_LSX', '-mlasx', '-DHAVE_LASX', language: 'c')
|
|
97
|
+
add_project_arguments('-DHAVE_LSX', '-DHAVE_LASX', language: 'cpp')
|
|
98
|
+
casm_inc = include_directories(join_paths('codec', 'common', 'loongarch'))
|
|
99
|
+
elif cpu_family == 'riscv64'
|
|
100
|
+
# We don't have riscv64-specific optimization for now.
|
|
101
|
+
asm_format = asm_format64
|
|
102
|
+
elif cpu_family == 'ppc'
|
|
103
|
+
# We don't have powerpc-specific optimization for now.
|
|
104
|
+
asm_format = asm_format32
|
|
105
|
+
elif cpu_family == 'ppc64'
|
|
106
|
+
# We don't have powerpc64-specific optimization for now.
|
|
107
|
+
asm_format = asm_format64
|
|
108
|
+
else
|
|
109
|
+
error('FIXME: unhandled CPU family @0@ for @1@'.format(cpu_family, system))
|
|
110
|
+
endif
|
|
111
|
+
|
|
112
|
+
if ['ios', 'darwin', 'android'].contains(system)
|
|
113
|
+
cpp_lib = '-lc++'
|
|
114
|
+
endif
|
|
115
|
+
elif system == 'windows'
|
|
116
|
+
if cpu_family == 'x86'
|
|
117
|
+
asm_format = 'win32'
|
|
118
|
+
asm_args += ['-DPREFIX', '-DX86_32']
|
|
119
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
|
|
120
|
+
elif cpu_family == 'x86_64'
|
|
121
|
+
asm_format = 'win64'
|
|
122
|
+
asm_args += ['-DWIN64']
|
|
123
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'x86', '')
|
|
124
|
+
elif cpu_family == 'arm'
|
|
125
|
+
if cpp.get_argument_syntax() == 'msvc'
|
|
126
|
+
asm_format = 'armasm'
|
|
127
|
+
asm_args += ['-nologo', '-DHAVE_NEON', '-ignore', '4509']
|
|
128
|
+
asm_cmds = ['armasm']
|
|
129
|
+
else
|
|
130
|
+
asm_format = 'clang'
|
|
131
|
+
asm_args += ['-DHAVE_NEON', '-mimplicit-it=always']
|
|
132
|
+
asm_cmds = cpp.cmd_array()
|
|
133
|
+
endif
|
|
134
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'arm', '')
|
|
135
|
+
elif cpu_family == 'aarch64'
|
|
136
|
+
asm_format = 'armasm'
|
|
137
|
+
asm_args += ['-nologo', '-DHAVE_NEON_AARCH64']
|
|
138
|
+
asm_inc = join_paths(meson.current_source_dir(), 'codec', 'common', 'arm64', '')
|
|
139
|
+
else
|
|
140
|
+
error('FIXME: unhandled CPU family @0@ for Windows'.format(cpu_family))
|
|
141
|
+
endif
|
|
142
|
+
else
|
|
143
|
+
error('FIXME: Unhandled system @0@'.format(system))
|
|
144
|
+
endif
|
|
145
|
+
|
|
146
|
+
use_asm_gen = false
|
|
147
|
+
if cpu_family in ['x86', 'x86_64']
|
|
148
|
+
nasm = find_program('nasm')
|
|
149
|
+
|
|
150
|
+
use_asm_gen = true
|
|
151
|
+
asm_gen = generator(nasm,
|
|
152
|
+
output : '@BASENAME@.o',
|
|
153
|
+
arguments : [
|
|
154
|
+
'-f', asm_format,
|
|
155
|
+
'-i', asm_inc,
|
|
156
|
+
'@INPUT@',
|
|
157
|
+
'-o', '@OUTPUT@'] + asm_args)
|
|
158
|
+
elif system == 'windows'
|
|
159
|
+
if cpu_family == 'arm'
|
|
160
|
+
# For ARM, gas-preprocessor is needed for converting the asm to be
|
|
161
|
+
# buildable as thumb even with Clang.
|
|
162
|
+
use_asm_gen = true
|
|
163
|
+
gasprep = find_program('gas-preprocessor.pl')
|
|
164
|
+
asm_gen = generator(gasprep,
|
|
165
|
+
output : '@BASENAME@.obj',
|
|
166
|
+
arguments : [
|
|
167
|
+
'-as-type', asm_format,
|
|
168
|
+
'-force-thumb',
|
|
169
|
+
'--'
|
|
170
|
+
] + asm_cmds + [
|
|
171
|
+
'-I' + asm_inc] + asm_args + [
|
|
172
|
+
'@INPUT@',
|
|
173
|
+
'-c', '-o', '@OUTPUT@'])
|
|
174
|
+
elif cpu_family == 'aarch64'
|
|
175
|
+
# For ARM64, Clang can build the assembly as-is without needing to use
|
|
176
|
+
# either gas-preprocessor or armasm64.
|
|
177
|
+
if cpp.get_argument_syntax() == 'msvc' and (cpp.get_id() != 'clang-cl' or meson.version().version_compare('<0.58.0'))
|
|
178
|
+
use_asm_gen = true
|
|
179
|
+
gasprep = find_program('gas-preprocessor.pl')
|
|
180
|
+
asm_gen = generator(gasprep,
|
|
181
|
+
output : '@BASENAME@.obj',
|
|
182
|
+
arguments : [
|
|
183
|
+
'-as-type', asm_format,
|
|
184
|
+
'-arch', 'aarch64',
|
|
185
|
+
'--',
|
|
186
|
+
'armasm64',
|
|
187
|
+
'-I' + asm_inc] + asm_args + [
|
|
188
|
+
'@INPUT@',
|
|
189
|
+
'-c', '-o', '@OUTPUT@'])
|
|
190
|
+
endif
|
|
191
|
+
else
|
|
192
|
+
# Windows only supports x86, x86_64, arm, arm64
|
|
193
|
+
error('unreachable code')
|
|
194
|
+
endif
|
|
195
|
+
endif
|
|
196
|
+
|
|
197
|
+
subdir ('codec')
|
|
198
|
+
subdir ('test')
|
|
199
|
+
|
|
200
|
+
libopenh264 = library('openh264',
|
|
201
|
+
link_whole: [libcommon, libprocessing, libencoder, libdecoder],
|
|
202
|
+
install: true,
|
|
203
|
+
soversion: major_version,
|
|
204
|
+
version: meson.project_version(),
|
|
205
|
+
vs_module_defs: 'openh264.def',
|
|
206
|
+
dependencies: deps)
|
|
207
|
+
|
|
208
|
+
openh264_dep = declare_dependency(
|
|
209
|
+
link_with: libopenh264,
|
|
210
|
+
include_directories: include_directories('codec/api'),
|
|
211
|
+
dependencies: deps)
|
|
212
|
+
|
|
213
|
+
pkg = import('pkgconfig')
|
|
214
|
+
pkg.generate(libopenh264,
|
|
215
|
+
description: 'OpenH264 is a codec library which supports H.264 encoding ' +
|
|
216
|
+
'and decoding. It is suitable for use in real time ' +
|
|
217
|
+
'applications such as WebRTC.',
|
|
218
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
option('tests', type : 'feature', value : 'auto', yield : true)
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015, Mozilla Foundation and contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef __RefCount_h__
|
|
18
|
+
#define __RefCount_h__
|
|
19
|
+
|
|
20
|
+
#include <stdint.h>
|
|
21
|
+
#include <assert.h>
|
|
22
|
+
|
|
23
|
+
extern GMPPlatformAPI* g_platform_api;
|
|
24
|
+
|
|
25
|
+
inline GMPMutex* GMPCreateMutex() {
|
|
26
|
+
GMPMutex* mutex;
|
|
27
|
+
if (!g_platform_api) {
|
|
28
|
+
return nullptr;
|
|
29
|
+
}
|
|
30
|
+
GMPErr err = g_platform_api->createmutex(&mutex);
|
|
31
|
+
assert(mutex);
|
|
32
|
+
return GMP_FAILED(err) ? nullptr : mutex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class AutoLock {
|
|
36
|
+
public:
|
|
37
|
+
explicit AutoLock(GMPMutex* aMutex)
|
|
38
|
+
: mMutex(aMutex)
|
|
39
|
+
{
|
|
40
|
+
assert(aMutex);
|
|
41
|
+
if (mMutex) {
|
|
42
|
+
mMutex->Acquire();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
~AutoLock() {
|
|
46
|
+
if (mMutex) {
|
|
47
|
+
mMutex->Release();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
private:
|
|
51
|
+
GMPMutex* mMutex;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
class AtomicRefCount {
|
|
55
|
+
public:
|
|
56
|
+
explicit AtomicRefCount(uint32_t aValue)
|
|
57
|
+
: mCount(aValue)
|
|
58
|
+
, mMutex(GMPCreateMutex())
|
|
59
|
+
{
|
|
60
|
+
assert(mMutex);
|
|
61
|
+
}
|
|
62
|
+
~AtomicRefCount()
|
|
63
|
+
{
|
|
64
|
+
if (mMutex) {
|
|
65
|
+
mMutex->Destroy();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
uint32_t operator--() {
|
|
69
|
+
AutoLock lock(mMutex);
|
|
70
|
+
return --mCount;
|
|
71
|
+
}
|
|
72
|
+
uint32_t operator++() {
|
|
73
|
+
AutoLock lock(mMutex);
|
|
74
|
+
return ++mCount;
|
|
75
|
+
}
|
|
76
|
+
operator uint32_t() {
|
|
77
|
+
AutoLock lock(mMutex);
|
|
78
|
+
return mCount;
|
|
79
|
+
}
|
|
80
|
+
private:
|
|
81
|
+
uint32_t mCount;
|
|
82
|
+
GMPMutex* mMutex;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Note: Thread safe.
|
|
86
|
+
class RefCounted {
|
|
87
|
+
public:
|
|
88
|
+
void AddRef() {
|
|
89
|
+
++mRefCount;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
uint32_t Release() {
|
|
93
|
+
uint32_t newCount = --mRefCount;
|
|
94
|
+
if (!newCount) {
|
|
95
|
+
delete this;
|
|
96
|
+
}
|
|
97
|
+
return newCount;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
protected:
|
|
101
|
+
RefCounted()
|
|
102
|
+
: mRefCount(0)
|
|
103
|
+
{
|
|
104
|
+
}
|
|
105
|
+
virtual ~RefCounted()
|
|
106
|
+
{
|
|
107
|
+
assert(!mRefCount);
|
|
108
|
+
}
|
|
109
|
+
AtomicRefCount mRefCount;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
template<class T>
|
|
113
|
+
class RefPtr {
|
|
114
|
+
public:
|
|
115
|
+
explicit RefPtr(T* aPtr) : mPtr(nullptr) {
|
|
116
|
+
Assign(aPtr);
|
|
117
|
+
}
|
|
118
|
+
~RefPtr() {
|
|
119
|
+
Assign(nullptr);
|
|
120
|
+
}
|
|
121
|
+
T* operator->() const { return mPtr; }
|
|
122
|
+
|
|
123
|
+
RefPtr& operator=(T* aVal) {
|
|
124
|
+
Assign(aVal);
|
|
125
|
+
return *this;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private:
|
|
129
|
+
void Assign(T* aPtr) {
|
|
130
|
+
if (mPtr) {
|
|
131
|
+
mPtr->Release();
|
|
132
|
+
}
|
|
133
|
+
mPtr = aPtr;
|
|
134
|
+
if (mPtr) {
|
|
135
|
+
aPtr->AddRef();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
T* mPtr;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
#endif // __RefCount_h__
|