trainingsample 0.2.9__tar.gz → 0.2.11__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 (41) hide show
  1. {trainingsample-0.2.9 → trainingsample-0.2.11}/.github/workflows/publish.yml +6 -8
  2. {trainingsample-0.2.9 → trainingsample-0.2.11}/Cargo.lock +1 -1
  3. {trainingsample-0.2.9 → trainingsample-0.2.11}/Cargo.toml +1 -1
  4. {trainingsample-0.2.9 → trainingsample-0.2.11}/PKG-INFO +1 -1
  5. {trainingsample-0.2.9 → trainingsample-0.2.11}/pyproject.toml +1 -1
  6. {trainingsample-0.2.9 → trainingsample-0.2.11}/scripts/build-opencv-static.sh +130 -3
  7. {trainingsample-0.2.9 → trainingsample-0.2.11}/.cargo/config.toml +0 -0
  8. {trainingsample-0.2.9 → trainingsample-0.2.11}/.envrc +0 -0
  9. {trainingsample-0.2.9 → trainingsample-0.2.11}/.github/workflows/ci.yml +0 -0
  10. {trainingsample-0.2.9 → trainingsample-0.2.11}/.gitignore +0 -0
  11. {trainingsample-0.2.9 → trainingsample-0.2.11}/.pre-commit-config.yaml +0 -0
  12. {trainingsample-0.2.9 → trainingsample-0.2.11}/.rustfmt.toml +0 -0
  13. {trainingsample-0.2.9 → trainingsample-0.2.11}/BENCHMARKS.md +0 -0
  14. {trainingsample-0.2.9 → trainingsample-0.2.11}/Dockerfile +0 -0
  15. {trainingsample-0.2.9 → trainingsample-0.2.11}/LICENSE +0 -0
  16. {trainingsample-0.2.9 → trainingsample-0.2.11}/README.md +0 -0
  17. {trainingsample-0.2.9 → trainingsample-0.2.11}/clippy.toml +0 -0
  18. {trainingsample-0.2.9 → trainingsample-0.2.11}/docs/API_COMPAT_CV2.md +0 -0
  19. {trainingsample-0.2.9 → trainingsample-0.2.11}/docs/BUILDING_STATIC_OPENCV.md +0 -0
  20. {trainingsample-0.2.9 → trainingsample-0.2.11}/rust-toolchain.toml +0 -0
  21. {trainingsample-0.2.9 → trainingsample-0.2.11}/scripts/run_competitive_benchmarks.sh +0 -0
  22. {trainingsample-0.2.9 → trainingsample-0.2.11}/setup-env.sh +0 -0
  23. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/core.rs +0 -0
  24. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/cropping.rs +0 -0
  25. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/cv_batch_ops.rs +0 -0
  26. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/cv_batch_ops_optimized.rs +0 -0
  27. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/cv_compat.rs +0 -0
  28. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/format_conversion_simd.rs +0 -0
  29. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/lib.rs +0 -0
  30. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/loading.rs +0 -0
  31. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/luminance.rs +0 -0
  32. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/luminance_simd.rs +0 -0
  33. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/opencv_ops.rs +0 -0
  34. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/python_bindings.rs +0 -0
  35. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/tests.rs +0 -0
  36. {trainingsample-0.2.9 → trainingsample-0.2.11}/src/true_batch_ops.rs +0 -0
  37. {trainingsample-0.2.9 → trainingsample-0.2.11}/tests/__init__.py +0 -0
  38. {trainingsample-0.2.9 → trainingsample-0.2.11}/tests/comprehensive_tests.rs +0 -0
  39. {trainingsample-0.2.9 → trainingsample-0.2.11}/tests/test_comprehensive.py +0 -0
  40. {trainingsample-0.2.9 → trainingsample-0.2.11}/tests/test_performance_benchmarks.py +0 -0
  41. {trainingsample-0.2.9 → trainingsample-0.2.11}/tests/test_python_bindings.py +0 -0
@@ -41,7 +41,7 @@ jobs:
41
41
  uses: actions/cache@v4
42
42
  with:
43
43
  path: third_party/opencv-static
44
- key: opencv-static-4.12.0-codecs-no-itt-no-openjpeg-linux-${{ matrix.os }}-${{ runner.arch }}-${{ matrix.manylinux }}
44
+ key: opencv-static-4.12.0-codecs-jasper-ffmpeg-no-itt-no-openjpeg-linux-${{ matrix.os }}-${{ runner.arch }}-${{ matrix.manylinux }}
45
45
 
46
46
  - name: Install build dependencies
47
47
  run: |
@@ -51,7 +51,7 @@ jobs:
51
51
 
52
52
  sudo apt-get update
53
53
  # Install basic LLVM for opencv-rust bindings codegen
54
- sudo apt-get install -y clang libclang-dev llvm-dev cmake curl wget software-properties-common
54
+ sudo apt-get install -y clang libclang-dev llvm-dev cmake curl wget software-properties-common nasm yasm pkg-config
55
55
 
56
56
  # For Ubuntu 22.04, use the default LLVM 14 instead of PPA to avoid restart issues
57
57
  if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
@@ -84,7 +84,6 @@ jobs:
84
84
  echo "LLVM config at: $(which llvm-config-14 2>/dev/null || which llvm-config-18 2>/dev/null)"
85
85
 
86
86
  - name: Build static OpenCV
87
- if: steps.cache-opencv.outputs.cache-hit != 'true'
88
87
  run: |
89
88
  ./scripts/build-opencv-static.sh
90
89
 
@@ -105,7 +104,7 @@ jobs:
105
104
  # OpenCV static linking configuration
106
105
  OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
107
106
  OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
108
- OPENCV_LINK_LIBS: static=opencv_world,static=jpeg,static=png,static=tiff,static=webp,static=z,static=stdc++
107
+ OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=z,static=jasper,static=stdc++
109
108
  OPENCV_DISABLE_PROBES: pkg_config,cmake,vcpkg,vcpkg_cmake
110
109
 
111
110
  - name: Upload wheels
@@ -131,19 +130,18 @@ jobs:
131
130
  uses: actions/cache@v4
132
131
  with:
133
132
  path: third_party/opencv-static
134
- key: opencv-static-4.12.0-codecs-no-itt-no-openjpeg-macos-${{ runner.os }}-${{ runner.arch }}
133
+ key: opencv-static-4.12.0-codecs-jasper-ffmpeg-no-itt-no-openjpeg-macos-${{ runner.os }}-${{ runner.arch }}
135
134
 
136
135
  - name: Install build dependencies
137
136
  run: |
138
137
  # Install LLVM for opencv-rust bindings codegen (no need for system OpenCV anymore)
139
- brew install llvm cmake
138
+ brew install llvm cmake nasm pkg-config
140
139
  # Set up LLVM environment for opencv-rust bindings (keg-only installation)
141
140
  echo "LIBCLANG_PATH=/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV
142
141
  echo "LLVM_CONFIG_PATH=/opt/homebrew/opt/llvm/bin/llvm-config" >> $GITHUB_ENV
143
142
  echo "DYLD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
144
143
 
145
144
  - name: Build static OpenCV
146
- if: steps.cache-opencv.outputs.cache-hit != 'true'
147
145
  run: |
148
146
  ./scripts/build-opencv-static.sh
149
147
 
@@ -159,7 +157,7 @@ jobs:
159
157
  # OpenCV static linking configuration
160
158
  OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
161
159
  OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
162
- OPENCV_LINK_LIBS: static=opencv_world,static=jpeg,static=png,static=tiff,static=webp,static=z,framework=Accelerate,dylib=c++
160
+ OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=z,static=jasper,framework=Accelerate,dylib=c++
163
161
  OPENCV_DISABLE_PROBES: pkg_config,cmake,vcpkg,vcpkg_cmake
164
162
  - name: Upload wheels
165
163
  uses: actions/upload-artifact@v4
@@ -1746,7 +1746,7 @@ dependencies = [
1746
1746
 
1747
1747
  [[package]]
1748
1748
  name = "trainingsample"
1749
- version = "0.2.9"
1749
+ version = "0.2.11"
1750
1750
  dependencies = [
1751
1751
  "anyhow",
1752
1752
  "criterion",
@@ -38,7 +38,7 @@ description = "High-performance Rust reimplementation of GIL-blocking video/imag
38
38
  edition = "2021"
39
39
  license = "MIT"
40
40
  name = "trainingsample"
41
- version = "0.2.9"
41
+ version = "0.2.11"
42
42
  readme = "README.md"
43
43
 
44
44
  [profile.release]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trainingsample
3
- Version: 0.2.9
3
+ Version: 0.2.11
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -14,7 +14,7 @@ description = "High-performance Rust reimplementation of GIL-blocking video/imag
14
14
  license = {text = "MIT"}
15
15
  name = "trainingsample"
16
16
  requires-python = ">=3.11"
17
- version = "0.2.9"
17
+ version = "0.2.11"
18
18
 
19
19
  [project.optional-dependencies]
20
20
  dev = ["pytest>=6.0", "pytest-benchmark", "maturin>=1.0,<2.0", "pre-commit"]
@@ -5,12 +5,18 @@ set -euo pipefail
5
5
  # This eliminates the need for users to install OpenCV system packages
6
6
 
7
7
  OPENCV_VERSION="4.12.0"
8
+ FFMPEG_VERSION="6.1.1"
8
9
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
10
  PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
10
11
  BUILD_DIR="${PROJECT_ROOT}/opencv-build-tmp"
11
12
  INSTALL_DIR="${PROJECT_ROOT}/third_party/opencv-static"
12
13
  SIGNATURE_FILE="${INSTALL_DIR}/build_signature.txt"
13
- BUILD_SIGNATURE="opencv-${OPENCV_VERSION}-static-codecs-no-itt-no-openjpeg"
14
+ BUILD_SIGNATURE="opencv-${OPENCV_VERSION}-static-codecs-jasper-ffmpeg-no-itt-no-openjpeg"
15
+
16
+ FFMPEG_BUILD_DIR="${PROJECT_ROOT}/ffmpeg-build-tmp"
17
+ FFMPEG_INSTALL_DIR="${PROJECT_ROOT}/third_party/ffmpeg-static"
18
+ FFMPEG_SIGNATURE_FILE="${FFMPEG_INSTALL_DIR}/build_signature.txt"
19
+ FFMPEG_BUILD_SIGNATURE="ffmpeg-${FFMPEG_VERSION}-static-core"
14
20
 
15
21
  echo "Building static OpenCV ${OPENCV_VERSION}..."
16
22
  echo "Install directory: ${INSTALL_DIR}"
@@ -26,7 +32,96 @@ if [ -d "${INSTALL_DIR}/lib" ] && [ -f "${INSTALL_DIR}/lib/libopencv_world.a" ]
26
32
  rm -rf "${INSTALL_DIR}"
27
33
  fi
28
34
 
29
- # Create build directory
35
+ # Build FFmpeg static libraries (minimal feature set for decoding common formats)
36
+ build_ffmpeg() {
37
+ echo "Ensuring static FFmpeg ${FFMPEG_VERSION} is available..."
38
+ if [ -d "${FFMPEG_INSTALL_DIR}/lib" ] && [ -f "${FFMPEG_INSTALL_DIR}/lib/libavformat.a" ] && [ -f "${FFMPEG_SIGNATURE_FILE}" ]; then
39
+ if grep -qx "${FFMPEG_BUILD_SIGNATURE}" "${FFMPEG_SIGNATURE_FILE}"; then
40
+ echo "Static FFmpeg already built at ${FFMPEG_INSTALL_DIR} (signature match)"
41
+ return
42
+ fi
43
+
44
+ echo "Existing FFmpeg bundle does not match desired configuration. Rebuilding..."
45
+ rm -rf "${FFMPEG_INSTALL_DIR}"
46
+ fi
47
+
48
+ mkdir -p "${FFMPEG_BUILD_DIR}"
49
+ cd "${FFMPEG_BUILD_DIR}"
50
+
51
+ if [ ! -d "ffmpeg-${FFMPEG_VERSION}" ]; then
52
+ echo "Downloading FFmpeg ${FFMPEG_VERSION}..."
53
+ curl -L "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" \
54
+ -o "ffmpeg-${FFMPEG_VERSION}.tar.bz2"
55
+ tar -xjf "ffmpeg-${FFMPEG_VERSION}.tar.bz2"
56
+ fi
57
+
58
+ cd "ffmpeg-${FFMPEG_VERSION}"
59
+
60
+ echo "Configuring FFmpeg build..."
61
+ PKG_CONFIG_PATH="${FFMPEG_INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
62
+ export PKG_CONFIG_PATH
63
+
64
+ ./configure \
65
+ --prefix="${FFMPEG_INSTALL_DIR}" \
66
+ --pkg-config-flags="--static" \
67
+ --extra-cflags="-fPIC" \
68
+ --extra-cxxflags="-fPIC" \
69
+ --extra-ldflags="-fPIC" \
70
+ --enable-static \
71
+ --disable-shared \
72
+ --disable-doc \
73
+ --disable-debug \
74
+ --disable-autodetect \
75
+ --disable-hwaccels \
76
+ --disable-vulkan \
77
+ --disable-cuvid \
78
+ --disable-nvenc \
79
+ --disable-nvdec \
80
+ --disable-vaapi \
81
+ --disable-vdpau \
82
+ --disable-d3d11va \
83
+ --disable-dxva2 \
84
+ --disable-alsa \
85
+ --disable-sdl2 \
86
+ --disable-libxcb \
87
+ --disable-iconv \
88
+ --disable-libdrm \
89
+ --disable-network \
90
+ --disable-avdevice \
91
+ --disable-postproc \
92
+ --disable-programs \
93
+ --enable-swscale \
94
+ --enable-swresample \
95
+ --enable-avcodec \
96
+ --enable-avformat \
97
+ --enable-avutil \
98
+ --enable-decoder=h264,hevc,mpeg4,vp8,vp9 \
99
+ --enable-parser=h264,hevc,mpeg4video,vp8,vp9 \
100
+ --enable-demuxer=mov,matroska,ogg,webm,image2 \
101
+ --enable-muxer=null \
102
+ --enable-protocol=file,data,pipe \
103
+ --enable-bsf=h264_mp4toannexb \
104
+ --enable-filter=scale || {
105
+ echo "FFmpeg configure failed"
106
+ exit 1
107
+ }
108
+
109
+ echo "Building FFmpeg..."
110
+ make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
111
+ echo "Installing FFmpeg..."
112
+ make install
113
+
114
+ printf '%s\n' "${FFMPEG_BUILD_SIGNATURE}" > "${FFMPEG_SIGNATURE_FILE}"
115
+
116
+ cd "${PROJECT_ROOT}"
117
+ rm -rf "${FFMPEG_BUILD_DIR}"
118
+ echo "FFmpeg build complete!"
119
+ }
120
+
121
+ # Ensure FFmpeg is present before building OpenCV
122
+ build_ffmpeg
123
+
124
+ # Create build directory for OpenCV
30
125
  mkdir -p "${BUILD_DIR}"
31
126
  cd "${BUILD_DIR}"
32
127
 
@@ -40,6 +135,7 @@ fi
40
135
 
41
136
  # Configure CMake build
42
137
  echo "Configuring CMake build..."
138
+ export PKG_CONFIG_PATH="${FFMPEG_INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
43
139
  cmake -S "opencv-${OPENCV_VERSION}" \
44
140
  -B build \
45
141
  -DCMAKE_BUILD_TYPE=Release \
@@ -52,11 +148,13 @@ cmake -S "opencv-${OPENCV_VERSION}" \
52
148
  -DBUILD_TIFF=ON \
53
149
  -DBUILD_WEBP=ON \
54
150
  -DBUILD_ZLIB=ON \
151
+ -DBUILD_JASPER=ON \
55
152
  -DWITH_JPEG=ON \
56
153
  -DWITH_PNG=ON \
57
154
  -DWITH_TIFF=ON \
58
155
  -DWITH_WEBP=ON \
59
156
  -DWITH_ZLIB=ON \
157
+ -DWITH_JASPER=ON \
60
158
  -DBUILD_TESTS=OFF \
61
159
  -DBUILD_PERF_TESTS=OFF \
62
160
  -DBUILD_EXAMPLES=OFF \
@@ -66,7 +164,8 @@ cmake -S "opencv-${OPENCV_VERSION}" \
66
164
  -DWITH_OPENCL=OFF \
67
165
  -DWITH_CUDA=OFF \
68
166
  -DWITH_OPENJPEG=OFF \
69
- -DWITH_FFMPEG=OFF \
167
+ -DWITH_FFMPEG=ON \
168
+ -DOPENCV_FFMPEG_USE_FIND_LIBS=ON \
70
169
  -DWITH_GSTREAMER=OFF \
71
170
  -DWITH_V4L=OFF \
72
171
  -DWITH_GTK=OFF \
@@ -94,6 +193,7 @@ declare -a CODEC_MAPPINGS=(
94
193
  "liblibtiff.a:libtiff.a"
95
194
  "liblibwebp.a:libwebp.a"
96
195
  "libzlib.a:libz.a"
196
+ "liblibjasper.a:libjasper.a"
97
197
  )
98
198
 
99
199
  for mapping in "${CODEC_MAPPINGS[@]}"; do
@@ -111,6 +211,26 @@ for mapping in "${CODEC_MAPPINGS[@]}"; do
111
211
  ln -sf "${CANONICAL_NAME}" "${INSTALL_DIR}/lib/${LINK_NAME}"
112
212
  done
113
213
 
214
+ # Copy FFmpeg static archives
215
+ declare -a FFMPEG_ARCHIVES=(
216
+ "libavcodec.a"
217
+ "libavfilter.a"
218
+ "libavformat.a"
219
+ "libavutil.a"
220
+ "libswresample.a"
221
+ "libswscale.a"
222
+ )
223
+
224
+ for archive in "${FFMPEG_ARCHIVES[@]}"; do
225
+ if [ ! -f "${FFMPEG_INSTALL_DIR}/lib/${archive}" ]; then
226
+ echo "ERROR: FFmpeg archive ${archive} not found in ${FFMPEG_INSTALL_DIR}/lib"
227
+ ls "${FFMPEG_INSTALL_DIR}/lib"
228
+ exit 1
229
+ fi
230
+
231
+ cp -f "${FFMPEG_INSTALL_DIR}/lib/${archive}" "${INSTALL_DIR}/lib/${archive}"
232
+ done
233
+
114
234
  # Verify installation - check both lib and lib64 (manylinux uses lib64)
115
235
  if [ -d "${INSTALL_DIR}/lib64" ]; then
116
236
  # Move from lib64 to lib for consistency (copy to handle reruns safely)
@@ -133,6 +253,13 @@ REQUIRED_ARCHIVES=(
133
253
  "libtiff.a"
134
254
  "libwebp.a"
135
255
  "libz.a"
256
+ "libjasper.a"
257
+ "libavcodec.a"
258
+ "libavfilter.a"
259
+ "libavformat.a"
260
+ "libavutil.a"
261
+ "libswresample.a"
262
+ "libswscale.a"
136
263
  )
137
264
 
138
265
  for archive in "${REQUIRED_ARCHIVES[@]}"; do
File without changes
File without changes