cutcutcodec 1.0.post3__py3-none-any.whl
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.
Potentially problematic release.
This version of cutcutcodec might be problematic. Click here for more details.
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__init__.py +6 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__main__.py +38 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/c_build.py +33 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/_helper_properties.py +52 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/duration.py +83 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/ffprobe.py +637 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/find.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/time_backprop.py +68 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_audio.py +239 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_video.py +97 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/shape.py +107 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/time_backprop.py +183 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/duration.py +162 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/nb_frames.py +159 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/rate.py +102 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/timestamps.py +194 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/container.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/encoder.py +152 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/filter.py +33 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame.py +127 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_audio.py +205 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_video.py +322 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/layout.py +206 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/meta_filter.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/muxer.py +184 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/node.py +164 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream.py +182 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_audio.py +130 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_video.py +193 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/__init__.py +7 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/ast_to_file.py +125 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/__init__.py +6 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/compatibility.py +734 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/default.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/encodec.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/muxer.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/rate.py +133 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_ast.py +477 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_json.py +104 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_tree.py +190 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/json_to_graph.py +114 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/parse.py +123 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/__init__.py +15 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/dynamic.py +544 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/lambdify.py +612 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/preprocess.py +698 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/printer.py +926 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/tree_to_graph.py +168 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/decision/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/add.py +73 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/remove.py +476 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/exceptions.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/add.py +170 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cat.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cut.py +112 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/delay.py +85 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/equation.py +261 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/fir.py +231 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/identity.py +48 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/resample.py +451 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/subclip.py +91 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/cut.py +74 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/audio_cast.py +208 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/video_cast.py +197 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/subclip.py +53 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/add.py +331 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cat.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cut.py +113 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/delay.py +84 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/equation.py +265 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/identity.py +48 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/pad.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/subclip.py +91 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/empty.py +73 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/equation.py +56 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/noise.py +243 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/c_fractal.cpython-312-x86_64-linux-gnu.so +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/empty.py +69 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/equation.py +109 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/fractal.c +116 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/geometry.py +100 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/mandelbrot.py +176 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/noise.py +112 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/seedable.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_ffmpeg.py +904 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_svg.py +145 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/scheduler.py +356 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/write.py +340 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/basic.py +35 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/graph.py +80 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/graph.py +81 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/singleton.py +47 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cuda/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/__init__.py +5 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/proba.py +189 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/__init__.py +5 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/delay_to_fir.py +88 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/graph.py +17 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/buffer.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/utils.py +34 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/audio_5.1_narration.oga +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/intro.webm +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/logo.svg +13 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/project.json +226 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/video.mp4 +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__main__.py +25 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/actions.py +63 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/app.py +248 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/base.py +50 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/container_input_ffmpeg.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_delay.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_equation.py +45 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_fir.py +58 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_subclip.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_cut.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_delay.py +20 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_subclip.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_delay.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_equation.py +53 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_subclip.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_equation.py +14 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_noise.py +19 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_equation.py +13 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_mandelbrot.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_noise.py +18 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/base.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/default.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/documentation.py +47 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/general.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/interface.py +305 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/loader.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/main.py +62 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edition_tabs.py +34 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/base.py +122 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/filters.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/generators.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry_tabs.py +46 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/_helper.py +54 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/container.py +226 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/doc.py +67 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/encodec.py +289 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/main.py +173 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/edge_properties.py +56 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/main.py +280 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/node.py +44 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/main.py +151 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/menu.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/audio_settings.py +183 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/main.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/video_settings.py +257 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/run.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/main.py +30 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/slider.py +286 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/track.py +97 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/view.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/toolbar.py +29 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/tools.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/audio_player.py +103 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/control.py +96 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/frame_extractor.py +254 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/main.py +115 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__main__.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/coding_style.py +49 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/generation.py +52 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/install.py +72 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/run.py +58 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/abstract.py +215 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_cast.py +35 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_equation.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/c_memory.py +132 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compatibility.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compile.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/encoder.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_cut.py +107 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_delay.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_empty.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/fir.py +143 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/hashes.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/initialisation.py +24 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/muxer.py +22 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/nan_snapshot.py +39 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/read.py +192 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/serialization_equality.py +50 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/snapshot_shape.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/sympy_to_torch.py +135 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/thread_safe.py +77 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/time_range.py +55 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/video_equation.py +77 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/write.py +95 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/utils.py +40 -0
- cutcutcodec-1.0.post3.dist-info/LICENSE +7 -0
- cutcutcodec-1.0.post3.dist-info/METADATA +271 -0
- cutcutcodec-1.0.post3.dist-info/RECORD +233 -0
- cutcutcodec-1.0.post3.dist-info/WHEEL +5 -0
- cutcutcodec-1.0.post3.dist-info/entry_points.txt +6 -0
- cutcutcodec-1.0.post3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Ensures that the methods and attributes of abstract classes are well defined."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
import math
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.classes.node import Node
|
|
11
|
+
from cutcutcodec.core.classes.stream import Stream
|
|
12
|
+
from cutcutcodec.core.classes.stream_video import StreamVideo
|
|
13
|
+
from cutcutcodec.testing.generation import extract_streams
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_node_default():
|
|
17
|
+
"""Make sure the ``default`` method is abstract."""
|
|
18
|
+
|
|
19
|
+
class _Node(Node):
|
|
20
|
+
_getstate = None
|
|
21
|
+
_setstate = None
|
|
22
|
+
|
|
23
|
+
class _NodeOk(_Node):
|
|
24
|
+
default = None
|
|
25
|
+
|
|
26
|
+
with pytest.raises(
|
|
27
|
+
TypeError,
|
|
28
|
+
match="Can't instantiate abstract class _Node with abstract method default",
|
|
29
|
+
):
|
|
30
|
+
_Node([], [])
|
|
31
|
+
_NodeOk([], [])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_node_getstate():
|
|
35
|
+
"""Make sure the ``getstate`` method is abstract."""
|
|
36
|
+
|
|
37
|
+
class _Node(Node):
|
|
38
|
+
_setstate = None
|
|
39
|
+
default = None
|
|
40
|
+
|
|
41
|
+
class _NodeOk(_Node):
|
|
42
|
+
_getstate = None
|
|
43
|
+
|
|
44
|
+
with pytest.raises(
|
|
45
|
+
TypeError,
|
|
46
|
+
match="Can't instantiate abstract class _Node with abstract method _getstate",
|
|
47
|
+
):
|
|
48
|
+
_Node([], [])
|
|
49
|
+
_NodeOk([], [])
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_node_setstate():
|
|
53
|
+
"""Make sure the ``getstate`` method is abstract."""
|
|
54
|
+
|
|
55
|
+
class _Node(Node):
|
|
56
|
+
_getstate = None
|
|
57
|
+
default = None
|
|
58
|
+
|
|
59
|
+
class _NodeOk(_Node):
|
|
60
|
+
_setstate = None
|
|
61
|
+
|
|
62
|
+
with pytest.raises(
|
|
63
|
+
TypeError,
|
|
64
|
+
match="Can't instantiate abstract class _Node with abstract method _setstate",
|
|
65
|
+
):
|
|
66
|
+
_Node([], [])
|
|
67
|
+
_NodeOk([], [])
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_stream_beginning():
|
|
71
|
+
"""Make sure the ``duration`` method is abstract."""
|
|
72
|
+
|
|
73
|
+
class _Node(Node):
|
|
74
|
+
_getstate = None
|
|
75
|
+
_setstate = None
|
|
76
|
+
default = None
|
|
77
|
+
|
|
78
|
+
class _Stream(Stream):
|
|
79
|
+
duration = None
|
|
80
|
+
is_space_continuous = None
|
|
81
|
+
is_time_continuous = None
|
|
82
|
+
type = None
|
|
83
|
+
|
|
84
|
+
class _StreamOk(_Stream):
|
|
85
|
+
beginning = None
|
|
86
|
+
|
|
87
|
+
node = _Node([], [])
|
|
88
|
+
with pytest.raises(
|
|
89
|
+
TypeError,
|
|
90
|
+
match="Can't instantiate abstract class _Stream with abstract method beginning",
|
|
91
|
+
):
|
|
92
|
+
_Stream(node)
|
|
93
|
+
_StreamOk(node)
|
|
94
|
+
|
|
95
|
+
for stream in extract_streams():
|
|
96
|
+
assert isinstance(stream.beginning, Fraction)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_stream_duration():
|
|
100
|
+
"""Make sure the ``duration`` method is abstract."""
|
|
101
|
+
|
|
102
|
+
class _Node(Node):
|
|
103
|
+
_getstate = None
|
|
104
|
+
_setstate = None
|
|
105
|
+
default = None
|
|
106
|
+
|
|
107
|
+
class _Stream(Stream):
|
|
108
|
+
beginning = None
|
|
109
|
+
is_space_continuous = None
|
|
110
|
+
is_time_continuous = None
|
|
111
|
+
type = None
|
|
112
|
+
|
|
113
|
+
class _StreamOk(_Stream):
|
|
114
|
+
duration = None
|
|
115
|
+
|
|
116
|
+
node = _Node([], [])
|
|
117
|
+
with pytest.raises(
|
|
118
|
+
TypeError,
|
|
119
|
+
match="Can't instantiate abstract class _Stream with abstract method duration",
|
|
120
|
+
):
|
|
121
|
+
_Stream(node)
|
|
122
|
+
_StreamOk(node)
|
|
123
|
+
|
|
124
|
+
for stream in extract_streams():
|
|
125
|
+
duration = stream.duration
|
|
126
|
+
assert isinstance(duration, Fraction) or duration == math.inf
|
|
127
|
+
assert duration >= 0
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_stream_space_continuous():
|
|
131
|
+
"""Make sure the ``is_space_continuous`` method is abstract."""
|
|
132
|
+
|
|
133
|
+
class _Node(Node):
|
|
134
|
+
_getstate = None
|
|
135
|
+
_setstate = None
|
|
136
|
+
default = None
|
|
137
|
+
|
|
138
|
+
class _Stream(StreamVideo):
|
|
139
|
+
beginning = None
|
|
140
|
+
duration = None
|
|
141
|
+
is_time_continuous = None
|
|
142
|
+
type = None
|
|
143
|
+
|
|
144
|
+
class _StreamOk(_Stream):
|
|
145
|
+
is_space_continuous = None
|
|
146
|
+
|
|
147
|
+
node = _Node([], [])
|
|
148
|
+
with pytest.raises(
|
|
149
|
+
TypeError,
|
|
150
|
+
match="Can't instantiate abstract class _Stream with abstract method is_space_continuous",
|
|
151
|
+
):
|
|
152
|
+
_Stream(node)
|
|
153
|
+
_StreamOk(node)
|
|
154
|
+
|
|
155
|
+
for stream in (s for s in extract_streams() if isinstance(s, StreamVideo)):
|
|
156
|
+
assert isinstance(stream.is_space_continuous, bool)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_stream_time_continuous():
|
|
160
|
+
"""Make sure the ``is_time_continuous`` method is abstract."""
|
|
161
|
+
|
|
162
|
+
class _Node(Node):
|
|
163
|
+
_getstate = None
|
|
164
|
+
_setstate = None
|
|
165
|
+
default = None
|
|
166
|
+
|
|
167
|
+
class _Stream(Stream):
|
|
168
|
+
beginning = None
|
|
169
|
+
duration = None
|
|
170
|
+
is_space_continuous = None
|
|
171
|
+
type = None
|
|
172
|
+
|
|
173
|
+
class _StreamOk(_Stream):
|
|
174
|
+
is_time_continuous = None
|
|
175
|
+
|
|
176
|
+
node = _Node([], [])
|
|
177
|
+
with pytest.raises(
|
|
178
|
+
TypeError,
|
|
179
|
+
match="Can't instantiate abstract class _Stream with abstract method is_time_continuous",
|
|
180
|
+
):
|
|
181
|
+
_Stream(node)
|
|
182
|
+
_StreamOk(node)
|
|
183
|
+
|
|
184
|
+
for stream in extract_streams():
|
|
185
|
+
assert isinstance(stream.is_time_continuous, bool)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def test_stream_type():
|
|
189
|
+
"""Make sure the ``type`` method is abstract."""
|
|
190
|
+
|
|
191
|
+
class _Node(Node):
|
|
192
|
+
_getstate = None
|
|
193
|
+
_setstate = None
|
|
194
|
+
default = None
|
|
195
|
+
|
|
196
|
+
class _Stream(Stream):
|
|
197
|
+
beginning = None
|
|
198
|
+
duration = None
|
|
199
|
+
is_space_continuous = None
|
|
200
|
+
is_time_continuous = None
|
|
201
|
+
|
|
202
|
+
class _StreamOk(_Stream):
|
|
203
|
+
type = None
|
|
204
|
+
|
|
205
|
+
node = _Node([], [])
|
|
206
|
+
with pytest.raises(
|
|
207
|
+
TypeError,
|
|
208
|
+
match="Can't instantiate abstract class _Stream with abstract method type",
|
|
209
|
+
):
|
|
210
|
+
_Stream(node)
|
|
211
|
+
_StreamOk(node)
|
|
212
|
+
|
|
213
|
+
for stream in extract_streams():
|
|
214
|
+
assert isinstance(stream.type, str)
|
|
215
|
+
assert stream.type in {"audio", "subtitle", "video"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Test the bijection of the audio linear cast."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
|
|
7
|
+
import torch
|
|
8
|
+
|
|
9
|
+
from cutcutcodec.core.classes.frame_audio import FrameAudio
|
|
10
|
+
from cutcutcodec.core.classes.layout import Layout
|
|
11
|
+
from cutcutcodec.core.filters.mix.audio_cast import AudioConvertor
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_bijection():
|
|
15
|
+
"""Ensure that the convertion of A to B to A with B higher is identity."""
|
|
16
|
+
for p_in, p_out in AudioConvertor.all_layouts():
|
|
17
|
+
if len(Layout(p_in).channels) <= len(Layout(p_out).channels):
|
|
18
|
+
conv_1 = AudioConvertor(p_in, p_out)
|
|
19
|
+
conv_2 = AudioConvertor(p_out, p_in)
|
|
20
|
+
for var, equation in conv_2.equations.items():
|
|
21
|
+
assert 1.0*var == 1.0*equation.subs(conv_1.equations).simplify()
|
|
22
|
+
frame = FrameAudio(0, 1, p_in, torch.randn((len(Layout(p_in).channels), 1024)))
|
|
23
|
+
assert torch.equal(frame, conv_2(conv_1(frame))), (p_in, p_out)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_conserve_meta():
|
|
27
|
+
"""Ensure that the metadatas are conserved."""
|
|
28
|
+
converter = AudioConvertor("stereo", "mono")
|
|
29
|
+
assert converter(FrameAudio(0, 1, "stereo", torch.empty(2, 128))).time == 0
|
|
30
|
+
assert converter(FrameAudio("1/2", 1, "stereo", torch.empty(2, 128))).time == Fraction(1, 2)
|
|
31
|
+
assert converter(FrameAudio(1, 1, "stereo", torch.empty(2, 128))).time == 1
|
|
32
|
+
assert converter(FrameAudio(0, 1, "stereo", torch.empty(2, 128))).rate == 1
|
|
33
|
+
assert converter(FrameAudio(0, 48000, "stereo", torch.empty(2, 128))).rate == 48000
|
|
34
|
+
assert converter(FrameAudio(0, 1, "stereo", torch.empty(2, 128))).samples == 128
|
|
35
|
+
assert converter(FrameAudio(0, 1, "stereo", torch.empty(2, 256))).samples == 256
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Perform tests on the ``cutcutcodec.core.generation.audio.equation.GeneratorAudioEquation``."""
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
import sympy
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.generation.audio.equation import GeneratorAudioEquation
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_clip_nan():
|
|
14
|
+
"""Ensures that the values remain in the correct range."""
|
|
15
|
+
for stream, val in (
|
|
16
|
+
(GeneratorAudioEquation(-2).out_streams[0], -1),
|
|
17
|
+
(GeneratorAudioEquation(2).out_streams[0], 1),
|
|
18
|
+
(GeneratorAudioEquation("-2").out_streams[0], -1),
|
|
19
|
+
(GeneratorAudioEquation("2").out_streams[0], 1),
|
|
20
|
+
(GeneratorAudioEquation(math.inf).out_streams[0], 1),
|
|
21
|
+
(GeneratorAudioEquation(-math.inf).out_streams[0], -1),
|
|
22
|
+
(GeneratorAudioEquation(math.nan).out_streams[0], 0),
|
|
23
|
+
(GeneratorAudioEquation("oo").out_streams[0], 1),
|
|
24
|
+
(GeneratorAudioEquation("-oo").out_streams[0], -1),
|
|
25
|
+
(GeneratorAudioEquation("nan").out_streams[0], 0),
|
|
26
|
+
):
|
|
27
|
+
assert stream.snapshot(0, 1, 1).item() == val
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_complex_real_part():
|
|
31
|
+
"""Check that the Euclidean norm is used for a complex expression."""
|
|
32
|
+
(stream,) = GeneratorAudioEquation("(3/8+4/8*I)").out_streams
|
|
33
|
+
assert stream.snapshot(0, 1, 1).item() == 0.375 # /8 for double base 2
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_contant():
|
|
37
|
+
"""Make sure the numbers are cast in array."""
|
|
38
|
+
(stream,) = GeneratorAudioEquation(0).out_streams
|
|
39
|
+
assert stream.snapshot(0, 1, 2).shape == (1, 2)
|
|
40
|
+
(stream,) = GeneratorAudioEquation(0, "t").out_streams # mix cst and array
|
|
41
|
+
assert stream.snapshot(0, 1, 3).shape == (2, 3)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_divide_by_zero():
|
|
45
|
+
"""Make sure not failed when divide by 0."""
|
|
46
|
+
(stream,) = GeneratorAudioEquation("1/t").out_streams
|
|
47
|
+
stream.snapshot(0, 1, 1)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_input_type():
|
|
51
|
+
"""Check that the entries can be of sympy, str and number type."""
|
|
52
|
+
signals = [sympy.sympify("0"), 1 + sympy.Symbol("t", real=True, positive=True)]
|
|
53
|
+
(stream_from_expr,) = GeneratorAudioEquation(*signals).out_streams
|
|
54
|
+
(stream_from_str,) = GeneratorAudioEquation("0", "1+t").out_streams
|
|
55
|
+
(stream_from_num,) = GeneratorAudioEquation(0, signals[1]).out_streams
|
|
56
|
+
|
|
57
|
+
assert stream_from_expr.node.signals == signals
|
|
58
|
+
assert stream_from_str.node.signals == signals
|
|
59
|
+
assert stream_from_num.node.signals == signals
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_input_vars():
|
|
63
|
+
"""Make sure that only the symbol t is allowed."""
|
|
64
|
+
exprs_ok = ["t", "E", "pi", "oo", "nan"]
|
|
65
|
+
exprs_fail = list("abcdefghijklmnopqrsuvwxyzABCDFGHKLMPRUVWXYZ")
|
|
66
|
+
|
|
67
|
+
for expr in exprs_ok:
|
|
68
|
+
GeneratorAudioEquation(expr).out_streams[0].snapshot(0, 1, 1)
|
|
69
|
+
for expr in exprs_fail:
|
|
70
|
+
with pytest.raises(AssertionError):
|
|
71
|
+
GeneratorAudioEquation(expr).out_streams[0].snapshot(0, 1, 1)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the arrays comming from C are well referenced."""
|
|
4
|
+
|
|
5
|
+
import gc
|
|
6
|
+
import tracemalloc
|
|
7
|
+
|
|
8
|
+
from sympy.abc import x
|
|
9
|
+
from sympy.core.containers import Tuple
|
|
10
|
+
import numpy as np
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
13
|
+
from cutcutcodec.core.compilation.sympy_to_torch.lambdify import _lambdify_c
|
|
14
|
+
from cutcutcodec.core.compilation.sympy_to_torch.preprocess import preprocess
|
|
15
|
+
from cutcutcodec.core.compilation.sympy_to_torch.printer import _printer
|
|
16
|
+
from cutcutcodec.core.generation.video.c_fractal import mandelbrot
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@pytest.mark.slow
|
|
20
|
+
def test_leak_fractal_mandelbrot():
|
|
21
|
+
"""Ensure there is not memory leak in mandelbrot generation."""
|
|
22
|
+
imag, real = np.meshgrid(
|
|
23
|
+
np.linspace(-1.12, 1.12, 354, dtype=np.float64),
|
|
24
|
+
np.linspace(-2.0, 0.47, 354, dtype=np.float64),
|
|
25
|
+
indexing="ij",
|
|
26
|
+
) # 1 Mo for out
|
|
27
|
+
real, imag = real.ravel(), imag.ravel()
|
|
28
|
+
tracemalloc.start()
|
|
29
|
+
gc.collect()
|
|
30
|
+
snapshot1 = tracemalloc.take_snapshot()
|
|
31
|
+
for _ in range(1000): # total leak 1 Go
|
|
32
|
+
mandelbrot(real, imag, 64)
|
|
33
|
+
gc.collect()
|
|
34
|
+
snapshot2 = tracemalloc.take_snapshot()
|
|
35
|
+
tracemalloc.stop()
|
|
36
|
+
top_stat = snapshot2.compare_to(snapshot1, "lineno")[0]
|
|
37
|
+
assert top_stat.size_diff < 500_000_000, f"mandelbrot memory leak of {top_stat.size_diff} bytes"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_leak_inplace_array_printer():
|
|
41
|
+
"""Ensure there is not memory leak when the returned array is an input array."""
|
|
42
|
+
tree = preprocess(x + 1, set(), set(), set())
|
|
43
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
44
|
+
tracemalloc.start()
|
|
45
|
+
gc.collect()
|
|
46
|
+
snapshot1 = tracemalloc.take_snapshot()
|
|
47
|
+
for _ in range(1000): # total leak 1 Go
|
|
48
|
+
func(np.zeros(250_000, dtype=np.float32)) # 1 Mo
|
|
49
|
+
gc.collect()
|
|
50
|
+
snapshot2 = tracemalloc.take_snapshot()
|
|
51
|
+
tracemalloc.stop()
|
|
52
|
+
top_stat = snapshot2.compare_to(snapshot1, "lineno")[0]
|
|
53
|
+
assert top_stat.size_diff < 500_000_000, \
|
|
54
|
+
f"c printer inplace memory leak of {top_stat.size_diff} bytes"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_leak_new_array_printer():
|
|
58
|
+
"""Ensure there is not memory leak when the returned array is allocated inside the C func."""
|
|
59
|
+
tree = preprocess(x*(x + 1), set(), set(), set())
|
|
60
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
61
|
+
tracemalloc.start()
|
|
62
|
+
gc.collect()
|
|
63
|
+
snapshot1 = tracemalloc.take_snapshot()
|
|
64
|
+
for _ in range(1000): # total leak 1 Go
|
|
65
|
+
func(np.zeros(250_000, dtype=np.float32)) # 1 Mo
|
|
66
|
+
gc.collect()
|
|
67
|
+
snapshot2 = tracemalloc.take_snapshot()
|
|
68
|
+
tracemalloc.stop()
|
|
69
|
+
top_stat = snapshot2.compare_to(snapshot1, "lineno")[0]
|
|
70
|
+
assert top_stat.size_diff < 500_000_000, \
|
|
71
|
+
f"c printer new memory leak of {top_stat.size_diff} bytes"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_leak_tuple_pack_printer():
|
|
75
|
+
"""Ensure there is not memory leak when the returned arrays are packed in a tuple."""
|
|
76
|
+
tree = preprocess(Tuple(x, x + 1), set(), set(), set())
|
|
77
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
78
|
+
tracemalloc.start()
|
|
79
|
+
gc.collect()
|
|
80
|
+
snapshot1 = tracemalloc.take_snapshot()
|
|
81
|
+
for _ in range(1000): # total leak 1 or 2 Go
|
|
82
|
+
func(np.zeros(250_000, dtype=np.float32)) # 1 Mo
|
|
83
|
+
gc.collect()
|
|
84
|
+
snapshot2 = tracemalloc.take_snapshot()
|
|
85
|
+
tracemalloc.stop()
|
|
86
|
+
top_stat = snapshot2.compare_to(snapshot1, "lineno")[0]
|
|
87
|
+
assert top_stat.size_diff < 500_000_000, \
|
|
88
|
+
f"c printer inplace memory leak of {top_stat.size_diff} bytes"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_segfault_fractal_mandelbrot():
|
|
92
|
+
"""Ensure the result of mandelbrot is not dereferenced."""
|
|
93
|
+
imag, real = np.meshgrid(
|
|
94
|
+
np.linspace(-1.12, 1.12, 3540, dtype=np.float64),
|
|
95
|
+
np.linspace(-2.0, 0.47, 3540, dtype=np.float64),
|
|
96
|
+
indexing="ij",
|
|
97
|
+
) # 100 Mo for out
|
|
98
|
+
real, imag = real.ravel(), imag.ravel()
|
|
99
|
+
iterations = mandelbrot(real, imag, 64)
|
|
100
|
+
gc.collect()
|
|
101
|
+
iterations.copy() # acces underground data
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_segfault_inplace_array_printer():
|
|
105
|
+
"""Ensure the result of c printer inplace array is not dereferenced."""
|
|
106
|
+
tree = preprocess(x + 1, set(), set(), set())
|
|
107
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
108
|
+
out = func(np.zeros(25_000_000, dtype=np.float32)) # 100 Mo
|
|
109
|
+
gc.collect()
|
|
110
|
+
out.copy() # acces underground data
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def test_segfault_new_array_printer():
|
|
114
|
+
"""Ensure the result of c printer new array is not dereferenced."""
|
|
115
|
+
tree = preprocess(x * (x+1), set(), set(), set())
|
|
116
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
117
|
+
out = func(np.zeros(25_000_000, dtype=np.float32)) # 100 Mo
|
|
118
|
+
gc.collect()
|
|
119
|
+
out.copy() # acces underground data
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_segfault_tuple_pack_printer():
|
|
123
|
+
"""Ensure the result of c printer packed tuple is not dereferenced."""
|
|
124
|
+
tree = preprocess(Tuple(x, x + 1), set(), set(), set())
|
|
125
|
+
func = _lambdify_c(_printer(tree["dyn_tree"], tree["dyn_alloc"], {x}))
|
|
126
|
+
out = func(np.zeros(250_000, dtype=np.float32)) # 2 Mo
|
|
127
|
+
gc.collect()
|
|
128
|
+
arr1, arr2 = out
|
|
129
|
+
del out
|
|
130
|
+
gc.collect()
|
|
131
|
+
arr1.copy()
|
|
132
|
+
arr2.copy()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Exhaustively test all possible combinations."""
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.compilation.export.compatibility import Compatibilities
|
|
8
|
+
from cutcutcodec.core.classes.encoder import AllEncoders
|
|
9
|
+
from cutcutcodec.core.classes.muxer import AllMuxers
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.mark.slow
|
|
13
|
+
def test_audio_compatibilities():
|
|
14
|
+
"""Look for all muxers compatible with all audio encoders."""
|
|
15
|
+
encoders = sorted(AllEncoders().audio)
|
|
16
|
+
muxers = sorted(AllMuxers().set)
|
|
17
|
+
comp = Compatibilities().check(encoders, muxers)
|
|
18
|
+
assert (comp != "").any()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.mark.slow
|
|
22
|
+
def test_video_compatibilities():
|
|
23
|
+
"""Look for all muxers compatible with all video encoders."""
|
|
24
|
+
encoders = sorted(AllEncoders().video)
|
|
25
|
+
muxers = sorted(AllMuxers().set)
|
|
26
|
+
comp = Compatibilities().check(encoders, muxers)
|
|
27
|
+
assert (comp != "").any()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Compile and decompile all elements."""
|
|
4
|
+
|
|
5
|
+
from cutcutcodec.core.classes.container import ContainerOutput
|
|
6
|
+
from cutcutcodec.core.compilation.graph_to_ast import graph_to_ast
|
|
7
|
+
from cutcutcodec.core.compilation.graph_to_json import graph_to_json
|
|
8
|
+
from cutcutcodec.core.compilation.graph_to_tree import graph_to_tree
|
|
9
|
+
from cutcutcodec.core.compilation.json_to_graph import json_to_graph
|
|
10
|
+
from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
|
|
11
|
+
from cutcutcodec.testing.generation import extract_streams
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_all_types_tree2graph2tree2graph():
|
|
15
|
+
"""Compile and decompile all types of streams from tree."""
|
|
16
|
+
for stream in extract_streams():
|
|
17
|
+
graph1 = tree_to_graph(ContainerOutput([stream]))
|
|
18
|
+
graph2 = tree_to_graph(graph_to_tree(graph1))
|
|
19
|
+
assert graph1.edges == graph2.edges
|
|
20
|
+
assert graph1.nodes("class") == graph2.nodes("class")
|
|
21
|
+
assert graph1.nodes("state") == graph2.nodes("state")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_all_types_tree2graph2ast2tree():
|
|
25
|
+
"""Compile and decompile all types of streams from ast."""
|
|
26
|
+
for stream in extract_streams():
|
|
27
|
+
tree1 = ContainerOutput([stream])
|
|
28
|
+
mod_code = compile(graph_to_ast(tree_to_graph(tree1)), filename="", mode="exec")
|
|
29
|
+
context = {}
|
|
30
|
+
exec(mod_code, context, context) # load the references in context, not in locals()
|
|
31
|
+
tree2 = context["get_complete_tree"]()
|
|
32
|
+
assert tree1 == tree2
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_all_types_tree2graph2json2graph():
|
|
36
|
+
"""Compile and decompile all types of streams from json."""
|
|
37
|
+
for stream in extract_streams():
|
|
38
|
+
graph1 = tree_to_graph(ContainerOutput([stream]))
|
|
39
|
+
graph2 = json_to_graph(graph_to_json(graph1))
|
|
40
|
+
assert graph1.edges == graph2.edges
|
|
41
|
+
assert graph1.nodes("class") == graph2.nodes("class")
|
|
42
|
+
assert graph1.nodes("state") == graph2.nodes("state")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check is the properties are working for all codecs."""
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.classes.encoder import AllEncoders, Encoder
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.slow
|
|
11
|
+
def test_doc():
|
|
12
|
+
"""Try to extract the doc for all codecs."""
|
|
13
|
+
for encoder_name in AllEncoders().set:
|
|
14
|
+
doc = Encoder(encoder_name).doc
|
|
15
|
+
assert isinstance(doc, str), \
|
|
16
|
+
f"bad type {doc.__class__.__name__} for the doc of {encoder_name}"
|
|
17
|
+
assert doc != "", f"the doc of {encoder_name} is empty"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_parse():
|
|
21
|
+
"""Ensure all encoders can be parsed."""
|
|
22
|
+
for encoder in AllEncoders().set:
|
|
23
|
+
Encoder(encoder)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Perform advanced on ``FilterAudioCut`` and ``FilterVideoCut``."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
import math
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.exceptions import OutOfTimeRange
|
|
11
|
+
from cutcutcodec.core.filters.audio.cut import FilterAudioCut
|
|
12
|
+
from cutcutcodec.core.filters.video.cut import FilterVideoCut
|
|
13
|
+
from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise
|
|
14
|
+
from cutcutcodec.core.generation.video.noise import GeneratorVideoNoise
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _chec_audio(stream, beginning, duration):
|
|
18
|
+
assert stream.type == "audio"
|
|
19
|
+
assert stream.beginning == beginning
|
|
20
|
+
assert stream.duration == duration
|
|
21
|
+
if beginning:
|
|
22
|
+
with pytest.raises(OutOfTimeRange):
|
|
23
|
+
stream.snapshot(0, 1, 1)
|
|
24
|
+
if duration == math.inf:
|
|
25
|
+
stream.snapshot(beginning, 1, 1)
|
|
26
|
+
else:
|
|
27
|
+
rate = math.ceil(Fraction(3, duration))
|
|
28
|
+
stream.snapshot(beginning, rate, 3)
|
|
29
|
+
with pytest.raises(OutOfTimeRange):
|
|
30
|
+
stream.snapshot(beginning+duration, 1, 1)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _chec_video(stream, beginning, duration):
|
|
34
|
+
assert stream.type == "video"
|
|
35
|
+
assert stream.beginning == beginning
|
|
36
|
+
assert stream.duration == duration
|
|
37
|
+
if beginning:
|
|
38
|
+
with pytest.raises(OutOfTimeRange):
|
|
39
|
+
stream.snapshot(0, (1, 1))
|
|
40
|
+
stream.snapshot(beginning, (1, 1))
|
|
41
|
+
if duration != math.inf:
|
|
42
|
+
with pytest.raises(OutOfTimeRange):
|
|
43
|
+
stream.snapshot(beginning+duration, (1, 1))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_cut_n_audio():
|
|
47
|
+
"""Cuts several audio streams in severals points."""
|
|
48
|
+
bounds = [0, 1, 2, math.inf]
|
|
49
|
+
(stream_a,) = GeneratorAudioNoise(0).out_streams
|
|
50
|
+
(stream_b,) = GeneratorAudioNoise(0).out_streams
|
|
51
|
+
for i, stream in enumerate(FilterAudioCut([stream_a, stream_b], *bounds[1:-1]).out_streams):
|
|
52
|
+
bound_index = i//2
|
|
53
|
+
beginning, end = bounds[bound_index], bounds[bound_index+1]
|
|
54
|
+
_chec_audio(stream, beginning, end-beginning)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_cut_n_video():
|
|
58
|
+
"""Cuts several video streams in severals points."""
|
|
59
|
+
bounds = [0, 1, 2, math.inf]
|
|
60
|
+
(stream_a,) = GeneratorVideoNoise(0).out_streams
|
|
61
|
+
(stream_b,) = GeneratorVideoNoise(0).out_streams
|
|
62
|
+
for i, stream in enumerate(FilterVideoCut([stream_a, stream_b], *bounds[1:-1]).out_streams):
|
|
63
|
+
bound_index = i//2
|
|
64
|
+
beginning, end = bounds[bound_index], bounds[bound_index+1]
|
|
65
|
+
_chec_video(stream, beginning, end-beginning)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_cut_one_audio():
|
|
69
|
+
"""Cuts only the end of an audio stream."""
|
|
70
|
+
(s_base_audio,) = GeneratorAudioNoise(0).out_streams
|
|
71
|
+
cut_streams = FilterAudioCut([s_base_audio], 10).out_streams
|
|
72
|
+
assert len(cut_streams) == 2
|
|
73
|
+
(cut_stream_low, cut_stream_high) = cut_streams
|
|
74
|
+
_chec_audio(cut_stream_low, 0, 10)
|
|
75
|
+
_chec_audio(cut_stream_high, 10, math.inf)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_cut_one_video():
|
|
79
|
+
"""Does not cut a video streams."""
|
|
80
|
+
(s_base_video,) = GeneratorVideoNoise(0).out_streams
|
|
81
|
+
cut_streams = FilterVideoCut([s_base_video], 10).out_streams
|
|
82
|
+
assert len(cut_streams) == 2
|
|
83
|
+
(cut_stream_low, cut_stream_high) = cut_streams
|
|
84
|
+
_chec_video(cut_stream_low, 0, 10)
|
|
85
|
+
_chec_video(cut_stream_high, 10, math.inf)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_no_cut_audio():
|
|
89
|
+
"""Does not cut audio streams."""
|
|
90
|
+
(s_base_audio,) = GeneratorAudioNoise(0).out_streams
|
|
91
|
+
cut_streams = FilterAudioCut([s_base_audio]).out_streams
|
|
92
|
+
assert len(cut_streams) == 1
|
|
93
|
+
(cut_stream,) = cut_streams
|
|
94
|
+
assert cut_stream.beginning == 0
|
|
95
|
+
assert cut_stream.duration == math.inf
|
|
96
|
+
cut_stream.snapshot(0, 1, 1) # [0, 1[
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_no_cut_video():
|
|
100
|
+
"""Does not cut a video streams."""
|
|
101
|
+
(s_base_video,) = GeneratorVideoNoise(0).out_streams
|
|
102
|
+
cut_streams = FilterVideoCut([s_base_video]).out_streams
|
|
103
|
+
assert len(cut_streams) == 1
|
|
104
|
+
(cut_stream,) = cut_streams
|
|
105
|
+
assert cut_stream.beginning == 0
|
|
106
|
+
assert cut_stream.duration == math.inf
|
|
107
|
+
cut_stream.snapshot(0, (1, 1))
|