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,189 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Allow to combine probabilistic laws."""
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
import numbers
|
|
7
|
+
import typing
|
|
8
|
+
|
|
9
|
+
from sympy.core.basic import Basic
|
|
10
|
+
import torch
|
|
11
|
+
|
|
12
|
+
from cutcutcodec.core.compilation.parse import parse_to_sympy
|
|
13
|
+
from cutcutcodec.core.compilation.sympy_to_torch import Lambdify
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def compute_cumhist(
|
|
17
|
+
expr: typing.Union[Basic, numbers.Real, str], n_per_bars: numbers.Integral = 3
|
|
18
|
+
) -> torch.Tensor:
|
|
19
|
+
"""Calculate the cumulative histogram of a law combination of reduced uniform probability.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
expr : str or sympy.Basic
|
|
24
|
+
The combination expression of uniform laws.
|
|
25
|
+
The ``free_symbols`` variables correspond
|
|
26
|
+
to the draws of these independent reduced uniform distributions.
|
|
27
|
+
n_per_bars : int
|
|
28
|
+
The average number of samples by bars if there is enouth memory.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
min : float
|
|
33
|
+
The minimum value of the output of the expression `expr`.
|
|
34
|
+
max : float
|
|
35
|
+
The maximum value of the output of the expression `expr`.
|
|
36
|
+
cumhist : torch.Tensor
|
|
37
|
+
The float 32 cumulative histogram (1d vector) constitued of 256 bins.
|
|
38
|
+
the min and max of the histograms match with the min and max of the expr.
|
|
39
|
+
|
|
40
|
+
Notes
|
|
41
|
+
-----
|
|
42
|
+
This function can use some Gio of RAM.
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
>>> from cutcutcodec.core.opti.factor.proba import compute_cumhist
|
|
47
|
+
>>> min_, max_, cum = compute_cumhist("1 + x1 + x2")
|
|
48
|
+
>>> round(min_), round(max_)
|
|
49
|
+
(1, 3)
|
|
50
|
+
>>> cum.round(decimals=3)
|
|
51
|
+
tensor([0.0000, 0.0000, 0.0000, 0.0010, 0.0010, 0.0010, 0.0020, 0.0020, 0.0030,
|
|
52
|
+
0.0030, 0.0040, 0.0040, 0.0050, 0.0060, 0.0070, 0.0080, 0.0090, 0.0100,
|
|
53
|
+
0.0110, 0.0120, 0.0140, 0.0150, 0.0160, 0.0180, 0.0190, 0.0210, 0.0220,
|
|
54
|
+
0.0240, 0.0260, 0.0280, 0.0290, 0.0310, 0.0330, 0.0350, 0.0380, 0.0400,
|
|
55
|
+
0.0420, 0.0440, 0.0470, 0.0490, 0.0510, 0.0540, 0.0570, 0.0590, 0.0620,
|
|
56
|
+
0.0650, 0.0680, 0.0700, 0.0730, 0.0760, 0.0800, 0.0830, 0.0860, 0.0890,
|
|
57
|
+
0.0930, 0.0960, 0.0990, 0.1030, 0.1060, 0.1100, 0.1140, 0.1180, 0.1210,
|
|
58
|
+
0.1250, 0.1290, 0.1330, 0.1370, 0.1410, 0.1460, 0.1500, 0.1540, 0.1580,
|
|
59
|
+
0.1630, 0.1670, 0.1720, 0.1770, 0.1810, 0.1860, 0.1910, 0.1960, 0.2010,
|
|
60
|
+
0.2060, 0.2110, 0.2160, 0.2210, 0.2260, 0.2310, 0.2370, 0.2420, 0.2480,
|
|
61
|
+
0.2530, 0.2590, 0.2640, 0.2700, 0.2760, 0.2820, 0.2880, 0.2930, 0.2990,
|
|
62
|
+
0.3060, 0.3120, 0.3180, 0.3240, 0.3300, 0.3370, 0.3430, 0.3500, 0.3560,
|
|
63
|
+
0.3630, 0.3700, 0.3760, 0.3830, 0.3900, 0.3970, 0.4040, 0.4110, 0.4180,
|
|
64
|
+
0.4250, 0.4330, 0.4400, 0.4470, 0.4550, 0.4620, 0.4700, 0.4770, 0.4850,
|
|
65
|
+
0.4930, 0.5000, 0.5070, 0.5150, 0.5230, 0.5300, 0.5380, 0.5450, 0.5530,
|
|
66
|
+
0.5600, 0.5670, 0.5750, 0.5820, 0.5890, 0.5960, 0.6030, 0.6100, 0.6170,
|
|
67
|
+
0.6240, 0.6300, 0.6370, 0.6440, 0.6500, 0.6570, 0.6630, 0.6700, 0.6760,
|
|
68
|
+
0.6820, 0.6880, 0.6940, 0.7010, 0.7070, 0.7120, 0.7180, 0.7240, 0.7300,
|
|
69
|
+
0.7360, 0.7410, 0.7470, 0.7520, 0.7580, 0.7630, 0.7690, 0.7740, 0.7790,
|
|
70
|
+
0.7840, 0.7890, 0.7940, 0.7990, 0.8040, 0.8090, 0.8140, 0.8190, 0.8230,
|
|
71
|
+
0.8280, 0.8330, 0.8370, 0.8420, 0.8460, 0.8500, 0.8540, 0.8590, 0.8630,
|
|
72
|
+
0.8670, 0.8710, 0.8750, 0.8790, 0.8820, 0.8860, 0.8900, 0.8940, 0.8970,
|
|
73
|
+
0.9010, 0.9040, 0.9070, 0.9110, 0.9140, 0.9170, 0.9200, 0.9240, 0.9270,
|
|
74
|
+
0.9300, 0.9320, 0.9350, 0.9380, 0.9410, 0.9430, 0.9460, 0.9490, 0.9510,
|
|
75
|
+
0.9530, 0.9560, 0.9580, 0.9600, 0.9620, 0.9650, 0.9670, 0.9690, 0.9710,
|
|
76
|
+
0.9720, 0.9740, 0.9760, 0.9780, 0.9790, 0.9810, 0.9820, 0.9840, 0.9850,
|
|
77
|
+
0.9860, 0.9880, 0.9890, 0.9900, 0.9910, 0.9920, 0.9930, 0.9940, 0.9950,
|
|
78
|
+
0.9960, 0.9960, 0.9970, 0.9970, 0.9980, 0.9980, 0.9990, 0.9990, 0.9990,
|
|
79
|
+
1.0000, 1.0000, 1.0000, 1.0000])
|
|
80
|
+
>>>
|
|
81
|
+
"""
|
|
82
|
+
assert isinstance(expr, (Basic, numbers.Real, str)), expr
|
|
83
|
+
assert isinstance(n_per_bars, numbers.Integral), numbers.__class__.__name__
|
|
84
|
+
assert n_per_bars > 0, n_per_bars
|
|
85
|
+
|
|
86
|
+
expr = parse_to_sympy(expr)
|
|
87
|
+
symbs = sorted(map(str, expr.free_symbols))
|
|
88
|
+
assert symbs, "constant expressions are not yet supported"
|
|
89
|
+
func = Lambdify(expr, compile=False)
|
|
90
|
+
|
|
91
|
+
n_per_bars = min(n_per_bars, 268435456**(1/len(symbs))/256) # nbr = (256*n_per_bars)**n_symbs
|
|
92
|
+
start = 0.001953125 / n_per_bars # (1 / (2*n_per_bars)) / 256
|
|
93
|
+
nbr = max(2, 2**round(math.log(n_per_bars*256, 2))) # limited the bias if limited memory
|
|
94
|
+
lins = torch.linspace(start, 1.0-start, nbr, dtype=torch.float32)
|
|
95
|
+
lins = [lins] * len(symbs)
|
|
96
|
+
for i in range(len(symbs)-1):
|
|
97
|
+
lins = [lin.unsqueeze(i+1) for lin in lins]
|
|
98
|
+
lins = [lin.transpose(0, i) for i, lin in enumerate(lins)]
|
|
99
|
+
|
|
100
|
+
hist = func(**dict(zip(symbs, lins))).flatten()
|
|
101
|
+
min_, max_ = torch.aminmax(hist)
|
|
102
|
+
min_, max_ = min_.item(), max_.item()
|
|
103
|
+
nbr = hist.shape[0]
|
|
104
|
+
hist, _ = torch.histogram(hist, bins=256)
|
|
105
|
+
hist = torch.cumsum(hist, dim=0, out=hist)
|
|
106
|
+
hist /= nbr # [0, 1]
|
|
107
|
+
return min_, max_, hist
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def inv_cumhist(min_: numbers.Real, max_: numbers.Real, cumhist: torch.Tensor) -> list:
|
|
111
|
+
"""Reverse the histogram of the estimation of the proba repartition function.
|
|
112
|
+
|
|
113
|
+
Parameters
|
|
114
|
+
----------
|
|
115
|
+
min_ : numbers.Real
|
|
116
|
+
The minimum value of the reversed repartition function.
|
|
117
|
+
max_ : numbers.Real
|
|
118
|
+
The minimum value of the reversed repartition function.
|
|
119
|
+
cumhist : torch.Tensor
|
|
120
|
+
The strictely growing repartition function between 0 and 1.
|
|
121
|
+
Only y values are represented like a 1d torch vector.
|
|
122
|
+
The x axis is implicitely a linspace betwen 0 and 1.
|
|
123
|
+
|
|
124
|
+
Return
|
|
125
|
+
------
|
|
126
|
+
invrep : torch.Tensor
|
|
127
|
+
An estimation of the inverse function (1d vector).
|
|
128
|
+
The dimension is choose to be the same as the input histogram len.
|
|
129
|
+
|
|
130
|
+
Examples
|
|
131
|
+
--------
|
|
132
|
+
>>> from cutcutcodec.core.opti.factor.proba import compute_cumhist, inv_cumhist
|
|
133
|
+
>>> min_, max_, cum = compute_cumhist("1 + x1 + x2")
|
|
134
|
+
>>> inv_cumhist(min_, max_, cum)
|
|
135
|
+
tensor([0.9985, 1.0814, 1.1181, 1.1462, 1.1699, 1.1908, 1.2096, 1.2270, 1.2432,
|
|
136
|
+
1.2583, 1.2727, 1.2863, 1.2994, 1.3119, 1.3239, 1.3356, 1.3468, 1.3577,
|
|
137
|
+
1.3683, 1.3785, 1.3885, 1.3983, 1.4079, 1.4172, 1.4263, 1.4352, 1.4440,
|
|
138
|
+
1.4526, 1.4610, 1.4693, 1.4775, 1.4855, 1.4933, 1.5011, 1.5087, 1.5163,
|
|
139
|
+
1.5237, 1.5310, 1.5382, 1.5453, 1.5524, 1.5593, 1.5662, 1.5730, 1.5797,
|
|
140
|
+
1.5863, 1.5929, 1.5994, 1.6058, 1.6121, 1.6184, 1.6246, 1.6308, 1.6369,
|
|
141
|
+
1.6429, 1.6489, 1.6549, 1.6608, 1.6666, 1.6724, 1.6781, 1.6838, 1.6894,
|
|
142
|
+
1.6950, 1.7006, 1.7061, 1.7116, 1.7170, 1.7223, 1.7277, 1.7330, 1.7383,
|
|
143
|
+
1.7435, 1.7487, 1.7538, 1.7590, 1.7641, 1.7691, 1.7741, 1.7791, 1.7841,
|
|
144
|
+
1.7890, 1.7939, 1.7988, 1.8036, 1.8084, 1.8132, 1.8180, 1.8227, 1.8274,
|
|
145
|
+
1.8321, 1.8367, 1.8414, 1.8459, 1.8505, 1.8551, 1.8596, 1.8641, 1.8686,
|
|
146
|
+
1.8730, 1.8775, 1.8819, 1.8863, 1.8906, 1.8950, 1.8993, 1.9036, 1.9079,
|
|
147
|
+
1.9122, 1.9164, 1.9206, 1.9248, 1.9290, 1.9332, 1.9374, 1.9415, 1.9456,
|
|
148
|
+
1.9497, 1.9538, 1.9578, 1.9619, 1.9659, 1.9699, 1.9739, 1.9779, 1.9819,
|
|
149
|
+
1.9860, 1.9905, 1.9947, 1.9986, 2.0025, 2.0065, 2.0105, 2.0145, 2.0185,
|
|
150
|
+
2.0225, 2.0266, 2.0306, 2.0347, 2.0388, 2.0429, 2.0470, 2.0512, 2.0554,
|
|
151
|
+
2.0596, 2.0638, 2.0680, 2.0722, 2.0765, 2.0808, 2.0851, 2.0894, 2.0938,
|
|
152
|
+
2.0981, 2.1025, 2.1069, 2.1114, 2.1158, 2.1203, 2.1248, 2.1293, 2.1339,
|
|
153
|
+
2.1384, 2.1430, 2.1477, 2.1523, 2.1570, 2.1617, 2.1664, 2.1712, 2.1760,
|
|
154
|
+
2.1808, 2.1856, 2.1905, 2.1954, 2.2003, 2.2053, 2.2102, 2.2153, 2.2203,
|
|
155
|
+
2.2254, 2.2306, 2.2357, 2.2409, 2.2461, 2.2514, 2.2567, 2.2620, 2.2674,
|
|
156
|
+
2.2728, 2.2783, 2.2838, 2.2894, 2.2950, 2.3006, 2.3063, 2.3120, 2.3178,
|
|
157
|
+
2.3236, 2.3295, 2.3354, 2.3414, 2.3475, 2.3536, 2.3598, 2.3660, 2.3723,
|
|
158
|
+
2.3786, 2.3850, 2.3915, 2.3981, 2.4047, 2.4114, 2.4182, 2.4251, 2.4320,
|
|
159
|
+
2.4390, 2.4462, 2.4534, 2.4607, 2.4681, 2.4757, 2.4833, 2.4911, 2.4989,
|
|
160
|
+
2.5069, 2.5151, 2.5234, 2.5318, 2.5404, 2.5492, 2.5581, 2.5672, 2.5765,
|
|
161
|
+
2.5861, 2.5959, 2.6059, 2.6161, 2.6267, 2.6376, 2.6488, 2.6605, 2.6725,
|
|
162
|
+
2.6850, 2.6981, 2.7117, 2.7261, 2.7412, 2.7574, 2.7748, 2.7936, 2.8145,
|
|
163
|
+
2.8382, 2.8663, 2.9030, 2.9909])
|
|
164
|
+
>>>
|
|
165
|
+
"""
|
|
166
|
+
assert isinstance(min_, numbers.Real), min_.__class__.__name__
|
|
167
|
+
assert isinstance(max_, numbers.Real), max_.__class__.__name__
|
|
168
|
+
assert min_ < max_, (min_, max_)
|
|
169
|
+
assert isinstance(cumhist, torch.Tensor), cumhist.__class__.__name__
|
|
170
|
+
assert cumhist.ndim == 1, cumhist.shape
|
|
171
|
+
|
|
172
|
+
cum_min, cum_max = torch.aminmax(cumhist)
|
|
173
|
+
cum_min, cum_max = cum_min.item(), cum_max.item()
|
|
174
|
+
|
|
175
|
+
prob = torch.linspace(
|
|
176
|
+
0, 1, cumhist.shape[0], dtype=cumhist.dtype, device=cumhist.device
|
|
177
|
+
) # we can choose any len
|
|
178
|
+
index = cumhist.unsqueeze(0) > prob.unsqueeze(1)
|
|
179
|
+
index = index.to(dtype=torch.uint8, copy=False)
|
|
180
|
+
index = torch.argmax(index, dim=1)
|
|
181
|
+
index[0], index[-1] = 1, cumhist.shape[0]-1
|
|
182
|
+
p_max = cumhist[index]
|
|
183
|
+
index -= 1
|
|
184
|
+
p_min = cumhist[index]
|
|
185
|
+
d_p = p_max-p_min
|
|
186
|
+
shift = torch.where(d_p != 0, (prob-p_min)/d_p, .5)
|
|
187
|
+
out = (index + shift) * (max_-min_)/cumhist.shape[0] + min_
|
|
188
|
+
|
|
189
|
+
return out
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Convert a filter delay into a convlolution."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
|
|
7
|
+
import networkx
|
|
8
|
+
import torch
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.compilation.graph_to_tree import update_trees
|
|
11
|
+
from cutcutcodec.core.compilation.tree_to_graph import _node_name_base
|
|
12
|
+
# from cutcutcodec.core.filters.basic.cut import FilterCut
|
|
13
|
+
from cutcutcodec.core.filters.audio.delay import FilterAudioDelay
|
|
14
|
+
from cutcutcodec.core.filters.audio.fir import FilterAudioFIR
|
|
15
|
+
from cutcutcodec.core.opti.utils import node_selector
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _criteria(graph: networkx.MultiDiGraph, node: str) -> bool:
|
|
19
|
+
"""Return True if the node can be converted."""
|
|
20
|
+
data = graph.nodes[node]
|
|
21
|
+
if not issubclass(data["class"], FilterAudioDelay):
|
|
22
|
+
return False
|
|
23
|
+
if Fraction(data["state"]["delay"]) < 0:
|
|
24
|
+
return False
|
|
25
|
+
if len(in_edges := list(graph.in_edges(node, keys=True))) != 1:
|
|
26
|
+
return False
|
|
27
|
+
in_edge = in_edges.pop()
|
|
28
|
+
update_trees(graph)
|
|
29
|
+
stream = graph.edges[in_edge]["cache"][1]["tree"]
|
|
30
|
+
if stream.type != "audio":
|
|
31
|
+
return False
|
|
32
|
+
return True
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@node_selector(_criteria)
|
|
36
|
+
def delay_to_fir(graph: networkx.MultiDiGraph, *, node: str):
|
|
37
|
+
"""Replace the properties of the delay node by the properties of a conv node.
|
|
38
|
+
|
|
39
|
+
Works only for audio streams.
|
|
40
|
+
|
|
41
|
+
Examples
|
|
42
|
+
--------
|
|
43
|
+
>>> from pprint import pprint
|
|
44
|
+
>>> from cutcutcodec.core.classes.container import ContainerOutput
|
|
45
|
+
>>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
|
|
46
|
+
>>> from cutcutcodec.core.filters.audio.delay import FilterAudioDelay
|
|
47
|
+
>>> from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise
|
|
48
|
+
>>> from cutcutcodec.core.opti.generalize.delay_to_fir import delay_to_fir
|
|
49
|
+
>>> out = ContainerOutput(FilterAudioDelay(GeneratorAudioNoise(0).out_streams, 1).out_streams)
|
|
50
|
+
>>> graph = tree_to_graph(out)
|
|
51
|
+
>>>
|
|
52
|
+
>>> pprint(dict(graph.nodes("state")))
|
|
53
|
+
{'container_output_1': {},
|
|
54
|
+
'filter_audio_delay_1': {'delay': '1'},
|
|
55
|
+
'generator_audio_noise_1': {'layout': 'stereo', 'seed': 0.0}}
|
|
56
|
+
>>> pprint(list(graph.edges))
|
|
57
|
+
[('filter_audio_delay_1', 'container_output_1', '0->0'),
|
|
58
|
+
('generator_audio_noise_1', 'filter_audio_delay_1', '0->0')]
|
|
59
|
+
>>> delay_to_fir(graph)
|
|
60
|
+
>>> pprint(dict(graph.nodes("state"))) # doctest: +ELLIPSIS
|
|
61
|
+
{'container_output_1': {},
|
|
62
|
+
'filter_audio_fir_1': {'fir_encoded': 'XQAAAAT//////////wAAb/3//6O3/0c+SBVyOWFRuJIo5qOGB/n...',
|
|
63
|
+
'fir_rate': 48000},
|
|
64
|
+
'generator_audio_noise_1': {'layout': 'stereo', 'seed': 0.0}}
|
|
65
|
+
>>> pprint(list(graph.edges))
|
|
66
|
+
[('generator_audio_noise_1', 'filter_audio_fir_1', '0->0'),
|
|
67
|
+
('filter_audio_fir_1', 'container_output_1', '0->0')]
|
|
68
|
+
>>>
|
|
69
|
+
"""
|
|
70
|
+
assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
|
|
71
|
+
assert isinstance(node, str), node.__class__.__name__
|
|
72
|
+
assert node in graph
|
|
73
|
+
assert _criteria(graph, node) # useless because of the decorator
|
|
74
|
+
|
|
75
|
+
# name_cut = _node_name_base(graph, FilterCut.__name__)
|
|
76
|
+
name_fir = _node_name_base(graph, FilterAudioFIR.__name__)
|
|
77
|
+
|
|
78
|
+
delay = Fraction(graph.nodes[node]["state"]["delay"])
|
|
79
|
+
|
|
80
|
+
networkx.relabel_nodes(graph, {node: name_fir}, copy=False)
|
|
81
|
+
graph.nodes[name_fir]["class"] = FilterAudioFIR
|
|
82
|
+
rate = 48000
|
|
83
|
+
fir = torch.zeros(round(delay*rate)+1, dtype=torch.float16)
|
|
84
|
+
fir[-1] = 1.0
|
|
85
|
+
graph.nodes[name_fir]["state"] = (
|
|
86
|
+
{"fir_encoded": FilterAudioFIR.encode_fir(fir), "fir_rate": rate}
|
|
87
|
+
)
|
|
88
|
+
# the filter cut has to be appened
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Optimize the assembly graph."""
|
|
4
|
+
|
|
5
|
+
import networkx
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def optimize(graph: networkx.MultiDiGraph) -> networkx.MultiDiGraph:
|
|
9
|
+
"""Optimize the graph in order to improve the exportation speed.
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
graph : networkx.MultiDiGraph
|
|
14
|
+
The brut assembly graph, not yet optimizated.
|
|
15
|
+
"""
|
|
16
|
+
assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
|
|
17
|
+
return graph
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Buffer management in threading loop."""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import threading
|
|
7
|
+
import typing
|
|
8
|
+
import queue
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class _ImapThread(threading.Thread):
|
|
12
|
+
"""Manage exception and autostart."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, *args, func=None, arg=None, **kwargs):
|
|
15
|
+
self.func = func
|
|
16
|
+
self.arg = arg
|
|
17
|
+
|
|
18
|
+
self.result = None
|
|
19
|
+
self.exception = False
|
|
20
|
+
|
|
21
|
+
super().__init__(*args, **kwargs)
|
|
22
|
+
self.start()
|
|
23
|
+
|
|
24
|
+
def run(self):
|
|
25
|
+
try:
|
|
26
|
+
self.result = self.func(*self.arg)
|
|
27
|
+
except Exception as err:
|
|
28
|
+
self.exception = True
|
|
29
|
+
self.result = err
|
|
30
|
+
|
|
31
|
+
def get(self):
|
|
32
|
+
"""Return the result."""
|
|
33
|
+
self.join()
|
|
34
|
+
if self.exception:
|
|
35
|
+
raise self.result
|
|
36
|
+
return self.result
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def imap(func: callable, args: typing.Iterable, maxsize: typing.Optional[int] = None):
|
|
40
|
+
"""Do same as multiprocessing.pool.ThreadPool.imap but with a limited output buffer.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
func : callable
|
|
45
|
+
The function to evaluate in an over thread.
|
|
46
|
+
args : iterable
|
|
47
|
+
The parameters to give a the function.
|
|
48
|
+
maxsize : int, default=os.cpu_count()
|
|
49
|
+
The size of the buffer.
|
|
50
|
+
|
|
51
|
+
Examples
|
|
52
|
+
--------
|
|
53
|
+
>>> from cutcutcodec.core.opti.parallel.buffer import imap
|
|
54
|
+
>>> for _ in imap(print, range(4), maxsize=2):
|
|
55
|
+
... print("hello")
|
|
56
|
+
...
|
|
57
|
+
0
|
|
58
|
+
1
|
|
59
|
+
hello
|
|
60
|
+
2
|
|
61
|
+
hello
|
|
62
|
+
3
|
|
63
|
+
hello
|
|
64
|
+
hello
|
|
65
|
+
>>>
|
|
66
|
+
"""
|
|
67
|
+
assert isinstance(args, typing.Iterable), args.__class__.__name__
|
|
68
|
+
yield from starimap(func, ((a,) for a in args), maxsize)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def starimap(func: callable, args: typing.Iterable, maxsize: typing.Optional[int] = None):
|
|
72
|
+
"""Like ``cutcutcodec.core.opti.parallel.imap`` with stared args."""
|
|
73
|
+
assert callable(func), func.__class__.__name__
|
|
74
|
+
assert isinstance(args, typing.Iterable), args.__class__.__name__
|
|
75
|
+
if maxsize is None:
|
|
76
|
+
maxsize = os.cpu_count()
|
|
77
|
+
assert isinstance(maxsize, int), maxsize.__class__.__name__
|
|
78
|
+
assert maxsize >= 1, maxsize # avoid infinite blocking
|
|
79
|
+
|
|
80
|
+
buff = queue.Queue()
|
|
81
|
+
queue_size = 0
|
|
82
|
+
for star_arg in args:
|
|
83
|
+
buff.put(_ImapThread(func=func, arg=star_arg, daemon=True))
|
|
84
|
+
queue_size += 1
|
|
85
|
+
if queue_size < maxsize:
|
|
86
|
+
continue
|
|
87
|
+
yield buff.get().get()
|
|
88
|
+
queue_size -= 1
|
|
89
|
+
for _ in range(queue_size):
|
|
90
|
+
yield buff.get().get()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Little tools used by some functions of graph optimization."""
|
|
4
|
+
|
|
5
|
+
import functools
|
|
6
|
+
|
|
7
|
+
import networkx
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def node_selector(criteria: callable):
|
|
11
|
+
"""Decorate for selecting and appening the `node` kwargs to the decorated function.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
criteria : callable
|
|
16
|
+
A function that take in argument
|
|
17
|
+
the graph (`networkx.networkx.MultiDiGraph`) and the node name (`str`).
|
|
18
|
+
It returns True if the node can be selected, False otherwise.
|
|
19
|
+
"""
|
|
20
|
+
assert hasattr(criteria, "__call__"), criteria.__class__.__name__
|
|
21
|
+
|
|
22
|
+
def decorator(func: callable):
|
|
23
|
+
@functools.wraps(func)
|
|
24
|
+
def decorated(graph: networkx.MultiDiGraph, *args, **kwargs):
|
|
25
|
+
while True:
|
|
26
|
+
for node in graph:
|
|
27
|
+
if criteria(graph, node):
|
|
28
|
+
func(graph, *args, node=node, **kwargs)
|
|
29
|
+
break
|
|
30
|
+
else:
|
|
31
|
+
break
|
|
32
|
+
return decorated
|
|
33
|
+
|
|
34
|
+
return decorator
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="64" width="64">
|
|
2
|
+
<circle cx="32" cy="32" r="32" fill="#ffff00"/> # main background disk
|
|
3
|
+
<path id="c" d="M 25 40
|
|
4
|
+
C 10 40, 15 15, 60 25
|
|
5
|
+
C 17 17, 12 38, 25 40" fill="black"/>
|
|
6
|
+
<path id="u" d="M 27 27
|
|
7
|
+
C 28 38, 36 38, 37 27
|
|
8
|
+
C 37 40, 27 40, 27 27"
|
|
9
|
+
fill="black"/>
|
|
10
|
+
<path id="t" d="M 50 25
|
|
11
|
+
Q 45 30 50 40
|
|
12
|
+
Q 48 30 50 25" fill="black"/>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
{
|
|
2
|
+
"export_settings": {
|
|
3
|
+
"rates": {
|
|
4
|
+
"audio": [
|
|
5
|
+
44100
|
|
6
|
+
],
|
|
7
|
+
"video": [
|
|
8
|
+
"24"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"shapes": [
|
|
12
|
+
[
|
|
13
|
+
480,
|
|
14
|
+
480
|
|
15
|
+
]
|
|
16
|
+
],
|
|
17
|
+
"stem": "cutcutcodec_project",
|
|
18
|
+
"suffix": ""
|
|
19
|
+
},
|
|
20
|
+
"graph": {
|
|
21
|
+
"edges": [
|
|
22
|
+
[
|
|
23
|
+
"filter_add_1",
|
|
24
|
+
"container_output_1",
|
|
25
|
+
"0->0"
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"filter_delay_2",
|
|
29
|
+
"filter_add_1",
|
|
30
|
+
"0->1"
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"filter_subclip_1",
|
|
34
|
+
"filter_add_1",
|
|
35
|
+
"0->0"
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
"filter_subclip_2",
|
|
39
|
+
"filter_delay_2",
|
|
40
|
+
"0->0"
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"filter_subclip_3",
|
|
44
|
+
"filter_add_1",
|
|
45
|
+
"0->2"
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"filter_video_equation_1",
|
|
49
|
+
"filter_subclip_1",
|
|
50
|
+
"0->0"
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
"filter_video_equation_2",
|
|
54
|
+
"filter_subclip_2",
|
|
55
|
+
"0->0"
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"generator_video_equation_1",
|
|
59
|
+
"filter_subclip_3",
|
|
60
|
+
"0->0"
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"generator_video_equation_2",
|
|
64
|
+
"filter_video_equation_2",
|
|
65
|
+
"0->0"
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"generator_video_noise_1",
|
|
69
|
+
"filter_video_equation_1",
|
|
70
|
+
"0->0"
|
|
71
|
+
]
|
|
72
|
+
],
|
|
73
|
+
"nodes": {
|
|
74
|
+
"container_output_1": {
|
|
75
|
+
"class": "classes.container.ContainerOutput",
|
|
76
|
+
"display": {
|
|
77
|
+
"position": [
|
|
78
|
+
1200.0,
|
|
79
|
+
9.599999999999962
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"state": {}
|
|
83
|
+
},
|
|
84
|
+
"filter_add_1": {
|
|
85
|
+
"class": "filters.video.add.FilterVideoAdd",
|
|
86
|
+
"display": {
|
|
87
|
+
"position": [
|
|
88
|
+
960.0,
|
|
89
|
+
-120.0
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"state": {}
|
|
93
|
+
},
|
|
94
|
+
"filter_delay_2": {
|
|
95
|
+
"class": "filters.video.delay.FilterVideoDelay",
|
|
96
|
+
"display": {
|
|
97
|
+
"position": [
|
|
98
|
+
720.0,
|
|
99
|
+
-120.0
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"state": {
|
|
103
|
+
"delay": "10"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"filter_subclip_1": {
|
|
107
|
+
"class": "filters.video.subclip.FilterVideoSubclip",
|
|
108
|
+
"display": {
|
|
109
|
+
"position": [
|
|
110
|
+
480.0,
|
|
111
|
+
-240.0
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"state": {
|
|
115
|
+
"delay": "0",
|
|
116
|
+
"duration_max": "20"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"filter_subclip_2": {
|
|
120
|
+
"class": "filters.video.subclip.FilterVideoSubclip",
|
|
121
|
+
"display": {
|
|
122
|
+
"position": [
|
|
123
|
+
480.0,
|
|
124
|
+
-120.0
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"state": {
|
|
128
|
+
"delay": "0",
|
|
129
|
+
"duration_max": "10"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"filter_subclip_3": {
|
|
133
|
+
"class": "filters.video.subclip.FilterVideoSubclip",
|
|
134
|
+
"display": {
|
|
135
|
+
"position": [
|
|
136
|
+
240.0,
|
|
137
|
+
0.0
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"state": {
|
|
141
|
+
"delay": "0",
|
|
142
|
+
"duration_max": "20"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"filter_video_equation_1": {
|
|
146
|
+
"class": "filters.video.equation.FilterVideoEquation",
|
|
147
|
+
"display": {
|
|
148
|
+
"position": [
|
|
149
|
+
240.0,
|
|
150
|
+
-240.0
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"state": {
|
|
154
|
+
"colors": [
|
|
155
|
+
"b0*(1 - t/20)",
|
|
156
|
+
"g0*t/20",
|
|
157
|
+
"r0*(1 - t/20)",
|
|
158
|
+
"0.200000000000000"
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"filter_video_equation_2": {
|
|
163
|
+
"class": "filters.video.equation.FilterVideoEquation",
|
|
164
|
+
"display": {
|
|
165
|
+
"position": [
|
|
166
|
+
240.0,
|
|
167
|
+
-120.0
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"state": {
|
|
171
|
+
"colors": [
|
|
172
|
+
"b0*exp((1 - exp(4*(1 - t/10)))*(i**2 + j**2))",
|
|
173
|
+
"g0*exp((1 - exp(4*(1 - t/10)))*(i**2 + j**2))",
|
|
174
|
+
"r0*exp((1 - exp(4*(1 - t/10)))*(i**2 + j**2))",
|
|
175
|
+
"exp((1 - exp(4*(1 - t/10)))*(i**2 + j**2))"
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"generator_video_equation_1": {
|
|
180
|
+
"class": "generation.video.equation.GeneratorVideoEquation",
|
|
181
|
+
"display": {
|
|
182
|
+
"position": [
|
|
183
|
+
0,
|
|
184
|
+
0.0
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"state": {
|
|
188
|
+
"colors": [
|
|
189
|
+
"0",
|
|
190
|
+
"(i/2 - (sin(pi*t) + 1)*cos(pi*(10*j - t/2))/4)**3",
|
|
191
|
+
"i/2 - (sin(pi*t) + 1)*cos(pi*(10*j - t/2))/4"
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"generator_video_equation_2": {
|
|
196
|
+
"class": "generation.video.equation.GeneratorVideoEquation",
|
|
197
|
+
"display": {
|
|
198
|
+
"position": [
|
|
199
|
+
0.0,
|
|
200
|
+
-120.0
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
"state": {
|
|
204
|
+
"colors": [
|
|
205
|
+
"(sin((-pi)*t + 50*sqrt(i**2) + 50*sqrt(j**2))/2 + 1/2)**4",
|
|
206
|
+
"0",
|
|
207
|
+
"(sin(pi*t + 50*sqrt(i**2 + j**2))/2 + 1/2)**4"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"generator_video_noise_1": {
|
|
212
|
+
"class": "generation.video.noise.GeneratorVideoNoise",
|
|
213
|
+
"display": {
|
|
214
|
+
"position": [
|
|
215
|
+
0.0,
|
|
216
|
+
-240.0
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"state": {
|
|
220
|
+
"seed": 0.0
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"project_files": []
|
|
226
|
+
}
|
|
Binary file
|