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,135 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the generated function works whell."""
|
|
4
|
+
|
|
5
|
+
import itertools
|
|
6
|
+
|
|
7
|
+
from sympy.abc import x, y, z
|
|
8
|
+
from sympy.core.mul import Mul
|
|
9
|
+
from sympy.functions.elementary.complexes import Abs
|
|
10
|
+
from sympy.core.power import Pow
|
|
11
|
+
from sympy.functions.elementary.miscellaneous import cbrt, sqrt
|
|
12
|
+
from sympy.core.add import Add
|
|
13
|
+
from sympy.functions.elementary.trigonometric import cos, exp, sin
|
|
14
|
+
import torch
|
|
15
|
+
|
|
16
|
+
from cutcutcodec.core.compilation.sympy_to_torch import Lambdify
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
FUNC_R2R = (Abs, cbrt, cos, exp, sin, sqrt)
|
|
20
|
+
FUNC_RR2R = (Add, Mul, Pow)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_broadcast():
|
|
24
|
+
"""Test broadcasting shapes."""
|
|
25
|
+
g_cpu = torch.Generator()
|
|
26
|
+
g_cpu.manual_seed(0)
|
|
27
|
+
args = (
|
|
28
|
+
torch.randn(1, 1, 100, generator=g_cpu),
|
|
29
|
+
torch.randn(1, 100, 1, generator=g_cpu),
|
|
30
|
+
torch.randn(100, 1, 1, generator=g_cpu),
|
|
31
|
+
)
|
|
32
|
+
for func, comp, cst, safe in itertools.product(
|
|
33
|
+
FUNC_RR2R,
|
|
34
|
+
(True, False),
|
|
35
|
+
(set(), {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}),
|
|
36
|
+
(set(), {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}),
|
|
37
|
+
):
|
|
38
|
+
out = Lambdify(
|
|
39
|
+
func(x, func(y, z)), safe=safe, compile=comp, cst_args=cst
|
|
40
|
+
)(*args)
|
|
41
|
+
assert (
|
|
42
|
+
out.shape == torch.broadcast_shapes(*(a.shape for a in args))
|
|
43
|
+
), (
|
|
44
|
+
f"func {func} comp {comp} cst {cst} safe {safe} "
|
|
45
|
+
f"out_shape {out.shape} in_shapes {(a.shape for a in args)}"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_func_r2r_inplace_safe():
|
|
50
|
+
"""Check that the values of the input tensor are not modified."""
|
|
51
|
+
g_cpu = torch.Generator()
|
|
52
|
+
g_cpu.manual_seed(0)
|
|
53
|
+
arg = torch.randn(1000, generator=g_cpu)
|
|
54
|
+
arg_clone = arg.clone()
|
|
55
|
+
for func, comp, cst in itertools.product(
|
|
56
|
+
FUNC_R2R,
|
|
57
|
+
(True, False),
|
|
58
|
+
(set(), {x}),
|
|
59
|
+
):
|
|
60
|
+
Lambdify(func(x), safe={x}, compile=comp, cst_args=cst)(arg)
|
|
61
|
+
assert torch.equal(arg, arg_clone), f"func {func}, comp {comp} cst {cst}"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_func_rr2r_inplace_safe():
|
|
65
|
+
"""Check that thes values of the input tensor are not modified."""
|
|
66
|
+
g_cpu = torch.Generator()
|
|
67
|
+
g_cpu.manual_seed(0)
|
|
68
|
+
arg_left = torch.randn(1000, generator=g_cpu)
|
|
69
|
+
arg_right = torch.randn(1000, generator=g_cpu)
|
|
70
|
+
arg_left_clone = arg_left.clone()
|
|
71
|
+
arg_right_clone = arg_right.clone()
|
|
72
|
+
for func, comp, cst in itertools.product(
|
|
73
|
+
FUNC_RR2R,
|
|
74
|
+
(True, False),
|
|
75
|
+
(set(), {x}, {y}, {x, y}),
|
|
76
|
+
):
|
|
77
|
+
Lambdify(
|
|
78
|
+
func(x, y), safe={x, y}, compile=comp, cst_args=cst, shapes={frozenset({x, y})}
|
|
79
|
+
)(arg_left, arg_right)
|
|
80
|
+
assert torch.equal(arg_left, arg_left_clone), f"func {func} comp {comp} cst {cst}"
|
|
81
|
+
assert torch.equal(arg_right, arg_right_clone), f"func {func} comp {comp} cst {cst}"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_homogeneous_2r2_dtype():
|
|
85
|
+
"""Check that the dtype in conserved in r to r functions."""
|
|
86
|
+
g_cpu = torch.Generator()
|
|
87
|
+
g_cpu.manual_seed(0)
|
|
88
|
+
for dtype in (torch.float32, torch.float64, torch.complex64, torch.complex128):
|
|
89
|
+
arg = torch.randn(1000, generator=g_cpu, dtype=dtype)
|
|
90
|
+
for func, comp, cst in itertools.product(
|
|
91
|
+
FUNC_R2R,
|
|
92
|
+
(True, False),
|
|
93
|
+
(set(), {x}),
|
|
94
|
+
):
|
|
95
|
+
out = Lambdify(func(x), safe={x}, compile=comp, cst_args=cst)(arg)
|
|
96
|
+
assert out.dtype == dtype, (
|
|
97
|
+
f"func {func}, comp {comp} cst {cst} "
|
|
98
|
+
f"in_dtype {dtype} out_dtype {out.dtype}"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_homogeneous_2r2_dtype_empty():
|
|
103
|
+
"""Check that the dtype in conserved in r to r functions."""
|
|
104
|
+
g_cpu = torch.Generator()
|
|
105
|
+
g_cpu.manual_seed(0)
|
|
106
|
+
for dtype in (torch.float32, torch.float64, torch.complex64, torch.complex128):
|
|
107
|
+
arg = torch.tensor([], dtype=dtype)
|
|
108
|
+
for func, comp, cst in itertools.product(
|
|
109
|
+
FUNC_R2R,
|
|
110
|
+
(True, False),
|
|
111
|
+
(set(), {x}),
|
|
112
|
+
):
|
|
113
|
+
out = Lambdify(func(x), safe={x}, compile=comp, cst_args=cst)(arg)
|
|
114
|
+
assert out.dtype == dtype, (
|
|
115
|
+
f"func {func}, comp {comp} cst {cst} "
|
|
116
|
+
f"in_dtype {dtype} out_dtype {out.dtype}"
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_homogeneous_2r2_shape():
|
|
121
|
+
"""Check that the shape is conserved in r to r functions."""
|
|
122
|
+
g_cpu = torch.Generator()
|
|
123
|
+
g_cpu.manual_seed(0)
|
|
124
|
+
for shape in ((0,), (1,), (1, 1), (1, 2, 3, 4)):
|
|
125
|
+
arg = torch.randn(*shape, generator=g_cpu)
|
|
126
|
+
for func, comp, cst in itertools.product(
|
|
127
|
+
FUNC_R2R,
|
|
128
|
+
(True, False),
|
|
129
|
+
(set(), {x}),
|
|
130
|
+
):
|
|
131
|
+
out = Lambdify(func(x), safe={x}, compile=comp, cst_args=cst)(arg)
|
|
132
|
+
assert out.shape == shape, (
|
|
133
|
+
f"func {func}, comp {comp} cst {cst} "
|
|
134
|
+
f"in_shape {shape} out_shape {out.shape}"
|
|
135
|
+
)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the asynchrone decoding of the audio and video files goes well."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
import math
|
|
7
|
+
import queue
|
|
8
|
+
import threading
|
|
9
|
+
|
|
10
|
+
import torch
|
|
11
|
+
|
|
12
|
+
from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_async_audio():
|
|
16
|
+
"""Read audio async."""
|
|
17
|
+
res_queue = queue.Queue()
|
|
18
|
+
lock = threading.Lock()
|
|
19
|
+
|
|
20
|
+
def _snapshot_put(ind, stream, timestamp, rate, samples):
|
|
21
|
+
frame = stream.snapshot(timestamp, rate, samples)
|
|
22
|
+
with lock:
|
|
23
|
+
res_queue.put((ind, frame))
|
|
24
|
+
|
|
25
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
26
|
+
(stream,) = container.out_streams
|
|
27
|
+
frames = [
|
|
28
|
+
stream.snapshot(Fraction(i, stream.rate), stream.rate, 512)
|
|
29
|
+
for i in range(0, math.ceil(stream.duration * stream.rate)-513, 512)
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
tasks = [
|
|
33
|
+
threading.Thread(
|
|
34
|
+
target=_snapshot_put, args=(i, stream, f.time, stream.rate, 512), daemon=True
|
|
35
|
+
)
|
|
36
|
+
for i, f in enumerate(frames)
|
|
37
|
+
]
|
|
38
|
+
for task in tasks:
|
|
39
|
+
task.start()
|
|
40
|
+
for task in tasks:
|
|
41
|
+
task.join()
|
|
42
|
+
for _ in range(len(frames)):
|
|
43
|
+
ind, frame = res_queue.get_nowait()
|
|
44
|
+
assert frames[ind].time == frame.time
|
|
45
|
+
assert torch.equal(frame, frames[ind]), (frame, frames[ind])
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_async_video():
|
|
49
|
+
"""Read video async."""
|
|
50
|
+
res_queue = queue.Queue()
|
|
51
|
+
lock = threading.Lock()
|
|
52
|
+
|
|
53
|
+
def _snapshot_put(ind, stream, timestamp, shape):
|
|
54
|
+
frame = stream.snapshot(timestamp, shape)
|
|
55
|
+
with lock:
|
|
56
|
+
res_queue.put((ind, frame))
|
|
57
|
+
|
|
58
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
59
|
+
(stream,) = container.out_streams
|
|
60
|
+
shape = (stream.height, stream.width)
|
|
61
|
+
frames = [
|
|
62
|
+
stream.snapshot(i/stream.rate, shape)
|
|
63
|
+
for i in range(math.ceil(stream.duration*stream.rate))
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
tasks = [
|
|
67
|
+
threading.Thread(target=_snapshot_put, args=(i, stream, f.time, shape), daemon=True)
|
|
68
|
+
for i, f in enumerate(frames)
|
|
69
|
+
]
|
|
70
|
+
for task in tasks:
|
|
71
|
+
task.start()
|
|
72
|
+
for task in tasks:
|
|
73
|
+
task.join()
|
|
74
|
+
for _ in range(len(frames)):
|
|
75
|
+
ind, frame = res_queue.get_nowait()
|
|
76
|
+
assert frames[ind].time == frame.time
|
|
77
|
+
assert torch.equal(frame, frames[ind]), (frame, frames[ind])
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the start times and durations of the streams are consistent."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
import math
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.exceptions import OutOfTimeRange
|
|
11
|
+
from cutcutcodec.testing.generation import extract_streams
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_time_range_audio():
|
|
15
|
+
"""Ensures that audio snapshots only exist in the interval [start, end[."""
|
|
16
|
+
for stream in extract_streams():
|
|
17
|
+
if stream.type != "audio":
|
|
18
|
+
continue
|
|
19
|
+
t_min = stream.beginning
|
|
20
|
+
t_max = t_min + stream.duration
|
|
21
|
+
assert t_max >= t_min
|
|
22
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_min-1}, stream={stream}"
|
|
23
|
+
stream.snapshot(t_min - 1)
|
|
24
|
+
if t_max < math.inf:
|
|
25
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_max+1}, stream={stream}"
|
|
26
|
+
stream.snapshot(t_max + 1)
|
|
27
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_max}, stream={stream}"
|
|
28
|
+
stream.snapshot(t_max)
|
|
29
|
+
if t_max != t_min:
|
|
30
|
+
if t_max < math.inf:
|
|
31
|
+
rate = 1 + math.ceil(Fraction(3, (t_max-t_min)))
|
|
32
|
+
stream.snapshot(t_min, rate, 3)
|
|
33
|
+
stream.snapshot(t_max-Fraction(3, rate), rate, 3)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_time_range_video():
|
|
37
|
+
"""Ensures that video snapshots only exist in the interval [start, end[."""
|
|
38
|
+
for stream in extract_streams():
|
|
39
|
+
if stream.type != "video":
|
|
40
|
+
continue
|
|
41
|
+
t_min = stream.beginning
|
|
42
|
+
t_max = t_min + stream.duration
|
|
43
|
+
assert t_max >= t_min
|
|
44
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_min-1}, stream={stream}"
|
|
45
|
+
stream.snapshot(t_min - 1, (1, 1))
|
|
46
|
+
if t_max < math.inf:
|
|
47
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_max+1}, stream={stream}"
|
|
48
|
+
stream.snapshot(t_max + 1, (1, 1))
|
|
49
|
+
with pytest.raises(OutOfTimeRange): # f"t={t_max}, stream={stream}"
|
|
50
|
+
stream.snapshot(t_max, (1, 1))
|
|
51
|
+
if t_max != t_min:
|
|
52
|
+
stream.snapshot(t_min, (1, 1)) # close start insterval
|
|
53
|
+
if t_max < math.inf:
|
|
54
|
+
stream.snapshot((t_min + t_max)/2, (1, 1))
|
|
55
|
+
stream.snapshot(t_max - Fraction(1, 100_000), (1, 1))
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Perform tests on the ``cutcutcodec.core.generation.video.equation.GeneratorVideoEquation``."""
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
import sympy
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.generation.video.equation import GeneratorVideoEquation
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_clip_nan():
|
|
14
|
+
"""Ensures that the values remain in the correct range."""
|
|
15
|
+
for stream, val in (
|
|
16
|
+
(GeneratorVideoEquation(-1).out_streams[0], 0),
|
|
17
|
+
(GeneratorVideoEquation(2).out_streams[0], 255),
|
|
18
|
+
(GeneratorVideoEquation("-1").out_streams[0], 0),
|
|
19
|
+
(GeneratorVideoEquation("2").out_streams[0], 255),
|
|
20
|
+
(GeneratorVideoEquation(math.inf).out_streams[0], 255),
|
|
21
|
+
(GeneratorVideoEquation(-math.inf).out_streams[0], 0),
|
|
22
|
+
(GeneratorVideoEquation(math.nan).out_streams[0], 127),
|
|
23
|
+
(GeneratorVideoEquation("oo").out_streams[0], 255),
|
|
24
|
+
(GeneratorVideoEquation("-oo").out_streams[0], 0),
|
|
25
|
+
(GeneratorVideoEquation("nan").out_streams[0], 127),
|
|
26
|
+
):
|
|
27
|
+
assert stream.snapshot(0, (1, 1)).item() == val
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_complex_module_part():
|
|
31
|
+
"""Check that the real part is used for a complex expression."""
|
|
32
|
+
(stream,) = GeneratorVideoEquation("(3+4*I)/255").out_streams
|
|
33
|
+
assert stream.snapshot(0, (1, 1)).item() == 5
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_contant():
|
|
37
|
+
"""Make sure the numbers are cast in array."""
|
|
38
|
+
(stream,) = GeneratorVideoEquation("0", "1", "t").out_streams
|
|
39
|
+
assert stream.snapshot(0, (5, 4)).shape == (5, 4, 3)
|
|
40
|
+
(stream,) = GeneratorVideoEquation("0", "i").out_streams # mix cst and array
|
|
41
|
+
assert stream.snapshot(0, (5, 4)).shape == (5, 4, 2)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_divide_by_zero():
|
|
45
|
+
"""Make sure not failed when divide by 0."""
|
|
46
|
+
(stream,) = GeneratorVideoEquation("1/t").out_streams
|
|
47
|
+
stream.snapshot(0, (1, 1))
|
|
48
|
+
(stream,) = GeneratorVideoEquation("1/sqrt(t)").out_streams
|
|
49
|
+
stream.snapshot(0, (1, 1))
|
|
50
|
+
(stream,) = GeneratorVideoEquation("t**-2").out_streams
|
|
51
|
+
stream.snapshot(0, (1, 1))
|
|
52
|
+
(stream,) = GeneratorVideoEquation("0", "1/j", "1/i").out_streams
|
|
53
|
+
stream.snapshot(0, (3, 3))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_input_type():
|
|
57
|
+
"""Check that the entries can be of sympy, str and number type."""
|
|
58
|
+
colors = [sympy.sympify("0"), 1 + sympy.Symbol("t", real=True, positive=True)]
|
|
59
|
+
(stream_from_expr,) = GeneratorVideoEquation(*colors).out_streams
|
|
60
|
+
(stream_from_str,) = GeneratorVideoEquation("0", "1+t").out_streams
|
|
61
|
+
(stream_from_num,) = GeneratorVideoEquation(0, colors[1]).out_streams
|
|
62
|
+
|
|
63
|
+
assert stream_from_expr.node.colors == colors
|
|
64
|
+
assert stream_from_str.node.colors == colors
|
|
65
|
+
assert stream_from_num.node.colors == colors
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_input_vars():
|
|
69
|
+
"""Make sure that only the symbols t, i and j are allowed."""
|
|
70
|
+
exprs_ok = ["t+i+j", "exp(1)", "E", "pi", "oo", "nan"]
|
|
71
|
+
exprs_fail = list("abcdefghklmnopqrsuvwxyzABCDFGHKLMPRUVWXYZ")
|
|
72
|
+
|
|
73
|
+
for expr in exprs_ok:
|
|
74
|
+
GeneratorVideoEquation(expr).out_streams[0].snapshot(0, (1, 1))
|
|
75
|
+
for expr in exprs_fail:
|
|
76
|
+
with pytest.raises(ValueError):
|
|
77
|
+
GeneratorVideoEquation(expr).out_streams[0].snapshot(0, (1, 1))
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the encoding of the multimedia files goes well."""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import tempfile
|
|
7
|
+
from fractions import Fraction
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from cutcutcodec.core.exceptions import MissingStreamError
|
|
12
|
+
from cutcutcodec.core.filters.audio.subclip import FilterAudioSubclip
|
|
13
|
+
from cutcutcodec.core.filters.video.subclip import FilterVideoSubclip
|
|
14
|
+
from cutcutcodec.core.generation.audio.empty import GeneratorAudioEmpty
|
|
15
|
+
from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise
|
|
16
|
+
from cutcutcodec.core.generation.video.empty import GeneratorVideoEmpty
|
|
17
|
+
from cutcutcodec.core.generation.video.equation import GeneratorVideoEquation
|
|
18
|
+
from cutcutcodec.core.generation.video.noise import GeneratorVideoNoise
|
|
19
|
+
from cutcutcodec.core.io.scheduler import scheduler
|
|
20
|
+
from cutcutcodec.core.io.write import ContainerOutputFFMPEG
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_detect_empty_audio():
|
|
24
|
+
"""Ensures that empty stream detection works."""
|
|
25
|
+
(stream_empty,) = GeneratorAudioEmpty().out_streams
|
|
26
|
+
with pytest.raises(MissingStreamError):
|
|
27
|
+
list(scheduler([stream_empty], [Fraction(1)]))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_detect_empty_video():
|
|
31
|
+
"""Ensures that empty stream detection works."""
|
|
32
|
+
(stream_empty,) = GeneratorVideoEmpty().out_streams
|
|
33
|
+
with pytest.raises(MissingStreamError):
|
|
34
|
+
list(scheduler([stream_empty], [Fraction(1)], shape=(1, 1)))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_transcode_audio_alone():
|
|
38
|
+
"""Writes a file with only one audio stream."""
|
|
39
|
+
streams_settings = [{"encodec": "libopus", "rate": 8000}]
|
|
40
|
+
_, filename = tempfile.mkstemp(suffix=".ogg")
|
|
41
|
+
(audio_stream,) = FilterAudioSubclip(GeneratorAudioNoise(0).out_streams, 0, 1).out_streams
|
|
42
|
+
ContainerOutputFFMPEG([audio_stream], filename, streams_settings=streams_settings).write()
|
|
43
|
+
os.remove(filename)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_transcode_multi_streams():
|
|
47
|
+
"""Writes a file with multiple video and audio streams."""
|
|
48
|
+
_, filename = tempfile.mkstemp(suffix=".mkv")
|
|
49
|
+
container_a = FilterAudioSubclip(
|
|
50
|
+
(GeneratorAudioNoise(0).out_streams + GeneratorAudioNoise(0).out_streams), 0, 1
|
|
51
|
+
)
|
|
52
|
+
container_v = FilterVideoSubclip(
|
|
53
|
+
(GeneratorVideoNoise(0).out_streams + GeneratorVideoNoise(0).out_streams), 0, 1
|
|
54
|
+
)
|
|
55
|
+
streams = container_a.out_streams + container_v.out_streams
|
|
56
|
+
settings = [
|
|
57
|
+
{"encodec": "libopus", "rate": 8000},
|
|
58
|
+
{"encodec": "libopus", "rate": 8000},
|
|
59
|
+
{"encodec": "libx264", "rate": 12, "shape": (2, 2)},
|
|
60
|
+
{"encodec": "libx264", "rate": 12, "shape": (2, 2)}
|
|
61
|
+
]
|
|
62
|
+
ContainerOutputFFMPEG(streams, filename, streams_settings=settings).write()
|
|
63
|
+
os.remove(filename)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def test_transcode_video_alone():
|
|
67
|
+
"""Writes a file with only one video stream."""
|
|
68
|
+
streams_settings = [{"encodec": "libx264", "rate": 12, "shape": (2, 2)}]
|
|
69
|
+
_, filename = tempfile.mkstemp(suffix=".mkv")
|
|
70
|
+
(video_stream,) = FilterVideoSubclip(GeneratorVideoNoise(0).out_streams, 0, 1).out_streams
|
|
71
|
+
ContainerOutputFFMPEG([video_stream], filename, streams_settings=streams_settings).write()
|
|
72
|
+
os.remove(filename)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_video_scheduler():
|
|
76
|
+
"""Check that in case of a tie, the left frame is given away before the right one."""
|
|
77
|
+
(stream_inf,) = GeneratorVideoEquation.default().out_streams
|
|
78
|
+
fps = Fraction(10)
|
|
79
|
+
(stream,) = FilterVideoSubclip([stream_inf], 0, Fraction(1, 2)).out_streams
|
|
80
|
+
|
|
81
|
+
# single input
|
|
82
|
+
inds = [ind for ind, _ in scheduler([stream], [fps], shape=(1, 1))]
|
|
83
|
+
assert inds == [0]*5 # 500 ms & 10 fps => 5 frames
|
|
84
|
+
# 2 synchronous inputs
|
|
85
|
+
inds = [ind for ind, _ in scheduler([stream, stream], [fps, fps], shape=(1, 1))]
|
|
86
|
+
assert inds == [0, 1]*5
|
|
87
|
+
# 3 synchronous inputs
|
|
88
|
+
inds = [ind for ind, _ in scheduler([stream, stream, stream], [fps, fps, fps], shape=(1, 1))]
|
|
89
|
+
assert inds == [0, 1, 2]*5
|
|
90
|
+
# 2 inputs, the first twice as fast as the seconde
|
|
91
|
+
inds = [ind for ind, _ in scheduler([stream, stream], [2*fps, fps], shape=(1, 1))]
|
|
92
|
+
assert inds == [0, 1, 0]*5
|
|
93
|
+
# 2 inputs, the second twice as fast as the first
|
|
94
|
+
inds = [ind for ind, _ in scheduler([stream, stream], [fps, 2*fps], shape=(1, 1))]
|
|
95
|
+
assert inds == [0, 1, 1]*5
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Pythonic tools."""
|
|
4
|
+
|
|
5
|
+
import pathlib
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_compilation_rules() -> dict:
|
|
11
|
+
"""Return the extra compilation rules."""
|
|
12
|
+
return {
|
|
13
|
+
"define_macros": [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")], # for warning
|
|
14
|
+
"extra_compile_args": [
|
|
15
|
+
"-fopenmp", # for threads
|
|
16
|
+
"-fopenmp-simd", # for single instruction multiple data
|
|
17
|
+
"-lm", # for math functions
|
|
18
|
+
"-march=native", # uses local processor instructions
|
|
19
|
+
"-O3", # hight optimisation, -O3 include -ffast-math
|
|
20
|
+
],
|
|
21
|
+
"include_dirs": [np.get_include()], # requires for #include numpy
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_project_root() -> pathlib.Path:
|
|
26
|
+
"""Return the absolute project root folder.
|
|
27
|
+
|
|
28
|
+
Examples
|
|
29
|
+
--------
|
|
30
|
+
>>> from cutcutcodec.utils import get_project_root
|
|
31
|
+
>>> root = get_project_root()
|
|
32
|
+
>>> root.is_dir()
|
|
33
|
+
True
|
|
34
|
+
>>> root.name
|
|
35
|
+
'cutcutcodec'
|
|
36
|
+
>>> sorted(p.name for p in root.iterdir())
|
|
37
|
+
['__init__.py', '__main__.py', '__pycache__', 'core', 'examples', 'gui', 'testing', 'utils.py']
|
|
38
|
+
>>>
|
|
39
|
+
"""
|
|
40
|
+
return pathlib.Path(__file__).resolve().parent
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright © 2023 Robin RICHARD
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|