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,71 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Perform tests on ``FilterAudioDelay`` and ``FilterVideoDelay``."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from cutcutcodec.core.exceptions import OutOfTimeRange
|
|
10
|
+
from cutcutcodec.core.filters.audio.delay import FilterAudioDelay
|
|
11
|
+
from cutcutcodec.core.filters.audio.subclip import FilterAudioSubclip
|
|
12
|
+
from cutcutcodec.core.filters.video.delay import FilterVideoDelay
|
|
13
|
+
from cutcutcodec.core.filters.video.subclip import FilterVideoSubclip
|
|
14
|
+
from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise
|
|
15
|
+
from cutcutcodec.core.generation.video.noise import GeneratorVideoNoise
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_limits_audio():
|
|
19
|
+
"""Ensures that the limits move in the right direction by the right amount."""
|
|
20
|
+
container = FilterAudioSubclip(GeneratorAudioNoise(0).out_streams, 0, 1)
|
|
21
|
+
for delay in (0, 1):
|
|
22
|
+
stream = FilterAudioDelay(container.out_streams, delay).out_streams[0]
|
|
23
|
+
with pytest.raises(OutOfTimeRange):
|
|
24
|
+
stream.snapshot(delay - Fraction(1, 100_000), 1, 1)
|
|
25
|
+
stream.snapshot(delay, 1, 1)
|
|
26
|
+
with pytest.raises(OutOfTimeRange):
|
|
27
|
+
stream.snapshot(delay + 1, 1, 1)
|
|
28
|
+
with pytest.raises(OutOfTimeRange):
|
|
29
|
+
stream.snapshot(delay + 1 + Fraction(1, 100_000), 1, 1)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_limits_video():
|
|
33
|
+
"""Ensures that the limits move in the right direction by the right amount."""
|
|
34
|
+
container = FilterVideoSubclip(GeneratorVideoNoise(0).out_streams, 0, 1)
|
|
35
|
+
for delay in (0, 1):
|
|
36
|
+
stream = FilterVideoDelay(container.out_streams, delay).out_streams[0]
|
|
37
|
+
with pytest.raises(OutOfTimeRange):
|
|
38
|
+
stream.snapshot(delay - Fraction(1, 100_000), (1, 1))
|
|
39
|
+
stream.snapshot(delay, (1, 1))
|
|
40
|
+
stream.snapshot(delay + 1 - Fraction(1, 100_000), (1, 1))
|
|
41
|
+
with pytest.raises(OutOfTimeRange):
|
|
42
|
+
stream.snapshot(delay + 1, (1, 1))
|
|
43
|
+
with pytest.raises(OutOfTimeRange):
|
|
44
|
+
stream.snapshot(delay + 1 + Fraction(1, 100_000), (1, 1))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_concat_audio():
|
|
48
|
+
"""Ensure that the concatenation of the stream is coherent."""
|
|
49
|
+
container = FilterAudioSubclip(GeneratorAudioNoise(0).out_streams, 0, 1)
|
|
50
|
+
stream = FilterAudioDelay(
|
|
51
|
+
FilterAudioDelay(container.out_streams, 1).out_streams, 2
|
|
52
|
+
).out_streams[0]
|
|
53
|
+
with pytest.raises(OutOfTimeRange):
|
|
54
|
+
stream.snapshot(3 - Fraction(1, 100_000), 1, 1)
|
|
55
|
+
stream.snapshot(3, 1, 1)
|
|
56
|
+
with pytest.raises(OutOfTimeRange):
|
|
57
|
+
stream.snapshot(4, 1, 1)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_concat_video():
|
|
61
|
+
"""Ensure that the concatenation of the stream is coherent."""
|
|
62
|
+
container = FilterVideoSubclip(GeneratorVideoNoise(0).out_streams, 0, 1)
|
|
63
|
+
stream = FilterVideoDelay(
|
|
64
|
+
FilterVideoDelay(container.out_streams, 1).out_streams, 2
|
|
65
|
+
).out_streams[0]
|
|
66
|
+
with pytest.raises(OutOfTimeRange):
|
|
67
|
+
stream.snapshot(3 - Fraction(1, 100_000), (1, 1))
|
|
68
|
+
stream.snapshot(3, (1, 1))
|
|
69
|
+
stream.snapshot(4 - Fraction(1, 100_000), (1, 1))
|
|
70
|
+
with pytest.raises(OutOfTimeRange):
|
|
71
|
+
stream.snapshot(4, (1, 1))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check the consistency between the number of incoming and outgoing streams."""
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.classes.container import ContainerInput, ContainerOutput
|
|
8
|
+
from cutcutcodec.core.classes.filter import Filter
|
|
9
|
+
from cutcutcodec.core.compilation.graph_to_tree import new_node
|
|
10
|
+
from cutcutcodec.core.generation.audio.empty import GeneratorAudioEmpty
|
|
11
|
+
from cutcutcodec.testing.generation import extract_cls_and_default
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_empty():
|
|
15
|
+
"""Check that all filters can be emptied."""
|
|
16
|
+
for cls, node in extract_cls_and_default():
|
|
17
|
+
if not issubclass(cls, Filter) or issubclass(cls, (ContainerInput, ContainerOutput)):
|
|
18
|
+
continue
|
|
19
|
+
empty_filter = new_node(cls, [], node.getstate())
|
|
20
|
+
assert empty_filter.in_streams == ()
|
|
21
|
+
assert empty_filter.out_streams == (), cls
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_raise_semi_empty():
|
|
25
|
+
"""Ensures that a filter cannot be half empty."""
|
|
26
|
+
class _Filter(Filter):
|
|
27
|
+
_getstate = None
|
|
28
|
+
_setstate = None
|
|
29
|
+
default = None
|
|
30
|
+
|
|
31
|
+
stream = GeneratorAudioEmpty().out_streams[0]
|
|
32
|
+
_Filter([], [])
|
|
33
|
+
with pytest.raises(AssertionError):
|
|
34
|
+
_Filter([stream], [])
|
|
35
|
+
with pytest.raises(AssertionError):
|
|
36
|
+
_Filter([], [stream])
|
|
37
|
+
_Filter([stream], [stream])
|
|
38
|
+
_Filter([stream], [stream, stream])
|
|
39
|
+
_Filter([stream, stream], [stream])
|
|
40
|
+
_Filter([stream, stream], [stream, stream])
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check the Finite Impulse Response Filter."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from fractions import Fraction
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
import torch
|
|
10
|
+
|
|
11
|
+
from cutcutcodec.core.exceptions import OutOfTimeRange
|
|
12
|
+
from cutcutcodec.core.filters.audio.cut import FilterAudioCut
|
|
13
|
+
from cutcutcodec.core.filters.audio.delay import FilterAudioDelay
|
|
14
|
+
from cutcutcodec.core.filters.audio.fir import FilterAudioFIR
|
|
15
|
+
from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def delay(size: int):
|
|
19
|
+
"""Convolution with a dirac translated of size sample, zero padding left."""
|
|
20
|
+
stream_in, _ = FilterAudioCut(GeneratorAudioNoise(0).out_streams, 1).out_streams
|
|
21
|
+
(stream_out,) = FilterAudioFIR([stream_in], torch.tensor([0.0]*size + [1.0]), 48000).out_streams
|
|
22
|
+
(stream_out_exp,) = FilterAudioDelay([stream_in], Fraction(size, 48000)).out_streams
|
|
23
|
+
|
|
24
|
+
# test values
|
|
25
|
+
assert (
|
|
26
|
+
stream_out_exp.snapshot(Fraction(1, 2) + Fraction(size, 48000), 48000, 64)
|
|
27
|
+
== pytest.approx(
|
|
28
|
+
stream_out.snapshot(Fraction(1, 2) + Fraction(size, 48000), 48000, 64),
|
|
29
|
+
rel=1e-6,
|
|
30
|
+
abs=1e-6,
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
assert (abs(stream_out.snapshot(0, 48000, size)) <= 1e-6).all() # zero padding left
|
|
34
|
+
|
|
35
|
+
# test time limits
|
|
36
|
+
assert stream_out.beginning == 0
|
|
37
|
+
assert stream_out.duration == 1 + Fraction(size, 48000)
|
|
38
|
+
stream_out.snapshot(0, 48000, 1)
|
|
39
|
+
stream_out.snapshot(1 + Fraction(size-1, 48000), 48000, 1)
|
|
40
|
+
with pytest.raises(OutOfTimeRange):
|
|
41
|
+
stream_out.snapshot(1 + Fraction(size, 48000), 48000, 1)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def identity_queue(size: int):
|
|
45
|
+
"""Check the identity impulsional response with zero padding right."""
|
|
46
|
+
stream_in, _ = FilterAudioCut(GeneratorAudioNoise(0).out_streams, 1).out_streams
|
|
47
|
+
(stream_out,) = FilterAudioFIR([stream_in], torch.tensor([1.0] + [0.0]*size), 48000).out_streams
|
|
48
|
+
|
|
49
|
+
# test values
|
|
50
|
+
assert (
|
|
51
|
+
stream_in.snapshot(Fraction(1, 2), 48000, 64)
|
|
52
|
+
== pytest.approx(stream_out.snapshot(Fraction(1, 2), 48000, 64), rel=1e-6, abs=1e-6)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# test time limits
|
|
56
|
+
assert stream_out.beginning == 0
|
|
57
|
+
assert stream_out.duration == 1 + Fraction(size, 48000)
|
|
58
|
+
stream_out.snapshot(0, 48000, 1)
|
|
59
|
+
stream_out.snapshot(1 + Fraction(size-1, 48000), 48000, 1)
|
|
60
|
+
with pytest.raises(OutOfTimeRange):
|
|
61
|
+
stream_out.snapshot(1 + Fraction(size, 48000), 48000, 1)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_identity():
|
|
65
|
+
"""Test to convolute with the neutral."""
|
|
66
|
+
identity_queue(0)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_identity_queue_1():
|
|
70
|
+
"""Test to convolute with the neutral, padded by one 0."""
|
|
71
|
+
identity_queue(1)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_identity_queue_2():
|
|
75
|
+
"""Test to convolute with the neutral, padded by two 0."""
|
|
76
|
+
identity_queue(2)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_identity_queue_128():
|
|
80
|
+
"""Test to convolute with the neutral, padded by 128 0."""
|
|
81
|
+
identity_queue(128)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_identity_queue_65536():
|
|
85
|
+
"""Test to convolute with the neutral, padded by 65536 0."""
|
|
86
|
+
identity_queue(65536)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_factor():
|
|
90
|
+
"""Test to convolute by a cst value."""
|
|
91
|
+
stream_in, _ = FilterAudioCut(GeneratorAudioNoise(0).out_streams, 1).out_streams
|
|
92
|
+
(stream_out,) = FilterAudioFIR([stream_in], torch.tensor([-.5]), 48000).out_streams
|
|
93
|
+
assert (
|
|
94
|
+
-.5*stream_in.snapshot(Fraction(1, 2), 48000, 64)
|
|
95
|
+
== pytest.approx(stream_out.snapshot(Fraction(1, 2), 48000, 64), rel=1e-6, abs=1e-6)
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_delay_1():
|
|
100
|
+
"""Test to convolute by a delayed dirac (one sample late)."""
|
|
101
|
+
delay(1)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_delay_2():
|
|
105
|
+
"""Test to convolute by a delayed dirac (two samples late)."""
|
|
106
|
+
delay(2)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_delay_128():
|
|
110
|
+
"""Test to convolute by a delayed dirac (128 samples late)."""
|
|
111
|
+
delay(128)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_delay_65536():
|
|
115
|
+
"""Test to convolute by a delayed dirac (65536 samples late)."""
|
|
116
|
+
delay(65536)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# def timer():
|
|
120
|
+
# """Test the perfs for differents sizes."""
|
|
121
|
+
# import time
|
|
122
|
+
# import matplotlib.pyplot as plt
|
|
123
|
+
# (stream_in,) = GeneratorAudioNoise(0).out_streams
|
|
124
|
+
# sizes = [round(2.0**(.25*i)) for i in range(64)]
|
|
125
|
+
# samples2times = {1: [], 4096: [], 65536: []}
|
|
126
|
+
# for size in sizes:
|
|
127
|
+
# (stream,) = FilterAudioFIR([stream_in], torch.full((size,), 1.0/size), 48000).out_streams
|
|
128
|
+
# for samples, times in samples2times.items():
|
|
129
|
+
# stream.snapshot(0, 48000, samples)
|
|
130
|
+
# t_ref = time.time()
|
|
131
|
+
# for _ in range(50):
|
|
132
|
+
# stream.snapshot(0, 48000, samples)
|
|
133
|
+
# times.append((time.time()-t_ref)/50)
|
|
134
|
+
# print(f"kernel {size}, {samples} samples, {1000*times[-1]:3f} ms")
|
|
135
|
+
|
|
136
|
+
# for samples, times in samples2times.items():
|
|
137
|
+
# plt.plot(sizes, times, label=f"{samples} samples")
|
|
138
|
+
# plt.xlabel("len kernel")
|
|
139
|
+
# plt.ylabel("time (s)")
|
|
140
|
+
# plt.legend()
|
|
141
|
+
# plt.xscale("log")
|
|
142
|
+
# plt.yscale("log")
|
|
143
|
+
# plt.show()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Ensures that the hashes are consistent."""
|
|
4
|
+
|
|
5
|
+
import itertools
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.classes.container import ContainerOutput
|
|
8
|
+
from cutcutcodec.core.opti.cache.hashes.graph import compute_graph_items_hash
|
|
9
|
+
from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
|
|
10
|
+
from cutcutcodec.testing.generation import extract_streams
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_invariance_and_differences():
|
|
14
|
+
"""Ensures that the function is repeatable and that it can detect differences."""
|
|
15
|
+
all_graphs = [
|
|
16
|
+
tree_to_graph(ContainerOutput([stream]))
|
|
17
|
+
for stream in extract_streams()
|
|
18
|
+
]
|
|
19
|
+
hashes = [compute_graph_items_hash(graph) for graph in all_graphs]
|
|
20
|
+
for graph, signature in zip(all_graphs, hashes):
|
|
21
|
+
assert compute_graph_items_hash(graph) == signature
|
|
22
|
+
for hash_1, hash_2 in itertools.combinations(hashes, 2):
|
|
23
|
+
assert hash_1 != hash_2
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Ensures all source files are importable."""
|
|
4
|
+
|
|
5
|
+
import importlib
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.testing.generation import extract_cls_and_default
|
|
8
|
+
from cutcutcodec.utils import get_project_root
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_default():
|
|
12
|
+
"""Initialize the example of each class."""
|
|
13
|
+
for node_cls, node in extract_cls_and_default():
|
|
14
|
+
assert isinstance(node, node_cls)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_import():
|
|
18
|
+
"""Recursively browse all files to import them."""
|
|
19
|
+
for filepath in get_project_root().rglob("*.py"):
|
|
20
|
+
importlib.import_module(
|
|
21
|
+
".".join(
|
|
22
|
+
("cutcutcodec" / filepath.relative_to(get_project_root()).with_suffix("")).parts
|
|
23
|
+
)
|
|
24
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check is the properties are working for all muxers."""
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.classes.muxer import AllMuxers, Muxer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.slow
|
|
11
|
+
def test_doc():
|
|
12
|
+
"""Try to extract the doc for all muxers."""
|
|
13
|
+
for muxer in AllMuxers().set:
|
|
14
|
+
doc = Muxer(muxer).doc
|
|
15
|
+
assert isinstance(doc, str), f"bad type {doc.__class__.__name__} for the doc of {muxer}"
|
|
16
|
+
assert doc != "", f"the doc of {muxer} is empty"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_parse():
|
|
20
|
+
"""Ensure all muxers can be parsed."""
|
|
21
|
+
for muxer in AllMuxers().set:
|
|
22
|
+
Muxer(muxer)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Ensure the behavor of nan value in timestamp for snapshot is taken in account."""
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
import torch
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.core.classes.node import Node
|
|
11
|
+
from cutcutcodec.core.classes.stream_video import StreamVideo
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_video_nan():
|
|
15
|
+
"""Test nan value on a video stream."""
|
|
16
|
+
class NodeEmpty(Node):
|
|
17
|
+
_getstate = None
|
|
18
|
+
_setstate = None
|
|
19
|
+
default = None
|
|
20
|
+
|
|
21
|
+
class Stream(StreamVideo):
|
|
22
|
+
beginning = None
|
|
23
|
+
duration = None
|
|
24
|
+
is_space_continuous = None
|
|
25
|
+
is_time_continuous = None
|
|
26
|
+
|
|
27
|
+
stream = Stream(NodeEmpty([], []))
|
|
28
|
+
assert np.array_equal(
|
|
29
|
+
stream.snapshot(math.nan, (480, 720)).numpy(force=True),
|
|
30
|
+
np.zeros((480, 720, 2), dtype=np.uint8),
|
|
31
|
+
)
|
|
32
|
+
assert np.array_equal(
|
|
33
|
+
stream.snapshot(np.nan, (480, 720)).numpy(force=True),
|
|
34
|
+
np.zeros((480, 720, 2), dtype=np.uint8),
|
|
35
|
+
)
|
|
36
|
+
assert np.array_equal(
|
|
37
|
+
stream.snapshot(torch.nan, (480, 720)).numpy(force=True),
|
|
38
|
+
np.zeros((480, 720, 2), dtype=np.uint8),
|
|
39
|
+
)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Check that the decoding of the audio and video files goes well."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
import itertools
|
|
7
|
+
import math
|
|
8
|
+
import random
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
import torch
|
|
12
|
+
|
|
13
|
+
from cutcutcodec.core.exceptions import OutOfTimeRange
|
|
14
|
+
from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_duration_audio():
|
|
18
|
+
"""Ensure the duration is optimized and repetable."""
|
|
19
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
20
|
+
(stream,) = container.out_streams
|
|
21
|
+
duration = stream.duration
|
|
22
|
+
assert duration is not None
|
|
23
|
+
# test read all frames once
|
|
24
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
25
|
+
(stream,) = container.out_streams
|
|
26
|
+
rate = stream.rate
|
|
27
|
+
try:
|
|
28
|
+
stream.snapshot(0, rate, int(2*duration*rate))
|
|
29
|
+
except OutOfTimeRange:
|
|
30
|
+
pass
|
|
31
|
+
assert getattr(stream, "_duration", None) is not None
|
|
32
|
+
assert getattr(stream, "_duration", None) == duration
|
|
33
|
+
# test seek
|
|
34
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
35
|
+
(stream,) = container.out_streams
|
|
36
|
+
try:
|
|
37
|
+
stream.seek(duration + 3600)
|
|
38
|
+
except OutOfTimeRange:
|
|
39
|
+
pass
|
|
40
|
+
assert getattr(stream, "_duration", None) is not None
|
|
41
|
+
assert getattr(stream, "_duration", None) == duration
|
|
42
|
+
# test duration from scratch
|
|
43
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
44
|
+
(stream,) = container.out_streams
|
|
45
|
+
assert stream.duration == duration
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_duration_video():
|
|
49
|
+
"""Ensure the duration is optimized and repetable."""
|
|
50
|
+
# test read all frames
|
|
51
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
52
|
+
(stream,) = container.out_streams
|
|
53
|
+
shape = (stream.height, stream.width)
|
|
54
|
+
rate = stream.rate
|
|
55
|
+
try:
|
|
56
|
+
for timestamp in itertools.count():
|
|
57
|
+
stream.snapshot(Fraction(timestamp, rate), shape)
|
|
58
|
+
except OutOfTimeRange:
|
|
59
|
+
pass
|
|
60
|
+
assert getattr(stream, "_duration", None) is not None
|
|
61
|
+
duration = getattr(stream, "_duration", None)
|
|
62
|
+
# test seek
|
|
63
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
64
|
+
(stream,) = container.out_streams
|
|
65
|
+
try:
|
|
66
|
+
stream.seek(duration + 3600)
|
|
67
|
+
except OutOfTimeRange:
|
|
68
|
+
pass
|
|
69
|
+
assert getattr(stream, "_duration", None) is not None
|
|
70
|
+
assert getattr(stream, "_duration", None) == duration
|
|
71
|
+
# test duration from scratch
|
|
72
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
73
|
+
(stream,) = container.out_streams
|
|
74
|
+
assert stream.duration == duration
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_linear_reading_audio():
|
|
78
|
+
"""Linear reading of the entiere audio file."""
|
|
79
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
80
|
+
(stream,) = container.out_streams
|
|
81
|
+
samples = math.floor(stream.duration * stream.rate)
|
|
82
|
+
stream.snapshot(0, stream.rate, samples)
|
|
83
|
+
for i in range(0, samples-512, 512):
|
|
84
|
+
stream.snapshot(Fraction(i, stream.rate), stream.rate, 512)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_linear_reading_video():
|
|
88
|
+
"""Linear reading of the entire video file."""
|
|
89
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
90
|
+
(stream,) = container.out_streams
|
|
91
|
+
shape = (stream.height, stream.width)
|
|
92
|
+
prec_time = stream.snapshot(0, shape).time
|
|
93
|
+
for i in range(1, math.ceil(stream.duration * stream.rate)):
|
|
94
|
+
timestamp = (i-1) / stream.rate
|
|
95
|
+
next_time = stream.snapshot(i/stream.rate, shape).time
|
|
96
|
+
assert prec_time <= timestamp
|
|
97
|
+
assert next_time > timestamp
|
|
98
|
+
assert prec_time <= next_time # the time of the images must be increasing
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_out_of_bounds_audio():
|
|
102
|
+
"""Make sure that you can't reach outside the duration of the audio."""
|
|
103
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
104
|
+
(stream,) = container.out_streams
|
|
105
|
+
with pytest.raises(OutOfTimeRange):
|
|
106
|
+
stream.snapshot(-Fraction(1, 100_000), stream.rate, 1)
|
|
107
|
+
stream.snapshot(0, stream.rate, 1)
|
|
108
|
+
stream.snapshot(stream.duration - 2*Fraction(1, stream.rate), stream.rate, 2)
|
|
109
|
+
stream.snapshot(stream.duration - Fraction(1, stream.rate), stream.rate, 1)
|
|
110
|
+
with pytest.raises(OutOfTimeRange):
|
|
111
|
+
stream.snapshot(stream.duration - Fraction(1, stream.rate), stream.rate, 2)
|
|
112
|
+
with pytest.raises(OutOfTimeRange):
|
|
113
|
+
stream.snapshot(stream.duration, stream.rate, 1)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_out_of_bounds_video():
|
|
117
|
+
"""Make sure that you can't reach outside the duration of the video."""
|
|
118
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
119
|
+
(stream,) = container.out_streams
|
|
120
|
+
shape = (stream.height, stream.width)
|
|
121
|
+
with pytest.raises(OutOfTimeRange):
|
|
122
|
+
stream.snapshot(Fraction(-1, 100_000), shape)
|
|
123
|
+
stream.snapshot(0, shape)
|
|
124
|
+
stream.snapshot(stream.duration - Fraction(1, 100_000), shape)
|
|
125
|
+
with pytest.raises(OutOfTimeRange):
|
|
126
|
+
stream.snapshot(stream.duration, shape)
|
|
127
|
+
with pytest.raises(OutOfTimeRange):
|
|
128
|
+
stream.snapshot(stream.duration + Fraction(1, 100_000), shape)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@pytest.mark.slow
|
|
132
|
+
def test_random_reading_video():
|
|
133
|
+
"""Random reading of the entire video file."""
|
|
134
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
135
|
+
(stream,) = container.out_streams
|
|
136
|
+
shape = (stream.height, stream.width)
|
|
137
|
+
frames = [
|
|
138
|
+
stream.snapshot(i/stream.rate, shape)
|
|
139
|
+
for i in range(math.ceil(stream.duration*stream.rate))
|
|
140
|
+
]
|
|
141
|
+
random.Random(0).shuffle(frames)
|
|
142
|
+
for frame_ref in frames:
|
|
143
|
+
frame = stream.snapshot(frame_ref.time, shape)
|
|
144
|
+
assert frame.time == frame_ref.time
|
|
145
|
+
assert torch.equal(frame, frame_ref)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def test_random_reading_audio():
|
|
149
|
+
"""Random reading of the entire audio file."""
|
|
150
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
151
|
+
(stream,) = container.out_streams
|
|
152
|
+
frames = [
|
|
153
|
+
stream.snapshot(Fraction(i, stream.rate), stream.rate, 512)
|
|
154
|
+
for i in range(0, math.ceil(stream.duration * stream.rate)-513, 512)
|
|
155
|
+
]
|
|
156
|
+
random.Random(0).shuffle(frames)
|
|
157
|
+
for frame_ref in frames:
|
|
158
|
+
frame = stream.snapshot(frame_ref.time, stream.rate, 512)
|
|
159
|
+
assert frame.time == frame_ref.time
|
|
160
|
+
assert torch.equal(frame, frame_ref), (frame_ref, frame)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@pytest.mark.slow
|
|
164
|
+
def test_reverse_reading_video():
|
|
165
|
+
"""Read all frames in reverse order."""
|
|
166
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/video.mp4") as container:
|
|
167
|
+
(stream,) = container.out_streams
|
|
168
|
+
shape = (stream.height, stream.width)
|
|
169
|
+
frames = [
|
|
170
|
+
stream.snapshot(i/stream.rate, shape)
|
|
171
|
+
for i in range(math.ceil(stream.duration*stream.rate))
|
|
172
|
+
]
|
|
173
|
+
frames.reverse()
|
|
174
|
+
for frame_ref in frames:
|
|
175
|
+
frame = stream.snapshot(frame_ref.time, shape)
|
|
176
|
+
assert frame.time == frame_ref.time
|
|
177
|
+
assert torch.equal(frame, frame_ref)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_reverse_reading_audio():
|
|
181
|
+
"""Random reading of the entire audio file."""
|
|
182
|
+
with ContainerInputFFMPEG("cutcutcodec/examples/audio_5.1_narration.oga") as container:
|
|
183
|
+
(stream,) = container.out_streams
|
|
184
|
+
frames = [
|
|
185
|
+
stream.snapshot(Fraction(i, stream.rate), stream.rate, 512)
|
|
186
|
+
for i in range(0, math.ceil(stream.duration * stream.rate)-513, 512)
|
|
187
|
+
]
|
|
188
|
+
frames.reverse()
|
|
189
|
+
for frame_ref in frames:
|
|
190
|
+
frame = stream.snapshot(frame_ref.time, stream.rate, 512)
|
|
191
|
+
assert frame.time == frame_ref.time
|
|
192
|
+
assert torch.equal(frame, frame_ref), (frame_ref, frame)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Ensures that objects serialize correctly and remain equivalent.
|
|
4
|
+
|
|
5
|
+
* Checks that the classes that inherit from ``cutcutcodec.core.classes.node.Node`` are pickable.
|
|
6
|
+
* Checks that classes inheriting from ``cutcutcodec.core.classes.stream.Stream``
|
|
7
|
+
can serialize and attach to there node.
|
|
8
|
+
* Checks that the deserialized objects are equal to there initial version.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import itertools
|
|
12
|
+
import json
|
|
13
|
+
|
|
14
|
+
import pickle
|
|
15
|
+
import typing
|
|
16
|
+
|
|
17
|
+
from cutcutcodec.core.classes.node import Node
|
|
18
|
+
from cutcutcodec.core.classes.stream import Stream
|
|
19
|
+
from cutcutcodec.testing.generation import extract_default, extract_streams
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def single_check(obj: typing.Union[Node, Stream]):
|
|
23
|
+
"""Perform serialization and equality tests on a single object."""
|
|
24
|
+
assert isinstance(obj, (Node, Stream)), obj.__class__.__name__
|
|
25
|
+
assert obj == obj # every node and stream must be equal to itself
|
|
26
|
+
obj_bis = pickle.loads(pickle.dumps(obj)) # must be serializable with the native pickle module
|
|
27
|
+
assert obj_bis is not obj
|
|
28
|
+
assert obj_bis == obj # serializing and deserializing should not change much
|
|
29
|
+
if isinstance(obj, Node):
|
|
30
|
+
state = obj.getstate()
|
|
31
|
+
assert isinstance(state, dict) # state need to be dict
|
|
32
|
+
assert all(isinstance(k, str) for k in state) # all keys need to be str
|
|
33
|
+
assert json.loads(json.dumps(state)) == state # node state needs to be jsonisable
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def inequality_check(objs: typing.Iterable[typing.Union[Node, Stream]]):
|
|
37
|
+
"""Check that all the objects provided are different."""
|
|
38
|
+
for obj_1, obj_2 in itertools.combinations(objs, 2):
|
|
39
|
+
assert obj_1 != obj_2
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_node_are_differents():
|
|
43
|
+
"""Ensure that all nodes are differents."""
|
|
44
|
+
inequality_check(extract_default())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_streams_serialization():
|
|
48
|
+
"""Perform checks on streams independently."""
|
|
49
|
+
for stream in extract_streams():
|
|
50
|
+
single_check(stream)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Test the video stream snapshot shape."""
|
|
4
|
+
|
|
5
|
+
import itertools
|
|
6
|
+
|
|
7
|
+
from cutcutcodec.core.generation.video.empty import GeneratorVideoEmpty
|
|
8
|
+
from cutcutcodec.testing.generation import extract_streams
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_shape():
|
|
12
|
+
"""Extract snapshot in all video streams."""
|
|
13
|
+
for stream in extract_streams():
|
|
14
|
+
if stream.type != "video":
|
|
15
|
+
continue
|
|
16
|
+
if isinstance(stream.node, GeneratorVideoEmpty):
|
|
17
|
+
continue
|
|
18
|
+
for height, width in itertools.product([1, 2, 3, 100, 101], [1, 2, 3, 100, 101]):
|
|
19
|
+
frame = stream.snapshot(0, (height, width))
|
|
20
|
+
assert frame.height == height, (frame, height, frame.height)
|
|
21
|
+
assert frame.width == width, (frame, width, frame.width)
|