cutcutcodec 1.2.1__tar.gz → 1.2.2__tar.gz

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.
Files changed (205) hide show
  1. {cutcutcodec-1.2.1/cutcutcodec.egg-info → cutcutcodec-1.2.2}/PKG-INFO +5 -1
  2. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/README.rst +1 -0
  3. cutcutcodec-1.2.2/c_build.py +47 -0
  4. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/__init__.py +1 -1
  5. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/ffprobe.py +1 -0
  6. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/stream/rate_audio.py +2 -2
  7. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/stream/rate_video.py +2 -2
  8. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/stream/shape.py +2 -2
  9. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/stream/time_backprop.py +2 -2
  10. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/node.py +9 -0
  11. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/colorspace/func.py +2 -2
  12. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/compatibility.py +8 -9
  13. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/rate.py +2 -2
  14. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/lambdify.py +2 -2
  15. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/equation.py +1 -1
  16. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/equation.py +1 -1
  17. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/resize.py +25 -25
  18. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/fractal/fractal.c +58 -76
  19. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/fractal/mandelbrot.py +1 -1
  20. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/__init__.py +6 -29
  21. cutcutcodec-1.2.2/cutcutcodec/core/io/cst.py +84 -0
  22. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/read_ffmpeg.py +98 -106
  23. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/read_ffmpeg_color.py +11 -11
  24. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/scheduler.py +3 -3
  25. cutcutcodec-1.2.2/cutcutcodec/core/opti/cache/basic.py +67 -0
  26. cutcutcodec-1.2.2/cutcutcodec/core/opti/parallel/__init__.py +7 -0
  27. cutcutcodec-1.2.2/cutcutcodec/core/opti/parallel/buffer.py +174 -0
  28. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/utils.py +3 -4
  29. cutcutcodec-1.2.2/cutcutcodec/core/signal/metric.c +578 -0
  30. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/utils.py +33 -17
  31. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2/cutcutcodec.egg-info}/PKG-INFO +5 -1
  32. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec.egg-info/SOURCES.txt +3 -2
  33. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec.egg-info/requires.txt +4 -0
  34. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec.egg-info/top_level.txt +1 -0
  35. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/pyproject.toml +5 -2
  36. cutcutcodec-1.2.1/c_build.py +0 -32
  37. cutcutcodec-1.2.1/cutcutcodec/core/opti/cache/basic.py +0 -36
  38. cutcutcodec-1.2.1/cutcutcodec/core/opti/parallel/__init__.py +0 -3
  39. cutcutcodec-1.2.1/cutcutcodec/core/opti/parallel/buffer.py +0 -90
  40. cutcutcodec-1.2.1/media/logo.svg +0 -13
  41. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/LICENSE +0 -0
  42. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/__main__.py +0 -0
  43. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/config/__init__.py +0 -0
  44. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/config/config.py +0 -0
  45. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/__init__.py +0 -0
  46. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/__init__.py +0 -0
  47. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/_helper_properties.py +0 -0
  48. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/audio/__init__.py +0 -0
  49. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/audio/properties/__init__.py +0 -0
  50. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/audio/properties/duration.py +0 -0
  51. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/graph/__init__.py +0 -0
  52. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/graph/find.py +0 -0
  53. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/graph/time_backprop.py +0 -0
  54. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/stream/__init__.py +0 -0
  55. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/__init__.py +0 -0
  56. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/properties/__init__.py +0 -0
  57. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/properties/duration.py +0 -0
  58. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/properties/nb_frames.py +0 -0
  59. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/properties/rate.py +0 -0
  60. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/analysis/video/properties/timestamps.py +0 -0
  61. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/__init__.py +0 -0
  62. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/container.py +0 -0
  63. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/encoder.py +0 -0
  64. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/filter.py +0 -0
  65. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/frame.py +0 -0
  66. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/frame_audio.py +0 -0
  67. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/frame_video.py +0 -0
  68. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/layout.py +0 -0
  69. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/meta_filter.py +0 -0
  70. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/muxer.py +0 -0
  71. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/stream.py +0 -0
  72. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/stream_audio.py +0 -0
  73. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/classes/stream_video.py +0 -0
  74. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/colorspace/__init__.py +0 -0
  75. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/colorspace/cst.py +0 -0
  76. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/__init__.py +0 -0
  77. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/ast_to_file.py +0 -0
  78. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/__init__.py +0 -0
  79. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/default.py +0 -0
  80. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/encodec.py +0 -0
  81. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/export/muxer.py +0 -0
  82. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/graph_to_ast.py +0 -0
  83. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/graph_to_json.py +0 -0
  84. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/graph_to_tree.py +0 -0
  85. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/json_to_graph.py +0 -0
  86. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/parse.py +0 -0
  87. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/__init__.py +0 -0
  88. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/dynamic.py +0 -0
  89. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/memory_check.py +0 -0
  90. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/preprocess.py +0 -0
  91. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/printer.py +0 -0
  92. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/sympy_to_torch/printer_atom.py +0 -0
  93. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/compilation/tree_to_graph.py +0 -0
  94. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/__init__.py +0 -0
  95. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/decision/__init__.py +0 -0
  96. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/factor/__init__.py +0 -0
  97. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/factor/proba.py +0 -0
  98. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/generalize/__init__.py +0 -0
  99. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/generalize/delay_to_fir.py +0 -0
  100. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/operation/__init__.py +0 -0
  101. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/operation/add.py +0 -0
  102. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/edit/operation/remove.py +0 -0
  103. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/exceptions.py +0 -0
  104. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/__init__.py +0 -0
  105. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/__init__.py +0 -0
  106. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/add.py +0 -0
  107. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/cat.py +0 -0
  108. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/cut.py +0 -0
  109. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/delay.py +0 -0
  110. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/fir.py +0 -0
  111. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/resample.py +0 -0
  112. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/subclip.py +0 -0
  113. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/audio/wiener.py +0 -0
  114. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/cut.py +0 -0
  115. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/identity.py +0 -0
  116. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/mix/__init__.py +0 -0
  117. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/mix/audio_cast.py +0 -0
  118. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/mix/video_cast.py +0 -0
  119. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/subclip.py +0 -0
  120. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/__init__.py +0 -0
  121. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/add.py +0 -0
  122. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/cat.py +0 -0
  123. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/colorspace.py +0 -0
  124. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/cut.py +0 -0
  125. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/delay.py +0 -0
  126. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/pad.py +0 -0
  127. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/patch.py +0 -0
  128. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/speed.py +0 -0
  129. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/filter/video/subclip.py +0 -0
  130. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/__init__.py +0 -0
  131. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/audio/__init__.py +0 -0
  132. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/audio/empty.py +0 -0
  133. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/audio/equation.py +0 -0
  134. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/audio/noise.py +0 -0
  135. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/__init__.py +0 -0
  136. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/empty.py +0 -0
  137. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/equation.py +0 -0
  138. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/fractal/__init__.py +0 -0
  139. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/fractal/geometry.py +0 -0
  140. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/generation/video/noise.py +0 -0
  141. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/interfaces/__init__.py +0 -0
  142. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/interfaces/seedable.py +0 -0
  143. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/pix_map.py +0 -0
  144. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/read_image.py +0 -0
  145. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/read_svg.py +0 -0
  146. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/io/write_ffmpeg.py +0 -0
  147. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/__init__.py +0 -0
  148. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/dataaug/__init__.py +0 -0
  149. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/dataaug/image.py +0 -0
  150. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/loader.py +0 -0
  151. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/model/__init__.py +0 -0
  152. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/model/compression/__init__.py +0 -0
  153. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/nn/model/compression/img_cgavaenn.py +0 -0
  154. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/__init__.py +0 -0
  155. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/__init__.py +0 -0
  156. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/clean/__init__.py +0 -0
  157. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/clean/graph.py +0 -0
  158. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/hashes/__init__.py +0 -0
  159. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/hashes/graph.py +0 -0
  160. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cache/singleton.py +0 -0
  161. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/cuda/__init__.py +0 -0
  162. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/opti/graph.py +0 -0
  163. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/signal/__init__.py +0 -0
  164. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/signal/psd.py +0 -0
  165. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/core/signal/window.py +0 -0
  166. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/audio_5.1_narration.oga +0 -0
  167. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/intro.webm +0 -0
  168. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/logo.png +0 -0
  169. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/logo.svg +0 -0
  170. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/project.json +0 -0
  171. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/examples/video.mp4 +0 -0
  172. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/__init__.py +0 -0
  173. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/__main__.py +0 -0
  174. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/coding_style.py +0 -0
  175. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/install.py +0 -0
  176. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/run.py +0 -0
  177. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/abstract.py +0 -0
  178. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/audio_cast.py +0 -0
  179. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/audio_equation.py +0 -0
  180. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/c_memory.py +0 -0
  181. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/colorspace.py +0 -0
  182. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/compatibility.py +0 -0
  183. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/encoder.py +0 -0
  184. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/filter_cut.py +0 -0
  185. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/filter_delay.py +0 -0
  186. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/filter_empty.py +0 -0
  187. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/fir.py +0 -0
  188. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/initialisation.py +0 -0
  189. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/mandelbrot.py +0 -0
  190. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/muxer.py +0 -0
  191. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/nan_snapshot.py +0 -0
  192. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/pad.py +0 -0
  193. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/read.py +0 -0
  194. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/sympy_to_torch.py +0 -0
  195. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/thread_safe.py +0 -0
  196. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/video_equation.py +0 -0
  197. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec/testing/tests/write.py +0 -0
  198. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec.egg-info/dependency_links.txt +0 -0
  199. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/cutcutcodec.egg-info/entry_points.txt +0 -0
  200. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/docs/build/html/_static/check-solid.svg +0 -0
  201. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/docs/build/html/_static/copy-button.svg +0 -0
  202. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/docs/build/html/_static/css/fonts/fontawesome-webfont.svg +0 -0
  203. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/docs/build/html/_static/nbsphinx-broken-thumbnail.svg +0 -0
  204. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/docs/build/html/_static/nbsphinx-no-thumbnail.svg +0 -0
  205. {cutcutcodec-1.2.1 → cutcutcodec-1.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cutcutcodec
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: video editing software
5
5
  Author-email: "Robin RICHARD (robinechuca)" <serveurpython.oz@gmail.com>
6
6
  Maintainer-email: "Robin RICHARD (robinechuca)" <serveurpython.oz@gmail.com>
@@ -81,6 +81,9 @@ Provides-Extra: test
81
81
  Requires-Dist: pydocstyle<=6.1.1; extra == "test"
82
82
  Requires-Dist: pylama[all,toml]; extra == "test"
83
83
  Requires-Dist: pytest; extra == "test"
84
+ Provides-Extra: gui
85
+ Requires-Dist: jupyter; extra == "gui"
86
+ Requires-Dist: matplotlib; extra == "gui"
84
87
 
85
88
  .. rst syntax: https://deusyss.developpez.com/tutoriels/Python/SphinxDoc/
86
89
  .. version conv: https://peps.python.org/pep-0440/
@@ -175,3 +178,4 @@ Video
175
178
  #. Resize and crop (high quality, no aliasing).
176
179
  #. Overlaying video tracks (with transparency control).
177
180
  #. Apply an arbitrary equation one several video streams.
181
+ #. Fast C implementation of the ``psnr``, ``mse`` and ``ssim`` metrics.
@@ -91,3 +91,4 @@ Video
91
91
  #. Resize and crop (high quality, no aliasing).
92
92
  #. Overlaying video tracks (with transparency control).
93
93
  #. Apply an arbitrary equation one several video streams.
94
+ #. Fast C implementation of the ``psnr``, ``mse`` and ``ssim`` metrics.
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """The rules of compilation for setuptools."""
4
+
5
+ """
6
+ pyenv virtualenv-delete test
7
+ find . -name "*.so" | xargs rm
8
+ pyenv virtualenv 3.13 test
9
+ pyenv activate test
10
+ pip install .[doc]
11
+ python
12
+ from cutcutcodec.core.filter.video.metric import ssim
13
+ """
14
+
15
+ import os
16
+ import sys
17
+
18
+ from setuptools import Extension
19
+ from setuptools.command.build_py import build_py as _build_py
20
+
21
+ sys.path.insert(0, os.getcwd()) # it is required to find cutcutcodec
22
+ from cutcutcodec.utils import get_compilation_rules, get_project_root
23
+
24
+
25
+ class Build(_build_py):
26
+ """Builder to compile c files."""
27
+
28
+ def run(self):
29
+ self.run_command("build_ext")
30
+ return super().run()
31
+
32
+ def initialize_options(self):
33
+ super().initialize_options()
34
+ if self.distribution.ext_modules is None:
35
+ self.distribution.ext_modules = []
36
+ rules = get_compilation_rules()
37
+ root = get_project_root()
38
+ for file in (
39
+ file_root / basename
40
+ for file_root, _, files in root.walk()
41
+ for basename in files
42
+ if basename.endswith(".c")
43
+ ):
44
+ file = file.relative_to(root.parent)
45
+ self.distribution.ext_modules.append(
46
+ Extension(".".join(file.with_suffix("").parts), sources=[str(file)], **rules)
47
+ )
@@ -3,4 +3,4 @@
3
3
  """Video editing software."""
4
4
 
5
5
  __author__ = "Robin RICHARD (robinechuca)"
6
- __version__ = "1.2.1" # pep 440
6
+ __version__ = "1.2.2" # pep 440
@@ -538,6 +538,7 @@ def get_slices_metadata(
538
538
  for time_key in ("best_effort_timestamp", "pts", "pkt_pts", "dts", "pkt_dts"):
539
539
  if (time := data.get(time_key, "N/A")) != "N/A":
540
540
  if (time := float(int(time) * times_base[stream_index])) > progress_bar.n:
541
+ progress_bar.total = max(progress_bar.total, time)
541
542
  progress_bar.update(time - progress_bar.n)
542
543
  break
543
544
 
@@ -27,8 +27,8 @@ from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
27
27
  RATE_ESTIMATORS = {} # to each node stream class, associate the func to find the optimal rate
28
28
 
29
29
 
30
- def _add_estimator(node_cls: type) -> typing.Callable:
31
- def _add_func(func) -> typing.Callable:
30
+ def _add_estimator(node_cls: type) -> callable:
31
+ def _add_func(func) -> callable:
32
32
  RATE_ESTIMATORS[node_cls] = func
33
33
  return func
34
34
  return _add_func
@@ -14,8 +14,8 @@ from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
14
14
  FPS_ESTIMATORS = {} # to each node stream class, associate the func to find the optimal rate
15
15
 
16
16
 
17
- def _add_estimator(node_cls: type) -> typing.Callable:
18
- def _add_func(func) -> typing.Callable:
17
+ def _add_estimator(node_cls: type) -> callable:
18
+ def _add_func(func) -> callable:
19
19
  FPS_ESTIMATORS[node_cls] = func
20
20
  return func
21
21
  return _add_func
@@ -17,8 +17,8 @@ from cutcutcodec.core.io.read_svg import ContainerInputSVG
17
17
  SHAPE_ESTIMATORS = {} # to each node stream class, associate the func to find the optimal rate
18
18
 
19
19
 
20
- def _add_estimator(node_cls: type) -> typing.Callable:
21
- def _add_func(func) -> typing.Callable:
20
+ def _add_estimator(node_cls: type) -> callable:
21
+ def _add_func(func) -> callable:
22
22
  SHAPE_ESTIMATORS[node_cls] = func
23
23
  return func
24
24
  return _add_func
@@ -16,8 +16,8 @@ from cutcutcodec.core.filter.video.delay import FilterVideoDelay
16
16
  SLICE_ESTIMATORS = {} # to each node stream class, associate the func to find the time translation
17
17
 
18
18
 
19
- def _add_estimator(node_cls: type) -> typing.Callable:
20
- def _add_func(func) -> typing.Callable:
19
+ def _add_estimator(node_cls: type) -> callable:
20
+ def _add_func(func) -> callable:
21
21
  SLICE_ESTIMATORS[node_cls] = func
22
22
  return func
23
23
  return _add_func
@@ -49,6 +49,15 @@ class Node(abc.ABC):
49
49
  return False # not compare out_streams to avoide infinite loop
50
50
  return True
51
51
 
52
+ def __enter__(self) -> typing.Self:
53
+ """To allow context manager."""
54
+ return self
55
+
56
+ def __exit__(self, exc_type, exc_val, exc_tb):
57
+ """Exit the context manager."""
58
+ for stream in self.in_streams:
59
+ stream.node.__exit__(exc_type, exc_val, exc_tb)
60
+
52
61
  def __getstate__(self) -> tuple[typing.Iterable[Stream], dict]:
53
62
  """Allow ``pickle`` to serialize efficiently."""
54
63
  return self.in_streams, self.getstate()
@@ -59,10 +59,10 @@ def convert(
59
59
  assert isinstance(src, str), src.__class__.__name__
60
60
  assert isinstance(dst, str), dst.__class__.__name__
61
61
  if len(src_space := [p for p in SYMBS if src.lower().startswith(p)]) != 1:
62
- raise ValueError(f"failed to understand the src space {src}")
62
+ raise ValueError(f"failed to understand the src space {src}, {src_space}")
63
63
  src_space = src_space.pop()
64
64
  if len(dst_space := [p for p in SYMBS if dst.lower().startswith(p)]) != 1:
65
- raise ValueError(f"failed to understand the dst space {dst}")
65
+ raise ValueError(f"failed to understand the dst space {dst}, {dst_space}")
66
66
  dst_space = dst_space.pop()
67
67
  primaries_src = [p for p in PRIMARIES if p in src.lower()]
68
68
  primaries_src = primaries_src.pop() if primaries_src else None
@@ -575,16 +575,15 @@ class Compatibilities(metaclass=MetaSingleton):
575
575
  >>> from fractions import Fraction
576
576
  >>> from pprint import pprint
577
577
  >>> from cutcutcodec.core.compilation.export.compatibility import Compatibilities
578
- >>> pprint(
579
- ... Compatibilities().codecs_video(pix_fmt="yuv444p12le", rate=Fraction(120))
580
- ... ) # doctest: +ELLIPSIS
581
- {'dirac': [('vc2', 'avi'),
582
- ...
583
- ('vc2', 'wtv')],
578
+ >>> comp = Compatibilities().codecs_video(pix_fmt="yuv444p12le", rate=Fraction(120))
579
+ >>> pprint(comp["hevc"]) # doctest: +ELLIPSIS
580
+ [('libx265', 'flv'),
584
581
  ...
585
- 'vp9': [('libvpx-vp9', 'avi'),
586
- ...
587
- ('libvpx-vp9', 'webm')]}
582
+ ('libx265', 'vob')]
583
+ >>> pprint(comp["libdav1d"]) # doctest: +ELLIPSIS
584
+ [('libaom-av1', 'avi'),
585
+ ...
586
+ ('librav1e', 'webm')]
588
587
  >>>
589
588
  """
590
589
  encoders = sorted(AllEncoders().video) # sorted, not list because dict is sorted
@@ -42,7 +42,7 @@ def available_audio_rates(encoders: typing.Iterable[str]) -> typing.Union[None,
42
42
  [8000, 12000, 16000, 24000, 48000]
43
43
  >>>
44
44
  """
45
- assert hasattr(encoders, "__iter__"), encoders.__class__.__name__
45
+ assert isinstance(encoders, typing.Iterable), encoders.__class__.__name__
46
46
  common_rates = set()
47
47
  for encoder in encoders:
48
48
  if (rates := Encoder(encoder).audio_rates) is None:
@@ -84,7 +84,7 @@ def suggest_audio_rate(
84
84
  """
85
85
  assert isinstance(stream, StreamAudio), stream.__class__.__name__
86
86
  if choices is not None:
87
- assert hasattr(choices, "__iter__"), choices.__class__.__name__
87
+ assert isinstance(choices, typing.Iterable), choices.__class__.__name__
88
88
  choices = set(choices)
89
89
  assert all(isinstance(r, int) for r in choices), choices
90
90
  assert all(r > 0 for r in choices), choices
@@ -33,7 +33,7 @@ from cutcutcodec.utils import get_compilation_rules
33
33
 
34
34
 
35
35
  def _cast_lambdify_c(
36
- func: typing.Callable, input_args: dict[str, typing.Union[numbers.Real, torch.Tensor]]
36
+ func: callable, input_args: dict[str, typing.Union[numbers.Real, torch.Tensor]]
37
37
  ) -> typing.Union[torch.Tensor, tuple[torch.Tensor]]:
38
38
  """Cast the tensors into flat c continuous numpy array and cast back before return.
39
39
 
@@ -123,7 +123,7 @@ def _cast_lambdify_c(
123
123
  return torch.from_numpy(out).reshape(shape)
124
124
 
125
125
 
126
- def _lambdify_c(code: str) -> typing.Callable:
126
+ def _lambdify_c(code: str) -> callable:
127
127
  """Compile the C source code and import the func.
128
128
 
129
129
  Parameters
@@ -172,7 +172,7 @@ class _StreamAudioEquation(StreamAudio):
172
172
  super().__init__(node)
173
173
  self._signals_func = None # cache
174
174
 
175
- def _get_signals_func(self) -> typing.Callable:
175
+ def _get_signals_func(self) -> callable:
176
176
  """Allow to "compile" equations at the last moment."""
177
177
  if self._signals_func is None:
178
178
  free_symbs = Tuple(*self.node.signals).free_symbols
@@ -159,7 +159,7 @@ class _StreamVideoEquation(StreamVideo):
159
159
  self._fields = None # cache
160
160
  self._fileds_mask = None
161
161
 
162
- def _get_colors_func(self) -> typing.Callable:
162
+ def _get_colors_func(self) -> callable:
163
163
  """Allow to "compile" equations at the last moment."""
164
164
  if self._colors_func is None:
165
165
  free_symbs = Tuple(*self.node.colors).free_symbols
@@ -33,7 +33,7 @@ def _resize(image: np.ndarray, shape: tuple[int, int], copy: bool) -> np.ndarray
33
33
  image = cv2.resize( # 10 times faster than torchvision.transforms.v2.functional.resize
34
34
  image,
35
35
  dsize=(width, height),
36
- interpolation=(cv2.INTER_CUBIC if enlarge else cv2.INTER_AREA), # for antialiasing
36
+ interpolation=(cv2.INTER_LANCZOS4 if enlarge else cv2.INTER_AREA), # for antialiasing
37
37
  )
38
38
  if enlarge and np.issubdtype(image.dtype, np.floating):
39
39
  image = np.clip(image, 0.0, 1.0, out=image)
@@ -224,12 +224,12 @@ class FilterVideoResize(Filter):
224
224
  >>> (stream_out,) = FilterVideoResize([stream_in], (4, 6), keep_ratio=True).out_streams
225
225
  >>> stream_out.snapshot(0, (8, 9)).convert(1)[..., 0]
226
226
  tensor([[0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000],
227
- [0.5824, 0.4850, 0.4080, 0.4435, 0.4082, 0.3316, 0.1949, 0.1162, 0.1010],
228
- [0.5159, 0.6177, 0.6451, 0.4976, 0.4357, 0.4693, 0.5354, 0.4819, 0.4018],
229
- [0.5097, 0.6685, 0.7636, 0.6089, 0.5496, 0.6249, 0.7717, 0.7542, 0.6719],
230
- [0.5771, 0.4820, 0.4956, 0.7424, 0.7381, 0.5821, 0.4989, 0.4615, 0.4656],
231
- [0.6798, 0.3974, 0.1954, 0.4461, 0.6377, 0.5819, 0.2722, 0.4009, 0.6595],
232
- [0.7855, 0.3979, 0.0538, 0.1131, 0.4572, 0.5968, 0.1714, 0.4655, 0.9226],
227
+ [0.5866, 0.4670, 0.3995, 0.4464, 0.4259, 0.3350, 0.1897, 0.1025, 0.1142],
228
+ [0.5095, 0.6204, 0.6410, 0.4723, 0.3990, 0.4812, 0.5390, 0.4913, 0.4245],
229
+ [0.4987, 0.6738, 0.7806, 0.6340, 0.5265, 0.6353, 0.7835, 0.7586, 0.6572],
230
+ [0.5877, 0.4707, 0.5004, 0.7429, 0.7577, 0.5788, 0.4987, 0.4818, 0.4790],
231
+ [0.6685, 0.3844, 0.1571, 0.4173, 0.7007, 0.5451, 0.2300, 0.3524, 0.6429],
232
+ [0.7850, 0.4343, 0.0535, 0.0743, 0.5272, 0.5781, 0.1937, 0.4503, 0.9598],
233
233
  [0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000]])
234
234
  >>> stream_out.snapshot(0, (4, 3)).convert(1)[..., 0]
235
235
  tensor([[0.0000, 0.0000, 0.0000],
@@ -247,26 +247,26 @@ class FilterVideoResize(Filter):
247
247
  >>> # deformation
248
248
  >>> (stream_out,) = FilterVideoResize([stream_in], (4, 6), keep_ratio=False).out_streams
249
249
  >>> stream_out.snapshot(0, (8, 9))[..., 0]
250
- tensor([[0.5249, 0.2219, 0.1432, 0.6494, 0.9650, 0.8563, 0.4235, 0.5095, 0.7819],
251
- [0.5466, 0.3829, 0.3196, 0.5422, 0.8268, 0.8783, 0.5912, 0.5052, 0.5478],
252
- [0.5869, 0.6509, 0.6105, 0.3653, 0.5991, 0.9156, 0.8694, 0.4953, 0.1543],
253
- [0.4496, 0.7269, 0.7851, 0.2679, 0.4595, 0.9105, 0.9867, 0.5825, 0.1567],
254
- [0.1976, 0.5635, 0.7489, 0.3050, 0.4868, 0.8683, 0.8806, 0.7199, 0.5543],
255
- [0.3183, 0.5522, 0.6515, 0.3231, 0.4995, 0.8010, 0.7522, 0.7571, 0.7768],
256
- [0.7429, 0.6901, 0.5374, 0.3183, 0.4986, 0.7456, 0.6644, 0.6728, 0.7112],
257
- [0.9979, 0.7723, 0.4679, 0.3156, 0.4980, 0.7114, 0.6099, 0.6234, 0.6762]])
250
+ tensor([[0.5186, 0.2040, 0.1217, 0.6263, 1.0000, 0.8228, 0.4027, 0.5082, 0.8317],
251
+ [0.5837, 0.4015, 0.2937, 0.5282, 0.8607, 0.8669, 0.5844, 0.4760, 0.5484],
252
+ [0.6039, 0.6970, 0.5962, 0.3657, 0.5604, 0.9367, 0.8844, 0.4597, 0.1515],
253
+ [0.4040, 0.7688, 0.7883, 0.2821, 0.3852, 0.9566, 1.0000, 0.5497, 0.1524],
254
+ [0.1668, 0.6130, 0.7582, 0.3105, 0.4186, 0.9009, 0.9197, 0.6914, 0.5459],
255
+ [0.2929, 0.5605, 0.6228, 0.3390, 0.4971, 0.8122, 0.7501, 0.7327, 0.8138],
256
+ [0.7253, 0.6989, 0.5109, 0.3182, 0.5178, 0.7448, 0.6579, 0.6546, 0.7545],
257
+ [1.0000, 0.8142, 0.4661, 0.2942, 0.5099, 0.7171, 0.6343, 0.5901, 0.6479]])
258
258
  >>> stream_out.snapshot(0, (4, 3))[..., 0]
259
- tensor([[0.2707, 0.9211, 0.5108],
260
- [0.7336, 0.5043, 0.5231],
261
- [0.5234, 0.5003, 0.7601],
262
- [0.7485, 0.4983, 0.6364]])
259
+ tensor([[0.2721, 0.9769, 0.4960],
260
+ [0.7737, 0.4440, 0.4901],
261
+ [0.5577, 0.4625, 0.7313],
262
+ [0.7737, 0.5130, 0.6131]])
263
263
  >>> stream_out.snapshot(0, (6, 5))[..., 0]
264
- tensor([[0.4540, 0.2289, 0.9573, 0.5031, 0.7061],
265
- [0.5602, 0.4533, 0.7130, 0.7831, 0.3862],
266
- [0.5510, 0.6799, 0.4676, 1.0000, 0.2411],
267
- [0.2747, 0.6644, 0.4939, 0.8722, 0.6517],
268
- [0.5425, 0.5388, 0.4989, 0.7224, 0.7488],
269
- [0.9176, 0.4212, 0.4981, 0.6359, 0.6641]])
264
+ tensor([[0.4298, 0.1972, 1.0000, 0.4729, 0.7146],
265
+ [0.6007, 0.4248, 0.7106, 0.7914, 0.3603],
266
+ [0.5545, 0.6820, 0.3978, 1.0000, 0.2288],
267
+ [0.2864, 0.6698, 0.4334, 0.9205, 0.6380],
268
+ [0.5371, 0.5082, 0.5150, 0.7171, 0.7786],
269
+ [0.9398, 0.4087, 0.5103, 0.6623, 0.6369]])
270
270
  >>>
271
271
  """
272
272
 
@@ -1,18 +1,11 @@
1
1
  /* Fast generation of fractal. */
2
2
 
3
3
  #define PY_SSIZE_T_CLEAN
4
- // for detection and management of nestead threads
5
- #include <unistd.h>
6
- #include <sys/syscall.h>
7
- #ifndef SYS_gettid
8
- #error 'SYS_gettid unavailable on this system'
9
- #endif
10
- #define gettid() ((pid_t)syscall(SYS_gettid))
11
- // classical imports
12
4
  #include <numpy/arrayobject.h>
13
5
  #include <omp.h>
14
6
  #include <complex.h>
15
7
  #include <Python.h>
8
+ #include "cutcutcodec/core/opti/parallel/threading.h"
16
9
 
17
10
 
18
11
  float compute_mandelbrot_longdouble(
@@ -212,7 +205,7 @@ void mandelbrot_double(float* iters, double* cst_reals, double* cst_imags, const
212
205
  }
213
206
 
214
207
 
215
- static PyObject* py_mandelbrot(PyObject* self, PyObject* args, PyObject* kwargs) {
208
+ static PyObject* py_mandelbrot(PyObject* Py_UNUSED(self), PyObject* args, PyObject* kwargs) {
216
209
  // declaration
217
210
  static char *kwlist[] = {"cpx_plan", "iterations", "inper2", "threads", "out", NULL};
218
211
  PyArrayObject *cpx_plan, *fractal = NULL;
@@ -220,7 +213,6 @@ static PyObject* py_mandelbrot(PyObject* self, PyObject* args, PyObject* kwargs)
220
213
  int inper2 = 1;
221
214
  npy_intp shape[2];
222
215
 
223
-
224
216
  // parse and check
225
217
  if ( !PyArg_ParseTupleAndKeywords(
226
218
  args, kwargs, "O!|l$plO!", kwlist,
@@ -239,17 +231,7 @@ static PyObject* py_mandelbrot(PyObject* self, PyObject* args, PyObject* kwargs)
239
231
  }
240
232
 
241
233
  // set omp nbr threads
242
- if ( threads == 0 ) {
243
- if ( gettid() == getpid() ) {
244
- omp_set_num_threads(omp_get_num_procs());
245
- } else {
246
- omp_set_num_threads(1);
247
- }
248
- } else if ( threads < 0 ) {
249
- omp_set_num_threads(omp_get_num_procs());
250
- } else {
251
- omp_set_num_threads(threads);
252
- }
234
+ set_num_threads(threads);
253
235
 
254
236
  // alloc fractal
255
237
  if ( fractal == NULL ) {
@@ -299,61 +281,61 @@ static PyObject* py_mandelbrot(PyObject* self, PyObject* args, PyObject* kwargs)
299
281
 
300
282
  static PyMethodDef fractalMethods[] = {
301
283
  {
302
- "mandelbrot", (PyCFunction)py_mandelbrot, METH_VARARGS | METH_KEYWORDS,
303
- R"(Compute a mandelbrot grayscale image in C language.
304
-
305
- For each pixel, given by a complex point :math:`c`, compute :math:`n` iterations of the suite:
306
-
307
- .. math::
308
-
309
- \begin{cases}
310
- z_0 = 0 \\
311
- z_{n+1} = z_n^2 + c \\
312
- \end{cases}
313
-
314
- Parameters
315
- ----------
316
- cpx_plan : np.ndarray
317
- The 2d complex plane that associates the constant :math:`c` to each pixel.
318
- If the real part is ``nan``, The corresponding pixel will not be initialized.
319
- This array doesn't has to be c contiguous.
320
- iterations : int, default=256
321
- The maximum number of iterations before declaring that the sequence does not diverge.
322
- It must be >= 1 and <= 2147483647.
323
- inper2 : boolean, default=True
324
- If True (default), performs a test for each pixel to determine whether
325
- the pixel in question is in the cardioid or in the main disk.
326
- If False, calculates the sequence directly without prior testing.
327
- threads : int, optional
328
- Defines the number of threads.
329
- The value -1 means that the function uses as many calculation threads as there are cores.
330
- The default value (0) allows the same behavior as (-1) if the function
331
- is called in the main thread, otherwise (1) to avoid nested threads.
332
- Any other positive value corresponds to the number of threads used.
333
- out : np.ndarray[np.float32], optional
334
- If provided, set the result in this array and return it.
335
- This array doesn't has to be c contiguous.
336
-
337
- Returns
338
- -------
339
- fractal : np.ndarray[np.float32]
340
- The convergence speed of the suite in [0, 1].
341
- 1 means it converges and 0 it diverges.
342
- The shape is the same as ``cpx_plan``.
343
-
344
- Examples
345
- --------
346
- >>> import numpy as np
347
- >>> from cutcutcodec.core.generation.video.fractal.fractal import mandelbrot
348
- >>> y, x = np.meshgrid(
349
- ... np.linspace(1, -1, 2000, dtype=np.float128), # imaginary part, -y axis
350
- ... np.linspace(-2, 1, 3000, dtype=np.float128), # real part, x axis
351
- ... indexing="ij",
352
- ... )
353
- >>> cpx_plan = x + 1j*y
354
- >>> fractal = mandelbrot(cpx_plan)
355
- >>>
356
- )"
284
+ "mandelbrot", (PyCFunction)py_mandelbrot, METH_VARARGS | METH_KEYWORDS,
285
+ R"(Compute a mandelbrot grayscale image in C language.
286
+
287
+ For each pixel, given by a complex point :math:`c`, compute :math:`n` iterations of the suite:
288
+
289
+ .. math::
290
+
291
+ \begin{cases}
292
+ z_0 = 0 \\
293
+ z_{n+1} = z_n^2 + c \\
294
+ \end{cases}
295
+
296
+ Parameters
297
+ ----------
298
+ cpx_plan : np.ndarray
299
+ The 2d complex plane that associates the constant :math:`c` to each pixel.
300
+ If the real part is ``nan``, The corresponding pixel will not be initialized.
301
+ This array doesn't has to be c contiguous.
302
+ iterations : int, default=256
303
+ The maximum number of iterations before declaring that the sequence does not diverge.
304
+ It must be >= 1 and <= 2147483647.
305
+ inper2 : boolean, default=True
306
+ If True (default), performs a test for each pixel to determine whether
307
+ the pixel in question is in the cardioid or in the main disk.
308
+ If False, calculates the sequence directly without prior testing.
309
+ threads : int, optional
310
+ Defines the number of threads.
311
+ The value -1 means that the function uses as many calculation threads as there are cores.
312
+ The default value (0) allows the same behavior as (-1) if the function
313
+ is called in the main thread, otherwise (1) to avoid nested threads.
314
+ Any other positive value corresponds to the number of threads used.
315
+ out : np.ndarray[np.float32], optional
316
+ If provided, set the result in this array and return it.
317
+ This array doesn't has to be c contiguous.
318
+
319
+ Returns
320
+ -------
321
+ fractal : np.ndarray[np.float32]
322
+ The convergence speed of the suite in [0, 1].
323
+ 1 means it converges and 0 it diverges.
324
+ The shape is the same as ``cpx_plan``.
325
+
326
+ Examples
327
+ --------
328
+ >>> import numpy as np
329
+ >>> from cutcutcodec.core.generation.video.fractal.fractal import mandelbrot
330
+ >>> y, x = np.meshgrid(
331
+ ... np.linspace(1, -1, 2000, dtype=np.float128), # imaginary part, -y axis
332
+ ... np.linspace(-2, 1, 3000, dtype=np.float128), # real part, x axis
333
+ ... indexing="ij",
334
+ ... )
335
+ >>> cpx_plan = x + 1j*y
336
+ >>> fractal = mandelbrot(cpx_plan)
337
+ >>>
338
+ )"
357
339
  },
358
340
  {NULL, NULL, 0, NULL}
359
341
  };
@@ -123,7 +123,7 @@ class _StreamVideoMandelbrot(StreamVideo):
123
123
  super().__init__(node)
124
124
  self._bounds_func = None # cache
125
125
 
126
- def _get_func(self) -> typing.Callable:
126
+ def _get_func(self) -> callable:
127
127
  """Allow to "compile" bounds and iterations equations at the last moment."""
128
128
  if self._bounds_func is None:
129
129
  self._bounds_func = Lambdify(
@@ -8,37 +8,14 @@ import typing
8
8
 
9
9
  from cutcutcodec.core.exceptions import DecodeError
10
10
  from cutcutcodec.core.classes.node import Node
11
+ from .cst import AUDIO_SUFFIXES, VIDEO_SUFFIXES, IMAGE_SUFFIXES
11
12
  from .read_ffmpeg_color import ContainerInputFFMPEGColor
12
13
  from .read_image import ContainerInputImage
13
14
  from .read_svg import ContainerInputSVG
14
15
  from .write_ffmpeg import ContainerOutputFFMPEG
15
16
 
16
17
 
17
- IMAGE_SUFFIXES = {
18
- ".avif",
19
- ".bmp", ".dib",
20
- ".exr",
21
- ".hdr", ".pic",
22
- ".heic",
23
- ".jp2", ".jpg2", ".jpeg2000", ".jpg2000",
24
- ".jpeg", ".jpg", ".jpe",
25
- ".kra",
26
- ".pbm", ".pgm", ".ppm", ".pxm", ".pnm",
27
- ".pfm",
28
- ".png",
29
- ".psd",
30
- ".sgi",
31
- ".sr", ".ras",
32
- ".tif", ".tiff",
33
- ".webp",
34
- ".xbm",
35
- }
36
- VIDEO_SUFFIXES = {
37
- ".avi", ".gif", ".m2ts", ".mkv", ".mp4", ".ogv", ".vob", ".webm"
38
- }
39
-
40
-
41
- __all__ = ["read", "IMAGE_SUFFIXES", "VIDEO_SUFFIXES"]
18
+ __all__ = ["read", "write", "AUDIO_SUFFIXES", "IMAGE_SUFFIXES", "VIDEO_SUFFIXES"]
42
19
 
43
20
 
44
21
  def read(filename: typing.Union[str, bytes, pathlib.Path], **kwargs) -> Node:
@@ -66,7 +43,7 @@ def read(filename: typing.Union[str, bytes, pathlib.Path], **kwargs) -> Node:
66
43
  extension = pathlib.Path(filename).suffix.lower()
67
44
 
68
45
  # simple case where extension is knowned
69
- if extension in VIDEO_SUFFIXES:
46
+ if extension in VIDEO_SUFFIXES | AUDIO_SUFFIXES:
70
47
  return ContainerInputFFMPEGColor(filename, **kwargs)
71
48
  if extension in IMAGE_SUFFIXES:
72
49
  return ContainerInputImage(filename, **kwargs)
@@ -74,14 +51,14 @@ def read(filename: typing.Union[str, bytes, pathlib.Path], **kwargs) -> Node:
74
51
  return ContainerInputSVG(filename, **kwargs)
75
52
 
76
53
  # case we have to try
77
- logging.warning("unknowned extension %s, try several readers", extension)
54
+ logging.warning("unknown extension %s, try several readers", extension)
78
55
  try:
79
56
  return ContainerInputSVG(filename, **kwargs)
80
57
  except DecodeError:
81
58
  try:
82
- return ContainerInputImage(filename, **kwargs)
83
- except DecodeError:
84
59
  return ContainerInputFFMPEGColor(filename, **kwargs)
60
+ except DecodeError:
61
+ return ContainerInputImage(filename, **kwargs)
85
62
 
86
63
 
87
64
  def write(*args, **kwargs):