mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-04 11:24:41 +08:00
Compare commits
263 Commits
4.6.1
...
6.0.0-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebd5e8eb3d | ||
|
|
50d5cb16d1 | ||
|
|
8eac1a7393 | ||
|
|
f0f3166d92 | ||
|
|
482e82f9c4 | ||
|
|
58ea9e4b35 | ||
|
|
e077849a2c | ||
|
|
0fb547589d | ||
|
|
1f18b8507d | ||
|
|
eb7d411f49 | ||
|
|
640d9cd52b | ||
|
|
bc168d11ab | ||
|
|
e09f348890 | ||
|
|
f3caf22765 | ||
|
|
cd2006b4d9 | ||
|
|
ecbc512711 | ||
|
|
3fe1f6d544 | ||
|
|
ee4d6f360e | ||
|
|
7ae1943754 | ||
|
|
c2a4b25290 | ||
|
|
f79d4893db | ||
|
|
37c2c4c647 | ||
|
|
c7fa9c10e6 | ||
|
|
fa1dca8708 | ||
|
|
a7952fc493 | ||
|
|
721de8cbce | ||
|
|
7de040bbb7 | ||
|
|
b382f3973f | ||
|
|
37bdfddf55 | ||
|
|
21967209b8 | ||
|
|
b4b7cadf0d | ||
|
|
7c70032fe7 | ||
|
|
71821dbb56 | ||
|
|
22993028b4 | ||
|
|
6d934e6a98 | ||
|
|
78a2aafa0e | ||
|
|
e535cf7333 | ||
|
|
e725712be9 | ||
|
|
d66b7fa144 | ||
|
|
155a144a93 | ||
|
|
275f329f7f | ||
|
|
60ae71f3c5 | ||
|
|
cc01f2d8e2 | ||
|
|
5255e20283 | ||
|
|
c746773980 | ||
|
|
afc0df30cd | ||
|
|
bb759197d8 | ||
|
|
b4570cc106 | ||
|
|
66f4c17294 | ||
|
|
30048ae304 | ||
|
|
84b730497b | ||
|
|
db0b87597d | ||
|
|
102340e2be | ||
|
|
85437a8481 | ||
|
|
176ae90bbb | ||
|
|
44238aed35 | ||
|
|
045e643867 | ||
|
|
c92805e7bc | ||
|
|
899fe3ae2d | ||
|
|
a75c2a50ca | ||
|
|
508d6ea4d0 | ||
|
|
8976dd8199 | ||
|
|
29a55e633c | ||
|
|
f7d6dc41b3 | ||
|
|
d236131134 | ||
|
|
d669654142 | ||
|
|
4b0ab5382c | ||
|
|
737646a248 | ||
|
|
9fc0aa787e | ||
|
|
a041a60d87 | ||
|
|
020fb2dc80 | ||
|
|
9a27960bf7 | ||
|
|
862b811517 | ||
|
|
e01d24c164 | ||
|
|
0a052a3a72 | ||
|
|
f3eaa47ec6 | ||
|
|
3f457907b6 | ||
|
|
a1d750e7ca | ||
|
|
22f656b800 | ||
|
|
8eeba71ece | ||
|
|
afca10a17b | ||
|
|
f976bdc1c9 | ||
|
|
51c0c38b34 | ||
|
|
f2b2e11c41 | ||
|
|
865e3bd193 | ||
|
|
e0dc8237f5 | ||
|
|
bbc1b57445 | ||
|
|
ebbe4570d5 | ||
|
|
bcb2e97f89 | ||
|
|
ba29349e65 | ||
|
|
1b67f373d1 | ||
|
|
7215ee1921 | ||
|
|
65c0d32a51 | ||
|
|
268460fd17 | ||
|
|
d72ecb332a | ||
|
|
8ba56e58c2 | ||
|
|
fa485b6cdd | ||
|
|
625b340f3d | ||
|
|
fa3bd38217 | ||
|
|
0fca5c8e9a | ||
|
|
237f6336ec | ||
|
|
083af60c6f | ||
|
|
f7756886e7 | ||
|
|
6e72df66fc | ||
|
|
2bfcb13976 | ||
|
|
49e0375eee | ||
|
|
4459f4d3be | ||
|
|
c0fe81bd2e | ||
|
|
8cb64d3b70 | ||
|
|
0b154a715c | ||
|
|
05031b2b5a | ||
|
|
2510c8fa28 | ||
|
|
f17d75539c | ||
|
|
82512ef10c | ||
|
|
ad479e53b8 | ||
|
|
a356bfeaff | ||
|
|
dee8e23485 | ||
|
|
1fa0821057 | ||
|
|
b5ecffba81 | ||
|
|
672c9b8652 | ||
|
|
9f73e75f17 | ||
|
|
ef1a8f3e41 | ||
|
|
04f409ef80 | ||
|
|
51c8693dce | ||
|
|
bb572e2468 | ||
|
|
c07fafc0e9 | ||
|
|
595b179d3c | ||
|
|
c865d494a1 | ||
|
|
f4acb2188d | ||
|
|
01d4006c75 | ||
|
|
a7f0f34751 | ||
|
|
b6b1bf9f0e | ||
|
|
5d7a53a2fc | ||
|
|
b32e0ec132 | ||
|
|
6378a36d91 | ||
|
|
0d0fd70a24 | ||
|
|
7c0e9c45d8 | ||
|
|
7b60041529 | ||
|
|
6ffd6282e0 | ||
|
|
c37e7f0d72 | ||
|
|
ca1e593874 | ||
|
|
bfb0f339e2 | ||
|
|
3690337092 | ||
|
|
6c129a1c7a | ||
|
|
2b539c15f7 | ||
|
|
53456cd442 | ||
|
|
e1f4cdd71d | ||
|
|
ab6d2e3c9e | ||
|
|
f69c95a608 | ||
|
|
c103e45076 | ||
|
|
240d722fda | ||
|
|
14f3cd1e16 | ||
|
|
f4cc178dcd | ||
|
|
ad825bd2ba | ||
|
|
151733c8f8 | ||
|
|
544a7081ed | ||
|
|
4b3bde1615 | ||
|
|
b38cef2de2 | ||
|
|
b27da8a61a | ||
|
|
5e4170b0b7 | ||
|
|
b3539d4aa8 | ||
|
|
d09efc4748 | ||
|
|
dc532ff184 | ||
|
|
1fbb2f22f3 | ||
|
|
339815f74c | ||
|
|
fa6dc88faa | ||
|
|
ce344caa72 | ||
|
|
d8aed8065b | ||
|
|
6b83734382 | ||
|
|
2b52d4aa45 | ||
|
|
a515886ad8 | ||
|
|
a7629db518 | ||
|
|
ba336e9c75 | ||
|
|
736771b1c8 | ||
|
|
f9f736bec1 | ||
|
|
535681f3cd | ||
|
|
f283a12a0b | ||
|
|
ac80de9399 | ||
|
|
7eabac2175 | ||
|
|
e870399af1 | ||
|
|
37d567f208 | ||
|
|
7b9e811c99 | ||
|
|
0d97a11015 | ||
|
|
079a2aa64b | ||
|
|
9cdddd2e41 | ||
|
|
26d82e1582 | ||
|
|
c4e73cfbc7 | ||
|
|
2fffeeadf1 | ||
|
|
25155b3029 | ||
|
|
26795c5561 | ||
|
|
5543382d03 | ||
|
|
dc51b8b04c | ||
|
|
cde02be32b | ||
|
|
9213e3e13a | ||
|
|
b41f1f7e6c | ||
|
|
7201c036d5 | ||
|
|
da532d8e13 | ||
|
|
f97ed080e1 | ||
|
|
d67f55c824 | ||
|
|
095d40b688 | ||
|
|
bd6690fed1 | ||
|
|
bfda833bcf | ||
|
|
09345703e6 | ||
|
|
64e4a41710 | ||
|
|
f7b8b2520a | ||
|
|
fad793b18e | ||
|
|
d09d05ae9b | ||
|
|
89ca3b09d9 | ||
|
|
4694c557ec | ||
|
|
33d96bcd4e | ||
|
|
eee43def3b | ||
|
|
f4be9cc596 | ||
|
|
cc89b0aac5 | ||
|
|
9e8e95803f | ||
|
|
df0861ff5c | ||
|
|
706aeab03f | ||
|
|
f850ca80f1 | ||
|
|
608bf1a2ec | ||
|
|
b1f7290c20 | ||
|
|
65d445c293 | ||
|
|
43dbb134b6 | ||
|
|
84b0684d64 | ||
|
|
29b4153b63 | ||
|
|
3f1821f1ac | ||
|
|
4f8bb1be1c | ||
|
|
c2f1e43656 | ||
|
|
914d5cdf87 | ||
|
|
de77c90dd1 | ||
|
|
458ce82644 | ||
|
|
1d145a8690 | ||
|
|
b37acfa31d | ||
|
|
a0522311e2 | ||
|
|
7de9cc699a | ||
|
|
685648957f | ||
|
|
c2260ca709 | ||
|
|
776475265e | ||
|
|
21928f9eb4 | ||
|
|
211f024e49 | ||
|
|
bfdb051705 | ||
|
|
d824cd6516 | ||
|
|
b4f46ad31e | ||
|
|
a8d7f7ecf2 | ||
|
|
2b84e497b5 | ||
|
|
9b408a6e62 | ||
|
|
ecf94490a7 | ||
|
|
881183ed0a | ||
|
|
9389511d2d | ||
|
|
16389fc8a6 | ||
|
|
c7013b2576 | ||
|
|
a82fcc778e | ||
|
|
6dbdf93ca4 | ||
|
|
64eb03ac08 | ||
|
|
227cf54a47 | ||
|
|
107d31e5dc | ||
|
|
04562dcaa1 | ||
|
|
7059852586 | ||
|
|
8b7e9f959b | ||
|
|
19bd05149d | ||
|
|
a3706a1a17 | ||
|
|
5a7c464dea | ||
|
|
6c1b49b5ed | ||
|
|
59860dcfc3 | ||
|
|
b38ce2c56d |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
models/* linguist-vendored
|
||||
12
.github/FUNDING.yml
vendored
12
.github/FUNDING.yml
vendored
@@ -1,12 +1,2 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
github: k4yt3x
|
||||
patreon: k4yt3x
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
|
||||
26
.github/ISSUE_TEMPLATE/bug-report.md
vendored
26
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@@ -1,26 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Use this template if you believe you've encountered a bug.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: K4YT3X
|
||||
|
||||
---
|
||||
|
||||
## Component Versions
|
||||
|
||||
Please at least fill in the release version and GUI or CLI version.
|
||||
|
||||
- **Video2X release version**:
|
||||
- **Upscaler version**:
|
||||
- **GUI version**:
|
||||
- **CLI version**:
|
||||
|
||||
## Symptom
|
||||
|
||||
In this section, briefly describe what's going on.
|
||||
|
||||
## Error Log or Screenshots
|
||||
|
||||
Please upload or paste the error log here. You may also include screenshots.
|
||||
**It is highly recommended to include your error log.**
|
||||
16
.github/ISSUE_TEMPLATE/feature_request.md
vendored
16
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,16 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Request a new feature to be added
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: K4YT3X
|
||||
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Briefly describe the feature that you'd like Video2X to have.
|
||||
|
||||
## Sources
|
||||
|
||||
Paste links to descriptions of related documentations, websites and etc. here.
|
||||
93
.github/workflows/build.yml
vendored
Normal file
93
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
pull_request: {}
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libavcodec-dev \
|
||||
libavdevice-dev \
|
||||
libavfilter-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswscale-dev \
|
||||
libvulkan-dev \
|
||||
glslang-tools \
|
||||
libomp-dev \
|
||||
libopencv-dev
|
||||
- name: Build Video2X
|
||||
run: |
|
||||
mkdir -p /tmp/build /tmp/install
|
||||
cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF \
|
||||
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/tmp/install \
|
||||
-DINSTALL_BIN_DESTINATION=. -DINSTALL_INCLUDE_DESTINATION=include \
|
||||
-DINSTALL_LIB_DESTINATION=. -DINSTALL_MODEL_DESTINATION=.
|
||||
cmake --build /tmp/build --config Debug --target install --parallel
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: video2x-nightly-linux-amd64
|
||||
path: /tmp/install
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@v1.2.0
|
||||
with:
|
||||
vulkan-query-version: 1.3.204.0
|
||||
vulkan-components: Vulkan-Headers, Vulkan-Loader, Glslang, SPIRV-Tools, SPIRV-Headers
|
||||
- name: Install dependencies
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ffmpegVersion = "7.1"
|
||||
$ncnnVersion = "20240820"
|
||||
$opencvVersion = "4.10.0"
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
curl -Lo ffmpeg-shared.zip "https://github.com/GyanD/codexffmpeg/releases/download/$ffmpegVersion/ffmpeg-$ffmpegVersion-full_build-shared.zip"
|
||||
Expand-Archive -Path ffmpeg-shared.zip -DestinationPath third_party
|
||||
Rename-Item -Path "third_party/ffmpeg-$ffmpegVersion-full_build-shared" -NewName ffmpeg-shared
|
||||
|
||||
curl -Lo ncnn-shared.zip "https://github.com/Tencent/ncnn/releases/download/$ncnnVersion/ncnn-$ncnnVersion-windows-vs2022-shared.zip"
|
||||
Expand-Archive -Path ncnn-shared.zip -DestinationPath third_party
|
||||
Rename-Item -Path "third_party/ncnn-$ncnnVersion-windows-vs2022-shared" -NewName ncnn-shared
|
||||
|
||||
curl -Lo opencv-shared.exe "https://github.com/opencv/opencv/releases/download/$opencvVersion/opencv-$opencvVersion-windows.exe"
|
||||
7z x opencv-shared.exe -y
|
||||
Move-Item -Path opencv -Destination third_party\opencv-shared
|
||||
- name: Build Video2X
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake -S . -B build `
|
||||
-DUSE_SYSTEM_NCNN=OFF -DUSE_SYSTEM_SPDLOG=OFF -DUSE_SYSTEM_OPENCV=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=build/video2x_install
|
||||
cmake --build build --config Debug --parallel --target install
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: video2x-nightly-windows-amd64
|
||||
path: build/video2x_install
|
||||
54
.github/workflows/codeql-analysis.yml
vendored
54
.github/workflows/codeql-analysis.yml
vendored
@@ -1,54 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '0 4 * * 5'
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
name: Analyse
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
69
.github/workflows/nightly.yml
vendored
69
.github/workflows/nightly.yml
vendored
@@ -1,69 +0,0 @@
|
||||
# Name: Video2X Nightly Build
|
||||
# Creator: K4YT3X
|
||||
# Date Created: May 12, 2020
|
||||
# Last Modified: May 28, 2020
|
||||
|
||||
name: Video2X Nightly Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: src
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -U pip
|
||||
pip install -U pyinstaller pywin32
|
||||
pip install -U -r requirements.txt
|
||||
- name: Build Video2X CLI
|
||||
run: |
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="wrappers;wrappers" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x.py
|
||||
- name: Build Video2X GUI
|
||||
run: |
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--add-data="images;images" `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="video2x_gui.ui;." `
|
||||
--add-data="wrappers;wrappers" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_gui.py
|
||||
- name: Build Video2X setup script
|
||||
run: |
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--additional-hooks-dir "pyinstaller\hooks" `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="pyinstaller\7z1900-extra;7z" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_setup.py
|
||||
- name: Collect artifacts into folder
|
||||
run: |
|
||||
New-Item "video2x-nightly-win32-light\" -ItemType Directory
|
||||
Copy-Item "dist\video2x.exe" -Destination "video2x-nightly-win32-light\"
|
||||
Copy-Item "dist\video2x_gui.exe" -Destination "video2x-nightly-win32-light\"
|
||||
Copy-Item "dist\video2x_setup.exe" -Destination "video2x-nightly-win32-light\"
|
||||
Copy-Item "video2x.yaml" -Destination "video2x-nightly-win32-light\"
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: video2x-nightly-win32-light
|
||||
path: src/video2x-nightly-win32-light/
|
||||
57
.github/workflows/release.yml
vendored
Normal file
57
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
if: github.event.base_ref == 'refs/heads/master'
|
||||
name: Setup
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.get_version.outputs.version }}
|
||||
steps:
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: echo version=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
|
||||
|
||||
container:
|
||||
name: Build and upload container
|
||||
needs:
|
||||
- setup
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: mr-smithers-excellent/docker-build-push@v5
|
||||
name: Build & push the Docker image
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USER }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
dockerfile: Dockerfile
|
||||
image: video2x
|
||||
tags: latest, ${{ needs.setup.outputs.version }}
|
||||
|
||||
create-release:
|
||||
name: Create release
|
||||
needs:
|
||||
- setup
|
||||
- container
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_name: ${{ needs.setup.outputs.version }}
|
||||
release_name: Video2X ${{ needs.setup.outputs.version }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
161
.gitignore
vendored
161
.gitignore
vendored
@@ -1,110 +1,77 @@
|
||||
# QtCreator
|
||||
video2x_gui.pyproject.user
|
||||
# Data files
|
||||
data/
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
# Built-binaries
|
||||
bin/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Translations
|
||||
#*.mo
|
||||
#*.pot
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
#*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
# Kernel Module Compile Results
|
||||
#*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
# clang tooling compilation databases
|
||||
.cache/
|
||||
*.plist
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
# CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
CMakeUserPresets.json
|
||||
|
||||
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
[submodule "third_party/libreal_esrgan_ncnn_vulkan"]
|
||||
path = third_party/libreal_esrgan_ncnn_vulkan
|
||||
url = https://github.com/k4yt3x/libreal-esrgan-ncnn-vulkan.git
|
||||
[submodule "third_party/ncnn"]
|
||||
path = third_party/ncnn
|
||||
url = https://github.com/Tencent/ncnn.git
|
||||
[submodule "third_party/spdlog"]
|
||||
path = third_party/spdlog
|
||||
url = https://github.com/gabime/spdlog.git
|
||||
[submodule "third_party/opencv"]
|
||||
path = third_party/opencv
|
||||
url = https://github.com/opencv/opencv.git
|
||||
8
CHANGELOG.md
Normal file
8
CHANGELOG.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
451
CMakeLists.txt
Normal file
451
CMakeLists.txt
Normal file
@@ -0,0 +1,451 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(video2x VERSION 6.0.0 LANGUAGES C CXX)
|
||||
|
||||
# Set the C standard
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# Set the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Set the default build type to Release if not specified
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# Set the default optimization flags for Release builds
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /GL /LTCG /MD /DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /GL /LTCG /MD /DNDEBUG")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=native -flto")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native -flto")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -s")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set global compile options for all targets
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
add_compile_options(/W4 /permissive-)
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion -Wshadow)
|
||||
endif()
|
||||
|
||||
# Build options
|
||||
option(BUILD_SHARED_LIBS "Build libvideo2x as a shared library" ON)
|
||||
option(BUILD_VIDEO2X_CLI "Build the video2x executable" ON)
|
||||
option(USE_SYSTEM_SPDLOG "Use system spdlog library" ON)
|
||||
option(USE_SYSTEM_OPENCV "Use system OpenCV library" ON)
|
||||
option(USE_SYSTEM_NCNN "Use system ncnn library" ON)
|
||||
|
||||
# Generate the version header file
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/libvideo2x/version.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libvideo2x/version.h"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Find the required packages
|
||||
set(ALL_INCLUDE_DIRS)
|
||||
set(ALL_LIBRARIES)
|
||||
|
||||
# spdlog
|
||||
if (USE_SYSTEM_SPDLOG)
|
||||
find_package(spdlog REQUIRED)
|
||||
list(APPEND ALL_INCLUDE_DIRS ${spdlog_INCLUDE_DIRS})
|
||||
list(APPEND ALL_LIBRARIES spdlog::spdlog)
|
||||
else()
|
||||
add_subdirectory(third_party/spdlog)
|
||||
list(APPEND ALL_LIBRARIES spdlog::spdlog_header_only)
|
||||
endif()
|
||||
|
||||
# Platform-specific dependencies
|
||||
if(WIN32)
|
||||
# Define base paths for FFmpeg and ncnn
|
||||
set(FFMPEG_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ffmpeg-shared)
|
||||
set(NCNN_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/ncnn-shared/x64)
|
||||
set(OPENCV_BASE_PATH ${PROJECT_SOURCE_DIR}/third_party/opencv-shared)
|
||||
|
||||
# FFmpeg
|
||||
list(APPEND ALL_LIBRARIES
|
||||
${FFMPEG_BASE_PATH}/lib/avcodec.lib
|
||||
${FFMPEG_BASE_PATH}/lib/avdevice.lib
|
||||
${FFMPEG_BASE_PATH}/lib/avfilter.lib
|
||||
${FFMPEG_BASE_PATH}/lib/avformat.lib
|
||||
${FFMPEG_BASE_PATH}/lib/avutil.lib
|
||||
${FFMPEG_BASE_PATH}/lib/swscale.lib
|
||||
)
|
||||
list(APPEND ALL_INCLUDE_DIRS ${FFMPEG_BASE_PATH}/include)
|
||||
|
||||
# ncnn
|
||||
# TODO: Figure out why this file is not being copied to the install directory
|
||||
set(SPIRV_BUILD_PATH
|
||||
${CMAKE_BINARY_DIR}/realesrgan-prefix/src/realesrgan-build/ncnn/glslang/SPIRV
|
||||
)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set(SPIRV_LIB ${SPIRV_BUILD_PATH}/Release/SPIRV.lib)
|
||||
else()
|
||||
set(SPIRV_LIB ${SPIRV_BUILD_PATH}/Debug/SPIRVd.lib)
|
||||
endif()
|
||||
|
||||
list(APPEND ALL_LIBRARIES
|
||||
${NCNN_BASE_PATH}/lib/ncnn.lib
|
||||
${SPIRV_LIB}
|
||||
)
|
||||
list(APPEND ALL_INCLUDE_DIRS ${NCNN_BASE_PATH}/include/ncnn)
|
||||
|
||||
# OpenCV
|
||||
list(APPEND ALL_LIBRARIES ${OPENCV_BASE_PATH}/build/x64/vc16/lib/opencv_world4100.lib)
|
||||
list(APPEND ALL_INCLUDE_DIRS ${OPENCV_BASE_PATH}/build/include)
|
||||
else()
|
||||
# FFmpeg
|
||||
find_package(PkgConfig REQUIRED)
|
||||
set(REQUIRED_PKGS
|
||||
libavcodec
|
||||
libavdevice
|
||||
libavfilter
|
||||
libavformat
|
||||
libavutil
|
||||
libswscale
|
||||
)
|
||||
|
||||
# Loop through each package to find and collect include dirs and libraries
|
||||
foreach(PKG ${REQUIRED_PKGS})
|
||||
pkg_check_modules(${PKG} REQUIRED ${PKG})
|
||||
list(APPEND ALL_INCLUDE_DIRS ${${PKG}_INCLUDE_DIRS})
|
||||
list(APPEND ALL_LIBRARIES ${${PKG}_LIBRARIES})
|
||||
endforeach()
|
||||
|
||||
# OpenCV
|
||||
if (USE_SYSTEM_OPENCV)
|
||||
find_package(OpenCV REQUIRED)
|
||||
list(APPEND ALL_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}/opencv2)
|
||||
list(APPEND ALL_LIBRARIES opencv_core opencv_videoio)
|
||||
else()
|
||||
option(BUILD_opencv_calib3d "" OFF)
|
||||
option(BUILD_opencv_core "" ON)
|
||||
option(BUILD_opencv_dnn "" OFF)
|
||||
option(BUILD_opencv_features2d "" OFF)
|
||||
option(BUILD_opencv_flann "" OFF)
|
||||
option(BUILD_opencv_gapi "" OFF)
|
||||
option(BUILD_opencv_highgui "" OFF)
|
||||
option(BUILD_opencv_imgcodecs "" OFF)
|
||||
option(BUILD_opencv_imgproc "" OFF)
|
||||
option(BUILD_opencv_java "" OFF)
|
||||
option(BUILD_opencv_js "" OFF)
|
||||
option(BUILD_opencv_ml "" OFF)
|
||||
option(BUILD_opencv_objc "" OFF)
|
||||
option(BUILD_opencv_objdetect "" OFF)
|
||||
option(BUILD_opencv_photo "" OFF)
|
||||
option(BUILD_opencv_python "" OFF)
|
||||
option(BUILD_opencv_python2 "" OFF)
|
||||
option(BUILD_opencv_python3 "" OFF)
|
||||
option(BUILD_opencv_stitching "" OFF)
|
||||
option(BUILD_opencv_ts "" OFF)
|
||||
option(BUILD_opencv_video "" OFF)
|
||||
option(BUILD_opencv_videoio "" ON)
|
||||
option(BUILD_opencv_world "" OFF)
|
||||
|
||||
option(WITH_PNG "" OFF)
|
||||
option(WITH_JPEG "" OFF)
|
||||
option(WITH_TIFF "" OFF)
|
||||
option(WITH_WEBP "" OFF)
|
||||
option(WITH_OPENJPEG "" OFF)
|
||||
option(WITH_JASPER "" OFF)
|
||||
option(WITH_OPENEXR "" OFF)
|
||||
option(WITH_IMGCODEC "" OFF)
|
||||
|
||||
add_subdirectory(third_party/opencv)
|
||||
list(APPEND ALL_INCLUDE_DIRS
|
||||
${PROJECT_SOURCE_DIR}/third_party/opencv/include
|
||||
${PROJECT_SOURCE_DIR}/third_party/opencv/modules/core/include
|
||||
${PROJECT_SOURCE_DIR}/third_party/opencv/modules/videoio/include
|
||||
)
|
||||
list(APPEND ALL_LIBRARIES opencv_core opencv_videoio)
|
||||
endif() # USE_SYSTEM_OPENCV
|
||||
endif() # WIN32
|
||||
|
||||
# Find ncnn package
|
||||
if(USE_SYSTEM_NCNN)
|
||||
find_package(ncnn REQUIRED)
|
||||
else()
|
||||
option(NCNN_INSTALL_SDK "" OFF)
|
||||
option(NCNN_PIXEL_ROTATE "" OFF)
|
||||
option(NCNN_VULKAN "" ON)
|
||||
option(NCNN_VULKAN_ONLINE_SPIRV "" ON)
|
||||
option(NCNN_BUILD_BENCHMARK "" OFF)
|
||||
option(NCNN_BUILD_TESTS "" OFF)
|
||||
option(NCNN_BUILD_TOOLS "" OFF)
|
||||
option(NCNN_BUILD_EXAMPLES "" OFF)
|
||||
option(NCNN_DISABLE_RTTI "" ON)
|
||||
option(NCNN_DISABLE_EXCEPTION "" ON)
|
||||
option(NCNN_BUILD_SHARED_LIBS "" OFF)
|
||||
option(SKIP_GLSLANG_INSTALL "" ON)
|
||||
|
||||
option(WITH_LAYER_absval "" OFF)
|
||||
option(WITH_LAYER_argmax "" OFF)
|
||||
option(WITH_LAYER_batchnorm "" OFF)
|
||||
option(WITH_LAYER_bias "" OFF)
|
||||
option(WITH_LAYER_bnll "" OFF)
|
||||
option(WITH_LAYER_concat "" ON)
|
||||
option(WITH_LAYER_convolution "" ON)
|
||||
option(WITH_LAYER_crop "" ON)
|
||||
option(WITH_LAYER_deconvolution "" OFF)
|
||||
option(WITH_LAYER_dropout "" OFF)
|
||||
option(WITH_LAYER_eltwise "" ON)
|
||||
option(WITH_LAYER_elu "" OFF)
|
||||
option(WITH_LAYER_embed "" OFF)
|
||||
option(WITH_LAYER_exp "" OFF)
|
||||
option(WITH_LAYER_flatten "" ON)
|
||||
option(WITH_LAYER_innerproduct "" ON)
|
||||
option(WITH_LAYER_input "" ON)
|
||||
option(WITH_LAYER_log "" OFF)
|
||||
option(WITH_LAYER_lrn "" OFF)
|
||||
option(WITH_LAYER_memorydata "" OFF)
|
||||
option(WITH_LAYER_mvn "" OFF)
|
||||
option(WITH_LAYER_pooling "" OFF)
|
||||
option(WITH_LAYER_power "" OFF)
|
||||
option(WITH_LAYER_prelu "" ON)
|
||||
option(WITH_LAYER_proposal "" OFF)
|
||||
option(WITH_LAYER_reduction "" OFF)
|
||||
option(WITH_LAYER_relu "" ON)
|
||||
option(WITH_LAYER_reshape "" OFF)
|
||||
option(WITH_LAYER_roipooling "" OFF)
|
||||
option(WITH_LAYER_scale "" OFF)
|
||||
option(WITH_LAYER_sigmoid "" OFF)
|
||||
option(WITH_LAYER_slice "" OFF)
|
||||
option(WITH_LAYER_softmax "" OFF)
|
||||
option(WITH_LAYER_split "" ON)
|
||||
option(WITH_LAYER_spp "" OFF)
|
||||
option(WITH_LAYER_tanh "" OFF)
|
||||
option(WITH_LAYER_threshold "" OFF)
|
||||
option(WITH_LAYER_tile "" OFF)
|
||||
option(WITH_LAYER_rnn "" OFF)
|
||||
option(WITH_LAYER_lstm "" OFF)
|
||||
option(WITH_LAYER_binaryop "" ON)
|
||||
option(WITH_LAYER_unaryop "" OFF)
|
||||
option(WITH_LAYER_convolutiondepthwise "" OFF)
|
||||
option(WITH_LAYER_padding "" ON)
|
||||
option(WITH_LAYER_squeeze "" OFF)
|
||||
option(WITH_LAYER_expanddims "" OFF)
|
||||
option(WITH_LAYER_normalize "" OFF)
|
||||
option(WITH_LAYER_permute "" OFF)
|
||||
option(WITH_LAYER_priorbox "" OFF)
|
||||
option(WITH_LAYER_detectionoutput "" OFF)
|
||||
option(WITH_LAYER_interp "" ON)
|
||||
option(WITH_LAYER_deconvolutiondepthwise "" OFF)
|
||||
option(WITH_LAYER_shufflechannel "" OFF)
|
||||
option(WITH_LAYER_instancenorm "" OFF)
|
||||
option(WITH_LAYER_clip "" OFF)
|
||||
option(WITH_LAYER_reorg "" OFF)
|
||||
option(WITH_LAYER_yolodetectionoutput "" OFF)
|
||||
option(WITH_LAYER_quantize "" OFF)
|
||||
option(WITH_LAYER_dequantize "" OFF)
|
||||
option(WITH_LAYER_yolov3detectionoutput "" OFF)
|
||||
option(WITH_LAYER_psroipooling "" OFF)
|
||||
option(WITH_LAYER_roialign "" OFF)
|
||||
option(WITH_LAYER_packing "" ON)
|
||||
option(WITH_LAYER_requantize "" OFF)
|
||||
option(WITH_LAYER_cast "" ON)
|
||||
option(WITH_LAYER_hardsigmoid "" OFF)
|
||||
option(WITH_LAYER_selu "" OFF)
|
||||
option(WITH_LAYER_hardswish "" OFF)
|
||||
option(WITH_LAYER_noop "" OFF)
|
||||
option(WITH_LAYER_pixelshuffle "" ON)
|
||||
option(WITH_LAYER_deepcopy "" OFF)
|
||||
option(WITH_LAYER_mish "" OFF)
|
||||
option(WITH_LAYER_statisticspooling "" OFF)
|
||||
option(WITH_LAYER_swish "" OFF)
|
||||
option(WITH_LAYER_gemm "" OFF)
|
||||
option(WITH_LAYER_groupnorm "" OFF)
|
||||
option(WITH_LAYER_layernorm "" OFF)
|
||||
option(WITH_LAYER_softplus "" OFF)
|
||||
|
||||
add_subdirectory(third_party/ncnn)
|
||||
endif()
|
||||
|
||||
# Include ExternalProject module
|
||||
include(ExternalProject)
|
||||
|
||||
# Add libreal-esrgan-ncnn-vulkan as an external project
|
||||
ExternalProject_Add(
|
||||
realesrgan
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/libreal_esrgan_ncnn_vulkan/src
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/realesrgan_install
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DUSE_SYSTEM_NCNN=${USE_SYSTEM_NCNN}
|
||||
BUILD_ALWAYS ON
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
|
||||
# Remove duplicate entries
|
||||
list(REMOVE_DUPLICATES ALL_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES ALL_LIBRARIES)
|
||||
|
||||
# Add all source files for libvideo2x
|
||||
file(GLOB LIBVIDEO2X_SOURCES src/*.cpp)
|
||||
|
||||
# Create the shared library 'libvideo2x'
|
||||
add_library(libvideo2x ${LIBVIDEO2X_SOURCES})
|
||||
target_compile_definitions(libvideo2x PRIVATE LIBVIDEO2X_EXPORTS)
|
||||
if(WIN32)
|
||||
set_target_properties(libvideo2x PROPERTIES OUTPUT_NAME libvideo2x)
|
||||
else()
|
||||
set_target_properties(libvideo2x PROPERTIES OUTPUT_NAME video2x)
|
||||
endif()
|
||||
|
||||
# Ensure libvideo2x depends on realesrgan being built and installed
|
||||
add_dependencies(libvideo2x realesrgan)
|
||||
|
||||
# Include directories for the shared library
|
||||
target_include_directories(libvideo2x PRIVATE
|
||||
${ALL_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/include/libvideo2x
|
||||
${PROJECT_SOURCE_DIR}/third_party/libreal_esrgan_ncnn_vulkan/src
|
||||
)
|
||||
|
||||
# Compile options for the shared library
|
||||
target_compile_options(libvideo2x PRIVATE
|
||||
-fPIC
|
||||
$<$<CONFIG:Release>:-Ofast>
|
||||
$<$<CONFIG:Debug>:-g -DDEBUG>
|
||||
)
|
||||
|
||||
# Define the path to the built libresrgan-ncnn-vulkan library
|
||||
if(WIN32)
|
||||
set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.lib)
|
||||
else()
|
||||
set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.so)
|
||||
endif()
|
||||
|
||||
# Link the shared library with the dependencies
|
||||
target_link_libraries(libvideo2x PRIVATE ${ALL_LIBRARIES} ${REALESRGAN_LIB})
|
||||
|
||||
if(NOT WIN32)
|
||||
if (USE_SYSTEM_NCNN)
|
||||
target_link_libraries(libvideo2x PUBLIC ncnn)
|
||||
else()
|
||||
target_link_libraries(libvideo2x PRIVATE ncnn)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Create the executable 'video2x'
|
||||
if (BUILD_VIDEO2X_CLI)
|
||||
add_executable(video2x src/video2x.c src/getopt.c)
|
||||
set_target_properties(video2x PROPERTIES OUTPUT_NAME video2x)
|
||||
|
||||
# Include directories for the executable
|
||||
target_include_directories(video2x PRIVATE
|
||||
${ALL_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
# Compile options for the executable
|
||||
target_compile_options(video2x PRIVATE $<$<CONFIG:Debug>:-g -DDEBUG>)
|
||||
|
||||
# Link the executable with the shared library
|
||||
target_link_libraries(video2x PRIVATE ${ALL_LIBRARIES} libvideo2x)
|
||||
endif()
|
||||
|
||||
# Define the default installation directories
|
||||
if(WIN32)
|
||||
set(BIN_DESTINATION_DEFAULT ".")
|
||||
set(INCLUDE_DESTINATION_DEFAULT "include/libvideo2x")
|
||||
set(LIB_DESTINATION_DEFAULT ".")
|
||||
set(MODEL_DESTINATION_DEFAULT ".")
|
||||
else()
|
||||
set(BIN_DESTINATION_DEFAULT "bin")
|
||||
set(INCLUDE_DESTINATION_DEFAULT "include/libvideo2x")
|
||||
set(LIB_DESTINATION_DEFAULT "lib")
|
||||
set(MODEL_DESTINATION_DEFAULT "share/video2x")
|
||||
endif()
|
||||
|
||||
# Explicitly set the output paths since OpenCV changes these variables
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Set the installation directories
|
||||
set(INSTALL_BIN_DESTINATION ${BIN_DESTINATION_DEFAULT} CACHE STRING "")
|
||||
set(INSTALL_INCLUDE_DESTINATION ${INCLUDE_DESTINATION_DEFAULT} CACHE STRING "")
|
||||
set(INSTALL_LIB_DESTINATION ${LIB_DESTINATION_DEFAULT} CACHE STRING "")
|
||||
set(INSTALL_MODEL_DESTINATION ${MODEL_DESTINATION_DEFAULT} CACHE STRING "")
|
||||
|
||||
# Common installation rules for libvideo2x and models
|
||||
install(TARGETS libvideo2x
|
||||
LIBRARY DESTINATION ${INSTALL_LIB_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
ARCHIVE DESTINATION ${INSTALL_LIB_DESTINATION}
|
||||
RUNTIME DESTINATION ${INSTALL_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
# Install model files
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/models DESTINATION ${INSTALL_MODEL_DESTINATION})
|
||||
|
||||
# Install the executable if BUILD_VIDEO2X_CLI is enabled
|
||||
if(BUILD_VIDEO2X_CLI)
|
||||
install(TARGETS video2x RUNTIME DESTINATION ${INSTALL_BIN_DESTINATION})
|
||||
endif()
|
||||
|
||||
# Install the header file
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/include/libvideo2x/libvideo2x.h
|
||||
DESTINATION ${INSTALL_INCLUDE_DESTINATION}
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libvideo2x/version.h
|
||||
DESTINATION ${INSTALL_INCLUDE_DESTINATION}
|
||||
)
|
||||
|
||||
# Platform-specific installation rules
|
||||
if(WIN32)
|
||||
# Install Windows-specific dependencies
|
||||
install(FILES ${CMAKE_BINARY_DIR}/realesrgan_install/bin/librealesrgan-ncnn-vulkan.dll
|
||||
DESTINATION ${INSTALL_BIN_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
install(FILES ${FFMPEG_BASE_PATH}/bin/swscale-8.dll
|
||||
${FFMPEG_BASE_PATH}/bin/avcodec-61.dll
|
||||
${FFMPEG_BASE_PATH}/bin/avdevice-61.dll
|
||||
${FFMPEG_BASE_PATH}/bin/avfilter-10.dll
|
||||
${FFMPEG_BASE_PATH}/bin/avformat-61.dll
|
||||
${FFMPEG_BASE_PATH}/bin/avutil-59.dll
|
||||
${FFMPEG_BASE_PATH}/bin/postproc-58.dll
|
||||
${FFMPEG_BASE_PATH}/bin/swresample-5.dll
|
||||
DESTINATION ${INSTALL_BIN_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
install(FILES ${OPENCV_BASE_PATH}/build/x64/vc16/bin/opencv_world4100.dll
|
||||
${OPENCV_BASE_PATH}/build/x64/vc16/bin/opencv_videoio_msmf4100_64.dll
|
||||
DESTINATION ${INSTALL_BIN_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
install(FILES ${NCNN_BASE_PATH}/bin/ncnn.dll
|
||||
DESTINATION ${INSTALL_BIN_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
else()
|
||||
# Install Unix-specific dependencies
|
||||
install(FILES ${REALESRGAN_LIB}
|
||||
DESTINATION ${INSTALL_LIB_DESTINATION}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
endif()
|
||||
60
Dockerfile
60
Dockerfile
@@ -1,31 +1,45 @@
|
||||
# Name: Video2X Dockerfile
|
||||
# Creator: Danielle Douglas
|
||||
# Date Created: Unknown
|
||||
# Last Modified: January 14, 2020
|
||||
# Creator: K4YT3X
|
||||
# Date Created: February 3, 2022
|
||||
# Last Modified: October 21, 2024
|
||||
|
||||
# Editor: Lhanjian
|
||||
# Last Modified: May 24, 2020
|
||||
# stage 1: build the python components into wheels
|
||||
FROM docker.io/archlinux:latest AS builder
|
||||
|
||||
# Editor: K4YT3X
|
||||
# Last Modified: June 13, 2020
|
||||
# Install dependencies and create a non-root user
|
||||
RUN pacman -Syy --noconfirm \
|
||||
base-devel git cmake make clang pkgconf sudo \
|
||||
ffmpeg ncnn vulkan-headers openmp spdlog opencv \
|
||||
nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
|
||||
&& useradd -m builder \
|
||||
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder
|
||||
|
||||
# using Ubuntu LTS 19.10
|
||||
# Ubuntu 20.x is incompatible with Nvidia libraries
|
||||
FROM ubuntu:19.10
|
||||
# Switch to the non-root user and copy the source code
|
||||
USER builder
|
||||
COPY --chown=builder:builder . /video2x
|
||||
WORKDIR /video2x
|
||||
|
||||
# file mainainter labels
|
||||
LABEL maintainer="Danielle Douglas <ddouglas87@gmail.com>"
|
||||
LABEL maintainer="Lhanjian <lhjay1@foxmail.com>"
|
||||
LABEL maintainer="K4YT3X <k4yt3x@k4yt3x.com>"
|
||||
# Build the package
|
||||
RUN makepkg -s --noconfirm \
|
||||
&& find /video2x -maxdepth 1 -name 'video2x-*.pkg.tar.zst' ! -name '*-debug-*' | head -n 1 | \
|
||||
xargs -I {} cp {} /tmp/video2x.pkg.tar.zst
|
||||
|
||||
# run installation
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y git-core \
|
||||
&& git clone --recurse-submodules --progress https://github.com/k4yt3x/video2x.git /tmp/video2x/video2x \
|
||||
&& bash -e /tmp/video2x/video2x/src/video2x_setup_ubuntu.sh /
|
||||
# stage 2: install wheels into the final image
|
||||
FROM docker.io/archlinux:latest
|
||||
LABEL maintainer="K4YT3X <i@k4yt3x.com>" \
|
||||
org.opencontainers.image.source="https://github.com/k4yt3x/video2x" \
|
||||
org.opencontainers.image.description="A lossless video super resolution framework"
|
||||
|
||||
ENV VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json\
|
||||
:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json\
|
||||
:/usr/share/vulkan/icd.d/intel_icd.x86_64.json\
|
||||
:/usr/share/vulkan/icd.d/lvp_icd.x86_64.json
|
||||
|
||||
COPY --from=builder /tmp/video2x.pkg.tar.zst /video2x.pkg.tar.zst
|
||||
RUN pacman -Sy --noconfirm nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
|
||||
ffmpeg ncnn spdlog opencv \
|
||||
&& pacman -U --noconfirm /video2x.pkg.tar.zst \
|
||||
&& rm -rf /video2x.pkg.tar.zst /var/cache/pacman/pkg/*
|
||||
|
||||
WORKDIR /host
|
||||
ENTRYPOINT ["python3.8", "/video2x/src/video2x.py"]
|
||||
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES all
|
||||
ENV DEBIAN_FRONTEND teletype
|
||||
ENTRYPOINT ["/usr/bin/video2x"]
|
||||
|
||||
147
LICENSE
147
LICENSE
@@ -1,23 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
@@ -72,7 +60,7 @@ modification follow.
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
112
Makefile
Normal file
112
Makefile
Normal file
@@ -0,0 +1,112 @@
|
||||
.PHONY: build static debug clean \
|
||||
test-realesrgan test-libplacebo \
|
||||
memcheck-realesrgan memcheck-libplacebo \
|
||||
heaptrack-realesrgan heaptrack-libplacebo
|
||||
|
||||
BINDIR=build
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
|
||||
TEST_VIDEO=data/standard-test.mp4
|
||||
TEST_OUTPUT=data/output.mp4
|
||||
|
||||
build:
|
||||
cmake -S . -B $(BINDIR) \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DCMAKE_C_COMPILER=$(CC) \
|
||||
-DCMAKE_CXX_COMPILER=$(CXX) \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build $(BINDIR) --config Release --parallel
|
||||
cp $(BINDIR)/compile_commands.json .
|
||||
|
||||
static:
|
||||
cmake -S . -B $(BINDIR) \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DCMAKE_C_COMPILER=$(CC) \
|
||||
-DCMAKE_CXX_COMPILER=$(CXX) \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
cmake --build $(BINDIR) --config Release --parallel
|
||||
cp $(BINDIR)/compile_commands.json .
|
||||
|
||||
debug:
|
||||
cmake -S . -B $(BINDIR) \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DCMAKE_C_COMPILER=$(CC) \
|
||||
-DCMAKE_CXX_COMPILER=$(CXX) \
|
||||
-DCMAKE_BUILD_TYPE=Debug
|
||||
cmake --build $(BINDIR) --config Debug --parallel
|
||||
cp $(BINDIR)/compile_commands.json .
|
||||
|
||||
debian:
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential cmake clang pkg-config \
|
||||
libavcodec-dev \
|
||||
libavdevice-dev \
|
||||
libavfilter-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswscale-dev \
|
||||
libvulkan-dev \
|
||||
glslang-tools \
|
||||
libomp-dev \
|
||||
libspdlog-dev \
|
||||
libopencv-dev
|
||||
cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF \
|
||||
-DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) \
|
||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/install \
|
||||
-DINSTALL_BIN_DESTINATION=. -DINSTALL_INCLUDE_DESTINATION=include \
|
||||
-DINSTALL_LIB_DESTINATION=. -DINSTALL_MODEL_DESTINATION=.
|
||||
cmake --build /tmp/build --config Release --target install --parallel
|
||||
|
||||
clean:
|
||||
rm -rf $(BINDIR)
|
||||
|
||||
test-realesrgan:
|
||||
LD_LIBRARY_PATH=$(BINDIR) $(BINDIR)/video2x -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f realesrgan -r 4 -m realesr-animevideov3
|
||||
|
||||
test-libplacebo:
|
||||
LD_LIBRARY_PATH=$(BINDIR) $(BINDIR)/video2x -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f libplacebo -w 1920 -h 1080 -s anime4k-mode-a
|
||||
|
||||
memcheck-realesrgan:
|
||||
LD_LIBRARY_PATH=$(BINDIR) valgrind \
|
||||
--tool=memcheck \
|
||||
--leak-check=full \
|
||||
--show-leak-kinds=all \
|
||||
--track-origins=yes \
|
||||
--show-reachable=yes \
|
||||
--verbose --log-file="valgrind.log" \
|
||||
$(BINDIR)/video2x \
|
||||
-i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f realesrgan -r 2 -m realesr-animevideov3 \
|
||||
-p veryfast -b 1000000 -q 30
|
||||
|
||||
memcheck-libplacebo:
|
||||
LD_LIBRARY_PATH=$(BINDIR) valgrind \
|
||||
--tool=memcheck \
|
||||
--leak-check=full \
|
||||
--show-leak-kinds=all \
|
||||
--track-origins=yes \
|
||||
--show-reachable=yes \
|
||||
--verbose --log-file="valgrind.log" \
|
||||
$(BINDIR)/video2x \
|
||||
-i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f libplacebo -w 1920 -h 1080 -s anime4k-mode-a \
|
||||
-p veryfast -b 1000000 -q 30
|
||||
|
||||
heaptrack-realesrgan:
|
||||
LD_LIBRARY_PATH=$(BINDIR) HEAPTRACK_ENABLE_DEBUGINFOD=1 heaptrack \
|
||||
$(BINDIR)/video2x \
|
||||
-i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f realesrgan -r 4 -m realesr-animevideov3 \
|
||||
-p veryfast -b 1000000 -q 30
|
||||
|
||||
heaptrack-libplacebo:
|
||||
LD_LIBRARY_PATH=$(BINDIR) HEAPTRACK_ENABLE_DEBUGINFOD=1 heaptrack \
|
||||
$(BINDIR)/video2x \
|
||||
-i $(TEST_VIDEO) -o $(TEST_OUTPUT) \
|
||||
-f libplacebo -w 1920 -h 1080 -s anime4k-mode-a \
|
||||
-p veryfast -b 1000000 -q 30
|
||||
11
NOTICE
Normal file
11
NOTICE
Normal file
@@ -0,0 +1,11 @@
|
||||
Video2X
|
||||
Copyright (C) 2018-2024 K4YT3X and contributors.
|
||||
|
||||
This product depends on FFmpeg, which is available under the GNU Lesser General Public License 2.1.
|
||||
The source code can be found at https://github.com/FFmpeg/FFmpeg.
|
||||
|
||||
This product depends on Real-ESRGAN ncnn Vulkan, which is available under the MIT License.
|
||||
The source code can be found at https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan.
|
||||
|
||||
This product depends on ncnn, which is available under the BSD 3-Clause License.
|
||||
The source code can be found at https://github.com/Tencent/ncnn.
|
||||
27
PKGBUILD
Normal file
27
PKGBUILD
Normal file
@@ -0,0 +1,27 @@
|
||||
pkgname=video2x
|
||||
pkgver=r843.e09f348
|
||||
pkgrel=1
|
||||
pkgdesc="A machine learning-based lossless video super resolution framework"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/k4yt3x/video2x"
|
||||
license=('AGPL3')
|
||||
depends=('ffmpeg' 'ncnn' 'vulkan-driver' 'opencv' 'spdlog')
|
||||
makedepends=('git' 'cmake' 'make' 'clang' 'pkgconf' 'vulkan-headers' 'openmp')
|
||||
|
||||
pkgver() {
|
||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
prepare() {
|
||||
git submodule update --init --recursive
|
||||
}
|
||||
|
||||
build() {
|
||||
cmake -B build -S .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build build --config Release --parallel
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
}
|
||||
|
||||
350
README.md
350
README.md
@@ -1,312 +1,130 @@
|
||||
<p align="center">
|
||||
<img src="https://user-images.githubusercontent.com/21986859/81626588-ae5ab800-93eb-11ea-918f-ebe98c2de40a.png"/>
|
||||
<img src="https://github.com/user-attachments/assets/5cd63373-e806-474f-94ec-6e04963bf90f"/>
|
||||
</br>
|
||||
<img src="https://img.shields.io/github/v/release/k4yt3x/video2x?style=flat-square"/>
|
||||
<img src="https://img.shields.io/github/actions/workflow/status/k4yt3x/video2x/build.yml?label=Build&style=flat-square"/>
|
||||
<img src="https://img.shields.io/github/downloads/k4yt3x/video2x/total?style=flat-square"/>
|
||||
<img src="https://img.shields.io/github/license/k4yt3x/video2x?style=flat-square"/>
|
||||
<img src="https://img.shields.io/badge/dynamic/json?color=%23e85b46&label=Patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F4507807&style=flat-square"/>
|
||||
</p>
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
> [!IMPORTANT]
|
||||
> Versions 4 and 5 have reached end-of-life (EOL) status. Due to limited development resources, issues related to any version earlier than 6 will no longer be addressed.
|
||||
|
||||
<!--# Video2X Lossless Video Enlarger-->
|
||||
## 🌟 Version 6.0.0 Preview
|
||||
|
||||
### Official Discussion Group (Telegram): https://t.me/video2x
|
||||
**[Direct download link for Windows (Installer)](https://github.com/k4yt3x/video2x/releases/download/6.0.0-beta.4/video2x-qt6-windows-amd64-installer.exe)**
|
||||
|
||||
## [Download Stable/Beta Builds](https://github.com/k4yt3x/video2x/releases/latest) (Windows)
|
||||

|
||||
|
||||
- **`Full`**: full package comes pre-configured with **all** dependencies like `FFmpeg` and `waifu2x-caffe`.
|
||||
- **`Light`**: ligt package comes with only Video2X binaries and a template configuration file. The user will either have to run the setup script or install and configure dependencies themselves.
|
||||
Version 6.0.0 is a complete rewrite of this project in C/C++. It:
|
||||
|
||||
Go to the **[Quick Start](#quick-start)** section for usages.
|
||||
- actually works this time, with less pain (in comparison to 5.0.0 beta);
|
||||
- is blazing fast, thanks to the redesigned efficient pipeline and the speed of C/C++;
|
||||
- is cross-platform, available right now for both Windows and Linux;
|
||||
- provides much better output quality with Anime4K v4 and RealESRGAN;
|
||||
- supports Anime4K v4 and all other custom MPV-compatible GLSL shaders;
|
||||
- supports RealESRGAN (all three models) via ncnn and Vulkan;
|
||||
- requires 0 disk space for processing the video, just space for storing the final output; and
|
||||
- exports a standard C function that can be easily integrated in your own projects!
|
||||
|
||||
### [Download From Mirror](https://files.k4yt3x.com/Projects/Video2X/latest)
|
||||
These are available for download now:
|
||||
|
||||
In case you're unable to download the releases directly from GitHub, you can try downloading from the mirror site hosted by the author. Only releases will be updated in this directory, not nightly builds.
|
||||
- **6.0.0 beta Qt6-based GUI for Windows** is on the [releases page](https://github.com/k4yt3x/video2x/releases).
|
||||
- **6.0.0 beta CLI preview builds for Windows and Linux** are on the [releases page](https://github.com/k4yt3x/video2x/releases).
|
||||
- You will need to install the dependencies and set `LD_LIBRARY_PATH` for the Linux build to work. Refer to the [PKGBUILD](PKGBUILD) file to see what needs to be installed.
|
||||
- Alternatively, you can build it from source. Take a look at the [Makefile](Makefile).
|
||||
- 6.0.0 beta AUR package for Arch Linux (`video2x-git`).
|
||||
- 6.0.0 beta [container image](https://github.com/k4yt3x/video2x/pkgs/container/video2x).
|
||||
- A new Colab will be made for 6.0.0 at a later time.
|
||||
|
||||
## [Download Nightly Builds](https://github.com/k4yt3x/video2x/actions) (Windows)
|
||||
There is still much to be done and optimize. Stay tuned for more updates. As for why the 5.0.0 branch was abandoned, here are some of the reasons:
|
||||
|
||||
**You need to be logged into GitHub to be able to download GitHub Actions artifacts.**
|
||||
- Wrapped C++ libraries for Python are too painful to build for cross-platform distribution.
|
||||
- Some wrapped C++ libraires exhibited unexpected behaviors.
|
||||
- Running FFmpeg via commands and piping data through stdin/stdout are inefficient.
|
||||
- C/C++ native binaries are much smaller and much more efficient.
|
||||
|
||||
Nightly builds are built automatically every time a new commit is pushed to the master branch. The lates nightly build is always up-to-date with the latest version of the code, but is less stable and may contain bugs. Nightly builds are handled by GitHub's integrated CI/CD tool, GitHub Actions.
|
||||
## [💬 Telegram Discussion Group](https://t.me/video2x)
|
||||
|
||||
To download the latest nightly build, go to the [GitHub Actions](https://github.com/k4yt3x/video2x/actions) tab, enter the last run of workflow "Video2X Nightly Build, and download the artifacts generated from the run.
|
||||
Join our Telegram discussion group to ask any questions you have about Video2X, chat directly with the developers, or discuss about super resolution technologies and the future of Video2X in general.
|
||||
|
||||
## [Docker Image](https://hub.docker.com/r/k4yt3x/video2x)
|
||||
## [🪟 Download Windows Releases](https://github.com/k4yt3x/video2x/releases/tag/4.8.1)
|
||||
|
||||
Video2X Docker images are available on Docker Hub for easy and rapid Video2X deployment on Linux and macOS. If you already have Docker installed, then only one command is needed to start upscaling a video. For more information on how to use Video2X's Docker image, please refer to the [documentations](https://github.com/K4YT3X/video2x/wiki/Docker).
|
||||
The latest Windows release build based on version 4.8.1. Go to the [GUI](https://github.com/k4yt3x/video2x/wiki/GUI) page to see the basic usages of the GUI. Try the [mirror](https://files.k4yt3x.com/Projects/Video2X/latest) if you can't download releases directly from GitHub.
|
||||
|
||||
## [📔 Google Colab](https://colab.research.google.com/drive/1gWEwcA9y57EsxwOjmLNmNMXPsafw0kGo)
|
||||
|
||||
You can use Video2X on [Google Colab](https://colab.research.google.com/) **for free** if you don't have a powerful GPU of your own. You can borrow a powerful GPU (Tesla K80, T4, P4, or P100) on Google's server for free for a maximum of 12 hours per session. **Please use the free resource fairly** and do not create sessions back-to-back and run upscaling 24/7. This might result in you getting banned. You can get [Colab Pro/Pro+](https://colab.research.google.com/signup/pricing) if you'd like to use better GPUs and get longer runtimes. Usage instructions are embedded in the [Colab Notebook](https://colab.research.google.com/drive/1gWEwcA9y57EsxwOjmLNmNMXPsafw0kGo).
|
||||
|
||||
## [📦 Container Image](https://github.com/k4yt3x/video2x/pkgs/container/video2x)
|
||||
|
||||
Video2X container images are available on the GitHub Container Registry for easy deployment on Linux and macOS. If you already have Docker/Podman installed, only one command is needed to start upscaling a video. For more information on how to use Video2X's Docker image, please refer to the [documentations](https://github.com/K4YT3X/video2x/wiki/Container).
|
||||
|
||||
## [📖 Documentations](https://github.com/k4yt3x/video2x/wiki)
|
||||
|
||||
Video2X's documentations are hosted on this repository's [Wiki page](https://github.com/k4yt3x/video2x/wiki). It includes comprehensive explanations for how to use the [GUI](https://github.com/k4yt3x/video2x/wiki/GUI), the [CLI](https://github.com/k4yt3x/video2x/wiki/CLI), the [container image](https://github.com/K4YT3X/video2x/wiki/Container), the [library](https://github.com/k4yt3x/video2x/wiki/Library), and more. The Wiki is open to edits by the community, so you, yes you, can also correct errors or add new contents to the documentations.
|
||||
|
||||
## Introduction
|
||||
|
||||
Video2X is a video/GIF/image upscaling software based on Waifu2X, Anime4K, SRMD and RealSR written in Python 3. It upscales videos, GIFs and images, restoring details from low-resolution inputs. Video2X also accepts GIF input to video output and video input to GIF output.
|
||||
|
||||
Currently, Video2X supports the following drivers (implementations of algorithms).
|
||||
|
||||
- **Waifu2X Caffe**: Caffe implementation of waifu2x
|
||||
- **Waifu2X Converter CPP**: CPP implementation of waifu2x based on OpenCL and OpenCV
|
||||
- **Waifu2X NCNN Vulkan**: NCNN implementation of waifu2x based on Vulkan API
|
||||
- **SRMD NCNN Vulkan**: NCNN implementation of SRMD based on Vulkan API
|
||||
- **RealSR NCNN Vulkan**: NCNN implementation of RealSR based on Vulkan API
|
||||
- **Anime4KCPP**: CPP implementation of Anime4K
|
||||
Video2X is a video/GIF/image upscaling and frame interpolation software written in Python. It can use these following state-of-the-art algorithms to increase the resolution and frame rate of your video/GIF/image. More information about the algorithms that it supports can be found in [the documentations](https://github.com/k4yt3x/video2x/wiki/Algorithms).
|
||||
|
||||
### Video Upscaling
|
||||
|
||||
\
|
||||
*Upscale Comparison Demonstration*
|
||||
_Upscale demo: Spirited Away's movie trailer_
|
||||
|
||||
**You can watch the whole demo video on YouTube: https://youtu.be/mGEfasQl2Zo**
|
||||
- **Spirited Away**: [YouTube](https://youtu.be/mGEfasQl2Zo) | [Bilibili](https://www.bilibili.com/video/BV1V5411471i/)
|
||||
- 360P to 4K
|
||||
- The [original video](https://www.youtube.com/watch?v=ByXuk9QqQkk)'s copyright belongs to 株式会社スタジオジブリ
|
||||
- **Bad Apple!!**: [YouTube](https://youtu.be/A81rW_FI3cw) | [Bilibili](https://www.bilibili.com/video/BV16K411K7ue)
|
||||
- 384P to 4K 120FPS
|
||||
- The [original video](https://www.nicovideo.jp/watch/sm8628149)'s copyright belongs to あにら
|
||||
- **The Pet Girl of Sakurasou**: [YouTube](https://youtu.be/M0vDI1HH2_Y) | [Bilibili](https://www.bilibili.com/video/BV14k4y167KP/)
|
||||
- 240P to 1080P 60FPS
|
||||
- The original video's copyright belongs to ASCII Media Works
|
||||
|
||||
Clip is from trailer of animated movie "千と千尋の神隠し". Copyright belongs to "株式会社スタジオジブリ (STUDIO GHIBLI INC.)". Will delete immediately if use of clip is in violation of copyright.
|
||||
### Standard Test Clip
|
||||
|
||||
### GIF Upscaling
|
||||
The following clip can be used to test if your setup works properly. This is also the standard clip used for running performance benchmarks.
|
||||
|
||||
This original input GIF is 160x120 in size. This image is downsized and accelerated to 20 FPS from its [original image](https://gfycat.com/craftyeasygoingankole-capoo-bug-cat).
|
||||
- [Standard Test Clip (240P)](https://files.k4yt3x.com/Resources/Videos/standard-test.mp4) 4.54 MiB
|
||||
- [waifu2x Upscaled Sample (1080P)](https://files.k4yt3x.com/Resources/Videos/standard-waifu2x.mp4) 4.54 MiB
|
||||
- [Ground Truth (1080P)](https://files.k4yt3x.com/Resources/Videos/standard-original.mp4) 22.2 MiB
|
||||
|
||||
\
|
||||
*Catfru original 160x120 GIF image*
|
||||
|
||||
Below is what it looks like after getting upscaled to 640x480 (4x) using Video2X.
|
||||
|
||||
\
|
||||
*Catfru 4x upscaled GIF*
|
||||
|
||||
### Image Upscaling
|
||||
|
||||
\
|
||||
*Image upscaling example*
|
||||
|
||||
[Original image](https://72915.tumblr.com/post/173793265673) from [nananicu@twitter](https://twitter.com/nananicu/status/994546266968281088), edited by K4YT3X.
|
||||
|
||||
## All Demo Videos
|
||||
|
||||
Below is a list of all the demo videos available.
|
||||
The list is sorted from new to old.
|
||||
|
||||
- **Bad Apple!!**
|
||||
- YouTube: https://youtu.be/-RKLdCELgkQ
|
||||
- Bilibili: https://www.bilibili.com/video/BV1s5411s7xV/
|
||||
- **The Pet Girl of Sakurasou 240P to 1080P 60FPS**
|
||||
- Original name: さくら荘のペットな彼女
|
||||
- YouTube: https://youtu.be/M0vDI1HH2_Y
|
||||
- Bilibili: https://www.bilibili.com/video/BV14k4y167KP/
|
||||
- **Spirited Away (360P to 4K)**
|
||||
- Original name: 千と千尋の神隠し
|
||||
- YouTube: https://youtu.be/mGEfasQl2Zo
|
||||
- Bilibili: https://www.bilibili.com/video/BV1V5411471i/
|
||||
|
||||
---
|
||||
|
||||
## Screenshots
|
||||
|
||||
### Video2X GUI
|
||||
|
||||
\
|
||||
*Video2X GUI Screenshot*
|
||||
|
||||
### Video2X CLI
|
||||
|
||||
\
|
||||
*Video2X CLI Screenshot*
|
||||
|
||||
---
|
||||
|
||||
### Sample Videos
|
||||
|
||||
If you can't find a video clip to begin with, or if you want to see a before-after comparison, we have prepared some sample clips for you. The quick start guide down below will also be based on the name of the sample clips.
|
||||
|
||||
\
|
||||
*Sample Upscale Videos*
|
||||
|
||||
- [Sample Video (240P) 4.54MB](https://files.k4yt3x.com/Resources/Videos/sample_input.mp4)
|
||||
- [Sample Video Upscaled (1080P) 4.54MB](https://files.k4yt3x.com/Resources/Videos/sample_output.mp4)
|
||||
- [Sample Video Original (1080P) 22.2MB](https://files.k4yt3x.com/Resources/Videos/sample_original.mp4)
|
||||
|
||||
Clip is from anime "さくら荘のペットな彼女". Copyright belongs to "株式会社アニプレックス (Aniplex Inc.)". Will delete immediately if use of clip is in violation of copyright.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before running Video2X, you'll need to ensure you have installed the drivers' external dependencies such as GPU drivers.
|
||||
|
||||
- waifu2x-caffe
|
||||
- GPU mode: Nvidia graphics card driver
|
||||
- cuDNN mode: Nvidia CUDA and [cuDNN](https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#install-windows)
|
||||
- Other Drivers
|
||||
- GPU driver if you want to use GPU for processing
|
||||
|
||||
### Running Video2X (GUI)
|
||||
|
||||
The easiest way to run Video2X is to use the full build. Extract the full release zip file and you'll get these files.
|
||||
|
||||
\
|
||||
*Video2X release files*
|
||||
|
||||
Simply double click on video2x_gui.exe to launch the GUI.
|
||||
|
||||
\
|
||||
*Video2X GUI main tab*
|
||||
|
||||
Then, drag the videos you wish to upscale into the window and select the appropriate output path.
|
||||
|
||||
\
|
||||
*Drag and drop file into Video2X GUI*
|
||||
|
||||
Tweak the settings if you want to, then hit the start button at the bottom and the upscale will start. Now you'll just have to wait for it to complete.
|
||||
|
||||
\
|
||||
*Video2X started processing input files*
|
||||
|
||||
### Running Video2X (CLI)
|
||||
|
||||
#### Basic Upscale Example
|
||||
|
||||
This example command below uses `waifu2x-caffe` to enlarge the video `sample-input.mp4` two double its original size.
|
||||
|
||||
```shell
|
||||
python video2x.py -i sample-input.mp4 -o sample-output.mp4 -r 2 -d waifu2x_caffe
|
||||
```
|
||||
|
||||
#### Advanced Upscale Example
|
||||
|
||||
If you would like to tweak engine-specific settings, either specify the corresponding argument after `--`, or edit the corresponding field in the configuration file `video2x.yaml`. **Command line arguments will overwrite default values in the config file.**
|
||||
|
||||
This example below adds enables TTA for `waifu2x-caffe`.
|
||||
|
||||
```shell
|
||||
python video2x.py -i sample-input.mp4 -o sample-output.mp4 -r 2 -d waifu2x_caffe -- --tta 1
|
||||
```
|
||||
|
||||
To see a help page for driver-specific settings, use `-d` to select the driver and append `-- --help` as demonstrated below. This will print all driver-specific settings and descriptions.
|
||||
|
||||
```shell
|
||||
python video2x.py -d waifu2x_caffe -- --help
|
||||
```
|
||||
|
||||
### Running Video2X (Docker)
|
||||
|
||||
Video2X can be deployed via Docker. The following command upscales the video `sample_input.mp4` two times with Waifu2X NCNN Vulkan and outputs the upscaled video to `sample_output.mp4`. For more details on Video2X Docker image usages, please refer to the [documentations](https://github.com/K4YT3X/video2x/wiki/Docker).
|
||||
|
||||
```shell
|
||||
docker run --rm -it --gpus all -v /dev/dri:/dev/dri -v $PWD:/host k4yt3x/video2x:4.6.0 -d waifu2x_ncnn_vulkan -r 2 -i sample_input.mp4 -o sample_output.mp4
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Documentations
|
||||
|
||||
### [Video2X Wiki](https://github.com/k4yt3x/video2x/wiki)
|
||||
|
||||
You can find all detailed user-facing and developer-facing documentations in the [Video2X Wiki](https://github.com/k4yt3x/video2x/wiki). It covers everything from step-by-step instructions for beginners, to the code structure of this program for advanced users and developers. If this README page doesn't answer all your questions, the wiki page is where you should head to.
|
||||
|
||||
### [Step-By-Step Tutorial](https://github.com/k4yt3x/video2x/wiki/Step-By-Step-Tutorial)
|
||||
|
||||
For those who want a detailed walk-through of how to use Video2X, you can head to the [Step-By-Step Tutorial](https://github.com/k4yt3x/video2x/wiki/Step-By-Step-Tutorial) wiki page. It includes almost every step you need to perform in order to enlarge your first video.
|
||||
|
||||
### [Run From Source Code](https://github.com/k4yt3x/video2x/wiki/Run-From-Source-Code)
|
||||
|
||||
This wiki page contains all instructions for how you can run Video2X directly from Python source code.
|
||||
|
||||
### [Drivers](https://github.com/k4yt3x/video2x/wiki/Drivers)
|
||||
|
||||
Go to the [Drivers](https://github.com/k4yt3x/video2x/wiki/Drivers) wiki page if you want to see a detailed description on the different types of drivers implemented by Video2X. This wiki page contains detailed difference between different drivers, and how to download and set each of them up for Video2X.
|
||||
|
||||
### [Q&A](https://github.com/k4yt3x/video2x/wiki/Q&A)
|
||||
|
||||
If you have any questions, first try visiting our [Q&A](https://github.com/k4yt3x/video2x/wiki/Q&A) page to see if your question is answered there. If not, open an issue and we will respond to your questions ASAP. Alternatively, you can also join our [Telegram discussion group](https://t.me/video2x) and ask your questions there.
|
||||
|
||||
### [History](https://github.com/k4yt3x/video2x/wiki/History)
|
||||
|
||||
Are you interested in how the idea of Video2X was born? Do you want to know the stories and histories behind Video2X's development? Come into this page.
|
||||
|
||||
---
|
||||
|
||||
# Full Usage
|
||||
|
||||
## Video2X Options
|
||||
|
||||
### -h, --help
|
||||
show this help message and exit
|
||||
|
||||
### -i INPUT, --input INPUT
|
||||
source video file/directory
|
||||
|
||||
### -o OUTPUT, --output OUTPUT
|
||||
output video file/directory
|
||||
|
||||
### -c CONFIG, --config CONFIG
|
||||
video2x config file path
|
||||
|
||||
### --log LOG
|
||||
log file path (default: program_directory\video2x_%Y-%m-%d_%H-%M-%S.log)
|
||||
|
||||
### --disable_logging
|
||||
disable logging (default: False)
|
||||
|
||||
### -v, --version
|
||||
display version, lawful information and exit
|
||||
|
||||
## Upscaling Options
|
||||
|
||||
### -d DRIVER, --driver DRIVER
|
||||
upscaling driver (default: waifu2x_caffe)
|
||||
|
||||
Available options are:
|
||||
|
||||
- waifu2x_caffe
|
||||
- waifu2x_converter_cpp
|
||||
- waifu2x_ncnn_vulkan
|
||||
- srmd_ncnn_vulkan
|
||||
- realsr_ncnn_vulkan
|
||||
- anime4kcpp
|
||||
|
||||
### -r RATIO, --ratio RATIO
|
||||
scaling ratio
|
||||
|
||||
### -p PROCESSES, --processes PROCESSES
|
||||
number of processes to use for upscaling (default: 1)
|
||||
|
||||
### --preserve_frames
|
||||
preserve extracted and upscaled frames (default: False)
|
||||
|
||||
---
|
||||
The original clip came from the anime "さくら荘のペットな彼女."\
|
||||
Copyright of this clip belongs to 株式会社アニプレックス.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the GNU General Public License Version 3 (GNU GPL v3)
|
||||
https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
This project is licensed under the [GNU Affero General Public License Version 3 (GNU AGPL v3)](https://www.gnu.org/licenses/agpl-3.0.txt)\
|
||||
Copyright (C) 2018-2024 K4YT3X and [contributors](https://github.com/k4yt3x/video2x/graphs/contributors).
|
||||
|
||||

|
||||

|
||||
|
||||
(C) 2018-2020 K4YT3X
|
||||
This project (`libvideo2x`) includes or depends on these following projects:
|
||||
|
||||
## Credits
|
||||
| Project | License |
|
||||
| ----------------------------------------------------------------------------- | --------------- |
|
||||
| [Anime4K](https://github.com/bloc97/Anime4K) | MIT License |
|
||||
| [FFmpeg](https://www.ffmpeg.org/) | LGPLv2.1, GPLv2 |
|
||||
| [Real-ESRGAN ncnn Vulkan](https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan) | MIT License |
|
||||
| [ncnn](https://github.com/Tencent/ncnn) | BSD 3-Clause |
|
||||
|
||||
This project relies on the following software and projects.
|
||||
|
||||
- [FFmpeg](https://www.ffmpeg.org/)
|
||||
- [waifu2x-caffe](https://github.com/lltcggie/waifu2x-caffe)
|
||||
- [waifu2x-converter-cpp](https://github.com/DeadSix27/waifu2x-converter-cpp)
|
||||
- [waifu2x-ncnn-vulkan](https://github.com/nihui/waifu2x-ncnn-vulkan)
|
||||
- [srmd-ncnn-vulkan](https://github.com/nihui/srmd-ncnn-vulkan)
|
||||
- [realsr-ncnn-vulkan](https://github.com/nihui/realsr-ncnn-vulkan)
|
||||
- [Anime4K](https://github.com/bloc97/Anime4K)
|
||||
- [Anime4KCPP](https://github.com/TianZerL/Anime4KCPP)
|
||||
- [Gifski](https://github.com/ImageOptim/gifski)
|
||||
More licensing information can be found in the [NOTICE](NOTICE) file.
|
||||
|
||||
## Special Thanks
|
||||
|
||||
Appreciations given to the following personnel who have contributed significantly to the project (specifically the technical perspective).
|
||||
Appreciations are given to the following personnel who have contributed significantly to the project.
|
||||
|
||||
- [@ArchieMeng](https://github.com/archiemeng)
|
||||
- [@BrianPetkovsek](https://github.com/BrianPetkovsek)
|
||||
- [@sat3ll](https://github.com/sat3ll)
|
||||
- [@ddouglas87](https://github.com/ddouglas87)
|
||||
- [@lhanjian](https://github.com/lhanjian)
|
||||
- [@nihui](https://github.com/nihui)
|
||||
- [@sat3ll](https://github.com/sat3ll)
|
||||
|
||||
## Related Projects
|
||||
## Similar Projects
|
||||
|
||||
- [Dandere2x](https://github.com/CardinalPanda/dandere2x): A lossy video upscaler also built around `waifu2x`, but with video compression techniques to shorten the time needed to process a video.
|
||||
- [Waifu2x-Extension-GUI](https://github.com/AaronFeng753/Waifu2x-Extension-GUI): A similar project that focuses more and only on building a better graphical user interface. It is built using C++ and Qt5, and currently only supports the Windows platform.
|
||||
|
||||
20
_config.yml
20
_config.yml
@@ -1,20 +0,0 @@
|
||||
# site settings
|
||||
locale: "en-US"
|
||||
title: "Video2X"
|
||||
title_separator: "-"
|
||||
subtitle: "Machine learning video/GIF/image upscaling"
|
||||
name: "K4YT3X"
|
||||
description: "An amazing website."
|
||||
url: "https://video2x.org"
|
||||
repository: "k4yt3x/video2x"
|
||||
|
||||
# set rendering style to be GitHub flavor
|
||||
kramdown:
|
||||
input: GFM
|
||||
|
||||
# use Minimal Mistakes theme
|
||||
remote_theme: mmistakes/minimal-mistakes
|
||||
|
||||
# plugin required for the Minimal Mistakes theme
|
||||
plugins:
|
||||
- jekyll-include-cache
|
||||
32
include/getopt.h
Normal file
32
include/getopt.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef __GETOPT_H__
|
||||
#define __GETOPT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int opterr; /* if error message should be printed */
|
||||
extern int optind; /* index into parent argv vector */
|
||||
extern int optopt; /* character checked for validity */
|
||||
extern int optreset; /* reset getopt */
|
||||
extern char *optarg; /* argument associated with option */
|
||||
|
||||
struct option {
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
// int getopt(int, char **, const char *);
|
||||
int getopt_long(int, char **, const char *, const struct option *, int *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GETOPT_H__ */
|
||||
20
include/libvideo2x/conversions.h
Normal file
20
include/libvideo2x/conversions.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef CONVERSIONS_H
|
||||
#define CONVERSIONS_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/frame.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
#include <mat.h>
|
||||
|
||||
// Convert AVFrame to another pixel format
|
||||
AVFrame *convert_avframe_pix_fmt(AVFrame *src_frame, AVPixelFormat pix_fmt);
|
||||
|
||||
// Convert AVFrame to ncnn::Mat
|
||||
ncnn::Mat avframe_to_ncnn_mat(AVFrame *frame);
|
||||
|
||||
// Convert ncnn::Mat to AVFrame
|
||||
AVFrame *ncnn_mat_to_avframe(const ncnn::Mat &mat, AVPixelFormat pix_fmt);
|
||||
|
||||
#endif // CONVERSIONS_H
|
||||
18
include/libvideo2x/decoder.h
Normal file
18
include/libvideo2x/decoder.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef DECODER_H
|
||||
#define DECODER_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
int init_decoder(
|
||||
AVHWDeviceType hw_type,
|
||||
AVBufferRef *hw_ctx,
|
||||
const char *in_fname,
|
||||
AVFormatContext **fmt_ctx,
|
||||
AVCodecContext **dec_ctx,
|
||||
int *vstream_idx
|
||||
);
|
||||
|
||||
#endif // DECODER_H
|
||||
33
include/libvideo2x/encoder.h
Normal file
33
include/libvideo2x/encoder.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef ENCODER_H
|
||||
#define ENCODER_H
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/opt.h>
|
||||
}
|
||||
|
||||
#include "libvideo2x.h"
|
||||
|
||||
int init_encoder(
|
||||
AVBufferRef *hw_ctx,
|
||||
const char *out_fname,
|
||||
AVFormatContext *ifmt_ctx,
|
||||
AVFormatContext **ofmt_ctx,
|
||||
AVCodecContext **enc_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
EncoderConfig *encoder_config,
|
||||
int vstream_idx,
|
||||
int **stream_map
|
||||
);
|
||||
|
||||
int encode_and_write_frame(
|
||||
AVFrame *frame,
|
||||
AVCodecContext *enc_ctx,
|
||||
AVFormatContext *ofmt_ctx,
|
||||
int vstream_idx
|
||||
);
|
||||
|
||||
int flush_encoder(AVCodecContext *enc_ctx, AVFormatContext *ofmt_ctx);
|
||||
|
||||
#endif // ENCODER_H
|
||||
21
include/libvideo2x/filter.h
Normal file
21
include/libvideo2x/filter.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef FILTER_H
|
||||
#define FILTER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
#include <libavutil/buffer.h>
|
||||
}
|
||||
|
||||
// Abstract base class for filters
|
||||
class Filter {
|
||||
public:
|
||||
virtual ~Filter() = default;
|
||||
virtual int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) = 0;
|
||||
virtual int process_frame(AVFrame *in_frame, AVFrame **out_frame) = 0;
|
||||
virtual int flush(std::vector<AVFrame *> &flushed_frames) { return 0; }
|
||||
};
|
||||
|
||||
#endif // FILTER_H
|
||||
12
include/libvideo2x/fsutils.h
Normal file
12
include/libvideo2x/fsutils.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef FSUTILS_H
|
||||
#define FSUTILS_H
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
bool filepath_is_readable(const std::filesystem::path &path);
|
||||
|
||||
std::filesystem::path find_resource_file(const std::filesystem::path &path);
|
||||
|
||||
std::string path_to_string(const std::filesystem::path& path);
|
||||
|
||||
#endif // FSUTILS_H
|
||||
22
include/libvideo2x/libplacebo.h
Normal file
22
include/libvideo2x/libplacebo.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef PLACEBO_H
|
||||
#define PLACEBO_H
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
}
|
||||
|
||||
int init_libplacebo(
|
||||
AVBufferRef *hw_ctx,
|
||||
AVFilterGraph **filter_graph,
|
||||
AVFilterContext **buffersrc_ctx,
|
||||
AVFilterContext **buffersink_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
int out_width,
|
||||
int out_height,
|
||||
const std::filesystem::path &shader_path
|
||||
);
|
||||
|
||||
#endif // PLACEBO_H
|
||||
43
include/libvideo2x/libplacebo_filter.h
Normal file
43
include/libvideo2x/libplacebo_filter.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef LIBPLACEBO_FILTER_H
|
||||
#define LIBPLACEBO_FILTER_H
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavfilter/buffersink.h>
|
||||
#include <libavfilter/buffersrc.h>
|
||||
}
|
||||
|
||||
#include "filter.h"
|
||||
|
||||
// LibplaceboFilter class definition
|
||||
class LibplaceboFilter : public Filter {
|
||||
private:
|
||||
AVFilterGraph *filter_graph;
|
||||
AVFilterContext *buffersrc_ctx;
|
||||
AVFilterContext *buffersink_ctx;
|
||||
int out_width;
|
||||
int out_height;
|
||||
const std::filesystem::path shader_path;
|
||||
AVRational in_time_base;
|
||||
AVRational out_time_base;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
LibplaceboFilter(int width, int height, const std::filesystem::path &shader_path);
|
||||
|
||||
// Destructor
|
||||
virtual ~LibplaceboFilter() override;
|
||||
|
||||
// Initializes the filter with decoder and encoder contexts
|
||||
int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) override;
|
||||
|
||||
// Processes an input frame and returns the processed frame
|
||||
int process_frame(AVFrame *in_frame, AVFrame **out_frame) override;
|
||||
|
||||
// Flushes any remaining frames
|
||||
int flush(std::vector<AVFrame *> &flushed_frames) override;
|
||||
};
|
||||
|
||||
#endif // LIBPLACEBO_FILTER_H
|
||||
104
include/libvideo2x/libvideo2x.h
Normal file
104
include/libvideo2x/libvideo2x.h
Normal file
@@ -0,0 +1,104 @@
|
||||
#ifndef LIBVIDEO2X_H
|
||||
#define LIBVIDEO2X_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef LIBVIDEO2X_EXPORTS
|
||||
#define LIBVIDEO2X_API __declspec(dllexport)
|
||||
#else
|
||||
#define LIBVIDEO2X_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define LIBVIDEO2X_API
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
// Enum to specify filter type
|
||||
enum FilterType {
|
||||
FILTER_LIBPLACEBO,
|
||||
FILTER_REALESRGAN
|
||||
};
|
||||
|
||||
// Enum to specify log level
|
||||
enum Libvideo2xLogLevel {
|
||||
LIBVIDEO2X_LOG_LEVEL_TRACE,
|
||||
LIBVIDEO2X_LOG_LEVEL_DEBUG,
|
||||
LIBVIDEO2X_LOG_LEVEL_INFO,
|
||||
LIBVIDEO2X_LOG_LEVEL_WARNING,
|
||||
LIBVIDEO2X_LOG_LEVEL_ERROR,
|
||||
LIBVIDEO2X_LOG_LEVEL_CRITICAL,
|
||||
LIBVIDEO2X_LOG_LEVEL_OFF
|
||||
};
|
||||
|
||||
// Configuration for Libplacebo filter
|
||||
struct LibplaceboConfig {
|
||||
int out_width;
|
||||
int out_height;
|
||||
const char *shader_path;
|
||||
};
|
||||
|
||||
// Configuration for RealESRGAN filter
|
||||
struct RealESRGANConfig {
|
||||
int gpuid;
|
||||
bool tta_mode;
|
||||
int scaling_factor;
|
||||
const char *model;
|
||||
};
|
||||
|
||||
// Unified filter configuration
|
||||
struct FilterConfig {
|
||||
enum FilterType filter_type;
|
||||
union {
|
||||
struct LibplaceboConfig libplacebo;
|
||||
struct RealESRGANConfig realesrgan;
|
||||
} config;
|
||||
};
|
||||
|
||||
// Encoder configuration
|
||||
struct EncoderConfig {
|
||||
int out_width;
|
||||
int out_height;
|
||||
bool copy_streams;
|
||||
enum AVCodecID codec;
|
||||
enum AVPixelFormat pix_fmt;
|
||||
const char *preset;
|
||||
int64_t bit_rate;
|
||||
float crf;
|
||||
};
|
||||
|
||||
// Video processing context
|
||||
struct VideoProcessingContext {
|
||||
int64_t processed_frames;
|
||||
int64_t total_frames;
|
||||
time_t start_time;
|
||||
bool pause;
|
||||
bool abort;
|
||||
bool completed;
|
||||
};
|
||||
|
||||
// C-compatible process_video function
|
||||
LIBVIDEO2X_API int process_video(
|
||||
const char *in_fname,
|
||||
const char *out_fname,
|
||||
enum Libvideo2xLogLevel log_level,
|
||||
bool benchmark,
|
||||
enum AVHWDeviceType hw_device_type,
|
||||
const struct FilterConfig *filter_config,
|
||||
struct EncoderConfig *encoder_config,
|
||||
struct VideoProcessingContext *proc_ctx
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LIBVIDEO2X_H
|
||||
48
include/libvideo2x/realesrgan_filter.h
Normal file
48
include/libvideo2x/realesrgan_filter.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef REALSRGAN_FILTER_H
|
||||
#define REALSRGAN_FILTER_H
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
#include "filter.h"
|
||||
#include "realesrgan.h"
|
||||
|
||||
// RealesrganFilter class definition
|
||||
class RealesrganFilter : public Filter {
|
||||
private:
|
||||
RealESRGAN *realesrgan;
|
||||
int gpuid;
|
||||
bool tta_mode;
|
||||
int scaling_factor;
|
||||
const char *model;
|
||||
const std::filesystem::path custom_model_param_path;
|
||||
const std::filesystem::path custom_model_bin_path;
|
||||
AVRational in_time_base;
|
||||
AVRational out_time_base;
|
||||
AVPixelFormat out_pix_fmt;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
RealesrganFilter(
|
||||
int gpuid = 0,
|
||||
bool tta_mode = false,
|
||||
int scaling_factor = 4,
|
||||
const char *model = "realesr-animevideov3",
|
||||
const std::filesystem::path custom_model_param_path = std::filesystem::path(),
|
||||
const std::filesystem::path custom_model_bin_path = std::filesystem::path()
|
||||
);
|
||||
|
||||
// Destructor
|
||||
virtual ~RealesrganFilter() override;
|
||||
|
||||
// Initializes the filter with decoder and encoder contexts
|
||||
int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) override;
|
||||
|
||||
// Processes an input frame and returns the processed frame
|
||||
int process_frame(AVFrame *in_frame, AVFrame **out_frame) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
6
include/libvideo2x/version.h.in
Normal file
6
include/libvideo2x/version.h.in
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define LIBVIDEO2X_VERSION_STRING "@PROJECT_VERSION@"
|
||||
|
||||
#endif // VERSION_H
|
||||
2585
models/libplacebo/anime4k-a+a.glsl
Normal file
2585
models/libplacebo/anime4k-a+a.glsl
Normal file
File diff suppressed because it is too large
Load Diff
2309
models/libplacebo/anime4k-a.glsl
Normal file
2309
models/libplacebo/anime4k-a.glsl
Normal file
File diff suppressed because it is too large
Load Diff
2585
models/libplacebo/anime4k-b+b.glsl
Normal file
2585
models/libplacebo/anime4k-b+b.glsl
Normal file
File diff suppressed because it is too large
Load Diff
2309
models/libplacebo/anime4k-b.glsl
Normal file
2309
models/libplacebo/anime4k-b.glsl
Normal file
File diff suppressed because it is too large
Load Diff
1711
models/libplacebo/anime4k-c+a.glsl
Normal file
1711
models/libplacebo/anime4k-c+a.glsl
Normal file
File diff suppressed because it is too large
Load Diff
1435
models/libplacebo/anime4k-c.glsl
Normal file
1435
models/libplacebo/anime4k-c.glsl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
models/realesrgan/realesr-animevideov3-x2.bin
Normal file
BIN
models/realesrgan/realesr-animevideov3-x2.bin
Normal file
Binary file not shown.
43
models/realesrgan/realesr-animevideov3-x2.param
Normal file
43
models/realesrgan/realesr-animevideov3-x2.param
Normal file
@@ -0,0 +1,43 @@
|
||||
7767517
|
||||
41 42
|
||||
Input input.1 0 1 data
|
||||
Split splitncnn_input0 1 2 data input.1_splitncnn_0 input.1_splitncnn_1
|
||||
Convolution Conv_0 1 1 input.1_splitncnn_1 54 0=64 1=3 4=1 5=1 6=1728
|
||||
PReLU PRelu_1 1 1 54 56 0=64
|
||||
Convolution Conv_2 1 1 56 57 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_3 1 1 57 59 0=64
|
||||
Convolution Conv_4 1 1 59 60 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_5 1 1 60 62 0=64
|
||||
Convolution Conv_6 1 1 62 63 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_7 1 1 63 65 0=64
|
||||
Convolution Conv_8 1 1 65 66 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_9 1 1 66 68 0=64
|
||||
Convolution Conv_10 1 1 68 69 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_11 1 1 69 71 0=64
|
||||
Convolution Conv_12 1 1 71 72 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_13 1 1 72 74 0=64
|
||||
Convolution Conv_14 1 1 74 75 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_15 1 1 75 77 0=64
|
||||
Convolution Conv_16 1 1 77 78 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_17 1 1 78 80 0=64
|
||||
Convolution Conv_18 1 1 80 81 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_19 1 1 81 83 0=64
|
||||
Convolution Conv_20 1 1 83 84 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_21 1 1 84 86 0=64
|
||||
Convolution Conv_22 1 1 86 87 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_23 1 1 87 89 0=64
|
||||
Convolution Conv_24 1 1 89 90 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_25 1 1 90 92 0=64
|
||||
Convolution Conv_26 1 1 92 93 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_27 1 1 93 95 0=64
|
||||
Convolution Conv_28 1 1 95 96 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_29 1 1 96 98 0=64
|
||||
Convolution Conv_30 1 1 98 99 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_31 1 1 99 101 0=64
|
||||
Convolution Conv_32 1 1 101 102 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_33 1 1 102 104 0=64
|
||||
Convolution Conv_34 1 1 104 105 0=48 1=3 4=1 5=1 6=27648
|
||||
PixelShuffle DepthToSpace_35 1 1 105 106 0=4
|
||||
Interp Resize_37 1 1 input.1_splitncnn_0 111 0=1 1=4.000000e+00 2=4.000000e+00
|
||||
BinaryOp Add_38 2 1 106 111 112
|
||||
Interp Resize_40 1 1 112 output 0=3 1=5.000000e-01 2=5.000000e-01
|
||||
BIN
models/realesrgan/realesr-animevideov3-x3.bin
Normal file
BIN
models/realesrgan/realesr-animevideov3-x3.bin
Normal file
Binary file not shown.
43
models/realesrgan/realesr-animevideov3-x3.param
Normal file
43
models/realesrgan/realesr-animevideov3-x3.param
Normal file
@@ -0,0 +1,43 @@
|
||||
7767517
|
||||
41 42
|
||||
Input input.1 0 1 data
|
||||
Split splitncnn_input0 1 2 data input.1_splitncnn_0 input.1_splitncnn_1
|
||||
Convolution Conv_0 1 1 input.1_splitncnn_1 54 0=64 1=3 4=1 5=1 6=1728
|
||||
PReLU PRelu_1 1 1 54 56 0=64
|
||||
Convolution Conv_2 1 1 56 57 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_3 1 1 57 59 0=64
|
||||
Convolution Conv_4 1 1 59 60 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_5 1 1 60 62 0=64
|
||||
Convolution Conv_6 1 1 62 63 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_7 1 1 63 65 0=64
|
||||
Convolution Conv_8 1 1 65 66 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_9 1 1 66 68 0=64
|
||||
Convolution Conv_10 1 1 68 69 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_11 1 1 69 71 0=64
|
||||
Convolution Conv_12 1 1 71 72 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_13 1 1 72 74 0=64
|
||||
Convolution Conv_14 1 1 74 75 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_15 1 1 75 77 0=64
|
||||
Convolution Conv_16 1 1 77 78 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_17 1 1 78 80 0=64
|
||||
Convolution Conv_18 1 1 80 81 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_19 1 1 81 83 0=64
|
||||
Convolution Conv_20 1 1 83 84 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_21 1 1 84 86 0=64
|
||||
Convolution Conv_22 1 1 86 87 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_23 1 1 87 89 0=64
|
||||
Convolution Conv_24 1 1 89 90 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_25 1 1 90 92 0=64
|
||||
Convolution Conv_26 1 1 92 93 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_27 1 1 93 95 0=64
|
||||
Convolution Conv_28 1 1 95 96 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_29 1 1 96 98 0=64
|
||||
Convolution Conv_30 1 1 98 99 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_31 1 1 99 101 0=64
|
||||
Convolution Conv_32 1 1 101 102 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_33 1 1 102 104 0=64
|
||||
Convolution Conv_34 1 1 104 105 0=48 1=3 4=1 5=1 6=27648
|
||||
PixelShuffle DepthToSpace_35 1 1 105 106 0=4
|
||||
Interp Resize_37 1 1 input.1_splitncnn_0 111 0=1 1=4.000000e+00 2=4.000000e+00
|
||||
BinaryOp Add_38 2 1 106 111 112
|
||||
Interp Resize_40 1 1 112 output 0=3 1=7.500000e-01 2=7.500000e-01
|
||||
BIN
models/realesrgan/realesr-animevideov3-x4.bin
Normal file
BIN
models/realesrgan/realesr-animevideov3-x4.bin
Normal file
Binary file not shown.
42
models/realesrgan/realesr-animevideov3-x4.param
Normal file
42
models/realesrgan/realesr-animevideov3-x4.param
Normal file
@@ -0,0 +1,42 @@
|
||||
7767517
|
||||
40 41
|
||||
Input input.1 0 1 data
|
||||
Split splitncnn_input0 1 2 data input.1_splitncnn_0 input.1_splitncnn_1
|
||||
Convolution Conv_0 1 1 input.1_splitncnn_1 54 0=64 1=3 4=1 5=1 6=1728
|
||||
PReLU PRelu_1 1 1 54 56 0=64
|
||||
Convolution Conv_2 1 1 56 57 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_3 1 1 57 59 0=64
|
||||
Convolution Conv_4 1 1 59 60 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_5 1 1 60 62 0=64
|
||||
Convolution Conv_6 1 1 62 63 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_7 1 1 63 65 0=64
|
||||
Convolution Conv_8 1 1 65 66 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_9 1 1 66 68 0=64
|
||||
Convolution Conv_10 1 1 68 69 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_11 1 1 69 71 0=64
|
||||
Convolution Conv_12 1 1 71 72 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_13 1 1 72 74 0=64
|
||||
Convolution Conv_14 1 1 74 75 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_15 1 1 75 77 0=64
|
||||
Convolution Conv_16 1 1 77 78 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_17 1 1 78 80 0=64
|
||||
Convolution Conv_18 1 1 80 81 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_19 1 1 81 83 0=64
|
||||
Convolution Conv_20 1 1 83 84 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_21 1 1 84 86 0=64
|
||||
Convolution Conv_22 1 1 86 87 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_23 1 1 87 89 0=64
|
||||
Convolution Conv_24 1 1 89 90 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_25 1 1 90 92 0=64
|
||||
Convolution Conv_26 1 1 92 93 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_27 1 1 93 95 0=64
|
||||
Convolution Conv_28 1 1 95 96 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_29 1 1 96 98 0=64
|
||||
Convolution Conv_30 1 1 98 99 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_31 1 1 99 101 0=64
|
||||
Convolution Conv_32 1 1 101 102 0=64 1=3 4=1 5=1 6=36864
|
||||
PReLU PRelu_33 1 1 102 104 0=64
|
||||
Convolution Conv_34 1 1 104 105 0=48 1=3 4=1 5=1 6=27648
|
||||
PixelShuffle DepthToSpace_35 1 1 105 106 0=4
|
||||
Interp Resize_37 1 1 input.1_splitncnn_0 111 0=1 1=4.000000e+00 2=4.000000e+00
|
||||
BinaryOp Add_38 2 1 106 111 output
|
||||
BIN
models/realesrgan/realesrgan-plus-anime-x4.bin
Normal file
BIN
models/realesrgan/realesrgan-plus-anime-x4.bin
Normal file
Binary file not shown.
270
models/realesrgan/realesrgan-plus-anime-x4.param
Normal file
270
models/realesrgan/realesrgan-plus-anime-x4.param
Normal file
@@ -0,0 +1,270 @@
|
||||
7767517
|
||||
268 473
|
||||
Input input.1 0 1 data
|
||||
Convolution Conv_0 1 1 data 193 0=64 1=3 4=1 5=1 6=1728
|
||||
Split splitncnn_0 1 8 193 193_splitncnn_0 193_splitncnn_1 193_splitncnn_2 193_splitncnn_3 193_splitncnn_4 193_splitncnn_5 193_splitncnn_6 193_splitncnn_7
|
||||
Convolution Conv_1 1 1 193_splitncnn_7 195 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_1 1 4 195 195_splitncnn_0 195_splitncnn_1 195_splitncnn_2 195_splitncnn_3
|
||||
Concat Concat_3 2 1 193_splitncnn_6 195_splitncnn_3 196
|
||||
Convolution Conv_4 1 1 196 198 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_2 1 3 198 198_splitncnn_0 198_splitncnn_1 198_splitncnn_2
|
||||
Concat Concat_6 3 1 193_splitncnn_5 195_splitncnn_2 198_splitncnn_2 199
|
||||
Convolution Conv_7 1 1 199 201 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_3 1 2 201 201_splitncnn_0 201_splitncnn_1
|
||||
Concat Concat_9 4 1 193_splitncnn_4 195_splitncnn_1 198_splitncnn_1 201_splitncnn_1 202
|
||||
Convolution Conv_10 1 1 202 204 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_12 5 1 193_splitncnn_3 195_splitncnn_0 198_splitncnn_0 201_splitncnn_0 204 205
|
||||
Convolution Conv_13 1 1 205 206 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_16 2 1 206 193_splitncnn_2 209 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_4 1 6 209 209_splitncnn_0 209_splitncnn_1 209_splitncnn_2 209_splitncnn_3 209_splitncnn_4 209_splitncnn_5
|
||||
Convolution Conv_17 1 1 209_splitncnn_5 211 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_5 1 4 211 211_splitncnn_0 211_splitncnn_1 211_splitncnn_2 211_splitncnn_3
|
||||
Concat Concat_19 2 1 209_splitncnn_4 211_splitncnn_3 212
|
||||
Convolution Conv_20 1 1 212 214 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_6 1 3 214 214_splitncnn_0 214_splitncnn_1 214_splitncnn_2
|
||||
Concat Concat_22 3 1 209_splitncnn_3 211_splitncnn_2 214_splitncnn_2 215
|
||||
Convolution Conv_23 1 1 215 217 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_7 1 2 217 217_splitncnn_0 217_splitncnn_1
|
||||
Concat Concat_25 4 1 209_splitncnn_2 211_splitncnn_1 214_splitncnn_1 217_splitncnn_1 218
|
||||
Convolution Conv_26 1 1 218 220 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_28 5 1 209_splitncnn_1 211_splitncnn_0 214_splitncnn_0 217_splitncnn_0 220 221
|
||||
Convolution Conv_29 1 1 221 222 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_32 2 1 222 209_splitncnn_0 225 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_8 1 6 225 225_splitncnn_0 225_splitncnn_1 225_splitncnn_2 225_splitncnn_3 225_splitncnn_4 225_splitncnn_5
|
||||
Convolution Conv_33 1 1 225_splitncnn_5 227 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_9 1 4 227 227_splitncnn_0 227_splitncnn_1 227_splitncnn_2 227_splitncnn_3
|
||||
Concat Concat_35 2 1 225_splitncnn_4 227_splitncnn_3 228
|
||||
Convolution Conv_36 1 1 228 230 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_10 1 3 230 230_splitncnn_0 230_splitncnn_1 230_splitncnn_2
|
||||
Concat Concat_38 3 1 225_splitncnn_3 227_splitncnn_2 230_splitncnn_2 231
|
||||
Convolution Conv_39 1 1 231 233 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_11 1 2 233 233_splitncnn_0 233_splitncnn_1
|
||||
Concat Concat_41 4 1 225_splitncnn_2 227_splitncnn_1 230_splitncnn_1 233_splitncnn_1 234
|
||||
Convolution Conv_42 1 1 234 236 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_44 5 1 225_splitncnn_1 227_splitncnn_0 230_splitncnn_0 233_splitncnn_0 236 237
|
||||
Convolution Conv_45 1 1 237 238 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_48 2 1 238 225_splitncnn_0 241 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_51 2 1 241 193_splitncnn_1 244 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_12 1 7 244 244_splitncnn_0 244_splitncnn_1 244_splitncnn_2 244_splitncnn_3 244_splitncnn_4 244_splitncnn_5 244_splitncnn_6
|
||||
Convolution Conv_52 1 1 244_splitncnn_6 246 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_13 1 4 246 246_splitncnn_0 246_splitncnn_1 246_splitncnn_2 246_splitncnn_3
|
||||
Concat Concat_54 2 1 244_splitncnn_5 246_splitncnn_3 247
|
||||
Convolution Conv_55 1 1 247 249 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_14 1 3 249 249_splitncnn_0 249_splitncnn_1 249_splitncnn_2
|
||||
Concat Concat_57 3 1 244_splitncnn_4 246_splitncnn_2 249_splitncnn_2 250
|
||||
Convolution Conv_58 1 1 250 252 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_15 1 2 252 252_splitncnn_0 252_splitncnn_1
|
||||
Concat Concat_60 4 1 244_splitncnn_3 246_splitncnn_1 249_splitncnn_1 252_splitncnn_1 253
|
||||
Convolution Conv_61 1 1 253 255 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_63 5 1 244_splitncnn_2 246_splitncnn_0 249_splitncnn_0 252_splitncnn_0 255 256
|
||||
Convolution Conv_64 1 1 256 257 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_67 2 1 257 244_splitncnn_1 260 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_16 1 6 260 260_splitncnn_0 260_splitncnn_1 260_splitncnn_2 260_splitncnn_3 260_splitncnn_4 260_splitncnn_5
|
||||
Convolution Conv_68 1 1 260_splitncnn_5 262 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_17 1 4 262 262_splitncnn_0 262_splitncnn_1 262_splitncnn_2 262_splitncnn_3
|
||||
Concat Concat_70 2 1 260_splitncnn_4 262_splitncnn_3 263
|
||||
Convolution Conv_71 1 1 263 265 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_18 1 3 265 265_splitncnn_0 265_splitncnn_1 265_splitncnn_2
|
||||
Concat Concat_73 3 1 260_splitncnn_3 262_splitncnn_2 265_splitncnn_2 266
|
||||
Convolution Conv_74 1 1 266 268 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_19 1 2 268 268_splitncnn_0 268_splitncnn_1
|
||||
Concat Concat_76 4 1 260_splitncnn_2 262_splitncnn_1 265_splitncnn_1 268_splitncnn_1 269
|
||||
Convolution Conv_77 1 1 269 271 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_79 5 1 260_splitncnn_1 262_splitncnn_0 265_splitncnn_0 268_splitncnn_0 271 272
|
||||
Convolution Conv_80 1 1 272 273 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_83 2 1 273 260_splitncnn_0 276 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_20 1 6 276 276_splitncnn_0 276_splitncnn_1 276_splitncnn_2 276_splitncnn_3 276_splitncnn_4 276_splitncnn_5
|
||||
Convolution Conv_84 1 1 276_splitncnn_5 278 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_21 1 4 278 278_splitncnn_0 278_splitncnn_1 278_splitncnn_2 278_splitncnn_3
|
||||
Concat Concat_86 2 1 276_splitncnn_4 278_splitncnn_3 279
|
||||
Convolution Conv_87 1 1 279 281 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_22 1 3 281 281_splitncnn_0 281_splitncnn_1 281_splitncnn_2
|
||||
Concat Concat_89 3 1 276_splitncnn_3 278_splitncnn_2 281_splitncnn_2 282
|
||||
Convolution Conv_90 1 1 282 284 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_23 1 2 284 284_splitncnn_0 284_splitncnn_1
|
||||
Concat Concat_92 4 1 276_splitncnn_2 278_splitncnn_1 281_splitncnn_1 284_splitncnn_1 285
|
||||
Convolution Conv_93 1 1 285 287 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_95 5 1 276_splitncnn_1 278_splitncnn_0 281_splitncnn_0 284_splitncnn_0 287 288
|
||||
Convolution Conv_96 1 1 288 289 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_99 2 1 289 276_splitncnn_0 292 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_102 2 1 292 244_splitncnn_0 295 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_24 1 7 295 295_splitncnn_0 295_splitncnn_1 295_splitncnn_2 295_splitncnn_3 295_splitncnn_4 295_splitncnn_5 295_splitncnn_6
|
||||
Convolution Conv_103 1 1 295_splitncnn_6 297 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_25 1 4 297 297_splitncnn_0 297_splitncnn_1 297_splitncnn_2 297_splitncnn_3
|
||||
Concat Concat_105 2 1 295_splitncnn_5 297_splitncnn_3 298
|
||||
Convolution Conv_106 1 1 298 300 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_26 1 3 300 300_splitncnn_0 300_splitncnn_1 300_splitncnn_2
|
||||
Concat Concat_108 3 1 295_splitncnn_4 297_splitncnn_2 300_splitncnn_2 301
|
||||
Convolution Conv_109 1 1 301 303 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_27 1 2 303 303_splitncnn_0 303_splitncnn_1
|
||||
Concat Concat_111 4 1 295_splitncnn_3 297_splitncnn_1 300_splitncnn_1 303_splitncnn_1 304
|
||||
Convolution Conv_112 1 1 304 306 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_114 5 1 295_splitncnn_2 297_splitncnn_0 300_splitncnn_0 303_splitncnn_0 306 307
|
||||
Convolution Conv_115 1 1 307 308 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_118 2 1 308 295_splitncnn_1 311 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_28 1 6 311 311_splitncnn_0 311_splitncnn_1 311_splitncnn_2 311_splitncnn_3 311_splitncnn_4 311_splitncnn_5
|
||||
Convolution Conv_119 1 1 311_splitncnn_5 313 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_29 1 4 313 313_splitncnn_0 313_splitncnn_1 313_splitncnn_2 313_splitncnn_3
|
||||
Concat Concat_121 2 1 311_splitncnn_4 313_splitncnn_3 314
|
||||
Convolution Conv_122 1 1 314 316 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_30 1 3 316 316_splitncnn_0 316_splitncnn_1 316_splitncnn_2
|
||||
Concat Concat_124 3 1 311_splitncnn_3 313_splitncnn_2 316_splitncnn_2 317
|
||||
Convolution Conv_125 1 1 317 319 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_31 1 2 319 319_splitncnn_0 319_splitncnn_1
|
||||
Concat Concat_127 4 1 311_splitncnn_2 313_splitncnn_1 316_splitncnn_1 319_splitncnn_1 320
|
||||
Convolution Conv_128 1 1 320 322 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_130 5 1 311_splitncnn_1 313_splitncnn_0 316_splitncnn_0 319_splitncnn_0 322 323
|
||||
Convolution Conv_131 1 1 323 324 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_134 2 1 324 311_splitncnn_0 327 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_32 1 6 327 327_splitncnn_0 327_splitncnn_1 327_splitncnn_2 327_splitncnn_3 327_splitncnn_4 327_splitncnn_5
|
||||
Convolution Conv_135 1 1 327_splitncnn_5 329 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_33 1 4 329 329_splitncnn_0 329_splitncnn_1 329_splitncnn_2 329_splitncnn_3
|
||||
Concat Concat_137 2 1 327_splitncnn_4 329_splitncnn_3 330
|
||||
Convolution Conv_138 1 1 330 332 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_34 1 3 332 332_splitncnn_0 332_splitncnn_1 332_splitncnn_2
|
||||
Concat Concat_140 3 1 327_splitncnn_3 329_splitncnn_2 332_splitncnn_2 333
|
||||
Convolution Conv_141 1 1 333 335 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_35 1 2 335 335_splitncnn_0 335_splitncnn_1
|
||||
Concat Concat_143 4 1 327_splitncnn_2 329_splitncnn_1 332_splitncnn_1 335_splitncnn_1 336
|
||||
Convolution Conv_144 1 1 336 338 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_146 5 1 327_splitncnn_1 329_splitncnn_0 332_splitncnn_0 335_splitncnn_0 338 339
|
||||
Convolution Conv_147 1 1 339 340 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_150 2 1 340 327_splitncnn_0 343 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_153 2 1 343 295_splitncnn_0 346 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_36 1 7 346 346_splitncnn_0 346_splitncnn_1 346_splitncnn_2 346_splitncnn_3 346_splitncnn_4 346_splitncnn_5 346_splitncnn_6
|
||||
Convolution Conv_154 1 1 346_splitncnn_6 348 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_37 1 4 348 348_splitncnn_0 348_splitncnn_1 348_splitncnn_2 348_splitncnn_3
|
||||
Concat Concat_156 2 1 346_splitncnn_5 348_splitncnn_3 349
|
||||
Convolution Conv_157 1 1 349 351 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_38 1 3 351 351_splitncnn_0 351_splitncnn_1 351_splitncnn_2
|
||||
Concat Concat_159 3 1 346_splitncnn_4 348_splitncnn_2 351_splitncnn_2 352
|
||||
Convolution Conv_160 1 1 352 354 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_39 1 2 354 354_splitncnn_0 354_splitncnn_1
|
||||
Concat Concat_162 4 1 346_splitncnn_3 348_splitncnn_1 351_splitncnn_1 354_splitncnn_1 355
|
||||
Convolution Conv_163 1 1 355 357 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_165 5 1 346_splitncnn_2 348_splitncnn_0 351_splitncnn_0 354_splitncnn_0 357 358
|
||||
Convolution Conv_166 1 1 358 359 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_169 2 1 359 346_splitncnn_1 362 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_40 1 6 362 362_splitncnn_0 362_splitncnn_1 362_splitncnn_2 362_splitncnn_3 362_splitncnn_4 362_splitncnn_5
|
||||
Convolution Conv_170 1 1 362_splitncnn_5 364 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_41 1 4 364 364_splitncnn_0 364_splitncnn_1 364_splitncnn_2 364_splitncnn_3
|
||||
Concat Concat_172 2 1 362_splitncnn_4 364_splitncnn_3 365
|
||||
Convolution Conv_173 1 1 365 367 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_42 1 3 367 367_splitncnn_0 367_splitncnn_1 367_splitncnn_2
|
||||
Concat Concat_175 3 1 362_splitncnn_3 364_splitncnn_2 367_splitncnn_2 368
|
||||
Convolution Conv_176 1 1 368 370 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_43 1 2 370 370_splitncnn_0 370_splitncnn_1
|
||||
Concat Concat_178 4 1 362_splitncnn_2 364_splitncnn_1 367_splitncnn_1 370_splitncnn_1 371
|
||||
Convolution Conv_179 1 1 371 373 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_181 5 1 362_splitncnn_1 364_splitncnn_0 367_splitncnn_0 370_splitncnn_0 373 374
|
||||
Convolution Conv_182 1 1 374 375 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_185 2 1 375 362_splitncnn_0 378 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_44 1 6 378 378_splitncnn_0 378_splitncnn_1 378_splitncnn_2 378_splitncnn_3 378_splitncnn_4 378_splitncnn_5
|
||||
Convolution Conv_186 1 1 378_splitncnn_5 380 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_45 1 4 380 380_splitncnn_0 380_splitncnn_1 380_splitncnn_2 380_splitncnn_3
|
||||
Concat Concat_188 2 1 378_splitncnn_4 380_splitncnn_3 381
|
||||
Convolution Conv_189 1 1 381 383 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_46 1 3 383 383_splitncnn_0 383_splitncnn_1 383_splitncnn_2
|
||||
Concat Concat_191 3 1 378_splitncnn_3 380_splitncnn_2 383_splitncnn_2 384
|
||||
Convolution Conv_192 1 1 384 386 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_47 1 2 386 386_splitncnn_0 386_splitncnn_1
|
||||
Concat Concat_194 4 1 378_splitncnn_2 380_splitncnn_1 383_splitncnn_1 386_splitncnn_1 387
|
||||
Convolution Conv_195 1 1 387 389 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_197 5 1 378_splitncnn_1 380_splitncnn_0 383_splitncnn_0 386_splitncnn_0 389 390
|
||||
Convolution Conv_198 1 1 390 391 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_201 2 1 391 378_splitncnn_0 394 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_204 2 1 394 346_splitncnn_0 397 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_48 1 7 397 397_splitncnn_0 397_splitncnn_1 397_splitncnn_2 397_splitncnn_3 397_splitncnn_4 397_splitncnn_5 397_splitncnn_6
|
||||
Convolution Conv_205 1 1 397_splitncnn_6 399 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_49 1 4 399 399_splitncnn_0 399_splitncnn_1 399_splitncnn_2 399_splitncnn_3
|
||||
Concat Concat_207 2 1 397_splitncnn_5 399_splitncnn_3 400
|
||||
Convolution Conv_208 1 1 400 402 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_50 1 3 402 402_splitncnn_0 402_splitncnn_1 402_splitncnn_2
|
||||
Concat Concat_210 3 1 397_splitncnn_4 399_splitncnn_2 402_splitncnn_2 403
|
||||
Convolution Conv_211 1 1 403 405 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_51 1 2 405 405_splitncnn_0 405_splitncnn_1
|
||||
Concat Concat_213 4 1 397_splitncnn_3 399_splitncnn_1 402_splitncnn_1 405_splitncnn_1 406
|
||||
Convolution Conv_214 1 1 406 408 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_216 5 1 397_splitncnn_2 399_splitncnn_0 402_splitncnn_0 405_splitncnn_0 408 409
|
||||
Convolution Conv_217 1 1 409 410 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_220 2 1 410 397_splitncnn_1 413 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_52 1 6 413 413_splitncnn_0 413_splitncnn_1 413_splitncnn_2 413_splitncnn_3 413_splitncnn_4 413_splitncnn_5
|
||||
Convolution Conv_221 1 1 413_splitncnn_5 415 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_53 1 4 415 415_splitncnn_0 415_splitncnn_1 415_splitncnn_2 415_splitncnn_3
|
||||
Concat Concat_223 2 1 413_splitncnn_4 415_splitncnn_3 416
|
||||
Convolution Conv_224 1 1 416 418 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_54 1 3 418 418_splitncnn_0 418_splitncnn_1 418_splitncnn_2
|
||||
Concat Concat_226 3 1 413_splitncnn_3 415_splitncnn_2 418_splitncnn_2 419
|
||||
Convolution Conv_227 1 1 419 421 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_55 1 2 421 421_splitncnn_0 421_splitncnn_1
|
||||
Concat Concat_229 4 1 413_splitncnn_2 415_splitncnn_1 418_splitncnn_1 421_splitncnn_1 422
|
||||
Convolution Conv_230 1 1 422 424 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_232 5 1 413_splitncnn_1 415_splitncnn_0 418_splitncnn_0 421_splitncnn_0 424 425
|
||||
Convolution Conv_233 1 1 425 426 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_236 2 1 426 413_splitncnn_0 429 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_56 1 6 429 429_splitncnn_0 429_splitncnn_1 429_splitncnn_2 429_splitncnn_3 429_splitncnn_4 429_splitncnn_5
|
||||
Convolution Conv_237 1 1 429_splitncnn_5 431 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_57 1 4 431 431_splitncnn_0 431_splitncnn_1 431_splitncnn_2 431_splitncnn_3
|
||||
Concat Concat_239 2 1 429_splitncnn_4 431_splitncnn_3 432
|
||||
Convolution Conv_240 1 1 432 434 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_58 1 3 434 434_splitncnn_0 434_splitncnn_1 434_splitncnn_2
|
||||
Concat Concat_242 3 1 429_splitncnn_3 431_splitncnn_2 434_splitncnn_2 435
|
||||
Convolution Conv_243 1 1 435 437 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_59 1 2 437 437_splitncnn_0 437_splitncnn_1
|
||||
Concat Concat_245 4 1 429_splitncnn_2 431_splitncnn_1 434_splitncnn_1 437_splitncnn_1 438
|
||||
Convolution Conv_246 1 1 438 440 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_248 5 1 429_splitncnn_1 431_splitncnn_0 434_splitncnn_0 437_splitncnn_0 440 441
|
||||
Convolution Conv_249 1 1 441 442 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_252 2 1 442 429_splitncnn_0 445 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_255 2 1 445 397_splitncnn_0 448 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_60 1 7 448 448_splitncnn_0 448_splitncnn_1 448_splitncnn_2 448_splitncnn_3 448_splitncnn_4 448_splitncnn_5 448_splitncnn_6
|
||||
Convolution Conv_256 1 1 448_splitncnn_6 450 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_61 1 4 450 450_splitncnn_0 450_splitncnn_1 450_splitncnn_2 450_splitncnn_3
|
||||
Concat Concat_258 2 1 448_splitncnn_5 450_splitncnn_3 451
|
||||
Convolution Conv_259 1 1 451 453 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_62 1 3 453 453_splitncnn_0 453_splitncnn_1 453_splitncnn_2
|
||||
Concat Concat_261 3 1 448_splitncnn_4 450_splitncnn_2 453_splitncnn_2 454
|
||||
Convolution Conv_262 1 1 454 456 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_63 1 2 456 456_splitncnn_0 456_splitncnn_1
|
||||
Concat Concat_264 4 1 448_splitncnn_3 450_splitncnn_1 453_splitncnn_1 456_splitncnn_1 457
|
||||
Convolution Conv_265 1 1 457 459 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_267 5 1 448_splitncnn_2 450_splitncnn_0 453_splitncnn_0 456_splitncnn_0 459 460
|
||||
Convolution Conv_268 1 1 460 461 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_271 2 1 461 448_splitncnn_1 464 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_64 1 6 464 464_splitncnn_0 464_splitncnn_1 464_splitncnn_2 464_splitncnn_3 464_splitncnn_4 464_splitncnn_5
|
||||
Convolution Conv_272 1 1 464_splitncnn_5 466 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_65 1 4 466 466_splitncnn_0 466_splitncnn_1 466_splitncnn_2 466_splitncnn_3
|
||||
Concat Concat_274 2 1 464_splitncnn_4 466_splitncnn_3 467
|
||||
Convolution Conv_275 1 1 467 469 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_66 1 3 469 469_splitncnn_0 469_splitncnn_1 469_splitncnn_2
|
||||
Concat Concat_277 3 1 464_splitncnn_3 466_splitncnn_2 469_splitncnn_2 470
|
||||
Convolution Conv_278 1 1 470 472 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_67 1 2 472 472_splitncnn_0 472_splitncnn_1
|
||||
Concat Concat_280 4 1 464_splitncnn_2 466_splitncnn_1 469_splitncnn_1 472_splitncnn_1 473
|
||||
Convolution Conv_281 1 1 473 475 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_283 5 1 464_splitncnn_1 466_splitncnn_0 469_splitncnn_0 472_splitncnn_0 475 476
|
||||
Convolution Conv_284 1 1 476 477 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_287 2 1 477 464_splitncnn_0 480 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Split splitncnn_68 1 6 480 480_splitncnn_0 480_splitncnn_1 480_splitncnn_2 480_splitncnn_3 480_splitncnn_4 480_splitncnn_5
|
||||
Convolution Conv_288 1 1 480_splitncnn_5 482 0=32 1=3 4=1 5=1 6=18432 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_69 1 4 482 482_splitncnn_0 482_splitncnn_1 482_splitncnn_2 482_splitncnn_3
|
||||
Concat Concat_290 2 1 480_splitncnn_4 482_splitncnn_3 483
|
||||
Convolution Conv_291 1 1 483 485 0=32 1=3 4=1 5=1 6=27648 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_70 1 3 485 485_splitncnn_0 485_splitncnn_1 485_splitncnn_2
|
||||
Concat Concat_293 3 1 480_splitncnn_3 482_splitncnn_2 485_splitncnn_2 486
|
||||
Convolution Conv_294 1 1 486 488 0=32 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Split splitncnn_71 1 2 488 488_splitncnn_0 488_splitncnn_1
|
||||
Concat Concat_296 4 1 480_splitncnn_2 482_splitncnn_1 485_splitncnn_1 488_splitncnn_1 489
|
||||
Convolution Conv_297 1 1 489 491 0=32 1=3 4=1 5=1 6=46080 9=2 -23310=1,2.000000e-01
|
||||
Concat Concat_299 5 1 480_splitncnn_1 482_splitncnn_0 485_splitncnn_0 488_splitncnn_0 491 492
|
||||
Convolution Conv_300 1 1 492 493 0=64 1=3 4=1 5=1 6=110592
|
||||
Eltwise Add_303 2 1 493 480_splitncnn_0 496 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Eltwise Add_306 2 1 496 448_splitncnn_0 499 0=1 -23301=2,2.000000e-01,1.000000e+00
|
||||
Convolution Conv_307 1 1 499 500 0=64 1=3 4=1 5=1 6=36864
|
||||
BinaryOp Add_308 2 1 193_splitncnn_0 500 501
|
||||
Interp Resize_310 1 1 501 506 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
Convolution Conv_311 1 1 506 508 0=64 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Interp Resize_314 1 1 508 513 0=1 1=2.000000e+00 2=2.000000e+00
|
||||
Convolution Conv_315 1 1 513 515 0=64 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Convolution Conv_317 1 1 515 517 0=64 1=3 4=1 5=1 6=36864 9=2 -23310=1,2.000000e-01
|
||||
Convolution Conv_319 1 1 517 output 0=3 1=3 4=1 5=1 6=1728
|
||||
BIN
models/realesrgan/realesrgan-plus-x4.bin
Normal file
BIN
models/realesrgan/realesrgan-plus-x4.bin
Normal file
Binary file not shown.
1001
models/realesrgan/realesrgan-plus-x4.param
Normal file
1001
models/realesrgan/realesrgan-plus-x4.param
Normal file
File diff suppressed because it is too large
Load Diff
86
scripts/download_merge_anime4k_glsl.py
Executable file
86
scripts/download_merge_anime4k_glsl.py
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
ANIME4K_COMMIT = "master"
|
||||
GITHUB_GLSL_ROOT = (
|
||||
f"https://raw.githubusercontent.com/bloc97/Anime4K/{ANIME4K_COMMIT}/glsl"
|
||||
)
|
||||
SHADERS_DIR = Path(__file__).parent.parent / "models" / "libplacebo"
|
||||
|
||||
|
||||
def download_and_combine_files():
|
||||
modes = {
|
||||
"a": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
"b": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_Soft_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
"c": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale+Denoise/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
"a+a": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_M.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
"b+b": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_Soft_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_Soft_M.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
"c+a": [
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Clamp_Highlights.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale+Denoise/Anime4K_Upscale_Denoise_CNN_x2_VL.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x2.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_AutoDownscalePre_x4.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Restore/Anime4K_Restore_CNN_M.glsl",
|
||||
f"{GITHUB_GLSL_ROOT}/Upscale/Anime4K_Upscale_CNN_x2_M.glsl",
|
||||
],
|
||||
}
|
||||
|
||||
for mode in modes:
|
||||
file_contents = ""
|
||||
for file in modes[mode]:
|
||||
response = requests.get(file, timeout=5)
|
||||
response.raise_for_status()
|
||||
file_contents += response.text + "\n"
|
||||
|
||||
with (SHADERS_DIR / Path(f"anime4k-{mode}.glsl")).open("w") as output_file:
|
||||
output_file.write(file_contents)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# clear shaders directory
|
||||
if SHADERS_DIR.exists():
|
||||
shutil.rmtree(SHADERS_DIR)
|
||||
SHADERS_DIR.mkdir(exist_ok=True)
|
||||
|
||||
# download and combine shaders
|
||||
download_and_combine_files()
|
||||
@@ -1,21 +0,0 @@
|
||||
# Directory Listing
|
||||
|
||||
- [**images**](images): image assets such as executable icons
|
||||
- [**locale**](locale): language locale files (.po, .mo)
|
||||
- [**pyinstaller**](pyinstaller): PyInstaller-specific files
|
||||
- [**wrappers**](wrappers): binary Python wrappers/bindings
|
||||
- [**bilogger.py**](bilogger.py): bidirectional logger
|
||||
- [**build.ps1**](build.ps1): release building script
|
||||
- [**exceptions.py**](exceptions.py): custom exceptions
|
||||
- [**image_cleaner.py**](image_cleaner.py): upscaled images cleaner
|
||||
- [**progress_monitor.py**](progress_monitor.py): upscaling progress monitor
|
||||
- [**requirements.txt**](requirements.txt): Python requirements for pip
|
||||
- [**upscaler.py**](upscaler.py): main upscaler class
|
||||
- [**video2x.pot**](video2x.pot): project i18n POT translation file
|
||||
- [**video2x.py**](video2x.py): command line interface
|
||||
- [**video2x.yaml**](video2x.yaml): configuration file
|
||||
- [**video2x_gui.py**](video2x_gui.py): graphical user interface
|
||||
- [**video2x_gui.pyproject**](video2x_gui.pyproject): QtCreator project file
|
||||
- [**video2x_gui.ui**](video2x_gui.ui): GUI UI file (defines GUI layout)
|
||||
- [**video2x_setup.py**](video2x_setup.py): automatic setup script for Windows
|
||||
- [**video2x_setup_ubuntu.sh**](video2x_setup_ubuntu.sh): automatic setup script for Ubuntu
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Creator: Video2X Bidirectional Logger
|
||||
Author: K4YT3X
|
||||
Date Created: June 4, 2020
|
||||
Last Modified: July 17, 2020
|
||||
"""
|
||||
|
||||
# built-in imports
|
||||
import _io
|
||||
import pathlib
|
||||
|
||||
|
||||
class BiLogger(object):
|
||||
""" A bidirectional logger that both prints the output
|
||||
and log all output to file.
|
||||
|
||||
Original code from: https://stackoverflow.com/a/14906787
|
||||
"""
|
||||
|
||||
def __init__(self, terminal: _io.TextIOWrapper, logfile: pathlib.Path):
|
||||
""" initialize BiLogger
|
||||
|
||||
Args:
|
||||
terminal (_io.TextIOWrapper): original terminal IO wrapper
|
||||
logfile (pathlib.Path): target log file path object
|
||||
"""
|
||||
self.terminal = terminal
|
||||
self.log = logfile.open(mode='a+', encoding='utf-8')
|
||||
|
||||
def write(self, message: str):
|
||||
""" write message to original terminal output and log file
|
||||
|
||||
Args:
|
||||
message (str): message to write
|
||||
"""
|
||||
self.terminal.write(message)
|
||||
self.terminal.flush()
|
||||
self.log.write(message)
|
||||
self.log.flush()
|
||||
|
||||
def flush(self):
|
||||
""" flush logger (for compability only)
|
||||
"""
|
||||
pass
|
||||
@@ -1,96 +0,0 @@
|
||||
<#
|
||||
Name: Video2X Build Script
|
||||
Creator: K4YT3X
|
||||
Date Created: May 6, 2020
|
||||
Last Modified: May 13, 2020
|
||||
|
||||
Description: A PowerShell script that will build Video2X
|
||||
executable (PE) releases automatically using PyInstaller.
|
||||
This script is currently only tuned for K4YT3X's environment.
|
||||
|
||||
To start a PowerShell session with execution policy bypass
|
||||
powershell -ExecutionPolicy Bypass
|
||||
#>
|
||||
|
||||
if ($args.count -ne 1){
|
||||
Write-Host -ForegroundColor White "Usage:`n .\build.ps1 VIDEO2X_VERSION"
|
||||
Exit
|
||||
}
|
||||
|
||||
# version number
|
||||
$SCRIPT_VERSION = "1.0.1"
|
||||
$VIDEO2X_VERSION = $args[0]
|
||||
|
||||
Write-Host -ForegroundColor White "Video2X Building Script Version $($SCRIPT_VERSION)
|
||||
Starting to build Video2X release packages
|
||||
Building Video2X release $($VIDEO2X_VERSION)"
|
||||
|
||||
# build Video2X CLI
|
||||
Write-Host -ForegroundColor White "`nBuilding Video2X CLI"
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="wrappers;wrappers" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x.py
|
||||
|
||||
# build Video2X GUI
|
||||
Write-Host -ForegroundColor White "`nBuilding Video2X GUI"
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--add-data="images;images" `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="video2x_gui.ui;." `
|
||||
--add-data="wrappers;wrappers" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_gui.py
|
||||
|
||||
# build setup script
|
||||
Write-Host -ForegroundColor White "`nBuilding Video2X setup script"
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--additional-hooks-dir "pyinstaller\hooks" `
|
||||
--add-data="locale;locale" `
|
||||
--add-data="pyinstaller\7z1900-extra;7z" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_setup.py
|
||||
|
||||
# remove old builds if found
|
||||
if (Test-Path "$($VIDEO2X_VERSION)" -PathType any) {
|
||||
Remove-Item -path "$($VIDEO2X_VERSION)" -recurse
|
||||
}
|
||||
|
||||
# create build directory
|
||||
New-Item "$($VIDEO2X_VERSION)" -ItemType Directory
|
||||
|
||||
# copy files into corresponding builds
|
||||
# full edition
|
||||
Write-Host -ForegroundColor White "`nCreating full package"
|
||||
New-Item "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-full" -ItemType Directory
|
||||
Copy-Item "dist\video2x.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-full\"
|
||||
Copy-Item "dist\video2x_gui.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-full\"
|
||||
Copy-Item -Path "$env:LOCALAPPDATA\video2x" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-full\dependencies" -Recurse
|
||||
|
||||
# overwrite paths to relative paths
|
||||
(Get-Content "video2x.yaml").replace("%LOCALAPPDATA%\video2x", "dependencies") | Set-Content "video2x.yaml.relative"
|
||||
Move-Item "video2x.yaml.relative" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-full\video2x.yaml"
|
||||
|
||||
# light edition
|
||||
Write-Host -ForegroundColor White "`nCreating light package"
|
||||
New-Item "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light" -ItemType Directory
|
||||
Copy-Item "dist\video2x.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
|
||||
Copy-Item "dist\video2x_gui.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
|
||||
Copy-Item "dist\video2x_setup.exe" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
|
||||
Copy-Item "video2x.yaml" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
|
||||
Copy-Item "requirements.txt" -Destination "$($VIDEO2X_VERSION)\video2x-$($VIDEO2X_VERSION)-win32-light\"
|
||||
|
||||
# clean up temporary files
|
||||
Write-Host -ForegroundColor White "`nDeleting temporary files"
|
||||
$pathsToRemove = "__pycache__", "build", "dist", "*.spec"
|
||||
|
||||
foreach ($path in $pathsToRemove){
|
||||
Write-Host "Removing path: $($path)"
|
||||
Remove-Item -path $path -recurse
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor White "`nBuild script finished"
|
||||
197
src/conversions.cpp
Normal file
197
src/conversions.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
#include "conversions.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
// Convert AVFrame format
|
||||
AVFrame *convert_avframe_pix_fmt(AVFrame *src_frame, AVPixelFormat pix_fmt) {
|
||||
AVFrame *dst_frame = av_frame_alloc();
|
||||
if (dst_frame == nullptr) {
|
||||
spdlog::error("Failed to allocate destination AVFrame.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dst_frame->format = pix_fmt;
|
||||
dst_frame->width = src_frame->width;
|
||||
dst_frame->height = src_frame->height;
|
||||
|
||||
// Allocate memory for the converted frame
|
||||
if (av_frame_get_buffer(dst_frame, 32) < 0) {
|
||||
spdlog::error("Failed to allocate memory for AVFrame.");
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create a SwsContext for pixel format conversion
|
||||
SwsContext *sws_ctx = sws_getContext(
|
||||
src_frame->width,
|
||||
src_frame->height,
|
||||
static_cast<AVPixelFormat>(src_frame->format),
|
||||
dst_frame->width,
|
||||
dst_frame->height,
|
||||
pix_fmt,
|
||||
SWS_BILINEAR,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (sws_ctx == nullptr) {
|
||||
spdlog::error("Failed to initialize swscale context.");
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Perform the conversion
|
||||
sws_scale(
|
||||
sws_ctx,
|
||||
src_frame->data,
|
||||
src_frame->linesize,
|
||||
0,
|
||||
src_frame->height,
|
||||
dst_frame->data,
|
||||
dst_frame->linesize
|
||||
);
|
||||
|
||||
// Clean up
|
||||
sws_freeContext(sws_ctx);
|
||||
|
||||
return dst_frame;
|
||||
}
|
||||
|
||||
// Convert AVFrame to ncnn::Mat by copying the data
|
||||
ncnn::Mat avframe_to_ncnn_mat(AVFrame *frame) {
|
||||
AVFrame *converted_frame = nullptr;
|
||||
|
||||
// Convert to BGR24 format if necessary
|
||||
if (frame->format != AV_PIX_FMT_BGR24) {
|
||||
converted_frame = convert_avframe_pix_fmt(frame, AV_PIX_FMT_BGR24);
|
||||
if (!converted_frame) {
|
||||
spdlog::error("Failed to convert AVFrame to BGR24.");
|
||||
return ncnn::Mat();
|
||||
}
|
||||
} else {
|
||||
// If the frame is already in BGR24, use it directly
|
||||
converted_frame = frame;
|
||||
}
|
||||
|
||||
// Allocate a new ncnn::Mat and copy the data
|
||||
int width = converted_frame->width;
|
||||
int height = converted_frame->height;
|
||||
ncnn::Mat ncnn_image = ncnn::Mat(width, height, static_cast<size_t>(3), 3);
|
||||
|
||||
// Manually copy the pixel data from AVFrame to the new ncnn::Mat
|
||||
const uint8_t *src_data = converted_frame->data[0];
|
||||
for (int y = 0; y < height; y++) {
|
||||
uint8_t *dst_row = ncnn_image.row<uint8_t>(y);
|
||||
const uint8_t *src_row = src_data + y * converted_frame->linesize[0];
|
||||
|
||||
// Copy 3 channels (BGR) per pixel
|
||||
memcpy(dst_row, src_row, static_cast<size_t>(width) * 3);
|
||||
}
|
||||
|
||||
// If we allocated a converted frame, free it
|
||||
if (converted_frame != frame) {
|
||||
av_frame_free(&converted_frame);
|
||||
}
|
||||
|
||||
return ncnn_image;
|
||||
}
|
||||
|
||||
// Convert ncnn::Mat to AVFrame with a specified pixel format (this part is unchanged)
|
||||
AVFrame *ncnn_mat_to_avframe(const ncnn::Mat &mat, AVPixelFormat pix_fmt) {
|
||||
int ret;
|
||||
|
||||
// Step 1: Allocate a destination AVFrame for the specified pixel format
|
||||
AVFrame *dst_frame = av_frame_alloc();
|
||||
if (!dst_frame) {
|
||||
spdlog::error("Failed to allocate destination AVFrame.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dst_frame->format = pix_fmt;
|
||||
dst_frame->width = mat.w;
|
||||
dst_frame->height = mat.h;
|
||||
|
||||
// Allocate memory for the frame buffer
|
||||
if (av_frame_get_buffer(dst_frame, 32) < 0) {
|
||||
spdlog::error("Failed to allocate memory for destination AVFrame.");
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Step 2: Convert ncnn::Mat to BGR AVFrame
|
||||
AVFrame *bgr_frame = av_frame_alloc();
|
||||
if (!bgr_frame) {
|
||||
spdlog::error("Failed to allocate intermediate BGR AVFrame.");
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bgr_frame->format = AV_PIX_FMT_BGR24;
|
||||
bgr_frame->width = mat.w;
|
||||
bgr_frame->height = mat.h;
|
||||
|
||||
// Allocate memory for the intermediate BGR frame
|
||||
if (av_frame_get_buffer(bgr_frame, 32) < 0) {
|
||||
spdlog::error("Failed to allocate memory for BGR AVFrame.");
|
||||
av_frame_free(&dst_frame);
|
||||
av_frame_free(&bgr_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Copy the pixel data from ncnn::Mat to the BGR AVFrame
|
||||
for (int y = 0; y < mat.h; y++) {
|
||||
uint8_t *dst_row = bgr_frame->data[0] + y * bgr_frame->linesize[0];
|
||||
const uint8_t *src_row = mat.row<const uint8_t>(y);
|
||||
|
||||
// Copy 3 channels (BGR) per pixel
|
||||
memcpy(dst_row, src_row, static_cast<size_t>(mat.w) * 3);
|
||||
}
|
||||
|
||||
// Step 3: Convert the BGR frame to the desired pixel format
|
||||
SwsContext *sws_ctx = sws_getContext(
|
||||
bgr_frame->width,
|
||||
bgr_frame->height,
|
||||
AV_PIX_FMT_BGR24,
|
||||
dst_frame->width,
|
||||
dst_frame->height,
|
||||
pix_fmt,
|
||||
SWS_BILINEAR,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (sws_ctx == nullptr) {
|
||||
spdlog::error("Failed to initialize swscale context.");
|
||||
av_frame_free(&bgr_frame);
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Perform the conversion
|
||||
ret = sws_scale(
|
||||
sws_ctx,
|
||||
bgr_frame->data,
|
||||
bgr_frame->linesize,
|
||||
0,
|
||||
bgr_frame->height,
|
||||
dst_frame->data,
|
||||
dst_frame->linesize
|
||||
);
|
||||
|
||||
// Clean up
|
||||
sws_freeContext(sws_ctx);
|
||||
av_frame_free(&bgr_frame);
|
||||
|
||||
if (ret != dst_frame->height) {
|
||||
spdlog::error("Failed to convert BGR AVFrame to destination pixel format.");
|
||||
av_frame_free(&dst_frame);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return dst_frame;
|
||||
}
|
||||
116
src/decoder.cpp
Normal file
116
src/decoder.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
#include "decoder.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
static enum AVPixelFormat hw_pix_fmt = AV_PIX_FMT_NONE;
|
||||
|
||||
// Callback function to choose the hardware-accelerated pixel format
|
||||
static enum AVPixelFormat get_hw_format(AVCodecContext *_, const enum AVPixelFormat *pix_fmts) {
|
||||
for (const enum AVPixelFormat *p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
|
||||
if (*p == hw_pix_fmt) {
|
||||
return *p;
|
||||
}
|
||||
}
|
||||
spdlog::error("Failed to get HW surface format.");
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
int init_decoder(
|
||||
AVHWDeviceType hw_type,
|
||||
AVBufferRef *hw_ctx,
|
||||
const char *in_fname,
|
||||
AVFormatContext **fmt_ctx,
|
||||
AVCodecContext **dec_ctx,
|
||||
int *vstream_idx
|
||||
) {
|
||||
AVFormatContext *ifmt_ctx = NULL;
|
||||
AVCodecContext *codec_ctx = NULL;
|
||||
int ret;
|
||||
|
||||
if ((ret = avformat_open_input(&ifmt_ctx, in_fname, NULL, NULL)) < 0) {
|
||||
spdlog::error("Could not open input file '{}'", in_fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
|
||||
spdlog::error("Failed to retrieve input stream information");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Find the first video stream
|
||||
ret = av_find_best_stream(ifmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Could not find video stream in the input file");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int stream_index = ret;
|
||||
AVStream *video_stream = ifmt_ctx->streams[stream_index];
|
||||
|
||||
// Set up the decoder
|
||||
const AVCodec *decoder = avcodec_find_decoder(video_stream->codecpar->codec_id);
|
||||
if (!decoder) {
|
||||
spdlog::error(
|
||||
"Failed to find decoder for codec ID {}",
|
||||
static_cast<int>(video_stream->codecpar->codec_id)
|
||||
);
|
||||
return AVERROR_DECODER_NOT_FOUND;
|
||||
}
|
||||
|
||||
codec_ctx = avcodec_alloc_context3(decoder);
|
||||
if (!codec_ctx) {
|
||||
spdlog::error("Failed to allocate the decoder context");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// Set hardware device context
|
||||
if (hw_ctx != nullptr) {
|
||||
codec_ctx->hw_device_ctx = av_buffer_ref(hw_ctx);
|
||||
codec_ctx->get_format = get_hw_format;
|
||||
|
||||
// Automatically determine the hardware pixel format
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig *config = avcodec_get_hw_config(decoder, i);
|
||||
if (config == nullptr) {
|
||||
spdlog::error(
|
||||
"Decoder {} does not support device type {}.",
|
||||
decoder->name,
|
||||
av_hwdevice_get_type_name(hw_type)
|
||||
);
|
||||
avcodec_free_context(&codec_ctx);
|
||||
avformat_close_input(&ifmt_ctx);
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX &&
|
||||
config->device_type == hw_type) {
|
||||
hw_pix_fmt = config->pix_fmt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = avcodec_parameters_to_context(codec_ctx, video_stream->codecpar)) < 0) {
|
||||
spdlog::error("Failed to copy decoder parameters to input decoder context");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Set decoder time base and frame rate
|
||||
codec_ctx->time_base = video_stream->time_base;
|
||||
codec_ctx->pkt_timebase = video_stream->time_base;
|
||||
codec_ctx->framerate = av_guess_frame_rate(ifmt_ctx, video_stream, NULL);
|
||||
|
||||
if ((ret = avcodec_open2(codec_ctx, decoder, NULL)) < 0) {
|
||||
spdlog::error("Failed to open decoder for stream #{}", stream_index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*fmt_ctx = ifmt_ctx;
|
||||
*dec_ctx = codec_ctx;
|
||||
*vstream_idx = stream_index;
|
||||
|
||||
return 0;
|
||||
}
|
||||
286
src/encoder.cpp
Normal file
286
src/encoder.cpp
Normal file
@@ -0,0 +1,286 @@
|
||||
#include "encoder.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "conversions.h"
|
||||
|
||||
static enum AVPixelFormat get_encoder_default_pix_fmt(const AVCodec *encoder) {
|
||||
const enum AVPixelFormat *p = encoder->pix_fmts;
|
||||
if (!p) {
|
||||
spdlog::error("No pixel formats supported by encoder");
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
return *p;
|
||||
}
|
||||
|
||||
int init_encoder(
|
||||
AVBufferRef *hw_ctx,
|
||||
const char *out_fname,
|
||||
AVFormatContext *ifmt_ctx,
|
||||
AVFormatContext **ofmt_ctx,
|
||||
AVCodecContext **enc_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
EncoderConfig *encoder_config,
|
||||
int vstream_idx,
|
||||
int **stream_map
|
||||
) {
|
||||
AVFormatContext *fmt_ctx = NULL;
|
||||
AVCodecContext *codec_ctx = NULL;
|
||||
int stream_index = 0;
|
||||
int ret;
|
||||
|
||||
avformat_alloc_output_context2(&fmt_ctx, NULL, NULL, out_fname);
|
||||
if (!fmt_ctx) {
|
||||
spdlog::error("Could not create output context");
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
const AVCodec *encoder = avcodec_find_encoder(encoder_config->codec);
|
||||
if (!encoder) {
|
||||
spdlog::error(
|
||||
"Required video encoder not found for vcodec {}",
|
||||
avcodec_get_name(encoder_config->codec)
|
||||
);
|
||||
return AVERROR_ENCODER_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Create a new video stream in the output file
|
||||
AVStream *out_stream = avformat_new_stream(fmt_ctx, NULL);
|
||||
if (!out_stream) {
|
||||
spdlog::error("Failed to allocate the output video stream");
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
codec_ctx = avcodec_alloc_context3(encoder);
|
||||
if (!codec_ctx) {
|
||||
spdlog::error("Failed to allocate the encoder context");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// Set hardware device context
|
||||
if (hw_ctx != nullptr) {
|
||||
codec_ctx->hw_device_ctx = av_buffer_ref(hw_ctx);
|
||||
}
|
||||
|
||||
// Set encoding parameters
|
||||
codec_ctx->height = encoder_config->out_height;
|
||||
codec_ctx->width = encoder_config->out_width;
|
||||
codec_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
|
||||
codec_ctx->bit_rate = encoder_config->bit_rate;
|
||||
|
||||
// Set the pixel format
|
||||
if (encoder_config->pix_fmt != AV_PIX_FMT_NONE) {
|
||||
// Use the specified pixel format
|
||||
codec_ctx->pix_fmt = encoder_config->pix_fmt;
|
||||
} else {
|
||||
// Fall back to the default pixel format
|
||||
codec_ctx->pix_fmt = get_encoder_default_pix_fmt(encoder);
|
||||
if (codec_ctx->pix_fmt == AV_PIX_FMT_NONE) {
|
||||
spdlog::error("Could not get the default pixel format for the encoder");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the time base
|
||||
codec_ctx->time_base = av_inv_q(dec_ctx->framerate);
|
||||
if (codec_ctx->time_base.num == 0 || codec_ctx->time_base.den == 0) {
|
||||
codec_ctx->time_base = av_inv_q(av_guess_frame_rate(ifmt_ctx, out_stream, NULL));
|
||||
}
|
||||
|
||||
// Set the CRF and preset for any codecs that support it
|
||||
char crf_str[16];
|
||||
snprintf(crf_str, sizeof(crf_str), "%.f", static_cast<double>(encoder_config->crf));
|
||||
av_opt_set(codec_ctx->priv_data, "crf", crf_str, 0);
|
||||
av_opt_set(codec_ctx->priv_data, "preset", encoder_config->preset, 0);
|
||||
|
||||
if (fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||
codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
}
|
||||
|
||||
if ((ret = avcodec_open2(codec_ctx, encoder, NULL)) < 0) {
|
||||
spdlog::error("Cannot open video encoder");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = avcodec_parameters_from_context(out_stream->codecpar, codec_ctx);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Failed to copy encoder parameters to output video stream");
|
||||
return ret;
|
||||
}
|
||||
|
||||
out_stream->time_base = codec_ctx->time_base;
|
||||
|
||||
if (encoder_config->copy_streams) {
|
||||
// Allocate the stream map
|
||||
*stream_map =
|
||||
reinterpret_cast<int *>(av_malloc_array(ifmt_ctx->nb_streams, sizeof(**stream_map)));
|
||||
if (!*stream_map) {
|
||||
spdlog::error("Could not allocate stream mapping");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// Map the video stream
|
||||
(*stream_map)[vstream_idx] = stream_index++;
|
||||
|
||||
// Loop through each stream in the input file
|
||||
for (int i = 0; i < static_cast<int>(ifmt_ctx->nb_streams); i++) {
|
||||
AVStream *in_stream = ifmt_ctx->streams[i];
|
||||
AVCodecParameters *in_codecpar = in_stream->codecpar;
|
||||
|
||||
if (i == vstream_idx) {
|
||||
// Video stream is already handled
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO &&
|
||||
in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
|
||||
(*stream_map)[i] = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create corresponding output stream
|
||||
AVStream *out_copied_stream = avformat_new_stream(fmt_ctx, NULL);
|
||||
if (!out_copied_stream) {
|
||||
spdlog::error("Failed allocating output stream");
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
ret = avcodec_parameters_copy(out_copied_stream->codecpar, in_codecpar);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Failed to copy codec parameters");
|
||||
return ret;
|
||||
}
|
||||
out_copied_stream->codecpar->codec_tag = 0;
|
||||
|
||||
// Copy time base
|
||||
out_copied_stream->time_base = in_stream->time_base;
|
||||
|
||||
(*stream_map)[i] = stream_index++;
|
||||
}
|
||||
}
|
||||
|
||||
// Open the output file
|
||||
if (!(fmt_ctx->oformat->flags & AVFMT_NOFILE)) {
|
||||
ret = avio_open(&fmt_ctx->pb, out_fname, AVIO_FLAG_WRITE);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Could not open output file '{}'", out_fname);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
*ofmt_ctx = fmt_ctx;
|
||||
*enc_ctx = codec_ctx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int encode_and_write_frame(
|
||||
AVFrame *frame,
|
||||
AVCodecContext *enc_ctx,
|
||||
AVFormatContext *ofmt_ctx,
|
||||
int vstream_idx
|
||||
) {
|
||||
AVFrame *converted_frame = nullptr;
|
||||
int ret;
|
||||
|
||||
// Convert the frame to the encoder's pixel format if needed
|
||||
if (frame->format != enc_ctx->pix_fmt) {
|
||||
converted_frame = convert_avframe_pix_fmt(frame, enc_ctx->pix_fmt);
|
||||
if (!converted_frame) {
|
||||
spdlog::error("Error converting frame to encoder's pixel format");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
converted_frame->pts = frame->pts;
|
||||
}
|
||||
|
||||
AVPacket *enc_pkt = av_packet_alloc();
|
||||
if (!enc_pkt) {
|
||||
spdlog::error("Could not allocate AVPacket");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (converted_frame != nullptr) {
|
||||
ret = avcodec_send_frame(enc_ctx, converted_frame);
|
||||
av_frame_free(&converted_frame);
|
||||
} else {
|
||||
ret = avcodec_send_frame(enc_ctx, frame);
|
||||
}
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error sending frame to encoder");
|
||||
av_packet_free(&enc_pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_packet(enc_ctx, enc_pkt);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
||||
av_packet_unref(enc_pkt);
|
||||
break;
|
||||
} else if (ret < 0) {
|
||||
spdlog::error("Error encoding frame");
|
||||
av_packet_free(&enc_pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Rescale packet timestamps
|
||||
av_packet_rescale_ts(
|
||||
enc_pkt, enc_ctx->time_base, ofmt_ctx->streams[vstream_idx]->time_base
|
||||
);
|
||||
enc_pkt->stream_index = vstream_idx;
|
||||
|
||||
// Write the packet
|
||||
ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt);
|
||||
av_packet_unref(enc_pkt);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error muxing packet");
|
||||
av_packet_free(&enc_pkt);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
av_packet_free(&enc_pkt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flush_encoder(AVCodecContext *enc_ctx, AVFormatContext *ofmt_ctx) {
|
||||
int ret;
|
||||
AVPacket *enc_pkt = av_packet_alloc();
|
||||
if (!enc_pkt) {
|
||||
spdlog::error("Could not allocate AVPacket");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
ret = avcodec_send_frame(enc_ctx, NULL);
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_packet(enc_ctx, enc_pkt);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
||||
av_packet_unref(enc_pkt);
|
||||
break;
|
||||
} else if (ret < 0) {
|
||||
spdlog::error("Error encoding frame");
|
||||
av_packet_free(&enc_pkt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Rescale packet timestamps
|
||||
av_packet_rescale_ts(enc_pkt, enc_ctx->time_base, ofmt_ctx->streams[0]->time_base);
|
||||
enc_pkt->stream_index = ofmt_ctx->streams[0]->index;
|
||||
|
||||
// Write the packet
|
||||
ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt);
|
||||
av_packet_unref(enc_pkt);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error muxing packet");
|
||||
av_packet_free(&enc_pkt);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
av_packet_free(&enc_pkt);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Name: Video2X Exceptions
|
||||
Dev: K4YT3X
|
||||
Date Created: December 13, 2018
|
||||
Last Modified: July 27, 2019
|
||||
"""
|
||||
|
||||
|
||||
class ArgumentError(Exception):
|
||||
def __init__(self, message):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class StreamNotFoundError(Exception):
|
||||
def __init__(self, message):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class UnrecognizedDriverError(Exception):
|
||||
def __init__(self, message):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class UnsupportedPixelError(Exception):
|
||||
def __init__(self, message):
|
||||
super().__init__(message)
|
||||
94
src/fsutils.cpp
Normal file
94
src/fsutils.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#include "fsutils.h"
|
||||
|
||||
#if _WIN32
|
||||
#include <windows.h>
|
||||
#include <cwchar>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#if _WIN32
|
||||
static std::filesystem::path get_executable_directory() {
|
||||
std::vector<wchar_t> filepath(MAX_PATH);
|
||||
|
||||
// Get the executable path, expanding the buffer if necessary
|
||||
DWORD size = GetModuleFileNameW(NULL, filepath.data(), static_cast<DWORD>(filepath.size()));
|
||||
if (size == 0) {
|
||||
spdlog::error("Error getting executable path: {}", GetLastError());
|
||||
return std::filesystem::path();
|
||||
}
|
||||
|
||||
// Resize the buffer if necessary
|
||||
while (size >= filepath.size()) {
|
||||
filepath.resize(filepath.size() * 2);
|
||||
size = GetModuleFileNameW(NULL, filepath.data(), static_cast<DWORD>(filepath.size()));
|
||||
if (size == 0) {
|
||||
spdlog::error("Error getting executable path: {}", GetLastError());
|
||||
return std::filesystem::path();
|
||||
}
|
||||
}
|
||||
|
||||
// Create a std::filesystem::path from the filepath and return its parent path
|
||||
std::filesystem::path execpath(filepath.data());
|
||||
return execpath.parent_path();
|
||||
}
|
||||
#else // _WIN32
|
||||
static std::filesystem::path get_executable_directory() {
|
||||
std::error_code ec;
|
||||
std::filesystem::path filepath = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
|
||||
if (ec) {
|
||||
spdlog::error("Error reading /proc/self/exe: {}", ec.message());
|
||||
return std::filesystem::path();
|
||||
}
|
||||
|
||||
return filepath.parent_path();
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
bool filepath_is_readable(const std::filesystem::path &path) {
|
||||
#if _WIN32
|
||||
FILE *fp = _wfopen(path.c_str(), L"rb");
|
||||
#else // _WIN32
|
||||
FILE *fp = fopen(path.c_str(), "rb");
|
||||
#endif // _WIN32
|
||||
if (!fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::filesystem::path find_resource_file(const std::filesystem::path &path) {
|
||||
if (filepath_is_readable(path)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
if (filepath_is_readable(std::filesystem::path("/usr/share/video2x/") / path)) {
|
||||
return std::filesystem::path("/usr/share/video2x/") / path;
|
||||
}
|
||||
|
||||
return get_executable_directory() / path;
|
||||
}
|
||||
|
||||
std::string path_to_string(const std::filesystem::path &path) {
|
||||
#if _WIN32
|
||||
std::wstring wide_path = path.wstring();
|
||||
int buffer_size =
|
||||
WideCharToMultiByte(CP_UTF8, 0, wide_path.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||
if (buffer_size == 0) {
|
||||
return std::string();
|
||||
}
|
||||
std::vector<char> buffer(buffer_size);
|
||||
WideCharToMultiByte(
|
||||
CP_UTF8, 0, wide_path.c_str(), -1, buffer.data(), buffer_size, nullptr, nullptr
|
||||
);
|
||||
return std::string(buffer.data());
|
||||
#else
|
||||
return path.string();
|
||||
#endif
|
||||
}
|
||||
249
src/getopt.c
Normal file
249
src/getopt.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994, 1996
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
/*
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern int optreset;
|
||||
extern char *optarg;
|
||||
*/
|
||||
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = 0; /* character checked for validity */
|
||||
int optreset = 0; /* reset getopt */
|
||||
char *optarg = NULL; /* argument associated with option */
|
||||
|
||||
#ifndef __P
|
||||
#define __P(x) x
|
||||
#endif
|
||||
#define _DIAGASSERT(x) assert(x)
|
||||
|
||||
static char *__progname __P((char *));
|
||||
int getopt_internal __P((int, char *const *, const char *));
|
||||
|
||||
static char *__progname(char *nargv0) {
|
||||
char *tmp;
|
||||
|
||||
_DIAGASSERT(nargv0 != NULL);
|
||||
|
||||
tmp = strrchr(nargv0, '/');
|
||||
if (tmp) {
|
||||
tmp++;
|
||||
} else {
|
||||
tmp = nargv0;
|
||||
}
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int getopt_internal(int nargc, char *const *nargv, const char *ostr) {
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
_DIAGASSERT(nargv != NULL);
|
||||
_DIAGASSERT(ostr != NULL);
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
/* ++optind; */
|
||||
place = EMSG;
|
||||
return (-2);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' || !(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int)'-') {
|
||||
return (-1);
|
||||
}
|
||||
if (!*place) {
|
||||
++optind;
|
||||
}
|
||||
if (opterr && *ostr != ':') {
|
||||
(void)fprintf(stderr, "%s: illegal option -- %c\n", __progname(nargv[0]), optopt);
|
||||
}
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place) {
|
||||
++optind;
|
||||
}
|
||||
} else { /* need an argument */
|
||||
if (*place) { /* no white space */
|
||||
optarg = place;
|
||||
} else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if ((opterr) && (*ostr != ':')) {
|
||||
(void)fprintf(
|
||||
stderr, "%s: option requires an argument -- %c\n", __progname(nargv[0]), optopt
|
||||
);
|
||||
}
|
||||
return (BADARG);
|
||||
} else { /* white space */
|
||||
optarg = nargv[optind];
|
||||
}
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt2(nargc, nargv, ostr)
|
||||
int nargc;
|
||||
char * const *nargv;
|
||||
const char *ostr;
|
||||
{
|
||||
int retval;
|
||||
|
||||
if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) {
|
||||
retval = -1;
|
||||
++optind;
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* getopt_long --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int getopt_long(
|
||||
int nargc,
|
||||
char **nargv,
|
||||
const char *options,
|
||||
const struct option *long_options,
|
||||
int *index
|
||||
) {
|
||||
int retval;
|
||||
|
||||
_DIAGASSERT(nargv != NULL);
|
||||
_DIAGASSERT(options != NULL);
|
||||
_DIAGASSERT(long_options != NULL);
|
||||
/* index may be NULL */
|
||||
|
||||
if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
|
||||
char *current_argv = nargv[optind++] + 2, *has_equal;
|
||||
int i, match = -1;
|
||||
size_t current_argv_len;
|
||||
|
||||
if (*current_argv == '\0') {
|
||||
return (-1);
|
||||
}
|
||||
if ((has_equal = strchr(current_argv, '=')) != NULL) {
|
||||
current_argv_len = has_equal - current_argv;
|
||||
has_equal++;
|
||||
} else {
|
||||
current_argv_len = strlen(current_argv);
|
||||
}
|
||||
|
||||
for (i = 0; long_options[i].name; i++) {
|
||||
if (strncmp(current_argv, long_options[i].name, current_argv_len)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strlen(long_options[i].name) == current_argv_len) {
|
||||
match = i;
|
||||
break;
|
||||
}
|
||||
if (match == -1) {
|
||||
match = i;
|
||||
}
|
||||
}
|
||||
if (match != -1) {
|
||||
if (long_options[match].has_arg == required_argument ||
|
||||
long_options[match].has_arg == optional_argument) {
|
||||
if (has_equal) {
|
||||
optarg = has_equal;
|
||||
} else {
|
||||
optarg = nargv[optind++];
|
||||
}
|
||||
}
|
||||
if ((long_options[match].has_arg == required_argument) && (optarg == NULL)) {
|
||||
/*
|
||||
* Missing argument, leading :
|
||||
* indicates no error should be generated
|
||||
*/
|
||||
if ((opterr) && (*options != ':')) {
|
||||
(void)fprintf(
|
||||
stderr,
|
||||
"%s: option requires an argument -- %s\n",
|
||||
__progname(nargv[0]),
|
||||
current_argv
|
||||
);
|
||||
}
|
||||
return (BADARG);
|
||||
}
|
||||
} else { /* No matching argument */
|
||||
if ((opterr) && (*options != ':')) {
|
||||
(void
|
||||
)fprintf(stderr, "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv);
|
||||
}
|
||||
return (BADCH);
|
||||
}
|
||||
if (long_options[match].flag) {
|
||||
*long_options[match].flag = long_options[match].val;
|
||||
retval = 0;
|
||||
} else {
|
||||
retval = long_options[match].val;
|
||||
}
|
||||
if (index) {
|
||||
*index = match;
|
||||
}
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Name: Video2X Image Cleaner
|
||||
Author: BrianPetkovsek
|
||||
Date Created: March 24, 2019
|
||||
Last Modified: July 27, 2019
|
||||
|
||||
Editor: K4YT3X
|
||||
Last Modified: March 23, 2020
|
||||
|
||||
Editor: 28598519a
|
||||
Last Modified: March 23, 2020
|
||||
|
||||
Description: This class is to remove the extracted frames
|
||||
that have already been upscaled.
|
||||
"""
|
||||
|
||||
# built-in imports
|
||||
import threading
|
||||
import time
|
||||
|
||||
|
||||
class ImageCleaner(threading.Thread):
|
||||
""" Video2X Image Cleaner
|
||||
|
||||
This class creates an object that keeps track of extracted
|
||||
frames that has already been upscaled and are not needed
|
||||
anymore. It then deletes them to save disk space.
|
||||
|
||||
Extends:
|
||||
threading.Thread
|
||||
"""
|
||||
|
||||
def __init__(self, input_directory, output_directory, threads):
|
||||
threading.Thread.__init__(self)
|
||||
self.input_directory = input_directory
|
||||
self.output_directory = output_directory
|
||||
self.threads = threads
|
||||
self.running = False
|
||||
|
||||
def run(self):
|
||||
""" Run image cleaner
|
||||
"""
|
||||
self.running = True
|
||||
|
||||
while self.running:
|
||||
self.remove_upscaled_frames()
|
||||
time.sleep(1)
|
||||
|
||||
def stop(self):
|
||||
""" Stop the image cleaner
|
||||
"""
|
||||
self.running = False
|
||||
self.join()
|
||||
|
||||
def remove_upscaled_frames(self):
|
||||
""" remove frames that have already been upscaled
|
||||
|
||||
This method compares the files in the extracted frames
|
||||
directory with the upscaled frames directory, and removes
|
||||
the frames that has already been upscaled.
|
||||
"""
|
||||
|
||||
# list all images in the extracted frames
|
||||
output_frames = [f.name for f in self.output_directory.iterdir() if f.is_file()]
|
||||
|
||||
# compare and remove frames downscaled images that finished being upscaled
|
||||
# within each thread's extracted frames directory
|
||||
for thread_id in range(self.threads):
|
||||
dir_path = self.input_directory / str(thread_id)
|
||||
|
||||
# for each file within all the directories
|
||||
for file in dir_path.iterdir():
|
||||
# if file also exists in the output directory, then the file
|
||||
# has already been processed, thus not needed anymore
|
||||
if file.is_file() and file.name in output_frames:
|
||||
file.unlink()
|
||||
output_frames.remove(file.name)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 110 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
137
src/libplacebo.cpp
Normal file
137
src/libplacebo.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
#include "libplacebo.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "fsutils.h"
|
||||
|
||||
int init_libplacebo(
|
||||
AVBufferRef *hw_ctx,
|
||||
AVFilterGraph **filter_graph,
|
||||
AVFilterContext **buffersrc_ctx,
|
||||
AVFilterContext **buffersink_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
int out_width,
|
||||
int out_height,
|
||||
const std::filesystem::path &shader_path
|
||||
) {
|
||||
char args[512];
|
||||
int ret;
|
||||
|
||||
AVFilterGraph *graph = avfilter_graph_alloc();
|
||||
if (!graph) {
|
||||
spdlog::error("Unable to create filter graph.");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
// Create buffer source
|
||||
const AVFilter *buffersrc = avfilter_get_by_name("buffer");
|
||||
snprintf(
|
||||
args,
|
||||
sizeof(args),
|
||||
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:frame_rate=%d/%d:"
|
||||
"pixel_aspect=%d/%d:colorspace=%d:range=%d",
|
||||
dec_ctx->width,
|
||||
dec_ctx->height,
|
||||
dec_ctx->pix_fmt,
|
||||
dec_ctx->time_base.num,
|
||||
dec_ctx->time_base.den,
|
||||
dec_ctx->framerate.num,
|
||||
dec_ctx->framerate.den,
|
||||
dec_ctx->sample_aspect_ratio.num,
|
||||
dec_ctx->sample_aspect_ratio.den,
|
||||
dec_ctx->colorspace,
|
||||
dec_ctx->color_range
|
||||
);
|
||||
|
||||
ret = avfilter_graph_create_filter(buffersrc_ctx, buffersrc, "in", args, NULL, graph);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Cannot create buffer source.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AVFilterContext *last_filter = *buffersrc_ctx;
|
||||
|
||||
// Create the libplacebo filter
|
||||
const AVFilter *libplacebo_filter = avfilter_get_by_name("libplacebo");
|
||||
if (!libplacebo_filter) {
|
||||
spdlog::error("Filter 'libplacebo' not found.");
|
||||
avfilter_graph_free(&graph);
|
||||
return AVERROR_FILTER_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Convert the shader path to a string since filter args is const char *
|
||||
std::string shader_path_string = path_to_string(shader_path);
|
||||
|
||||
#ifdef _WIN32
|
||||
// libplacebo does not recognize the Windows '\\' path separator
|
||||
std::replace(shader_path_string.begin(), shader_path_string.end(), '\\', '/');
|
||||
#endif
|
||||
|
||||
// Prepare the filter arguments
|
||||
char filter_args[512];
|
||||
snprintf(
|
||||
filter_args,
|
||||
sizeof(filter_args),
|
||||
"w=%d:h=%d:upscaler=ewa_lanczos:custom_shader_path=%s",
|
||||
out_width,
|
||||
out_height,
|
||||
shader_path_string.c_str()
|
||||
);
|
||||
|
||||
AVFilterContext *libplacebo_ctx;
|
||||
ret = avfilter_graph_create_filter(
|
||||
&libplacebo_ctx, libplacebo_filter, "libplacebo", filter_args, NULL, graph
|
||||
);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Cannot create libplacebo filter.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Set the hardware device context to Vulkan
|
||||
if (hw_ctx != nullptr) {
|
||||
libplacebo_ctx->hw_device_ctx = av_buffer_ref(hw_ctx);
|
||||
}
|
||||
|
||||
// Link buffersrc to libplacebo
|
||||
ret = avfilter_link(last_filter, 0, libplacebo_ctx, 0);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error connecting buffersrc to libplacebo filter.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
last_filter = libplacebo_ctx;
|
||||
|
||||
// Create buffer sink
|
||||
const AVFilter *buffersink = avfilter_get_by_name("buffersink");
|
||||
ret = avfilter_graph_create_filter(buffersink_ctx, buffersink, "out", NULL, NULL, graph);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Cannot create buffer sink.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Link libplacebo to buffersink
|
||||
ret = avfilter_link(last_filter, 0, *buffersink_ctx, 0);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error connecting libplacebo filter to buffersink.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Configure the filter graph
|
||||
ret = avfilter_graph_config(graph, NULL);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error configuring the filter graph.");
|
||||
avfilter_graph_free(&graph);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*filter_graph = graph;
|
||||
return 0;
|
||||
}
|
||||
143
src/libplacebo_filter.cpp
Normal file
143
src/libplacebo_filter.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
#include "libplacebo_filter.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "fsutils.h"
|
||||
#include "libplacebo.h"
|
||||
|
||||
LibplaceboFilter::LibplaceboFilter(
|
||||
int out_width,
|
||||
int out_height,
|
||||
const std::filesystem::path &shader_path
|
||||
)
|
||||
: filter_graph(nullptr),
|
||||
buffersrc_ctx(nullptr),
|
||||
buffersink_ctx(nullptr),
|
||||
out_width(out_width),
|
||||
out_height(out_height),
|
||||
shader_path(std::move(shader_path)) {}
|
||||
|
||||
LibplaceboFilter::~LibplaceboFilter() {
|
||||
if (buffersrc_ctx) {
|
||||
avfilter_free(buffersrc_ctx);
|
||||
buffersrc_ctx = nullptr;
|
||||
}
|
||||
if (buffersink_ctx) {
|
||||
avfilter_free(buffersink_ctx);
|
||||
buffersink_ctx = nullptr;
|
||||
}
|
||||
if (filter_graph) {
|
||||
avfilter_graph_free(&filter_graph);
|
||||
filter_graph = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int LibplaceboFilter::init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) {
|
||||
// Construct the shader path
|
||||
std::filesystem::path shader_full_path;
|
||||
if (filepath_is_readable(shader_path)) {
|
||||
// If the shader path is directly readable, use it
|
||||
shader_full_path = shader_path;
|
||||
} else {
|
||||
// Construct the fallback path using std::filesystem
|
||||
shader_full_path = find_resource_file(
|
||||
std::filesystem::path("models") / "libplacebo" / (shader_path.string() + ".glsl")
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the shader file exists
|
||||
if (!std::filesystem::exists(shader_full_path)) {
|
||||
spdlog::error("libplacebo shader file not found: {}", shader_full_path.string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Save the output time base
|
||||
in_time_base = dec_ctx->time_base;
|
||||
out_time_base = enc_ctx->time_base;
|
||||
|
||||
// Initialize the libplacebo filter
|
||||
int ret = init_libplacebo(
|
||||
hw_ctx,
|
||||
&filter_graph,
|
||||
&buffersrc_ctx,
|
||||
&buffersink_ctx,
|
||||
dec_ctx,
|
||||
out_width,
|
||||
out_height,
|
||||
shader_full_path
|
||||
);
|
||||
|
||||
// Set these resources to nullptr since they are already freed by `avfilter_graph_free`
|
||||
if (ret < 0) {
|
||||
buffersrc_ctx = nullptr;
|
||||
buffersink_ctx = nullptr;
|
||||
filter_graph = nullptr;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LibplaceboFilter::process_frame(AVFrame *in_frame, AVFrame **out_frame) {
|
||||
int ret;
|
||||
|
||||
// Get the filtered frame
|
||||
*out_frame = av_frame_alloc();
|
||||
if (*out_frame == nullptr) {
|
||||
spdlog::error("Failed to allocate output frame");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Feed the frame to the filter graph
|
||||
ret = av_buffersrc_add_frame(buffersrc_ctx, in_frame);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error while feeding the filter graph");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = av_buffersink_get_frame(buffersink_ctx, *out_frame);
|
||||
if (ret < 0) {
|
||||
av_frame_free(out_frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Rescale PTS to encoder's time base
|
||||
(*out_frame)->pts = av_rescale_q((*out_frame)->pts, in_time_base, out_time_base);
|
||||
|
||||
// Return the processed frame to the caller
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LibplaceboFilter::flush(std::vector<AVFrame *> &flushed_frames) {
|
||||
int ret = av_buffersrc_add_frame(buffersrc_ctx, nullptr);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Error while flushing filter graph");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Retrieve all remaining frames from the filter graph
|
||||
while (1) {
|
||||
AVFrame *filt_frame = av_frame_alloc();
|
||||
if (filt_frame == nullptr) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
||||
av_frame_free(&filt_frame);
|
||||
break;
|
||||
}
|
||||
if (ret < 0) {
|
||||
av_frame_free(&filt_frame);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Rescale PTS to encoder's time base
|
||||
filt_frame->pts = av_rescale_q(filt_frame->pts, in_time_base, out_time_base);
|
||||
|
||||
// Add to processed frames
|
||||
flushed_frames.push_back(filt_frame);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
483
src/libvideo2x.cpp
Normal file
483
src/libvideo2x.cpp
Normal file
@@ -0,0 +1,483 @@
|
||||
#include "libvideo2x.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <thread>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <opencv2/videoio.hpp>
|
||||
|
||||
#include "decoder.h"
|
||||
#include "encoder.h"
|
||||
#include "filter.h"
|
||||
#include "libplacebo_filter.h"
|
||||
#include "realesrgan_filter.h"
|
||||
|
||||
/**
|
||||
* @brief Process frames using the selected filter.
|
||||
*
|
||||
* @param[in] encoder_config Encoder configurations
|
||||
* @param[in,out] proc_ctx Struct containing the processing context
|
||||
* @param[in] ifmt_ctx Input format context
|
||||
* @param[in] ofmt_ctx Output format context
|
||||
* @param[in] dec_ctx Decoder context
|
||||
* @param[in] enc_ctx Encoder context
|
||||
* @param[in] filter Filter instance
|
||||
* @param[in] vstream_idx Index of the video stream in the input format context
|
||||
* @param[in] stream_map Array mapping input stream indexes to output stream indexes
|
||||
* @param[in] benchmark Flag to enable benchmarking mode
|
||||
* @return int 0 on success, negative value on error
|
||||
*/
|
||||
static int process_frames(
|
||||
EncoderConfig *encoder_config,
|
||||
VideoProcessingContext *proc_ctx,
|
||||
AVFormatContext *ifmt_ctx,
|
||||
AVFormatContext *ofmt_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
AVCodecContext *enc_ctx,
|
||||
Filter *filter,
|
||||
int vstream_idx,
|
||||
int *stream_map,
|
||||
bool benchmark = false
|
||||
) {
|
||||
int ret;
|
||||
AVPacket packet;
|
||||
std::vector<AVFrame *> flushed_frames;
|
||||
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||
|
||||
// Get the total number of frames in the video with OpenCV
|
||||
spdlog::debug("Unable to estimate total number of frames; reading with OpenCV");
|
||||
cv::VideoCapture cap(ifmt_ctx->url);
|
||||
if (!cap.isOpened()) {
|
||||
spdlog::error("Failed to open video file with OpenCV");
|
||||
return -1;
|
||||
}
|
||||
proc_ctx->total_frames = static_cast<int64_t>(cap.get(cv::CAP_PROP_FRAME_COUNT));
|
||||
cap.release();
|
||||
|
||||
// Check if the total number of frames is still 0
|
||||
if (proc_ctx->total_frames == 0) {
|
||||
spdlog::warn("Unable to determine total number of frames");
|
||||
} else {
|
||||
spdlog::debug("{} frames to process", proc_ctx->total_frames);
|
||||
}
|
||||
|
||||
// Get start time
|
||||
proc_ctx->start_time = time(NULL);
|
||||
if (proc_ctx->start_time == -1) {
|
||||
perror("time");
|
||||
}
|
||||
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
if (frame == nullptr) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Read frames from the input file
|
||||
while (!proc_ctx->abort) {
|
||||
ret = av_read_frame(ifmt_ctx, &packet);
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR_EOF) {
|
||||
spdlog::debug("Reached end of file");
|
||||
break;
|
||||
}
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error reading packet: {}", errbuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (packet.stream_index == vstream_idx) {
|
||||
// Send the packet to the decoder
|
||||
ret = avcodec_send_packet(dec_ctx, &packet);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error sending packet to decoder: {}", errbuf);
|
||||
av_packet_unref(&packet);
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Receive and process frames from the decoder
|
||||
while (!proc_ctx->abort) {
|
||||
// Check if the processing is paused
|
||||
if (proc_ctx->pause) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = avcodec_receive_frame(dec_ctx, frame);
|
||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
||||
spdlog::debug("Frame not ready");
|
||||
break;
|
||||
} else if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error decoding video frame: {}", errbuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Process the frame using the selected filter
|
||||
AVFrame *processed_frame = nullptr;
|
||||
ret = filter->process_frame(frame, &processed_frame);
|
||||
if (ret == 0 && processed_frame != nullptr) {
|
||||
// Encode and write the processed frame
|
||||
if (!benchmark) {
|
||||
ret =
|
||||
encode_and_write_frame(processed_frame, enc_ctx, ofmt_ctx, vstream_idx);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error encoding/writing frame: {}", errbuf);
|
||||
av_frame_free(&processed_frame);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
av_frame_free(&processed_frame);
|
||||
proc_ctx->processed_frames++;
|
||||
} else if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
|
||||
spdlog::error("Filter returned an error");
|
||||
goto end;
|
||||
}
|
||||
|
||||
av_frame_unref(frame);
|
||||
spdlog::debug(
|
||||
"Processed frame {}/{}", proc_ctx->processed_frames, proc_ctx->total_frames
|
||||
);
|
||||
}
|
||||
} else if (encoder_config->copy_streams && stream_map[packet.stream_index] >= 0) {
|
||||
AVStream *in_stream = ifmt_ctx->streams[packet.stream_index];
|
||||
int out_stream_index = stream_map[packet.stream_index];
|
||||
AVStream *out_stream = ofmt_ctx->streams[out_stream_index];
|
||||
|
||||
// Rescale packet timestamps
|
||||
av_packet_rescale_ts(&packet, in_stream->time_base, out_stream->time_base);
|
||||
packet.stream_index = out_stream_index;
|
||||
|
||||
// If copy streams is enabled, copy the packet to the output
|
||||
ret = av_interleaved_write_frame(ofmt_ctx, &packet);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error muxing packet: {}", errbuf);
|
||||
av_packet_unref(&packet);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
av_packet_unref(&packet);
|
||||
}
|
||||
|
||||
// Flush the filter
|
||||
ret = filter->flush(flushed_frames);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error flushing filter: {}", errbuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Encode and write all flushed frames
|
||||
for (AVFrame *&flushed_frame : flushed_frames) {
|
||||
ret = encode_and_write_frame(flushed_frame, enc_ctx, ofmt_ctx, vstream_idx);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error encoding/writing flushed frame: {}", errbuf);
|
||||
av_frame_free(&flushed_frame);
|
||||
flushed_frame = nullptr;
|
||||
goto end;
|
||||
}
|
||||
av_frame_free(&flushed_frame);
|
||||
flushed_frame = nullptr;
|
||||
}
|
||||
|
||||
// Flush the encoder
|
||||
ret = flush_encoder(enc_ctx, ofmt_ctx);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error flushing encoder: {}", errbuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
end:
|
||||
av_frame_free(&frame);
|
||||
// Free any flushed frames not yet freed
|
||||
for (AVFrame *flushed_frame : flushed_frames) {
|
||||
if (flushed_frame) {
|
||||
av_frame_free(&flushed_frame);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Cleanup resources after processing the video
|
||||
static void cleanup(
|
||||
AVFormatContext *ifmt_ctx,
|
||||
AVFormatContext *ofmt_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
AVCodecContext *enc_ctx,
|
||||
AVBufferRef *hw_ctx,
|
||||
int *stream_map,
|
||||
Filter *filter
|
||||
) {
|
||||
if (ifmt_ctx) {
|
||||
avformat_close_input(&ifmt_ctx);
|
||||
ifmt_ctx = nullptr;
|
||||
}
|
||||
if (ofmt_ctx && !(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) {
|
||||
avio_closep(&ofmt_ctx->pb);
|
||||
ofmt_ctx->pb = nullptr;
|
||||
}
|
||||
if (ofmt_ctx) {
|
||||
avformat_free_context(ofmt_ctx);
|
||||
ofmt_ctx = nullptr;
|
||||
}
|
||||
if (dec_ctx) {
|
||||
avcodec_free_context(&dec_ctx);
|
||||
dec_ctx = nullptr;
|
||||
}
|
||||
if (enc_ctx) {
|
||||
avcodec_free_context(&enc_ctx);
|
||||
enc_ctx = nullptr;
|
||||
}
|
||||
if (hw_ctx) {
|
||||
av_buffer_unref(&hw_ctx);
|
||||
hw_ctx = nullptr;
|
||||
}
|
||||
if (stream_map) {
|
||||
av_free(stream_map);
|
||||
stream_map = nullptr;
|
||||
}
|
||||
if (filter) {
|
||||
delete filter;
|
||||
filter = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Process a video file using the selected filter and encoder settings.
|
||||
*
|
||||
* @param[in] in_fname Path to the input video file
|
||||
* @param[in] out_fname Path to the output video file
|
||||
* @param[in] log_level Log level
|
||||
* @param[in] benchmark Flag to enable benchmarking mode
|
||||
* @param[in] hw_type Hardware device type
|
||||
* @param[in] filter_config Filter configurations
|
||||
* @param[in] encoder_config Encoder configurations
|
||||
* @param[in,out] proc_ctx Video processing context
|
||||
* @return int 0 on success, non-zero value on error
|
||||
*/
|
||||
extern "C" int process_video(
|
||||
const char *in_fname,
|
||||
const char *out_fname,
|
||||
Libvideo2xLogLevel log_level,
|
||||
bool benchmark,
|
||||
AVHWDeviceType hw_type,
|
||||
const FilterConfig *filter_config,
|
||||
EncoderConfig *encoder_config,
|
||||
VideoProcessingContext *proc_ctx
|
||||
) {
|
||||
AVFormatContext *ifmt_ctx = nullptr;
|
||||
AVFormatContext *ofmt_ctx = nullptr;
|
||||
AVCodecContext *dec_ctx = nullptr;
|
||||
AVCodecContext *enc_ctx = nullptr;
|
||||
AVBufferRef *hw_ctx = nullptr;
|
||||
int *stream_map = nullptr;
|
||||
Filter *filter = nullptr;
|
||||
int vstream_idx = -1;
|
||||
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
||||
int ret = 0;
|
||||
|
||||
// Set the log level for FFmpeg and spdlog (libvideo2x)
|
||||
switch (log_level) {
|
||||
case LIBVIDEO2X_LOG_LEVEL_TRACE:
|
||||
av_log_set_level(AV_LOG_TRACE);
|
||||
spdlog::set_level(spdlog::level::trace);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_DEBUG:
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
spdlog::set_level(spdlog::level::debug);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_INFO:
|
||||
av_log_set_level(AV_LOG_INFO);
|
||||
spdlog::set_level(spdlog::level::info);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_WARNING:
|
||||
av_log_set_level(AV_LOG_WARNING);
|
||||
spdlog::set_level(spdlog::level::warn);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_ERROR:
|
||||
av_log_set_level(AV_LOG_ERROR);
|
||||
spdlog::set_level(spdlog::level::err);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_CRITICAL:
|
||||
av_log_set_level(AV_LOG_FATAL);
|
||||
spdlog::set_level(spdlog::level::critical);
|
||||
break;
|
||||
case LIBVIDEO2X_LOG_LEVEL_OFF:
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
spdlog::set_level(spdlog::level::off);
|
||||
break;
|
||||
default:
|
||||
av_log_set_level(AV_LOG_INFO);
|
||||
spdlog::set_level(spdlog::level::info);
|
||||
break;
|
||||
}
|
||||
|
||||
// Initialize hardware device context
|
||||
if (hw_type != AV_HWDEVICE_TYPE_NONE) {
|
||||
ret = av_hwdevice_ctx_create(&hw_ctx, hw_type, NULL, NULL, 0);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error initializing hardware device context: {}", errbuf);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize input
|
||||
ret = init_decoder(hw_type, hw_ctx, in_fname, &ifmt_ctx, &dec_ctx, &vstream_idx);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Failed to initialize decoder: {}", errbuf);
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Initialize output based on Libplacebo or RealESRGAN configuration
|
||||
int output_width = 0, output_height = 0;
|
||||
switch (filter_config->filter_type) {
|
||||
case FILTER_LIBPLACEBO:
|
||||
output_width = filter_config->config.libplacebo.out_width;
|
||||
output_height = filter_config->config.libplacebo.out_height;
|
||||
break;
|
||||
case FILTER_REALESRGAN:
|
||||
// Calculate the output dimensions based on the scaling factor
|
||||
output_width = dec_ctx->width * filter_config->config.realesrgan.scaling_factor;
|
||||
output_height = dec_ctx->height * filter_config->config.realesrgan.scaling_factor;
|
||||
break;
|
||||
default:
|
||||
spdlog::error("Unknown filter type");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
spdlog::info("Output video dimensions: {}x{}", output_width, output_height);
|
||||
|
||||
// Initialize output encoder
|
||||
encoder_config->out_width = output_width;
|
||||
encoder_config->out_height = output_height;
|
||||
ret = init_encoder(
|
||||
hw_ctx,
|
||||
out_fname,
|
||||
ifmt_ctx,
|
||||
&ofmt_ctx,
|
||||
&enc_ctx,
|
||||
dec_ctx,
|
||||
encoder_config,
|
||||
vstream_idx,
|
||||
&stream_map
|
||||
);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Failed to initialize encoder: {}", errbuf);
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Write the output file header
|
||||
ret = avformat_write_header(ofmt_ctx, NULL);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error occurred when opening output file: {}", errbuf);
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Create and initialize the appropriate filter
|
||||
switch (filter_config->filter_type) {
|
||||
case FILTER_LIBPLACEBO: {
|
||||
const auto &config = filter_config->config.libplacebo;
|
||||
|
||||
// Validate shader path
|
||||
if (!config.shader_path) {
|
||||
spdlog::error("Shader path must be provided for the libplacebo filter");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Validate output dimensions
|
||||
if (config.out_width <= 0 || config.out_height <= 0) {
|
||||
spdlog::error("Output dimensions must be provided for the libplacebo filter");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
filter = new LibplaceboFilter{
|
||||
config.out_width, config.out_height, std::filesystem::path(config.shader_path)
|
||||
};
|
||||
break;
|
||||
}
|
||||
case FILTER_REALESRGAN: {
|
||||
const auto &config = filter_config->config.realesrgan;
|
||||
|
||||
// Validate model name
|
||||
if (!config.model) {
|
||||
spdlog::error("Model name must be provided for the RealESRGAN filter");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Validate scaling factor
|
||||
if (config.scaling_factor <= 0) {
|
||||
spdlog::error("Scaling factor must be provided for the RealESRGAN filter");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
filter = new RealesrganFilter{
|
||||
config.gpuid, config.tta_mode, config.scaling_factor, config.model
|
||||
};
|
||||
break;
|
||||
}
|
||||
default:
|
||||
spdlog::error("Unknown filter type");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Initialize the filter
|
||||
ret = filter->init(dec_ctx, enc_ctx, hw_ctx);
|
||||
if (ret < 0) {
|
||||
spdlog::error("Failed to initialize filter");
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Process frames
|
||||
ret = process_frames(
|
||||
encoder_config,
|
||||
proc_ctx,
|
||||
ifmt_ctx,
|
||||
ofmt_ctx,
|
||||
dec_ctx,
|
||||
enc_ctx,
|
||||
filter,
|
||||
vstream_idx,
|
||||
stream_map,
|
||||
benchmark
|
||||
);
|
||||
if (ret < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error processing frames: {}", errbuf);
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Write the output file trailer
|
||||
av_write_trailer(ofmt_ctx);
|
||||
|
||||
// Cleanup before returning
|
||||
cleanup(ifmt_ctx, ofmt_ctx, dec_ctx, enc_ctx, hw_ctx, stream_map, filter);
|
||||
|
||||
if (ret < 0 && ret != AVERROR_EOF) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
spdlog::error("Error occurred: {}", errbuf);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,347 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: 2020-05-22 17:51-0400\n"
|
||||
"PO-Revision-Date: 2020-05-22 17:54-0400\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: zh_CN\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: progress_monitor.py:42
|
||||
msgid "Upscaling Progress"
|
||||
msgstr "放大进度"
|
||||
|
||||
#: upscaler.py:110
|
||||
msgid "Specified or default cache directory is a file/link"
|
||||
msgstr "指定或默认的缓存目录是文件/链接"
|
||||
|
||||
#: upscaler.py:116
|
||||
msgid "Creating cache directory {}"
|
||||
msgstr "创建缓存目录 {}"
|
||||
|
||||
#: upscaler.py:119
|
||||
msgid "Unable to create {}"
|
||||
msgstr "无法创建 {}"
|
||||
|
||||
#: upscaler.py:124
|
||||
msgid "Extracted frames are being saved to: {}"
|
||||
msgstr "提取的帧将被保存到:{}"
|
||||
|
||||
#: upscaler.py:126
|
||||
msgid "Upscaled frames are being saved to: {}"
|
||||
msgstr "已放大的帧将被保存到:{}"
|
||||
|
||||
#: upscaler.py:136
|
||||
msgid "Cleaning up cache directory: {}"
|
||||
msgstr "清理缓存目录:{}"
|
||||
|
||||
#: upscaler.py:141
|
||||
msgid "Unable to delete: {}"
|
||||
msgstr "无法删除:{}"
|
||||
|
||||
#: upscaler.py:147 upscaler.py:162 upscaler.py:173
|
||||
msgid "Input and output path type mismatch"
|
||||
msgstr "输入和输出路径类型不匹配"
|
||||
|
||||
#: upscaler.py:148
|
||||
msgid "Input is multiple files but output is not directory"
|
||||
msgstr "输入是多个文件,但输出不是目录"
|
||||
|
||||
#: upscaler.py:152
|
||||
msgid "Input path {} is neither a file nor a directory"
|
||||
msgstr "输入路径 {} 既不是文件也不是目录"
|
||||
|
||||
#: upscaler.py:156 upscaler.py:178
|
||||
msgid "Input directory and output directory cannot be the same"
|
||||
msgstr "输入目录和输出目录不能相同"
|
||||
|
||||
#: upscaler.py:163
|
||||
msgid "Input is single file but output is directory"
|
||||
msgstr "所选的输入路径是单个文件,但输出路径是目录"
|
||||
|
||||
#: upscaler.py:166
|
||||
msgid "No suffix found in output file path"
|
||||
msgstr "在输出文件路径中未找到后缀"
|
||||
|
||||
#: upscaler.py:167
|
||||
msgid "Suffix must be specified"
|
||||
msgstr "必须指定文件后缀"
|
||||
|
||||
#: upscaler.py:174
|
||||
msgid "Input is directory but output is existing single file"
|
||||
msgstr "输入是目录,但输出是现有的单个文件"
|
||||
|
||||
#: upscaler.py:183
|
||||
msgid "Input path is neither a file nor a directory"
|
||||
msgstr "输入路径既不是文件也不是目录"
|
||||
|
||||
#: upscaler.py:192
|
||||
msgid "FFmpeg or FFprobe cannot be found under the specified path"
|
||||
msgstr "在指定的路径下找不到 FFmpeg 或 FFprobe"
|
||||
|
||||
#: upscaler.py:193 upscaler.py:203
|
||||
msgid "Please check the configuration file settings"
|
||||
msgstr "请检查配置文件设置"
|
||||
|
||||
#: upscaler.py:202
|
||||
msgid "Specified driver executable directory doesn't exist"
|
||||
msgstr "指定驱动的可执行文件不存在"
|
||||
|
||||
#: upscaler.py:229
|
||||
msgid "Failed to parse driver argument: {}"
|
||||
msgstr "解析驱动程序参数失败:{}"
|
||||
|
||||
#: upscaler.py:261
|
||||
msgid "Unrecognized driver: {}"
|
||||
msgstr "无法识别的驱动名称:{}"
|
||||
|
||||
#: upscaler.py:301
|
||||
msgid "Starting progress monitor"
|
||||
msgstr "启动进度监视器"
|
||||
|
||||
#: upscaler.py:306
|
||||
msgid "Starting upscaled image cleaner"
|
||||
msgstr "启动已放大图像清理程序"
|
||||
|
||||
#: upscaler.py:315 upscaler.py:332
|
||||
msgid "Killing progress monitor"
|
||||
msgstr "终结进度监视器"
|
||||
|
||||
#: upscaler.py:318 upscaler.py:335
|
||||
msgid "Killing upscaled image cleaner"
|
||||
msgstr "终结已放大图像清理程序"
|
||||
|
||||
#: upscaler.py:339
|
||||
msgid "Terminating all processes"
|
||||
msgstr "正在终止所有进程"
|
||||
|
||||
#: upscaler.py:346
|
||||
msgid "Main process waiting for subprocesses to exit"
|
||||
msgstr "主进程开始等待子进程结束"
|
||||
|
||||
#: upscaler.py:365 upscaler.py:369
|
||||
msgid "Subprocess {} exited with code {}"
|
||||
msgstr "子进程 {} 结束,返回码 {}"
|
||||
|
||||
#: upscaler.py:375
|
||||
msgid "Stop signal received"
|
||||
msgstr "收到停止信号"
|
||||
|
||||
#: upscaler.py:380
|
||||
msgid "Subprocess execution ran into an error"
|
||||
msgstr "子进程执行遇到错误"
|
||||
|
||||
#: upscaler.py:410
|
||||
msgid "Loading files into processing queue"
|
||||
msgstr "正在将文件添加到处理队列中"
|
||||
|
||||
#: upscaler.py:415
|
||||
msgid "Loading files from multiple paths"
|
||||
msgstr "正在从多个路径中导入文件"
|
||||
|
||||
#: upscaler.py:416 upscaler.py:435 upscaler.py:442
|
||||
msgid "Input path(s): {}"
|
||||
msgstr "输入路径:{}"
|
||||
|
||||
#: upscaler.py:434
|
||||
msgid "Loading single file"
|
||||
msgstr "正在导入单个文件"
|
||||
|
||||
#: upscaler.py:441
|
||||
msgid "Loading files from directory"
|
||||
msgstr "正在从文件夹中导入文件"
|
||||
|
||||
#: upscaler.py:455
|
||||
msgid "Loaded files into processing queue"
|
||||
msgstr "文件已添加到处理队列"
|
||||
|
||||
#: upscaler.py:458
|
||||
msgid "Input file: {}"
|
||||
msgstr "输入文件:{}"
|
||||
|
||||
#: upscaler.py:485
|
||||
msgid "Starting to upscale image"
|
||||
msgstr "开始放大图像"
|
||||
|
||||
#: upscaler.py:488 upscaler.py:550
|
||||
msgid "Upscaling completed"
|
||||
msgstr "放大完成"
|
||||
|
||||
#: upscaler.py:502
|
||||
msgid "Reading video information"
|
||||
msgstr "读取视频信息"
|
||||
|
||||
#: upscaler.py:516
|
||||
msgid "Aborting: No video stream found"
|
||||
msgstr "程序中止:文件中未找到视频流"
|
||||
|
||||
#: upscaler.py:521
|
||||
msgid "Framerate: {}"
|
||||
msgstr "帧率:{}"
|
||||
|
||||
#: upscaler.py:538
|
||||
msgid "Unsupported pixel format: {}"
|
||||
msgstr "不支持的像素格式:{}"
|
||||
|
||||
#: upscaler.py:548
|
||||
msgid "Starting to upscale extracted frames"
|
||||
msgstr "开始对提取的帧进行放大"
|
||||
|
||||
#: upscaler.py:555
|
||||
msgid "File {} ({}) neither an image nor a video"
|
||||
msgstr "文件 {} ({}) 既不是图片也不是视频"
|
||||
|
||||
#: upscaler.py:556
|
||||
msgid "Skipping this file"
|
||||
msgstr "将跳过此文件"
|
||||
|
||||
#: upscaler.py:566
|
||||
msgid "Converting extracted frames into GIF image"
|
||||
msgstr "正在将提取的帧转换为 GIF"
|
||||
|
||||
#: upscaler.py:570 upscaler.py:579
|
||||
msgid "Conversion completed"
|
||||
msgstr "转换已完成"
|
||||
|
||||
#: upscaler.py:575
|
||||
msgid "Converting extracted frames into video"
|
||||
msgstr "正在将提取的帧转换为视频"
|
||||
|
||||
#: upscaler.py:583
|
||||
msgid "Migrating audio, subtitles and other streams to upscaled video"
|
||||
msgstr "正在将音频、字幕和其他流迁移到放大后的视频"
|
||||
|
||||
#: upscaler.py:593
|
||||
msgid "Failed to migrate streams"
|
||||
msgstr "迁移流失败"
|
||||
|
||||
#: upscaler.py:594
|
||||
msgid "Trying to output video without additional streams"
|
||||
msgstr "正在尝试输出不含其他流的视频"
|
||||
|
||||
#: upscaler.py:610
|
||||
msgid "Output video file exists"
|
||||
msgstr "输出目标文件已存在"
|
||||
|
||||
#: upscaler.py:614
|
||||
msgid "Created temporary directory to contain file"
|
||||
msgstr "为文件创建了临时目录"
|
||||
|
||||
#: upscaler.py:617
|
||||
msgid "Writing intermediate file to: {}"
|
||||
msgstr "正在将中间视频文件写入至:{}"
|
||||
|
||||
#: video2x.py:85
|
||||
msgid ""
|
||||
"Video2X CLI Version: {}\n"
|
||||
"Upscaler Version: {}\n"
|
||||
"Author: K4YT3X\n"
|
||||
"License: GNU GPL v3\n"
|
||||
"Github Page: https://github.com/k4yt3x/video2x\n"
|
||||
"Contact: k4yt3x@k4yt3x.com"
|
||||
msgstr ""
|
||||
"Video2X 版本: {}\n"
|
||||
"放大组件版本:{}\n"
|
||||
"作者: K4YT3X\n"
|
||||
"开源许可: GNU GPL v3\n"
|
||||
"GitHub 主页:https://github.com/k4yt3x/video2x\n"
|
||||
"联系方式:k4yt3x@k4yt3x.com"
|
||||
|
||||
#: video2x.py:108
|
||||
msgid "Video2X Options"
|
||||
msgstr "Video2X 选项"
|
||||
|
||||
#: video2x.py:109
|
||||
msgid "show this help message and exit"
|
||||
msgstr "显示此帮助消息并退出"
|
||||
|
||||
#: video2x.py:110
|
||||
msgid "source video file/directory"
|
||||
msgstr "源视频文件/目录"
|
||||
|
||||
#: video2x.py:111
|
||||
msgid "output video file/directory"
|
||||
msgstr "输出视频文件/目录"
|
||||
|
||||
#: video2x.py:112
|
||||
msgid "video2x config file path"
|
||||
msgstr "video2x 配置文件路径"
|
||||
|
||||
#: video2x.py:114
|
||||
msgid "display version, lawful information and exit"
|
||||
msgstr "显示版本和法律信息并退出"
|
||||
|
||||
#: video2x.py:117
|
||||
msgid "Upscaling Options"
|
||||
msgstr "视频放大选项"
|
||||
|
||||
#: video2x.py:118
|
||||
msgid "upscaling driver"
|
||||
msgstr "视频放大驱动"
|
||||
|
||||
#: video2x.py:119
|
||||
msgid "scaling ratio"
|
||||
msgstr "缩放比"
|
||||
|
||||
#: video2x.py:120
|
||||
msgid "number of processes to use for upscaling"
|
||||
msgstr "并发进程数"
|
||||
|
||||
#: video2x.py:121
|
||||
msgid "preserve extracted and upscaled frames"
|
||||
msgstr "保留提取的和放大的帧"
|
||||
|
||||
#: video2x.py:161
|
||||
msgid "This file cannot be imported"
|
||||
msgstr "此文件无法被当作模块导入"
|
||||
|
||||
#: video2x.py:236
|
||||
msgid "Program completed, taking {} seconds"
|
||||
msgstr "程序执行完毕,总计花费 {} 秒"
|
||||
|
||||
#: video2x.py:239
|
||||
msgid "An exception has occurred"
|
||||
msgstr "发生了异常"
|
||||
|
||||
#~ msgid "Anime4KCPP doesn't yet support GIF processing"
|
||||
#~ msgstr "Anime4KCPP 尚不支持GIF处理"
|
||||
|
||||
#~ msgid "Starting to upscale video with Anime4KCPP"
|
||||
#~ msgstr "开始用 Anime4KCPP 放大视频"
|
||||
|
||||
#~ msgid "output video width"
|
||||
#~ msgstr "输出视频宽度"
|
||||
|
||||
#~ msgid "output video height"
|
||||
#~ msgstr "输出视频高度"
|
||||
|
||||
#~ msgid "You must specify input video file/directory path"
|
||||
#~ msgstr "您必须指定输入视频文件/目录路径"
|
||||
|
||||
#~ msgid "You must specify output video file/directory path"
|
||||
#~ msgstr "您必须指定输出视频文件/目录路径"
|
||||
|
||||
#~ msgid "Selected driver accepts only scaling ratio"
|
||||
#~ msgstr "所选驱动程序仅接受缩放比率"
|
||||
|
||||
#~ msgid "Scaling ratio must be 1 or 2 for waifu2x_ncnn_vulkan"
|
||||
#~ msgstr "waifu2x_ncnn_vulkan 的缩放比必须为 1 或 2"
|
||||
|
||||
#~ msgid "Scaling ratio must be one of 2, 3 or 4 for srmd_ncnn_vulkan"
|
||||
#~ msgstr "srmd_ncnn_vulkan 的缩放比必须为 2、3 或 4"
|
||||
|
||||
#~ msgid "You can only specify either scaling ratio or output width and height"
|
||||
#~ msgstr "您只能指定缩放比或输出宽度和高度两者之一"
|
||||
|
||||
#~ msgid "You must specify both width and height"
|
||||
#~ msgstr "您必须同时指定宽度和高度"
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Name: Video2X Upscale Progress Monitor
|
||||
Author: K4YT3X
|
||||
Date Created: May 7, 2020
|
||||
Last Modified: June 7, 2020
|
||||
"""
|
||||
|
||||
# built-in imports
|
||||
import contextlib
|
||||
import threading
|
||||
import time
|
||||
|
||||
# third-party imports
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
class ProgressMonitor(threading.Thread):
|
||||
""" progress monitor
|
||||
|
||||
This class provides progress monitoring functionalities
|
||||
by keeping track of the amount of frames in the input
|
||||
directory and the output directory. This is originally
|
||||
suggested by @ArmandBernard.
|
||||
"""
|
||||
|
||||
def __init__(self, upscaler, extracted_frames_directories):
|
||||
threading.Thread.__init__(self)
|
||||
self.upscaler = upscaler
|
||||
self.extracted_frames_directories = extracted_frames_directories
|
||||
self.running = False
|
||||
|
||||
def run(self):
|
||||
self.running = True
|
||||
|
||||
# get number of extracted frames
|
||||
self.upscaler.total_frames = 0
|
||||
for directory in self.extracted_frames_directories:
|
||||
self.upscaler.total_frames += len([f for f in directory.iterdir() if str(f).lower().endswith(self.upscaler.extracted_frame_format.lower())])
|
||||
|
||||
with tqdm(total=self.upscaler.total_frames, ascii=True, desc=_('Upscaling Progress')) as progress_bar:
|
||||
# tqdm update method adds the value to the progress
|
||||
# bar instead of setting the value. Therefore, a delta
|
||||
# needs to be calculated.
|
||||
previous_cycle_frames = 0
|
||||
while self.running:
|
||||
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
upscaled_frames = [f for f in self.upscaler.upscaled_frames.iterdir() if str(f).lower().endswith(self.upscaler.extracted_frame_format.lower())]
|
||||
if len(upscaled_frames) >= 1:
|
||||
self.upscaler.last_frame_upscaled = sorted(upscaled_frames)[-1]
|
||||
self.upscaler.total_frames_upscaled = len(upscaled_frames)
|
||||
|
||||
# update progress bar
|
||||
delta = self.upscaler.total_frames_upscaled - previous_cycle_frames
|
||||
previous_cycle_frames = self.upscaler.total_frames_upscaled
|
||||
progress_bar.update(delta)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
def stop(self):
|
||||
self.running = False
|
||||
self.join()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,85 +0,0 @@
|
||||
.Language=English,English
|
||||
.PluginContents=7-Zip Plugin
|
||||
|
||||
@Contents
|
||||
$^#7-Zip Plugin 19.00#
|
||||
$^#Copyright (c) 1999-2019 Igor Pavlov#
|
||||
This FAR module performs transparent #archive# processing.
|
||||
Files in the archive are handled in the same manner as if they
|
||||
were in a folder.
|
||||
|
||||
~Extracting from the archive~@Extract@
|
||||
|
||||
~Add files to the archive~@Update@
|
||||
|
||||
~7-Zip Plugin configuration~@Config@
|
||||
|
||||
|
||||
Web site: #www.7-zip.org#
|
||||
|
||||
@Extract
|
||||
$ #Extracting from the archive#
|
||||
|
||||
In this dialog you may enter extracting mode.
|
||||
|
||||
Path mode
|
||||
|
||||
#Full pathnames# Extract files with full pathnames.
|
||||
|
||||
#Current pathnames# Extract files with all relative paths.
|
||||
|
||||
#No pathnames# Extract files without folder paths.
|
||||
|
||||
|
||||
Overwrite mode
|
||||
|
||||
#Ask before overwrite# Ask before overwriting existing files.
|
||||
|
||||
#Overwrite without prompt# Overwrite existing files without prompt.
|
||||
|
||||
#Skip existing files# Skip extracting of existing files.
|
||||
|
||||
|
||||
Files
|
||||
|
||||
#Selected files# Extract only selected files.
|
||||
|
||||
#All files# Extract all files from archive.
|
||||
|
||||
@Update
|
||||
$ #Add files to the archive#
|
||||
|
||||
This dialog allows you to specify options for process of updating archive.
|
||||
|
||||
|
||||
Compression method
|
||||
|
||||
#Store# Files will be copied to archive without compression.
|
||||
|
||||
#Normal# Files will be compressed.
|
||||
|
||||
#Maximum# Files will be compressed with method that gives
|
||||
maximum compression ratio.
|
||||
|
||||
|
||||
Update mode
|
||||
|
||||
#Add and replace files# Add all specified files to the archive.
|
||||
|
||||
#Update and add files# Update older files in the archive and add
|
||||
files that are new to the archive.
|
||||
|
||||
#Freshen existing files# Update specified files in the archive that
|
||||
are older than the selected disk files.
|
||||
|
||||
#Synchronize files# Replace specified files only if
|
||||
added files are newer. Always add those
|
||||
files, which are not present in the
|
||||
archive. Delete from archive those files,
|
||||
which are not present on the disk.
|
||||
|
||||
@Config
|
||||
$ #7-Zip Plugin configuration#
|
||||
In this dialog you may change following parameters:
|
||||
|
||||
#Plugin is used by default# Plugin is used by default.
|
||||
@@ -1,211 +0,0 @@
|
||||
.Language=English,English
|
||||
|
||||
"Ok"
|
||||
"&Cancel"
|
||||
|
||||
"Warning"
|
||||
"Error"
|
||||
|
||||
"Format"
|
||||
|
||||
"Properties"
|
||||
|
||||
"Yes"
|
||||
"No"
|
||||
|
||||
"Get password"
|
||||
"Enter password"
|
||||
|
||||
"Extract"
|
||||
"&Extract to"
|
||||
|
||||
"Path mode"
|
||||
"&Full pathnames"
|
||||
"C&urrent pathnames"
|
||||
"&No pathnames"
|
||||
|
||||
"Overwrite mode"
|
||||
"As&k before overwrite"
|
||||
"&Overwrite without prompt"
|
||||
"Sk&ip existing files"
|
||||
"A&uto rename"
|
||||
"A&uto rename existing files"
|
||||
|
||||
"Extract"
|
||||
"&Selected files"
|
||||
"A&ll files"
|
||||
|
||||
"&Password"
|
||||
|
||||
"Extr&act"
|
||||
"&Cancel"
|
||||
|
||||
"Can not open output file '%s'."
|
||||
|
||||
"Unsupported compression method for '%s'."
|
||||
"CRC failed in '%s'."
|
||||
"Data error in '%s'."
|
||||
"CRC failed in encrypted file '%s'. Wrong password?"
|
||||
"Data error in encrypted file '%s'. Wrong password?"
|
||||
|
||||
"Confirm File Replace"
|
||||
"Destination folder already contains processed file."
|
||||
"Would you like to replace the existing file"
|
||||
"with this one"
|
||||
|
||||
"bytes"
|
||||
"modified on"
|
||||
|
||||
|
||||
"&Yes"
|
||||
"Yes to &All"
|
||||
"&No"
|
||||
"No to A&ll"
|
||||
"A&uto rename"
|
||||
"&Cancel"
|
||||
|
||||
|
||||
"Update operations are not supported for this archive."
|
||||
|
||||
|
||||
"Delete from archive"
|
||||
"Delete \"%.40s\" from the archive"
|
||||
"Delete selected files from the archive"
|
||||
"Delete %d files from the archive"
|
||||
"Delete"
|
||||
"Cancel"
|
||||
|
||||
"Add files to archive"
|
||||
|
||||
"Add to %s a&rchive:"
|
||||
|
||||
"Compression method"
|
||||
"&Store"
|
||||
"Fas&test"
|
||||
"&Fast"
|
||||
"&Normal"
|
||||
"&Maximum"
|
||||
"&Ultra"
|
||||
|
||||
"Update mode"
|
||||
"A&dd and replace files"
|
||||
"&Update and add files"
|
||||
"&Freshen existing files"
|
||||
"S&ynchronize files"
|
||||
|
||||
"&Add"
|
||||
"Se&lect archiver"
|
||||
|
||||
"Select archive format"
|
||||
|
||||
"Wait"
|
||||
"Reading the archive"
|
||||
"Extracting from the archive"
|
||||
"Deleting from the archive"
|
||||
"Updating the archive"
|
||||
|
||||
"Move operation is not supported"
|
||||
|
||||
"7-Zip"
|
||||
"7-Zip (add to archive)"
|
||||
|
||||
"7-Zip"
|
||||
|
||||
"Plugin is used by default"
|
||||
|
||||
"0"
|
||||
"1"
|
||||
"2"
|
||||
"Path"
|
||||
"Name"
|
||||
"Extension"
|
||||
"Is Folder"
|
||||
"Size"
|
||||
"Packed Size"
|
||||
"Attributes"
|
||||
"Created"
|
||||
"Accessed"
|
||||
"Modified"
|
||||
"Solid"
|
||||
"Commented"
|
||||
"Encrypted"
|
||||
"Splited Before"
|
||||
"Splited After"
|
||||
"Dictionary Size"
|
||||
"CRC"
|
||||
"Type"
|
||||
"Anti"
|
||||
"Method"
|
||||
"Host OS"
|
||||
"File System"
|
||||
"User"
|
||||
"Group"
|
||||
"Block"
|
||||
"Comment"
|
||||
"Position"
|
||||
"Path Prefix"
|
||||
"Folders"
|
||||
"Files"
|
||||
"Version"
|
||||
"Volume"
|
||||
"Multivolume"
|
||||
"Offset"
|
||||
"Links"
|
||||
"Blocks"
|
||||
"Volumes"
|
||||
"Time Type"
|
||||
"64-bit"
|
||||
"Big-endian"
|
||||
"CPU"
|
||||
"Physical Size"
|
||||
"Headers Size"
|
||||
"Checksum"
|
||||
"Characteristics"
|
||||
"Virtual Address"
|
||||
"ID"
|
||||
"Short Name"
|
||||
"Creator Application"
|
||||
"Sector Size"
|
||||
"Mode"
|
||||
"Symbolic Link"
|
||||
"Error"
|
||||
"Total Size"
|
||||
"Free Space"
|
||||
"Cluster Size"
|
||||
"Label"
|
||||
"Local Name"
|
||||
"Provider"
|
||||
"NT Security"
|
||||
"Alternate Stream"
|
||||
"Aux"
|
||||
"Deleted"
|
||||
"Tree"
|
||||
"SHA-1"
|
||||
"SHA-256"
|
||||
"Error Type"
|
||||
"Errors"
|
||||
"Errors"
|
||||
"Warnings"
|
||||
"Warning"
|
||||
"Streams"
|
||||
"Alternate Streams"
|
||||
"Alternate Streams Size"
|
||||
"Virtual Size"
|
||||
"Unpack Size"
|
||||
"Total Physical Size"
|
||||
"Volume Index"
|
||||
"SubType"
|
||||
"Short Comment"
|
||||
"Code Page"
|
||||
"Is not archive type"
|
||||
"Physical Size can't be detected"
|
||||
"Zeros Tail Is Allowed"
|
||||
"Tail Size"
|
||||
"Embedded Stub Size"
|
||||
"Link"
|
||||
"Hard Link"
|
||||
"iNode"
|
||||
"Stream ID"
|
||||
"Read-only"
|
||||
"Out Name"
|
||||
"Copy Link"
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,84 +0,0 @@
|
||||
.Language=Russian,Russian (<28><><EFBFBD>᪨<EFBFBD>)
|
||||
.PluginContents=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7-Zip
|
||||
|
||||
@Contents
|
||||
$^#7-Zip Plugin 19.00#
|
||||
$^#Copyright (c) 1999-2019 Igor Pavlov#
|
||||
<20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FAR <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠡ<><E0A0A1><EFBFBD><EFBFBD><EFBFBD> <20> #<23><>娢<EFBFBD><E5A8A2><EFBFBD>#. <20><><EFBFBD> <20><><EFBFBD>짮<EFBFBD><ECA7AE>⥫<EFBFBD>
|
||||
䠩<EFBFBD><EFBFBD> <20> <20><>娢<EFBFBD><E5A8A2> <20><> <20>⫨<EFBFBD><E2ABA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 䠩<><E4A0A9><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
|
||||
|
||||
~<7E><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD> <20><> <20><>娢<EFBFBD>~@Extract@
|
||||
|
||||
~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD> <20> <20><>娢<EFBFBD>~@Update@
|
||||
|
||||
~<7E><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD> ࠡ<><E0A0A1><EFBFBD> <20> <20><>娢<EFBFBD><E5A8A2><EFBFBD>~@Config@
|
||||
|
||||
|
||||
Web site: #www.7-zip.org#
|
||||
|
||||
@Extract
|
||||
$ #<23><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD> <20><> <20><>娢<EFBFBD>#
|
||||
<20> <20>⮬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
०<EFBFBD><EFBFBD> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD>.
|
||||
|
||||
<20><><EFBFBD><EFBFBD>
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD># <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD>묨 <20><><EFBFBD>ﬨ.
|
||||
|
||||
#<23>⭮<EFBFBD><E2ADAE>⥫<EFBFBD><E2A5AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD># <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>⭮<EFBFBD><E2ADAE>⥫<EFBFBD><E2A5AB>묨 <20><><EFBFBD>ﬨ.
|
||||
|
||||
#<23><><EFBFBD> <20><>⥩# <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>⥩.
|
||||
|
||||
|
||||
<20><>१<EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#<23><><EFBFBD><EFBFBD>訢<EFBFBD><E8A8A2><EFBFBD> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD># <20><><EFBFBD><EFBFBD>訢<EFBFBD><E8A8A2><EFBFBD> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD> <20><>
|
||||
<20><>१<EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>饣<EFBFBD> 䠩<><E4A0A9>.
|
||||
|
||||
#<23><><EFBFBD> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>騩 䠩<>
|
||||
<20><><EFBFBD> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD>.
|
||||
|
||||
#<23>ய<EFBFBD>᪠<EFBFBD><E1AAA0># <20>ய<EFBFBD>᪠<EFBFBD><E1AAA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>騥 䠩<><E4A0A9>.
|
||||
|
||||
|
||||
<20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#<23><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> 䠩<><E4A0A9># <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 <20>뤥<EFBFBD><EBA4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> <20><> <20><>娢<EFBFBD>.
|
||||
|
||||
#<23><><EFBFBD> 䠩<><E4A0A9># <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 䠩<><E4A0A9> <20><> <20><>娢<EFBFBD>.
|
||||
|
||||
@Update
|
||||
$ #<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD> <20> <20><>娢<EFBFBD>#
|
||||
|
||||
<20> <20>⮬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ०<><E0A5A6> 㯠<><E3AFA0><EFBFBD><EFBFBD><EFBFBD>.
|
||||
|
||||
|
||||
<20><>⮤ ᦠ<><E1A6A0><EFBFBD>:
|
||||
|
||||
#<23><><EFBFBD> ᦠ<><E1A6A0><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <><E1AAAE><EFBFBD><E0AEA2><EFBFBD> <20><><EFBFBD> ᦠ<><E1A6A0><EFBFBD>.
|
||||
|
||||
#<23><>ଠ<EFBFBD>쭮<EFBFBD> ᦠ⨥# <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᦠ<><E1A6A0>.
|
||||
|
||||
#<23><><EFBFBD>ᨬ<EFBFBD><E1A8AC>쭮<EFBFBD> ᦠ⨥# <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> ᦠ<><E1A6A0> <20> <20><><EFBFBD>ᨬ<EFBFBD><E1A8AC>쭮<EFBFBD>
|
||||
<20>⥯<EFBFBD><E2A5AF><EFBFBD><EFBFBD> ᦠ<><E1A6A0><EFBFBD>.
|
||||
|
||||
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> 䠩<><E4A0A9> <20> <20><>娢.
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ॢ訥 䠩<><E4A0A9> <20> <20><>娢<EFBFBD> <20>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><>娢<EFBFBD>.
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ॢ訥 䠩<><E4A0A9> <20> <20><>娢<EFBFBD>.
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><E0AEAD><EFBFBD><EFBFBD><E0AEA2><EFBFBD># <20><><EFBFBD><EFBFBD><EFBFBD><E0AEAD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> ᮤ<>ন<EFBFBD><E0A6A8><EFBFBD> <20><>娢<EFBFBD>
|
||||
<20> <20><><EFBFBD>࠭<EFBFBD>묨 䠩<><E4A0A9><EFBFBD><EFBFBD>.
|
||||
|
||||
|
||||
@Config
|
||||
$ #<23><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD> ࠡ<><E0A0A1><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7-Zip#
|
||||
<20> <20>⮬ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5><EFBFBD>騥 <20><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD>:
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᯮ<EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD># <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᯮ<EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD>
|
||||
@@ -1,211 +0,0 @@
|
||||
.Language=Russian,Russian (<28><><EFBFBD>᪨<EFBFBD>)
|
||||
|
||||
"<22>த<EFBFBD><E0AEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"&<26>⬥<EFBFBD><E2ACA5><EFBFBD><EFBFBD>"
|
||||
|
||||
"<22>।<EFBFBD><E0A5A4>०<EFBFBD><E0A5A6><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>訡<EFBFBD><E8A8A1>"
|
||||
|
||||
"<22><>ଠ<EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>⢠"
|
||||
|
||||
"<22><>"
|
||||
"<22><><EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD> <20><><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>"
|
||||
|
||||
"<22><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"&<26><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><>&<26><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
"<22>&⭮<><E2ADAE>⥫<EFBFBD><E2A5AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
"&<26><><EFBFBD> <20><>⥩"
|
||||
|
||||
"<22><>१<EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"&<26><><EFBFBD><EFBFBD>訢<EFBFBD><E8A8A2><EFBFBD> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD>"
|
||||
"<22>&<26><> <20><><EFBFBD>⢥ত<E2A2A5><E0A6A4><EFBFBD><EFBFBD>"
|
||||
"<22>ய&<26>᪠<EFBFBD><E1AAA0>"
|
||||
"<22><>२<EFBFBD><E0A5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>⮬."
|
||||
"<22><>२<EFBFBD>. <20><>⮬. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
|
||||
|
||||
"<22><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>&<26><>࠭<EFBFBD><E0A0AD><EFBFBD> 䠩<><E4A0A9>"
|
||||
"<22><><EFBFBD> &䠩<><E4A0A9>"
|
||||
|
||||
"&<26><><EFBFBD>"
|
||||
|
||||
"<22>&<26>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"&<26>⬥<EFBFBD><E2ACA5><EFBFBD><EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<> '%s'."
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>⮤ ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD> 䠩<><E4A0A9> '%s'."
|
||||
"<22>訡<EFBFBD><E8A8A1> CRC <20> '%s'."
|
||||
"<22>訡<EFBFBD><E8A8A1> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> '%s'."
|
||||
"<22>訡<EFBFBD><E8A8A1> CRC <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> '%s'. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>?"
|
||||
"<22>訡<EFBFBD><E8A8A1> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> '%s'. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>?"
|
||||
|
||||
"<22><><EFBFBD>⢥न<E2A2A5><E0A4A8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD> 㦥 ᮤ<>ন<EFBFBD> <20><>ࠡ<EFBFBD><E0A0A1>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD> 䠩<>."
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>騩 䠩<>"
|
||||
"<><E1ABA5><EFBFBD>騬 䠩<><E4A0A9><EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
|
||||
"&<26><>"
|
||||
"<22><> <20><><EFBFBD> &<26><><EFBFBD><EFBFBD>"
|
||||
"&<26><><EFBFBD>"
|
||||
"<22><><EFBFBD> <20><><EFBFBD> <20>&<26><><EFBFBD>"
|
||||
"<22><>२<EFBFBD><E0A5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>⮬<EFBFBD><E2AEAC><EFBFBD><EFBFBD><EFBFBD>᪨"
|
||||
"&<26>⬥<EFBFBD><E2ACA5><EFBFBD><EFBFBD>"
|
||||
|
||||
|
||||
"<22><><EFBFBD> <20>⮣<EFBFBD> <20><>娢<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>樨 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
|
||||
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>娢<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"%.40s\" <20><> <20><>娢<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> 䠩<><E4A0A9> <20><> <20><>娢<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d 䠩<><E4A0A9><EFBFBD> <20><> <20><>娢<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>⬥<EFBFBD><E2ACA5>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> <20> <20><>娢<EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> %s &<26><>娢<EFBFBD>"
|
||||
|
||||
"<22><>⮤ ᦠ<><E1A6A0><EFBFBD>"
|
||||
"<22><><EFBFBD> ᦠ<><E1A6A0><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭮<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>ଠ<EFBFBD><E0ACA0><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD>ᨬ<EFBFBD><E1A8AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><E0AEAD><EFBFBD><EFBFBD><E0AEA2><EFBFBD>"
|
||||
|
||||
"&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>&<26>娢<EFBFBD><E5A8A2><EFBFBD><EFBFBD>"
|
||||
|
||||
"<22>롮<EFBFBD> <20><>娢<EFBFBD><E5A8A2><EFBFBD><EFBFBD> <20><>ଠ<EFBFBD><E0ACA0>"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>⥭<EFBFBD><E2A5AD> <20><>娢<EFBFBD>"
|
||||
"<22><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
"<22><>६<EFBFBD>饭<EFBFBD><E9A5AD> 䠩<><E4A0A9><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
|
||||
"7-Zip"
|
||||
"7-Zip (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>娢)"
|
||||
|
||||
"7-Zip configuration"
|
||||
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᯮ<EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD>"
|
||||
|
||||
"0"
|
||||
"1"
|
||||
"2"
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>७<EFBFBD><E0A5AD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>ਡ<EFBFBD><E0A8A1><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뢭<EFBFBD><EBA2AD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"CRC"
|
||||
"<22><><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><>⮤"
|
||||
"<22><><EFBFBD>⥬<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD>"
|
||||
"<22><><EFBFBD>짮<EFBFBD><ECA7AE>⥫<EFBFBD>"
|
||||
"<22><>㯯<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>⮬<EFBFBD><E2AEAC><EFBFBD>"
|
||||
"<22><><EFBFBD>饭<EFBFBD><E9A5AD>"
|
||||
"<22><>뫮<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"Time Type"
|
||||
"64-bit"
|
||||
"Big-endian"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>᪨<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>. <20>㬬<EFBFBD>"
|
||||
"<22><>ࠪ<EFBFBD><E0A0AA><EFBFBD><EFBFBD><EFBFBD>⨪<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD>㠫<EFBFBD><E3A0AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"ID"
|
||||
"<22><><EFBFBD><EFBFBD>⪮<EFBFBD> <20><><EFBFBD>"
|
||||
"<22>ணࠬ<E0AEA3><E0A0AC>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᥪ<><E1A5AA><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쭠<EFBFBD> <20><>뫪<EFBFBD>"
|
||||
"<22>訡<EFBFBD><E8A8A1>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>⪠"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>쭮<EFBFBD> <20><><EFBFBD>"
|
||||
"<22><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"NT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>᭮<EFBFBD><E1ADAE><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>ୠ⨢<E0ADA0><E2A8A2><EFBFBD> <20><>⮪"
|
||||
"Aux"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>ॢ<EFBFBD>"
|
||||
"SHA-1"
|
||||
"SHA-256"
|
||||
"<22><><EFBFBD> <20>訡<EFBFBD><E8A8A1>"
|
||||
"<22>訡<EFBFBD><E8A8A1>"
|
||||
"<22>訡<EFBFBD><E8A8A1>"
|
||||
"<22>।<EFBFBD><E0A5A4>०<EFBFBD><E0A5A6><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22>।<EFBFBD><E0A5A4>०<EFBFBD><E0A5A6><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>⮪<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD>ୠ⨢<E0ADA0><E2A8A2><EFBFBD> <20><>⮪<EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ୠ⨢<E0ADA0><E2A8A2><EFBFBD> <20><>⮪<EFBFBD><E2AEAA>"
|
||||
"<22><><EFBFBD><EFBFBD>㠫<EFBFBD><E3A0AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>騩 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>᪨<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD>⨯"
|
||||
"<22><><EFBFBD><EFBFBD>⪨<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>࠭<EFBFBD><E0A0AD><EFBFBD>"
|
||||
"Is not archive type"
|
||||
"Physical Size can't be detected"
|
||||
"Zeros Tail Is Allowed"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⪠"
|
||||
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0AEA5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
"<22><>뫪<EFBFBD>"
|
||||
"<22><><EFBFBD>⪠<EFBFBD> <20><>뫪<EFBFBD>"
|
||||
"iNode"
|
||||
"ID <20><>⮪<EFBFBD>"
|
||||
"<22><><EFBFBD>쪮 <20><><EFBFBD> <20>⥭<EFBFBD><E2A5AD>"
|
||||
"Out Name"
|
||||
"Copy Link"
|
||||
@@ -1,67 +0,0 @@
|
||||
; 7z supporting for MutiArc in Far
|
||||
; Append the following strings to file
|
||||
; ..\Program Files\Far\Plugins\MultiArc\Formats\Custom.ini
|
||||
|
||||
[7z]
|
||||
TypeName=7z
|
||||
ID=37 7A BC AF 27 1C
|
||||
IDPos=
|
||||
IDOnly=1
|
||||
Extension=7z
|
||||
List=7z l -- %%AQ
|
||||
Start="^-----"
|
||||
End="^-----"
|
||||
Format0="yyyy tt dd hh mm ss aaaaa zzzzzzzzzzzz pppppppppppp nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
|
||||
Extract=7z x {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
ExtractWithoutPath=7z e {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
Test=7z t {-p%%P} -r0 -scsDOS -i@%%LQMN -- %%A
|
||||
Delete=7z d {-p%%P} -r0 -ms=off -scsDOS -i@%%LQMN -- %%A
|
||||
Add=7z a {-p%%P} -r0 -t7z {%%S} -scsDOS -i@%%LQMN -- %%A
|
||||
AddRecurse=7z a {-p%%P} -r0 -t7z {%%S} -scsDOS -i@%%LQMN -- %%A
|
||||
AllFilesMask="*"
|
||||
|
||||
[rpm]
|
||||
TypeName=rpm
|
||||
ID=ED AB EE DB
|
||||
IDPos=
|
||||
IDOnly=1
|
||||
Extension=rpm
|
||||
List=7z l -- %%AQ
|
||||
Start="^-----"
|
||||
End="^-----"
|
||||
Format0="yyyy tt dd hh mm ss aaaaa zzzzzzzzzzzz pppppppppppp nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
|
||||
Extract=7z x {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
ExtractWithoutPath=7z e {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
Test=7z t {-p%%P} -r0 -scsDOS -i@%%LQMN -- %%A
|
||||
AllFilesMask="*"
|
||||
|
||||
[cpio]
|
||||
TypeName=cpio
|
||||
ID=
|
||||
IDPos=
|
||||
IDOnly=0
|
||||
Extension=cpio
|
||||
List=7z l -- %%AQ
|
||||
Start="^-----"
|
||||
End="^-----"
|
||||
Format0="yyyy tt dd hh mm ss aaaaa zzzzzzzzzzzz pppppppppppp nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
|
||||
Extract=7z x {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
ExtractWithoutPath=7z e {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
Test=7z t {-p%%P} -r0 -scsDOS -i@%%LQMN -- %%A
|
||||
AllFilesMask="*"
|
||||
|
||||
[deb]
|
||||
TypeName=deb
|
||||
ID=
|
||||
IDPos=
|
||||
IDOnly=0
|
||||
Extension=deb
|
||||
List=7z l -- %%AQ
|
||||
Start="^-----"
|
||||
End="^-----"
|
||||
Format0="yyyy tt dd hh mm ss aaaaa zzzzzzzzzzzz pppppppppppp nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
|
||||
Extract=7z x {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
ExtractWithoutPath=7z e {-p%%P} -r0 -y -scsDOS -i@%%LQMN -- %%A
|
||||
Test=7z t {-p%%P} -r0 -scsDOS -i@%%LQMN -- %%A
|
||||
AllFilesMask="*"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
REGEDIT4
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\ZIP]
|
||||
"Extract"="7z x {-p%%P} -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e {-p%%P} -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t {-p%%P} -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"Delete"="7z d {-p%%P} -r0 {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Add"="7z a {-p%%P} -r0 -tzip {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AddRecurse"="7z a {-p%%P} -r0 -tzip {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\TAR]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"Delete"="7z d -r0 {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Add"="7z a -r0 -y -ttar {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AddRecurse"="7z a -r0 -y -ttar {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\GZIP]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"Delete"="7z d -r0 {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Add"="7z a -r0 -tgzip {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AddRecurse"="7z a -r0 -tgzip {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\BZIP]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"Delete"="7z d -r0 {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Add"="7z a -r0 -tbzip2 {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AddRecurse"="7z a -r0 -tbzip2 {-w%%W} {%%S} -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\ARJ]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\CAB]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\LZH]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\RAR]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\Z(Unix)]
|
||||
"Extract"="7z x -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"ExtractWithoutPath"="7z e -r0 -y {-w%%W} -scsDOS -i@%%LQMN -- %%A"
|
||||
"Test"="7z t -r0 -scsDOS -i@%%LQMN -- %%A"
|
||||
"AllFilesMask"="*"
|
||||
@@ -1,67 +0,0 @@
|
||||
7-Zip Plugin for FAR Manager
|
||||
----------------------------
|
||||
|
||||
FAR Manager is a file manager working in text mode.
|
||||
You can download "FAR Manager" from site:
|
||||
http://www.farmanager.com
|
||||
|
||||
Files:
|
||||
|
||||
far7z.txt - This file
|
||||
far7z.reg - Regisrty file for MultiArc Plugin
|
||||
7zToFar.ini - Supporting 7z for MultiArc Plugin
|
||||
7-ZipFar.dll - 7-Zip Plugin for FAR Manager
|
||||
7-ZipEng.hlf - Help file in English for FAR Manager
|
||||
7-ZipRus.hlf - Help file in Russian for FAR Manager
|
||||
7-ZipEng.lng - Plugin message strings in English for FAR Manager
|
||||
7-ZipRus.lng - Plugin message strings in Russian for FAR Manager
|
||||
|
||||
There are two ways to use 7-Zip with FAR Manager:
|
||||
|
||||
1) Via 7-Zip FAR Plugin (it's recommended way).
|
||||
2) Via standard MultiArc Plugin.
|
||||
|
||||
|
||||
7-Zip FAR Plugin
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
7-Zip FAR Plugin is first level plugin for FAR Manager, like MultiArc plugin.
|
||||
It very fast extracts and updates files in archive, since it doesn't use
|
||||
external programs. It supports all formats supported by 7-Zip:
|
||||
7z, ZIP, RAR, CAB, ARJ, GZIP, BZIP2, Z, TAR, CPIO, RPM and DEB.
|
||||
|
||||
To install 7-Zip FAR Plugin:
|
||||
1) Create "7-Zip" folder in ...\Program Files\Far\Plugins folder.
|
||||
2) Copy all files from "FAR" folder of this package to created folder.
|
||||
3) Install 7-Zip, or copy 7z.dll from 7-Zip to Program Files\Far\Plugins\7-Zip\
|
||||
4) Restart FAR.
|
||||
|
||||
You can open archives with one of the following ways:
|
||||
* Pressing Enter.
|
||||
* Pressing Ctrl-PgDown.
|
||||
* Pressing F11 and selecting 7-Zip item.
|
||||
|
||||
|
||||
You can create new archives with 7-Zip by pressing F11 and
|
||||
selecting 7-Zip (add to archive) item.
|
||||
|
||||
If you think that some operations with archives is better to do with MultiArc Plugin,
|
||||
you can disable 7-Zip plugin via Options / Pligin configuration / 7-Zip. In such mode
|
||||
opening archives by pressing Enter and Ctrl-PgDown will start MultiArc Plugin. And
|
||||
if you want to open archive with 7-Zip, press F11 and select 7-Zip item.
|
||||
|
||||
|
||||
Using command line 7-Zip via MultiArc Plugin
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want to use 7-Zip via MultiArc Plugin, you must
|
||||
register file far7z.reg.
|
||||
|
||||
If you want to use 7z archives via MultiArc Plugin, you must
|
||||
append contents of file Far\7zToFar.ini to file
|
||||
..\Program Files\Far\Plugins\MultiArc\Formats\Custom.ini.
|
||||
|
||||
|
||||
If you want to cancel using 7-Zip by MultiArc, just remove lines that contain
|
||||
7-Zip (7z) program name from HKEY_LOCAL_MACHINE\SOFTWARE\Far\Plugins\MultiArc\ZIP
|
||||
registry key.
|
||||
@@ -1,31 +0,0 @@
|
||||
7-Zip Extra
|
||||
~~~~~~~~~~~
|
||||
License for use and distribution
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Copyright (C) 1999-2019 Igor Pavlov.
|
||||
|
||||
7-Zip Extra files are under the GNU LGPL license.
|
||||
|
||||
|
||||
Notes:
|
||||
You can use 7-Zip Extra on any computer, including a computer in a commercial
|
||||
organization. You don't need to register or pay for 7-Zip.
|
||||
|
||||
|
||||
GNU LGPL information
|
||||
--------------------
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You can receive a copy of the GNU Lesser General Public License from
|
||||
http://www.gnu.org/
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
7-Zip Extra history
|
||||
-------------------
|
||||
|
||||
This file contains only information about changes related to that package exclusively.
|
||||
The full history of changes is listed in history.txt in main 7-Zip program.
|
||||
|
||||
|
||||
19.00 2019-02-21
|
||||
-------------------------
|
||||
- Encryption strength for 7z archives was increased:
|
||||
the size of random initialization vector was increased from 64-bit to 128-bit,
|
||||
and the pseudo-random number generator was improved.
|
||||
- Some bugs were fixed.
|
||||
|
||||
|
||||
18.06 2018-12-30
|
||||
-------------------------
|
||||
- The speed for LZMA/LZMA2 compressing was increased by 3-10%,
|
||||
and there are minor changes in compression ratio.
|
||||
- Some bugs were fixed.
|
||||
|
||||
|
||||
18.05 2018-04-30
|
||||
-------------------------
|
||||
- The speed for LZMA/LZMA2 compressing was increased
|
||||
by 8% for fastest/fast compression levels and
|
||||
by 3% for normal/maximum compression levels.
|
||||
|
||||
|
||||
18.03 beta 2018-03-04
|
||||
-------------------------
|
||||
- The speed for single-thread LZMA/LZMA2 decoding
|
||||
was increased by 30% in x64 version and by 3% in x86 version.
|
||||
- 7-Zip now can use multi-threading for 7z/LZMA2 decoding,
|
||||
if there are multiple independent data chunks in LZMA2 stream.
|
||||
|
||||
|
||||
9.35 beta 2014-12-07
|
||||
------------------------------
|
||||
- SFX modules were moved to LZMA SDK package.
|
||||
|
||||
|
||||
9.34 alpha 2014-06-22
|
||||
------------------------------
|
||||
- Minimum supported system now is Windows 2000 for EXE and DLL files.
|
||||
- all EXE and DLL files use msvcrt.dll.
|
||||
- 7zr.exe now support AES encryption.
|
||||
|
||||
|
||||
9.18 2010-11-02
|
||||
------------------------------
|
||||
- New small SFX module for installers.
|
||||
|
||||
|
||||
9.17 2010-10-04
|
||||
------------------------------
|
||||
- New 7-Zip plugin for FAR Manager x64.
|
||||
|
||||
|
||||
9.10 2009-12-30
|
||||
------------------------------
|
||||
- 7-Zip for installers now supports LZMA2.
|
||||
|
||||
|
||||
9.09 2009-12-12
|
||||
------------------------------
|
||||
- LZMA2 compression method support.
|
||||
- Some bugs were fixed.
|
||||
|
||||
|
||||
4.65 2009-02-03
|
||||
------------------------------
|
||||
- Some bugs were fixed.
|
||||
|
||||
|
||||
4.38 beta 2006-04-13
|
||||
------------------------------
|
||||
- SFX for installers now supports new properties in config file:
|
||||
Progress, Directory, ExecuteFile, ExecuteParameters.
|
||||
|
||||
|
||||
4.34 beta 2006-02-27
|
||||
------------------------------
|
||||
- ISetProperties::SetProperties:
|
||||
it's possible to specify desirable number of CPU threads:
|
||||
PROPVARIANT: name=L"mt", vt = VT_UI4, ulVal = NumberOfThreads
|
||||
If "mt" is not defined, 7za.dll will check number of processors in system to set
|
||||
number of desirable threads.
|
||||
Now 7za.dll can use:
|
||||
2 threads for LZMA compressing
|
||||
N threads for BZip2 compressing
|
||||
4 threads for BZip2 decompressing
|
||||
Other codecs use only one thread.
|
||||
Note: 7za.dll can use additional "small" threads with low CPU load.
|
||||
- It's possible to call ISetProperties::SetProperties to specify "mt" property for decoder.
|
||||
|
||||
|
||||
4.33 beta 2006-02-05
|
||||
------------------------------
|
||||
- Compressing speed and Memory requirements were increased.
|
||||
Default dictionary size was increased: Fastest: 64 KB, Fast: 1 MB,
|
||||
Normal: 4 MB, Max: 16 MB, Ultra: 64 MB.
|
||||
- 7z/LZMA now can use only these match finders: HC4, BT2, BT3, BT4
|
||||
|
||||
|
||||
4.27 2005-09-21
|
||||
------------------------------
|
||||
- Some GUIDs/interfaces were changed.
|
||||
IStream.h:
|
||||
ISequentialInStream::Read now works as old ReadPart
|
||||
ISequentialOutStream::Write now works as old WritePart
|
||||
@@ -1,124 +0,0 @@
|
||||
7-Zip Extra 19.00
|
||||
-----------------
|
||||
|
||||
7-Zip Extra is package of extra modules of 7-Zip.
|
||||
|
||||
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
|
||||
|
||||
7-Zip is free software. Read License.txt for more information about license.
|
||||
|
||||
Source code of binaries can be found at:
|
||||
http://www.7-zip.org/
|
||||
|
||||
This package contains the following files:
|
||||
|
||||
7za.exe - standalone console version of 7-Zip with reduced formats support.
|
||||
7za.dll - library for working with 7z archives
|
||||
7zxa.dll - library for extracting from 7z archives
|
||||
License.txt - license information
|
||||
readme.txt - this file
|
||||
|
||||
Far\ - plugin for Far Manager
|
||||
x64\ - binaries for x64
|
||||
|
||||
|
||||
All 32-bit binaries can work in:
|
||||
Windows 2000 / 2003 / 2008 / XP / Vista / 7 / 8 / 10
|
||||
and in any Windows x64 version with WoW64 support.
|
||||
All x64 binaries can work in any Windows x64 version.
|
||||
|
||||
All binaries use msvcrt.dll.
|
||||
|
||||
7za.exe
|
||||
-------
|
||||
|
||||
7za.exe - is a standalone console version of 7-Zip with reduced formats support.
|
||||
|
||||
Extra: 7za.exe : support for only some formats of 7-Zip.
|
||||
7-Zip: 7z.exe with 7z.dll : support for all formats of 7-Zip.
|
||||
|
||||
7za.exe and 7z.exe from 7-Zip have same command line interface.
|
||||
7za.exe doesn't use external DLL files.
|
||||
|
||||
You can read Help File (7-zip.chm) from 7-Zip package for description
|
||||
of all commands and switches for 7za.exe and 7z.exe.
|
||||
|
||||
7za.exe features:
|
||||
|
||||
- High compression ratio in 7z format
|
||||
- Supported formats:
|
||||
- Packing / unpacking: 7z, xz, ZIP, GZIP, BZIP2 and TAR
|
||||
- Unpacking only: Z, lzma, CAB.
|
||||
- Highest compression ratio for ZIP and GZIP formats.
|
||||
- Fast compression and decompression
|
||||
- Strong AES-256 encryption in 7z and ZIP formats.
|
||||
|
||||
Note: LZMA SDK contains 7zr.exe - more reduced version of 7za.exe.
|
||||
But you can use 7zr.exe as "public domain" code.
|
||||
|
||||
|
||||
|
||||
DLL files
|
||||
---------
|
||||
|
||||
7za.dll and 7zxa.dll are reduced versions of 7z.dll from 7-Zip.
|
||||
7za.dll and 7zxa.dll support only 7z format.
|
||||
Note: 7z.dll is main DLL file that works with all archive types in 7-Zip.
|
||||
|
||||
7za.dll and 7zxa.dll support the following decoding methods:
|
||||
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES, BZip2, Deflate.
|
||||
|
||||
7za.dll also supports 7z encoding with the following encoding methods:
|
||||
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES.
|
||||
|
||||
7za.dll and 7zxa.dll work via COM interfaces.
|
||||
But these DLLs don't use standard COM interfaces for objects creating.
|
||||
|
||||
Look also example code that calls DLL functions (in source code of 7-Zip):
|
||||
|
||||
7zip\UI\Client7z
|
||||
|
||||
Another example of binary that uses these interface is 7-Zip itself.
|
||||
The following binaries from 7-Zip use 7z.dll:
|
||||
- 7z.exe (console version)
|
||||
- 7zG.exe (GUI version)
|
||||
- 7zFM.exe (7-Zip File Manager)
|
||||
|
||||
Note: The source code of LZMA SDK also contains the code for similar DLLs
|
||||
(DLLs without BZip2, Deflate support). And these files from LZMA SDK can be
|
||||
used as "public domain" code. If you use LZMA SDK files, you don't need to
|
||||
follow GNU LGPL rules, if you want to change the code.
|
||||
|
||||
|
||||
|
||||
|
||||
License FAQ
|
||||
-----------
|
||||
|
||||
Can I use the EXE or DLL files from 7-Zip in a commercial application?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Yes, but you are required to specify in documentation for your application:
|
||||
(1) that you used parts of the 7-Zip program,
|
||||
(2) that 7-Zip is licensed under the GNU LGPL license and
|
||||
(3) you must give a link to www.7-zip.org, where the source code can be found.
|
||||
|
||||
|
||||
Can I use the source code of 7-Zip in a commercial application?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Since 7-Zip is licensed under the GNU LGPL you must follow the rules of that license.
|
||||
In brief, it means that any LGPL'ed code must remain licensed under the LGPL.
|
||||
For instance, you can change the code from 7-Zip or write a wrapper for some
|
||||
code from 7-Zip and compile it into a DLL; but, the source code of that DLL
|
||||
(including your modifications / additions / wrapper) must be licensed under
|
||||
the LGPL or GPL.
|
||||
Any other code in your application can be licensed as you wish. This scheme allows
|
||||
users and developers to change LGPL'ed code and recompile that DLL. That is the
|
||||
idea of free software. Read more here: http://www.gnu.org/.
|
||||
|
||||
|
||||
|
||||
Note: You can look also LZMA SDK, which is available under a more liberal license.
|
||||
|
||||
|
||||
---
|
||||
End of document
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,80 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2013-2017, PyInstaller Development Team.
|
||||
#
|
||||
# Distributed under the terms of the GNU General Public License with exception
|
||||
# for distributing bootloader.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
"""
|
||||
Name: PyInstaller patoolib Hook
|
||||
Original solution: https://github.com/pyinstaller/pyinstaller/issues/3013
|
||||
|
||||
PyInstaller cannot find libraries imported by patoolib,
|
||||
since it uses importlib to import these modules.
|
||||
"""
|
||||
|
||||
hiddenimports = [
|
||||
"patoolib.programs",
|
||||
"patoolib.programs.ar",
|
||||
"patoolib.programs.arc",
|
||||
"patoolib.programs.archmage",
|
||||
"patoolib.programs.bsdcpio",
|
||||
"patoolib.programs.bsdtar",
|
||||
"patoolib.programs.bzip2",
|
||||
"patoolib.programs.cabextract",
|
||||
"patoolib.programs.chmlib",
|
||||
"patoolib.programs.clzip",
|
||||
"patoolib.programs.compress",
|
||||
"patoolib.programs.cpio",
|
||||
"patoolib.programs.dpkg",
|
||||
"patoolib.programs.flac",
|
||||
"patoolib.programs.genisoimage",
|
||||
"patoolib.programs.gzip",
|
||||
"patoolib.programs.isoinfo",
|
||||
"patoolib.programs.lbzip2",
|
||||
"patoolib.programs.lcab",
|
||||
"patoolib.programs.lha",
|
||||
"patoolib.programs.lhasa",
|
||||
"patoolib.programs.lrzip",
|
||||
"patoolib.programs.lzip",
|
||||
"patoolib.programs.lzma",
|
||||
"patoolib.programs.lzop",
|
||||
"patoolib.programs.mac",
|
||||
"patoolib.programs.nomarch",
|
||||
"patoolib.programs.p7azip",
|
||||
"patoolib.programs.p7rzip",
|
||||
"patoolib.programs.p7zip",
|
||||
"patoolib.programs.pbzip2",
|
||||
"patoolib.programs.pdlzip",
|
||||
"patoolib.programs.pigz",
|
||||
"patoolib.programs.plzip",
|
||||
"patoolib.programs.py_bz2",
|
||||
"patoolib.programs.py_echo",
|
||||
"patoolib.programs.py_gzip",
|
||||
"patoolib.programs.py_lzma",
|
||||
"patoolib.programs.py_tarfile",
|
||||
"patoolib.programs.py_zipfile",
|
||||
"patoolib.programs.rar",
|
||||
"patoolib.programs.rpm",
|
||||
"patoolib.programs.rpm2cpio",
|
||||
"patoolib.programs.rzip",
|
||||
"patoolib.programs.shar",
|
||||
"patoolib.programs.shorten",
|
||||
"patoolib.programs.star",
|
||||
"patoolib.programs.tar",
|
||||
"patoolib.programs.unace",
|
||||
"patoolib.programs.unadf",
|
||||
"patoolib.programs.unalz",
|
||||
"patoolib.programs.uncompress",
|
||||
"patoolib.programs.unrar",
|
||||
"patoolib.programs.unshar",
|
||||
"patoolib.programs.unzip",
|
||||
"patoolib.programs.xdms",
|
||||
"patoolib.programs.xz",
|
||||
"patoolib.programs.zip",
|
||||
"patoolib.programs.zoo",
|
||||
"patoolib.programs.zopfli",
|
||||
"patoolib.programs.zpaq",
|
||||
]
|
||||
132
src/realesrgan_filter.cpp
Normal file
132
src/realesrgan_filter.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
#include "realesrgan_filter.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "conversions.h"
|
||||
#include "fsutils.h"
|
||||
|
||||
RealesrganFilter::RealesrganFilter(
|
||||
int gpuid,
|
||||
bool tta_mode,
|
||||
int scaling_factor,
|
||||
const char *model,
|
||||
const std::filesystem::path custom_model_param_path,
|
||||
const std::filesystem::path custom_model_bin_path
|
||||
)
|
||||
: realesrgan(nullptr),
|
||||
gpuid(gpuid),
|
||||
tta_mode(tta_mode),
|
||||
scaling_factor(scaling_factor),
|
||||
model(model),
|
||||
custom_model_param_path(std::move(custom_model_param_path)),
|
||||
custom_model_bin_path(std::move(custom_model_bin_path)) {}
|
||||
|
||||
RealesrganFilter::~RealesrganFilter() {
|
||||
if (realesrgan) {
|
||||
delete realesrgan;
|
||||
realesrgan = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int RealesrganFilter::init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *_) {
|
||||
// Construct the model paths using std::filesystem
|
||||
std::filesystem::path model_param_path;
|
||||
std::filesystem::path model_bin_path;
|
||||
|
||||
if (model) {
|
||||
// Find the model paths by model name if provided
|
||||
model_param_path = std::filesystem::path("models") / "realesrgan" /
|
||||
(std::string(model) + "-x" + std::to_string(scaling_factor) + ".param");
|
||||
model_bin_path = std::filesystem::path("models") / "realesrgan" /
|
||||
(std::string(model) + "-x" + std::to_string(scaling_factor) + ".bin");
|
||||
} else if (!custom_model_param_path.empty() && !custom_model_bin_path.empty()) {
|
||||
// Use the custom model paths if provided
|
||||
model_param_path = custom_model_param_path;
|
||||
model_bin_path = custom_model_bin_path;
|
||||
} else {
|
||||
// Neither model name nor custom model paths provided
|
||||
spdlog::error("Model or model paths must be provided for RealESRGAN filter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get the full paths using a function that possibly modifies or validates the path
|
||||
std::filesystem::path model_param_full_path = find_resource_file(model_param_path);
|
||||
std::filesystem::path model_bin_full_path = find_resource_file(model_bin_path);
|
||||
|
||||
// Check if the model files exist
|
||||
if (!std::filesystem::exists(model_param_full_path)) {
|
||||
spdlog::error("RealESRGAN model param file not found: {}", model_param_full_path.string());
|
||||
return -1;
|
||||
}
|
||||
if (!std::filesystem::exists(model_bin_full_path)) {
|
||||
spdlog::error("RealESRGAN model bin file not found: {}", model_bin_full_path.string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Create a new RealESRGAN instance
|
||||
realesrgan = new RealESRGAN(gpuid, tta_mode);
|
||||
|
||||
// Store the time bases
|
||||
in_time_base = dec_ctx->time_base;
|
||||
out_time_base = enc_ctx->time_base;
|
||||
out_pix_fmt = enc_ctx->pix_fmt;
|
||||
|
||||
// Load the model
|
||||
if (realesrgan->load(model_param_full_path, model_bin_full_path) != 0) {
|
||||
spdlog::error("Failed to load RealESRGAN model");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set RealESRGAN parameters
|
||||
realesrgan->scale = scaling_factor;
|
||||
realesrgan->prepadding = 10;
|
||||
|
||||
// Calculate tilesize based on GPU heap budget
|
||||
uint32_t heap_budget = ncnn::get_gpu_device(gpuid)->get_heap_budget();
|
||||
if (heap_budget > 1900) {
|
||||
realesrgan->tilesize = 200;
|
||||
} else if (heap_budget > 550) {
|
||||
realesrgan->tilesize = 100;
|
||||
} else if (heap_budget > 190) {
|
||||
realesrgan->tilesize = 64;
|
||||
} else {
|
||||
realesrgan->tilesize = 32;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RealesrganFilter::process_frame(AVFrame *in_frame, AVFrame **out_frame) {
|
||||
int ret;
|
||||
|
||||
// Convert the input frame to RGB24
|
||||
ncnn::Mat in_mat = avframe_to_ncnn_mat(in_frame);
|
||||
if (in_mat.empty()) {
|
||||
spdlog::error("Failed to convert AVFrame to ncnn::Mat");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Allocate space for ouptut ncnn::Mat
|
||||
int output_width = in_mat.w * realesrgan->scale;
|
||||
int output_height = in_mat.h * realesrgan->scale;
|
||||
ncnn::Mat out_mat = ncnn::Mat(output_width, output_height, static_cast<size_t>(3), 3);
|
||||
|
||||
ret = realesrgan->process(in_mat, out_mat);
|
||||
if (ret != 0) {
|
||||
spdlog::error("RealESRGAN processing failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Convert ncnn::Mat to AVFrame
|
||||
*out_frame = ncnn_mat_to_avframe(out_mat, out_pix_fmt);
|
||||
|
||||
// Rescale PTS to encoder's time base
|
||||
(*out_frame)->pts = av_rescale_q(in_frame->pts, in_time_base, out_time_base);
|
||||
|
||||
// Return the processed frame to the caller
|
||||
return ret;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
avalon_framework
|
||||
colorama
|
||||
patool
|
||||
pyqt5
|
||||
python-magic; platform_system != "Windows"
|
||||
python-magic-bin; platform_system == "Windows"
|
||||
pyyaml
|
||||
requests
|
||||
tqdm
|
||||
672
src/upscaler.py
672
src/upscaler.py
@@ -1,672 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Name: Video2X Upscaler
|
||||
Author: K4YT3X
|
||||
Date Created: December 10, 2018
|
||||
Last Modified: June 29, 2020
|
||||
|
||||
Description: This file contains the Upscaler class. Each
|
||||
instance of the Upscaler class is an upscaler on an image or
|
||||
a folder.
|
||||
"""
|
||||
|
||||
# local imports
|
||||
from exceptions import *
|
||||
from image_cleaner import ImageCleaner
|
||||
from progress_monitor import ProgressMonitor
|
||||
from wrappers.ffmpeg import Ffmpeg
|
||||
from wrappers.gifski import Gifski
|
||||
|
||||
# built-in imports
|
||||
from fractions import Fraction
|
||||
import contextlib
|
||||
import copy
|
||||
import gettext
|
||||
import importlib
|
||||
import locale
|
||||
import mimetypes
|
||||
import pathlib
|
||||
import queue
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
|
||||
# third-party imports
|
||||
from avalon_framework import Avalon
|
||||
import magic
|
||||
|
||||
# internationalization constants
|
||||
DOMAIN = 'video2x'
|
||||
LOCALE_DIRECTORY = pathlib.Path(__file__).parent.absolute() / 'locale'
|
||||
|
||||
# getting default locale settings
|
||||
default_locale, encoding = locale.getdefaultlocale()
|
||||
language = gettext.translation(DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True)
|
||||
language.install()
|
||||
_ = language.gettext
|
||||
|
||||
# version information
|
||||
UPSCALER_VERSION = '4.2.2'
|
||||
|
||||
# these names are consistent for
|
||||
# - driver selection in command line
|
||||
# - driver wrapper file names
|
||||
# - config file keys
|
||||
AVAILABLE_DRIVERS = ['waifu2x_caffe',
|
||||
'waifu2x_converter_cpp',
|
||||
'waifu2x_ncnn_vulkan',
|
||||
'srmd_ncnn_vulkan',
|
||||
'realsr_ncnn_vulkan',
|
||||
'anime4kcpp']
|
||||
|
||||
|
||||
class Upscaler:
|
||||
""" An instance of this class is a upscaler that will
|
||||
upscale all images in the given directory.
|
||||
|
||||
Raises:
|
||||
Exception -- all exceptions
|
||||
ArgumentError -- if argument is not valid
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
input_path: pathlib.Path or list,
|
||||
output_path: pathlib.Path,
|
||||
driver_settings: dict,
|
||||
ffmpeg_settings: dict,
|
||||
gifski_settings: dict,
|
||||
driver: str = 'waifu2x_caffe',
|
||||
scale_ratio: float = None,
|
||||
processes: int = 1,
|
||||
video2x_cache_directory: pathlib.Path = pathlib.Path(tempfile.gettempdir()) / 'video2x',
|
||||
extracted_frame_format: str = 'png',
|
||||
output_file_name_format_string: str = '{original_file_name}_output{extension}',
|
||||
image_output_extension: str = '.png',
|
||||
video_output_extension: str = '.mp4',
|
||||
preserve_frames: bool = False
|
||||
):
|
||||
|
||||
# required parameters
|
||||
self.input = input_path
|
||||
self.output = output_path
|
||||
self.driver_settings = driver_settings
|
||||
self.ffmpeg_settings = ffmpeg_settings
|
||||
self.gifski_settings = gifski_settings
|
||||
|
||||
# optional parameters
|
||||
self.driver = driver
|
||||
self.scale_ratio = scale_ratio
|
||||
self.processes = processes
|
||||
self.video2x_cache_directory = video2x_cache_directory
|
||||
self.extracted_frame_format = extracted_frame_format
|
||||
self.output_file_name_format_string = output_file_name_format_string
|
||||
self.image_output_extension = image_output_extension
|
||||
self.video_output_extension = video_output_extension
|
||||
self.preserve_frames = preserve_frames
|
||||
|
||||
# other internal members and signals
|
||||
self.running = False
|
||||
self.total_frames_upscaled = 0
|
||||
self.total_frames = 0
|
||||
self.total_files = 0
|
||||
self.total_processed = 0
|
||||
self.current_input_file = pathlib.Path()
|
||||
self.last_frame_upscaled = pathlib.Path()
|
||||
|
||||
def create_temp_directories(self):
|
||||
"""create temporary directories
|
||||
"""
|
||||
|
||||
# if cache directory unspecified, use %TEMP%\video2x
|
||||
if self.video2x_cache_directory is None:
|
||||
self.video2x_cache_directory = pathlib.Path(tempfile.gettempdir()) / 'video2x'
|
||||
|
||||
# if specified cache path exists and isn't a directory
|
||||
if self.video2x_cache_directory.exists() and not self.video2x_cache_directory.is_dir():
|
||||
Avalon.error(_('Specified or default cache directory is a file/link'))
|
||||
raise FileExistsError('Specified or default cache directory is a file/link')
|
||||
|
||||
# if cache directory doesn't exist, try creating it
|
||||
if not self.video2x_cache_directory.exists():
|
||||
try:
|
||||
Avalon.debug_info(_('Creating cache directory {}').format(self.video2x_cache_directory))
|
||||
self.video2x_cache_directory.mkdir(parents=True, exist_ok=True)
|
||||
except Exception as exception:
|
||||
Avalon.error(_('Unable to create {}').format(self.video2x_cache_directory))
|
||||
raise exception
|
||||
|
||||
# create temp directories for extracted frames and upscaled frames
|
||||
self.extracted_frames = pathlib.Path(tempfile.mkdtemp(dir=self.video2x_cache_directory))
|
||||
Avalon.debug_info(_('Extracted frames are being saved to: {}').format(self.extracted_frames))
|
||||
self.upscaled_frames = pathlib.Path(tempfile.mkdtemp(dir=self.video2x_cache_directory))
|
||||
Avalon.debug_info(_('Upscaled frames are being saved to: {}').format(self.upscaled_frames))
|
||||
|
||||
def cleanup_temp_directories(self):
|
||||
"""delete temp directories when done
|
||||
"""
|
||||
if not self.preserve_frames:
|
||||
for directory in [self.extracted_frames, self.upscaled_frames, self.video2x_cache_directory]:
|
||||
try:
|
||||
# avalon framework cannot be used if python is shutting down
|
||||
# therefore, plain print is used
|
||||
print(_('Cleaning up cache directory: {}').format(directory))
|
||||
shutil.rmtree(directory)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except OSError:
|
||||
print(_('Unable to delete: {}').format(directory))
|
||||
traceback.print_exc()
|
||||
|
||||
def _check_arguments(self):
|
||||
if isinstance(self.input, list):
|
||||
if self.output.exists() and not self.output.is_dir():
|
||||
Avalon.error(_('Input and output path type mismatch'))
|
||||
Avalon.error(_('Input is multiple files but output is not directory'))
|
||||
raise ArgumentError('input output path type mismatch')
|
||||
for input_path in self.input:
|
||||
if not input_path.is_file() and not input_path.is_dir():
|
||||
Avalon.error(_('Input path {} is neither a file nor a directory').format(input_path))
|
||||
raise FileNotFoundError(f'{input_path} is neither file nor directory')
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
if input_path.samefile(self.output):
|
||||
Avalon.error(_('Input directory and output directory cannot be the same'))
|
||||
raise FileExistsError('input directory and output directory are the same')
|
||||
|
||||
# if input is a file
|
||||
elif self.input.is_file():
|
||||
if self.output.is_dir():
|
||||
Avalon.error(_('Input and output path type mismatch'))
|
||||
Avalon.error(_('Input is single file but output is directory'))
|
||||
raise ArgumentError('input output path type mismatch')
|
||||
if self.output.suffix == '':
|
||||
Avalon.error(_('No suffix found in output file path'))
|
||||
Avalon.error(_('Suffix must be specified'))
|
||||
raise ArgumentError('no output file suffix specified')
|
||||
|
||||
# if input is a directory
|
||||
elif self.input.is_dir():
|
||||
if self.output.is_file():
|
||||
Avalon.error(_('Input and output path type mismatch'))
|
||||
Avalon.error(_('Input is directory but output is existing single file'))
|
||||
raise ArgumentError('input output path type mismatch')
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
if self.input.samefile(self.output):
|
||||
Avalon.error(_('Input directory and output directory cannot be the same'))
|
||||
raise FileExistsError('input directory and output directory are the same')
|
||||
|
||||
# if input is neither
|
||||
else:
|
||||
Avalon.error(_('Input path is neither a file nor a directory'))
|
||||
raise FileNotFoundError(f'{self.input} is neither file nor directory')
|
||||
|
||||
# check FFmpeg settings
|
||||
ffmpeg_path = pathlib.Path(self.ffmpeg_settings['ffmpeg_path'])
|
||||
if not ((pathlib.Path(ffmpeg_path / 'ffmpeg.exe').is_file() and
|
||||
pathlib.Path(ffmpeg_path / 'ffprobe.exe').is_file()) or
|
||||
(pathlib.Path(ffmpeg_path / 'ffmpeg').is_file() and
|
||||
pathlib.Path(ffmpeg_path / 'ffprobe').is_file())):
|
||||
Avalon.error(_('FFmpeg or FFprobe cannot be found under the specified path'))
|
||||
Avalon.error(_('Please check the configuration file settings'))
|
||||
raise FileNotFoundError(self.ffmpeg_settings['ffmpeg_path'])
|
||||
|
||||
# check if driver settings
|
||||
driver_settings = copy.deepcopy(self.driver_settings)
|
||||
driver_path = driver_settings.pop('path')
|
||||
|
||||
# check if driver path exists
|
||||
if not (pathlib.Path(driver_path).is_file() or pathlib.Path(f'{driver_path}.exe').is_file()):
|
||||
Avalon.error(_('Specified driver executable directory doesn\'t exist'))
|
||||
Avalon.error(_('Please check the configuration file settings'))
|
||||
raise FileNotFoundError(driver_path)
|
||||
|
||||
# parse driver arguments using driver's parser
|
||||
# the parser will throw AttributeError if argument doesn't satisfy constraints
|
||||
try:
|
||||
driver_arguments = []
|
||||
for key in driver_settings.keys():
|
||||
|
||||
value = driver_settings[key]
|
||||
|
||||
if value is None or value is False:
|
||||
continue
|
||||
|
||||
else:
|
||||
if len(key) == 1:
|
||||
driver_arguments.append(f'-{key}')
|
||||
else:
|
||||
driver_arguments.append(f'--{key}')
|
||||
# true means key is an option
|
||||
if value is not True:
|
||||
driver_arguments.append(str(value))
|
||||
|
||||
DriverWrapperMain = getattr(importlib.import_module(f'wrappers.{self.driver}'), 'WrapperMain')
|
||||
DriverWrapperMain.parse_arguments(driver_arguments)
|
||||
except AttributeError as e:
|
||||
Avalon.error(_('Failed to parse driver argument: {}').format(e.args[0]))
|
||||
raise e
|
||||
|
||||
# waifu2x-caffe scale_ratio, scale_width and scale_height check
|
||||
if self.driver == 'waifu2x_caffe':
|
||||
if (driver_settings['scale_width'] != 0 and driver_settings['scale_height'] == 0 or
|
||||
driver_settings['scale_width'] == 0 and driver_settings['scale_height'] != 0):
|
||||
Avalon.error(_('Only one of scale_width and scale_height is specified for waifu2x-caffe'))
|
||||
raise AttributeError('only one of scale_width and scale_height is specified for waifu2x-caffe')
|
||||
|
||||
# if scale_width and scale_height are specified, ensure scale_ratio is None
|
||||
elif self.driver_settings['scale_width'] != 0 and self.driver_settings['scale_height'] != 0:
|
||||
self.driver_settings['scale_ratio'] = None
|
||||
|
||||
# if scale_width and scale_height not specified
|
||||
# ensure they are None, not 0
|
||||
else:
|
||||
self.driver_settings['scale_width'] = None
|
||||
self.driver_settings['scale_height'] = None
|
||||
|
||||
def _upscale_frames(self):
|
||||
""" Upscale video frames with waifu2x-caffe
|
||||
|
||||
This function upscales all the frames extracted
|
||||
by ffmpeg using the waifu2x-caffe binary.
|
||||
|
||||
Arguments:
|
||||
w2 {Waifu2x Object} -- initialized waifu2x object
|
||||
"""
|
||||
|
||||
# initialize waifu2x driver
|
||||
if self.driver not in AVAILABLE_DRIVERS:
|
||||
raise UnrecognizedDriverError(_('Unrecognized driver: {}').format(self.driver))
|
||||
|
||||
# list all images in the extracted frames
|
||||
frames = [(self.extracted_frames / f) for f in self.extracted_frames.iterdir() if f.is_file]
|
||||
|
||||
# if we have less images than processes,
|
||||
# create only the processes necessary
|
||||
if len(frames) < self.processes:
|
||||
self.processes = len(frames)
|
||||
|
||||
# create a directory for each process and append directory
|
||||
# name into a list
|
||||
process_directories = []
|
||||
for process_id in range(self.processes):
|
||||
process_directory = self.extracted_frames / str(process_id)
|
||||
process_directories.append(process_directory)
|
||||
|
||||
# delete old directories and create new directories
|
||||
if process_directory.is_dir():
|
||||
shutil.rmtree(process_directory)
|
||||
process_directory.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# waifu2x-converter-cpp will perform multi-threading within its own process
|
||||
if self.driver in ['waifu2x_converter_cpp', 'waifu2x_ncnn_vulkan', 'srmd_ncnn_vulkan', 'realsr_ncnn_vulkan', 'anime4kcpp']:
|
||||
process_directories = [self.extracted_frames]
|
||||
|
||||
else:
|
||||
# evenly distribute images into each directory
|
||||
# until there is none left in the directory
|
||||
for image in frames:
|
||||
# move image
|
||||
image.rename(process_directories[0] / image.name)
|
||||
# rotate list
|
||||
process_directories = process_directories[-1:] + process_directories[:-1]
|
||||
|
||||
# create driver processes and start them
|
||||
for process_directory in process_directories:
|
||||
self.process_pool.append(self.driver_object.upscale(process_directory, self.upscaled_frames))
|
||||
|
||||
# start progress bar in a different thread
|
||||
Avalon.debug_info(_('Starting progress monitor'))
|
||||
self.progress_monitor = ProgressMonitor(self, process_directories)
|
||||
self.progress_monitor.start()
|
||||
|
||||
# create the clearer and start it
|
||||
Avalon.debug_info(_('Starting upscaled image cleaner'))
|
||||
self.image_cleaner = ImageCleaner(self.extracted_frames, self.upscaled_frames, len(self.process_pool))
|
||||
self.image_cleaner.start()
|
||||
|
||||
# wait for all process to exit
|
||||
try:
|
||||
self._wait()
|
||||
except (Exception, KeyboardInterrupt, SystemExit) as e:
|
||||
# cleanup
|
||||
Avalon.debug_info(_('Killing progress monitor'))
|
||||
self.progress_monitor.stop()
|
||||
|
||||
Avalon.debug_info(_('Killing upscaled image cleaner'))
|
||||
self.image_cleaner.stop()
|
||||
raise e
|
||||
|
||||
# if the driver is waifu2x-converter-cpp
|
||||
# images need to be renamed to be recognizable for FFmpeg
|
||||
if self.driver == 'waifu2x_converter_cpp':
|
||||
for image in [f for f in self.upscaled_frames.iterdir() if f.is_file()]:
|
||||
renamed = re.sub(f'_\\[.*\\]\\[x(\\d+(\\.\\d+)?)\\]\\.{self.extracted_frame_format}',
|
||||
f'.{self.extracted_frame_format}',
|
||||
str(image.name))
|
||||
(self.upscaled_frames / image).rename(self.upscaled_frames / renamed)
|
||||
|
||||
# upscaling done, kill helper threads
|
||||
Avalon.debug_info(_('Killing progress monitor'))
|
||||
self.progress_monitor.stop()
|
||||
|
||||
Avalon.debug_info(_('Killing upscaled image cleaner'))
|
||||
self.image_cleaner.stop()
|
||||
|
||||
def _terminate_subprocesses(self):
|
||||
Avalon.warning(_('Terminating all processes'))
|
||||
for process in self.process_pool:
|
||||
process.terminate()
|
||||
|
||||
def _wait(self):
|
||||
""" wait for subprocesses in process pool to complete
|
||||
"""
|
||||
Avalon.debug_info(_('Main process waiting for subprocesses to exit'))
|
||||
|
||||
try:
|
||||
# while process pool not empty
|
||||
while self.process_pool:
|
||||
|
||||
# if stop signal received, terminate all processes
|
||||
if self.running is False:
|
||||
raise SystemExit
|
||||
|
||||
for process in self.process_pool:
|
||||
process_status = process.poll()
|
||||
|
||||
# if process finished
|
||||
if process_status is None:
|
||||
continue
|
||||
|
||||
# if return code is not 0
|
||||
elif process_status != 0:
|
||||
Avalon.error(_('Subprocess {} exited with code {}').format(process.pid, process_status))
|
||||
raise subprocess.CalledProcessError(process_status, process.args)
|
||||
|
||||
else:
|
||||
Avalon.debug_info(_('Subprocess {} exited with code {}').format(process.pid, process_status))
|
||||
self.process_pool.remove(process)
|
||||
|
||||
time.sleep(0.1)
|
||||
|
||||
except (KeyboardInterrupt, SystemExit) as e:
|
||||
Avalon.warning(_('Stop signal received'))
|
||||
self._terminate_subprocesses()
|
||||
raise e
|
||||
|
||||
except (Exception, subprocess.CalledProcessError) as e:
|
||||
Avalon.error(_('Subprocess execution ran into an error'))
|
||||
self._terminate_subprocesses()
|
||||
raise e
|
||||
|
||||
def run(self):
|
||||
""" Main controller for Video2X
|
||||
|
||||
This function controls the flow of video conversion
|
||||
and handles all necessary functions.
|
||||
"""
|
||||
|
||||
# external stop signal when called in a thread
|
||||
self.running = True
|
||||
|
||||
# define process pool to contain processes
|
||||
self.process_pool = []
|
||||
|
||||
# load driver modules
|
||||
DriverWrapperMain = getattr(importlib.import_module(f'wrappers.{self.driver}'), 'WrapperMain')
|
||||
self.driver_object = DriverWrapperMain(self.driver_settings)
|
||||
|
||||
# load options from upscaler class into driver settings
|
||||
self.driver_object.load_configurations(self)
|
||||
|
||||
# initialize FFmpeg object
|
||||
self.ffmpeg_object = Ffmpeg(self.ffmpeg_settings, extracted_frame_format=self.extracted_frame_format)
|
||||
|
||||
# define processing queue
|
||||
self.processing_queue = queue.Queue()
|
||||
|
||||
Avalon.info(_('Loading files into processing queue'))
|
||||
Avalon.debug_info(_('Input path(s): {}').format(self.input))
|
||||
|
||||
# make output directory if the input is a list or a directory
|
||||
if isinstance(self.input, list) or self.input.is_dir():
|
||||
self.output.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
input_files = []
|
||||
|
||||
# if input is single directory
|
||||
# put it in a list for compability with the following code
|
||||
if not isinstance(self.input, list):
|
||||
input_paths = [self.input]
|
||||
else:
|
||||
input_paths = self.input
|
||||
|
||||
# flatten directories into file paths
|
||||
for input_path in input_paths:
|
||||
|
||||
# if the input path is a single file
|
||||
# add the file's path object to input_files
|
||||
if input_path.is_file():
|
||||
input_files.append(input_path)
|
||||
|
||||
# if the input path is a directory
|
||||
# add all files under the directory into the input_files (non-recursive)
|
||||
elif input_path.is_dir():
|
||||
input_files.extend([f for f in input_path.iterdir() if f.is_file()])
|
||||
|
||||
output_paths = []
|
||||
|
||||
for input_path in input_files:
|
||||
|
||||
# get file type
|
||||
# try python-magic if it's available
|
||||
try:
|
||||
input_file_mime_type = magic.from_file(str(input_path.absolute()), mime=True)
|
||||
input_file_type = input_file_mime_type.split('/')[0]
|
||||
input_file_subtype = input_file_mime_type.split('/')[1]
|
||||
except Exception:
|
||||
input_file_type = input_file_subtype = None
|
||||
|
||||
# in case python-magic fails to detect file type
|
||||
# try guessing file mime type with mimetypes
|
||||
if input_file_type not in ['image', 'video']:
|
||||
input_file_mime_type = mimetypes.guess_type(input_path.name)[0]
|
||||
input_file_type = input_file_mime_type.split('/')[0]
|
||||
input_file_subtype = input_file_mime_type.split('/')[1]
|
||||
|
||||
# set default output file suffixes
|
||||
# if image type is GIF, default output suffix is also .gif
|
||||
if input_file_mime_type == 'image/gif':
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension='.gif')
|
||||
|
||||
elif input_file_type == 'image':
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension=self.image_output_extension)
|
||||
|
||||
elif input_file_type == 'video':
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension=self.video_output_extension)
|
||||
|
||||
# if file is none of: image, image/gif, video
|
||||
# skip to the next task
|
||||
else:
|
||||
Avalon.error(_('File {} ({}) neither an image nor a video').format(input_path, input_file_mime_type))
|
||||
Avalon.warning(_('Skipping this file'))
|
||||
continue
|
||||
|
||||
# if there is only one input file
|
||||
# do not modify output file suffix
|
||||
if isinstance(self.input, pathlib.Path) and self.input.is_file():
|
||||
output_path = self.output
|
||||
|
||||
output_path_id = 0
|
||||
while str(output_path) in output_paths:
|
||||
output_path = output_path.parent / pathlib.Path(f'{output_path.stem}_{output_path_id}{output_path.suffix}')
|
||||
output_path_id += 1
|
||||
|
||||
# record output path
|
||||
output_paths.append(str(output_path))
|
||||
|
||||
# push file information into processing queue
|
||||
self.processing_queue.put((input_path.absolute(), output_path.absolute(), input_file_mime_type, input_file_type, input_file_subtype))
|
||||
|
||||
# check argument sanity before running
|
||||
self._check_arguments()
|
||||
|
||||
# record file count for external calls
|
||||
self.total_files = self.processing_queue.qsize()
|
||||
|
||||
Avalon.info(_('Loaded files into processing queue'))
|
||||
# print all files in queue for debugging
|
||||
for job in self.processing_queue.queue:
|
||||
Avalon.debug_info(_('Input file: {}').format(job[0].absolute()))
|
||||
|
||||
try:
|
||||
while not self.processing_queue.empty():
|
||||
|
||||
# get new job from queue
|
||||
self.current_input_file, output_path, input_file_mime_type, input_file_type, input_file_subtype = self.processing_queue.get()
|
||||
|
||||
# start handling input
|
||||
# if input file is a static image
|
||||
if input_file_type == 'image' and input_file_subtype != 'gif':
|
||||
Avalon.info(_('Starting to upscale image'))
|
||||
self.process_pool.append(self.driver_object.upscale(self.current_input_file, output_path))
|
||||
self._wait()
|
||||
Avalon.info(_('Upscaling completed'))
|
||||
|
||||
# static images don't require GIF or video encoding
|
||||
# go to the next task
|
||||
self.processing_queue.task_done()
|
||||
self.total_processed += 1
|
||||
continue
|
||||
|
||||
# if input file is a image/gif file or a video
|
||||
elif input_file_mime_type == 'image/gif' or input_file_type == 'video':
|
||||
|
||||
self.create_temp_directories()
|
||||
|
||||
# get video information JSON using FFprobe
|
||||
Avalon.info(_('Reading video information'))
|
||||
video_info = self.ffmpeg_object.probe_file_info(self.current_input_file)
|
||||
# analyze original video with FFprobe and retrieve framerate
|
||||
# width, height = info['streams'][0]['width'], info['streams'][0]['height']
|
||||
|
||||
# find index of video stream
|
||||
video_stream_index = None
|
||||
for stream in video_info['streams']:
|
||||
if stream['codec_type'] == 'video':
|
||||
video_stream_index = stream['index']
|
||||
break
|
||||
|
||||
# exit if no video stream found
|
||||
if video_stream_index is None:
|
||||
Avalon.error(_('Aborting: No video stream found'))
|
||||
raise StreamNotFoundError('no video stream found')
|
||||
|
||||
# get average frame rate of video stream
|
||||
framerate = float(Fraction(video_info['streams'][video_stream_index]['r_frame_rate']))
|
||||
Avalon.info(_('Framerate: {}').format(framerate))
|
||||
# self.ffmpeg_object.pixel_format = video_info['streams'][video_stream_index]['pix_fmt']
|
||||
|
||||
# extract frames from video
|
||||
self.process_pool.append((self.ffmpeg_object.extract_frames(self.current_input_file, self.extracted_frames)))
|
||||
self._wait()
|
||||
|
||||
# if driver is waifu2x-caffe
|
||||
# pass pixel format output depth information
|
||||
if self.driver == 'waifu2x_caffe':
|
||||
# get a dict of all pixel formats and corresponding bit depth
|
||||
pixel_formats = self.ffmpeg_object.get_pixel_formats()
|
||||
|
||||
# try getting pixel format's corresponding bti depth
|
||||
try:
|
||||
self.driver_settings['output_depth'] = pixel_formats[self.ffmpeg_object.pixel_format]
|
||||
except KeyError:
|
||||
Avalon.error(_('Unsupported pixel format: {}').format(self.ffmpeg_object.pixel_format))
|
||||
raise UnsupportedPixelError(f'unsupported pixel format {self.ffmpeg_object.pixel_format}')
|
||||
|
||||
# width/height will be coded width/height x upscale factor
|
||||
# original_width = video_info['streams'][video_stream_index]['width']
|
||||
# original_height = video_info['streams'][video_stream_index]['height']
|
||||
# scale_width = int(self.scale_ratio * original_width)
|
||||
# scale_height = int(self.scale_ratio * original_height)
|
||||
|
||||
# upscale images one by one using waifu2x
|
||||
Avalon.info(_('Starting to upscale extracted frames'))
|
||||
self._upscale_frames()
|
||||
Avalon.info(_('Upscaling completed'))
|
||||
|
||||
# start handling output
|
||||
# output can be either GIF or video
|
||||
|
||||
# if the desired output is gif file
|
||||
if output_path.suffix.lower() == '.gif':
|
||||
Avalon.info(_('Converting extracted frames into GIF image'))
|
||||
gifski_object = Gifski(self.gifski_settings)
|
||||
self.process_pool.append(gifski_object.make_gif(self.upscaled_frames, output_path, framerate, self.extracted_frame_format))
|
||||
self._wait()
|
||||
Avalon.info(_('Conversion completed'))
|
||||
|
||||
# if the desired output is video
|
||||
else:
|
||||
# frames to video
|
||||
Avalon.info(_('Converting extracted frames into video'))
|
||||
self.process_pool.append(self.ffmpeg_object.assemble_video(framerate, self.upscaled_frames))
|
||||
# f'{scale_width}x{scale_height}'
|
||||
self._wait()
|
||||
Avalon.info(_('Conversion completed'))
|
||||
|
||||
try:
|
||||
# migrate audio tracks and subtitles
|
||||
Avalon.info(_('Migrating audio, subtitles and other streams to upscaled video'))
|
||||
self.process_pool.append(self.ffmpeg_object.migrate_streams(self.current_input_file,
|
||||
output_path,
|
||||
self.upscaled_frames))
|
||||
self._wait()
|
||||
|
||||
# if failed to copy streams
|
||||
# use file with only video stream
|
||||
except subprocess.CalledProcessError:
|
||||
traceback.print_exc()
|
||||
Avalon.error(_('Failed to migrate streams'))
|
||||
Avalon.warning(_('Trying to output video without additional streams'))
|
||||
|
||||
if input_file_mime_type == 'image/gif':
|
||||
# copy will overwrite destination content if exists
|
||||
shutil.copy(self.upscaled_frames / self.ffmpeg_object.intermediate_file_name, output_path)
|
||||
|
||||
else:
|
||||
# construct output file path
|
||||
output_file_name = f'{output_path.stem}{self.ffmpeg_object.intermediate_file_name.suffix}'
|
||||
output_video_path = output_path.parent / output_file_name
|
||||
|
||||
# if output file already exists
|
||||
# create temporary directory in output folder
|
||||
# temporary directories generated by tempfile are guaranteed to be unique
|
||||
# and won't conflict with other files
|
||||
if output_video_path.exists():
|
||||
Avalon.error(_('Output video file exists'))
|
||||
|
||||
temporary_directory = pathlib.Path(tempfile.mkdtemp(dir=output_path.parent))
|
||||
output_video_path = temporary_directory / output_file_name
|
||||
Avalon.info(_('Created temporary directory to contain file'))
|
||||
|
||||
# move file to new destination
|
||||
Avalon.info(_('Writing intermediate file to: {}').format(output_video_path.absolute()))
|
||||
shutil.move(self.upscaled_frames / self.ffmpeg_object.intermediate_file_name, output_video_path)
|
||||
|
||||
# increment total number of files processed
|
||||
self.cleanup_temp_directories()
|
||||
self.processing_queue.task_done()
|
||||
self.total_processed += 1
|
||||
|
||||
except (Exception, KeyboardInterrupt, SystemExit) as e:
|
||||
with contextlib.suppress(ValueError, AttributeError):
|
||||
self.cleanup_temp_directories()
|
||||
self.running = False
|
||||
raise e
|
||||
|
||||
# signal upscaling completion
|
||||
self.running = False
|
||||
599
src/video2x.c
Normal file
599
src/video2x.c
Normal file
@@ -0,0 +1,599 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <threads.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <libavutil/hwcontext.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
#include <libavutil/pixfmt.h>
|
||||
|
||||
#include <libvideo2x/libvideo2x.h>
|
||||
#include <libvideo2x/version.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
// Define command line options
|
||||
static struct option long_options[] = {
|
||||
{"loglevel", required_argument, NULL, 0},
|
||||
{"noprogress", no_argument, NULL, 0},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, NULL, 0},
|
||||
|
||||
// General options
|
||||
{"input", required_argument, NULL, 'i'},
|
||||
{"output", required_argument, NULL, 'o'},
|
||||
{"filter", required_argument, NULL, 'f'},
|
||||
{"hwaccel", required_argument, NULL, 'a'},
|
||||
{"nocopystreams", no_argument, NULL, 0},
|
||||
{"benchmark", no_argument, NULL, 0},
|
||||
|
||||
// Encoder options
|
||||
{"codec", required_argument, NULL, 'c'},
|
||||
{"preset", required_argument, NULL, 'p'},
|
||||
{"pixfmt", required_argument, NULL, 'x'},
|
||||
{"bitrate", required_argument, NULL, 'b'},
|
||||
{"crf", required_argument, NULL, 'q'},
|
||||
|
||||
// libplacebo options
|
||||
{"shader", required_argument, NULL, 's'},
|
||||
{"width", required_argument, NULL, 'w'},
|
||||
{"height", required_argument, NULL, 'h'},
|
||||
|
||||
// RealESRGAN options
|
||||
{"gpuid", required_argument, NULL, 'g'},
|
||||
{"model", required_argument, NULL, 'm'},
|
||||
{"scale", required_argument, NULL, 'r'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
// List of valid RealESRGAN models
|
||||
const char *valid_realesrgan_models[] = {
|
||||
"realesrgan-plus",
|
||||
"realesrgan-plus-anime",
|
||||
"realesr-animevideov3",
|
||||
};
|
||||
|
||||
// Indicate if a newline needs to be printed before the next output
|
||||
bool newline_required = false;
|
||||
|
||||
// Structure to hold parsed arguments
|
||||
struct arguments {
|
||||
// General options
|
||||
const char *loglevel;
|
||||
bool noprogress;
|
||||
const char *in_fname;
|
||||
const char *out_fname;
|
||||
const char *filter_type;
|
||||
const char *hwaccel;
|
||||
bool nocopystreams;
|
||||
bool benchmark;
|
||||
|
||||
// Encoder options
|
||||
const char *codec;
|
||||
const char *pix_fmt;
|
||||
const char *preset;
|
||||
int64_t bitrate;
|
||||
float crf;
|
||||
|
||||
// libplacebo options
|
||||
const char *shader_path;
|
||||
int out_width;
|
||||
int out_height;
|
||||
|
||||
// RealESRGAN options
|
||||
int gpuid;
|
||||
const char *model;
|
||||
int scaling_factor;
|
||||
};
|
||||
|
||||
struct ProcessVideoThreadArguments {
|
||||
struct arguments *arguments;
|
||||
enum AVHWDeviceType hw_device_type;
|
||||
struct FilterConfig *filter_config;
|
||||
struct EncoderConfig *encoder_config;
|
||||
struct VideoProcessingContext *proc_ctx;
|
||||
};
|
||||
|
||||
// Set UNIX terminal input to non-blocking mode
|
||||
#ifndef _WIN32
|
||||
void set_nonblocking_input(bool enable) {
|
||||
static struct termios oldt, newt;
|
||||
if (enable) {
|
||||
tcgetattr(STDIN_FILENO, &oldt);
|
||||
newt = oldt;
|
||||
newt.c_lflag &= ~(tcflag_t)(ICANON | ECHO);
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
|
||||
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
|
||||
} else {
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
|
||||
fcntl(STDIN_FILENO, F_SETFL, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Newline-safe log callback for FFmpeg
|
||||
void newline_safe_ffmpeg_log_callback(void *ptr, int level, const char *fmt, va_list vl) {
|
||||
if (level <= av_log_get_level() && newline_required) {
|
||||
putchar('\n');
|
||||
newline_required = false;
|
||||
}
|
||||
av_log_default_callback(ptr, level, fmt, vl);
|
||||
}
|
||||
|
||||
int is_valid_realesrgan_model(const char *model) {
|
||||
if (!model) {
|
||||
return 0;
|
||||
}
|
||||
for (unsigned long i = 0;
|
||||
i < sizeof(valid_realesrgan_models) / sizeof(valid_realesrgan_models[0]);
|
||||
i++) {
|
||||
if (strcmp(model, valid_realesrgan_models[i]) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_help(void) {
|
||||
printf("Usage: video2x [OPTIONS]\n");
|
||||
printf("\nOptions:\n");
|
||||
printf(" --loglevel Set log level \n");
|
||||
printf(" (trace, debug, info, warn, error, critical, none)\n");
|
||||
printf(" --noprogress Do not display the progress bar\n");
|
||||
printf(" -v, --version Print program version\n");
|
||||
printf(" -?, --help Display this help page\n");
|
||||
printf("\nGeneral Processing Options:\n");
|
||||
printf(" -i, --input Input video file path\n");
|
||||
printf(" -o, --output Output video file path\n");
|
||||
printf(" -f, --filter Filter to use: 'libplacebo' or 'realesrgan'\n");
|
||||
printf(" -a, --hwaccel Hardware acceleration method (default: none)\n");
|
||||
printf(" --nocopystreams Do not copy audio and subtitle streams\n");
|
||||
printf(" --benchmark Discard processed frames and calculate average FPS\n");
|
||||
|
||||
printf("\nEncoder Options (Optional):\n");
|
||||
printf(" -c, --codec Output codec (default: libx264)\n");
|
||||
printf(" -p, --preset Encoder preset (default: slow)\n");
|
||||
printf(" -x, --pixfmt Output pixel format (default: auto)\n");
|
||||
printf(" -b, --bitrate Bitrate in bits per second (default: 0 (VBR))\n");
|
||||
printf(" -q, --crf Constant Rate Factor (default: 20.0)\n");
|
||||
|
||||
printf("\nlibplacebo Options:\n");
|
||||
printf(" -s, --shader Name or path of the GLSL shader file to use \n");
|
||||
printf(" (built-in: 'anime4k-a', 'anime4k-b', 'anime4k-c',\n");
|
||||
printf(" 'anime4k-a+a', 'anime4k-b+b', 'anime4k-c+a')\n");
|
||||
printf(" -w, --width Output width\n");
|
||||
printf(" -h, --height Output height\n");
|
||||
|
||||
printf("\nRealESRGAN Options:\n");
|
||||
printf(" -g, --gpuid Vulkan GPU ID (default: 0)\n");
|
||||
printf(" -m, --model Name of the model to use\n");
|
||||
printf(" -r, --scale Scaling factor (2, 3, or 4)\n");
|
||||
|
||||
printf("\nExamples Usage:\n");
|
||||
printf(" video2x -i in.mp4 -o out.mp4 -f libplacebo -s anime4k-a+a -w 3840 -h 2160\n");
|
||||
printf(" video2x -i in.mp4 -o out.mp4 -f realesrgan -m realesr-animevideov3 -r 4\n");
|
||||
}
|
||||
|
||||
void parse_arguments(int argc, char **argv, struct arguments *arguments) {
|
||||
int option_index = 0;
|
||||
int c;
|
||||
|
||||
// Default argument values
|
||||
arguments->loglevel = "info";
|
||||
arguments->noprogress = false;
|
||||
arguments->in_fname = NULL;
|
||||
arguments->out_fname = NULL;
|
||||
arguments->filter_type = NULL;
|
||||
arguments->hwaccel = "none";
|
||||
arguments->nocopystreams = false;
|
||||
arguments->benchmark = false;
|
||||
|
||||
// Encoder options
|
||||
arguments->codec = "libx264";
|
||||
arguments->preset = "slow";
|
||||
arguments->pix_fmt = NULL;
|
||||
arguments->bitrate = 0;
|
||||
arguments->crf = 20.0;
|
||||
|
||||
// libplacebo options
|
||||
arguments->shader_path = NULL;
|
||||
arguments->out_width = 0;
|
||||
arguments->out_height = 0;
|
||||
|
||||
// RealESRGAN options
|
||||
arguments->gpuid = 0;
|
||||
arguments->model = NULL;
|
||||
arguments->scaling_factor = 0;
|
||||
|
||||
while ((c = getopt_long(
|
||||
argc, argv, "i:o:f:a:c:x:p:b:q:s:w:h:r:m:v", long_options, &option_index
|
||||
)) != -1) {
|
||||
switch (c) {
|
||||
case 'i':
|
||||
arguments->in_fname = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
arguments->out_fname = optarg;
|
||||
break;
|
||||
case 'f':
|
||||
arguments->filter_type = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
arguments->hwaccel = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
arguments->codec = optarg;
|
||||
break;
|
||||
case 'x':
|
||||
arguments->pix_fmt = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
arguments->preset = optarg;
|
||||
break;
|
||||
case 'b':
|
||||
arguments->bitrate = strtoll(optarg, NULL, 10);
|
||||
if (arguments->bitrate <= 0) {
|
||||
fprintf(stderr, "Error: Invalid bitrate specified.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
arguments->crf = (float)atof(optarg);
|
||||
if (arguments->crf < 0.0 || arguments->crf > 51.0) {
|
||||
fprintf(stderr, "Error: CRF must be between 0 and 51.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
arguments->shader_path = optarg;
|
||||
break;
|
||||
case 'w':
|
||||
arguments->out_width = atoi(optarg);
|
||||
if (arguments->out_width <= 0) {
|
||||
fprintf(stderr, "Error: Output width must be greater than 0.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
arguments->out_height = atoi(optarg);
|
||||
if (arguments->out_height <= 0) {
|
||||
fprintf(stderr, "Error: Output height must be greater than 0.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'g':
|
||||
arguments->gpuid = atoi(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
arguments->model = optarg;
|
||||
if (!is_valid_realesrgan_model(arguments->model)) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"Error: Invalid model specified. Must be 'realesrgan-plus', "
|
||||
"'realesrgan-plus-anime', or 'realesr-animevideov3'.\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
arguments->scaling_factor = atoi(optarg);
|
||||
if (arguments->scaling_factor != 2 && arguments->scaling_factor != 3 &&
|
||||
arguments->scaling_factor != 4) {
|
||||
fprintf(stderr, "Error: Scaling factor must be 2, 3, or 4.\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
printf("Video2X version %s\n", LIBVIDEO2X_VERSION_STRING);
|
||||
exit(0);
|
||||
case 0: // Long-only options without short equivalents
|
||||
if (strcmp(long_options[option_index].name, "loglevel") == 0) {
|
||||
arguments->loglevel = optarg;
|
||||
} else if (strcmp(long_options[option_index].name, "noprogress") == 0) {
|
||||
arguments->noprogress = true;
|
||||
} else if (strcmp(long_options[option_index].name, "help") == 0) {
|
||||
print_help();
|
||||
exit(0);
|
||||
} else if (strcmp(long_options[option_index].name, "nocopystreams") == 0) {
|
||||
arguments->nocopystreams = true;
|
||||
} else if (strcmp(long_options[option_index].name, "benchmark") == 0) {
|
||||
arguments->benchmark = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Invalid options provided.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for required arguments
|
||||
if (!arguments->in_fname) {
|
||||
fprintf(stderr, "Error: Input file path is required.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!arguments->out_fname && !arguments->benchmark) {
|
||||
fprintf(stderr, "Error: Output file path is required.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!arguments->filter_type) {
|
||||
fprintf(stderr, "Error: Filter type is required (libplacebo or realesrgan).\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strcmp(arguments->filter_type, "libplacebo") == 0) {
|
||||
if (!arguments->shader_path || arguments->out_width == 0 || arguments->out_height == 0) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"Error: For libplacebo, shader name/path (-s), width (-w), "
|
||||
"and height (-e) are required.\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
} else if (strcmp(arguments->filter_type, "realesrgan") == 0) {
|
||||
if (arguments->scaling_factor == 0 || !arguments->model) {
|
||||
fprintf(
|
||||
stderr, "Error: For realesrgan, scaling factor (-r) and model (-m) are required.\n"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum Libvideo2xLogLevel parse_log_level(const char *level_name) {
|
||||
if (strcmp(level_name, "trace") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_TRACE;
|
||||
} else if (strcmp(level_name, "debug") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_DEBUG;
|
||||
} else if (strcmp(level_name, "info") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_INFO;
|
||||
} else if (strcmp(level_name, "warning") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_WARNING;
|
||||
} else if (strcmp(level_name, "error") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_ERROR;
|
||||
} else if (strcmp(level_name, "critical") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_CRITICAL;
|
||||
} else if (strcmp(level_name, "off") == 0) {
|
||||
return LIBVIDEO2X_LOG_LEVEL_OFF;
|
||||
} else {
|
||||
fprintf(stderr, "Warning: Invalid log level specified. Defaulting to 'info'.\n");
|
||||
return LIBVIDEO2X_LOG_LEVEL_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrapper function for video processing thread
|
||||
int process_video_thread(void *arg) {
|
||||
struct ProcessVideoThreadArguments *thread_args = (struct ProcessVideoThreadArguments *)arg;
|
||||
|
||||
// Extract individual arguments
|
||||
enum Libvideo2xLogLevel log_level = parse_log_level(thread_args->arguments->loglevel);
|
||||
struct arguments *arguments = thread_args->arguments;
|
||||
enum AVHWDeviceType hw_device_type = thread_args->hw_device_type;
|
||||
struct FilterConfig *filter_config = thread_args->filter_config;
|
||||
struct EncoderConfig *encoder_config = thread_args->encoder_config;
|
||||
struct VideoProcessingContext *proc_ctx = thread_args->proc_ctx;
|
||||
|
||||
// Call the process_video function
|
||||
int result = process_video(
|
||||
arguments->in_fname,
|
||||
arguments->out_fname,
|
||||
log_level,
|
||||
arguments->benchmark,
|
||||
hw_device_type,
|
||||
filter_config,
|
||||
encoder_config,
|
||||
proc_ctx
|
||||
);
|
||||
|
||||
proc_ctx->completed = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Print help if no arguments are provided
|
||||
if (argc < 2) {
|
||||
print_help();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Parse command line arguments
|
||||
struct arguments arguments;
|
||||
parse_arguments(argc, argv, &arguments);
|
||||
|
||||
// Setup filter configurations based on the parsed arguments
|
||||
struct FilterConfig filter_config;
|
||||
if (strcmp(arguments.filter_type, "libplacebo") == 0) {
|
||||
filter_config.filter_type = FILTER_LIBPLACEBO;
|
||||
filter_config.config.libplacebo.out_width = arguments.out_width;
|
||||
filter_config.config.libplacebo.out_height = arguments.out_height;
|
||||
filter_config.config.libplacebo.shader_path = arguments.shader_path;
|
||||
} else if (strcmp(arguments.filter_type, "realesrgan") == 0) {
|
||||
filter_config.filter_type = FILTER_REALESRGAN;
|
||||
filter_config.config.realesrgan.gpuid = arguments.gpuid;
|
||||
filter_config.config.realesrgan.tta_mode = 0;
|
||||
filter_config.config.realesrgan.scaling_factor = arguments.scaling_factor;
|
||||
filter_config.config.realesrgan.model = arguments.model;
|
||||
} else {
|
||||
fprintf(stderr, "Error: Invalid filter type specified.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Parse codec to AVCodec
|
||||
const AVCodec *codec = avcodec_find_encoder_by_name(arguments.codec);
|
||||
if (!codec) {
|
||||
fprintf(stderr, "Error: Codec '%s' not found.\n", arguments.codec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Parse pixel format to AVPixelFormat
|
||||
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
||||
if (arguments.pix_fmt) {
|
||||
pix_fmt = av_get_pix_fmt(arguments.pix_fmt);
|
||||
if (pix_fmt == AV_PIX_FMT_NONE) {
|
||||
fprintf(stderr, "Error: Invalid pixel format '%s'.\n", arguments.pix_fmt);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Setup encoder configuration
|
||||
struct EncoderConfig encoder_config = {
|
||||
.out_width = 0, // To be filled by libvideo2x
|
||||
.out_height = 0, // To be filled by libvideo2x
|
||||
.copy_streams = !arguments.nocopystreams,
|
||||
.codec = codec->id,
|
||||
.pix_fmt = pix_fmt,
|
||||
.preset = arguments.preset,
|
||||
.bit_rate = arguments.bitrate,
|
||||
.crf = arguments.crf,
|
||||
};
|
||||
|
||||
// Parse hardware acceleration method
|
||||
enum AVHWDeviceType hw_device_type = AV_HWDEVICE_TYPE_NONE;
|
||||
if (strcmp(arguments.hwaccel, "none") != 0) {
|
||||
hw_device_type = av_hwdevice_find_type_by_name(arguments.hwaccel);
|
||||
if (hw_device_type == AV_HWDEVICE_TYPE_NONE) {
|
||||
fprintf(stderr, "Error: Invalid hardware device type '%s'.\n", arguments.hwaccel);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Setup struct to store processing context
|
||||
struct VideoProcessingContext proc_ctx = {
|
||||
.processed_frames = 0,
|
||||
.total_frames = 0,
|
||||
.start_time = time(NULL),
|
||||
.pause = false,
|
||||
.abort = false,
|
||||
.completed = false
|
||||
};
|
||||
|
||||
// Create a ThreadArguments struct to hold all the arguments for the thread
|
||||
struct ProcessVideoThreadArguments thread_args = {
|
||||
.arguments = &arguments,
|
||||
.hw_device_type = hw_device_type,
|
||||
.filter_config = &filter_config,
|
||||
.encoder_config = &encoder_config,
|
||||
.proc_ctx = &proc_ctx
|
||||
};
|
||||
|
||||
// Register a newline-safe log callback for FFmpeg
|
||||
// This will ensure that log messages are printed on a new line after the progress bar
|
||||
av_log_set_callback(newline_safe_ffmpeg_log_callback);
|
||||
|
||||
// Create a thread for video processing
|
||||
thrd_t processing_thread;
|
||||
if (thrd_create(&processing_thread, process_video_thread, &thread_args) != thrd_success) {
|
||||
fprintf(stderr, "Failed to create processing thread\n");
|
||||
return 1;
|
||||
}
|
||||
printf("Video processing started; press SPACE to pause/resume, 'q' to abort.\n");
|
||||
|
||||
// Enable non-blocking input
|
||||
#ifndef _WIN32
|
||||
set_nonblocking_input(true);
|
||||
#endif
|
||||
|
||||
// Main thread loop to display progress and handle input
|
||||
while (!proc_ctx.completed) {
|
||||
// Check for key presses
|
||||
int ch = -1;
|
||||
|
||||
// Check for key press
|
||||
#ifdef _WIN32
|
||||
if (_kbhit()) {
|
||||
ch = _getch();
|
||||
}
|
||||
#else
|
||||
ch = getchar();
|
||||
#endif
|
||||
|
||||
if (ch == ' ' || ch == '\n') {
|
||||
// Toggle pause state
|
||||
proc_ctx.pause = !proc_ctx.pause;
|
||||
if (proc_ctx.pause) {
|
||||
printf("\nProcessing paused. Press SPACE to resume, 'q' to abort.\n");
|
||||
} else {
|
||||
printf("Resuming processing...\n");
|
||||
}
|
||||
} else if (ch == 'q' || ch == 'Q') {
|
||||
// Abort processing
|
||||
printf("\nAborting processing...\n");
|
||||
proc_ctx.abort = true;
|
||||
newline_required = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Display progress
|
||||
if (!arguments.noprogress && !proc_ctx.pause && proc_ctx.total_frames > 0) {
|
||||
printf(
|
||||
"\rProcessing frame %ld/%ld (%.2f%%); time elapsed: %lds",
|
||||
proc_ctx.processed_frames,
|
||||
proc_ctx.total_frames,
|
||||
proc_ctx.total_frames > 0
|
||||
? (double)proc_ctx.processed_frames * 100.0 / (double)proc_ctx.total_frames
|
||||
: 0.0,
|
||||
time(NULL) - proc_ctx.start_time
|
||||
);
|
||||
fflush(stdout);
|
||||
newline_required = true;
|
||||
}
|
||||
|
||||
// Sleep for 50ms
|
||||
thrd_sleep(&(struct timespec){.tv_sec = 0, .tv_nsec = 100000000}, NULL);
|
||||
}
|
||||
|
||||
// Restore terminal to blocking mode
|
||||
#ifndef _WIN32
|
||||
set_nonblocking_input(false);
|
||||
#endif
|
||||
|
||||
// Join the processing thread to ensure it completes before exiting
|
||||
int process_result;
|
||||
thrd_join(processing_thread, &process_result);
|
||||
|
||||
// Print a newline if progress bar was displayed
|
||||
if (newline_required) {
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
// Print final message based on processing result
|
||||
if (proc_ctx.abort) {
|
||||
fprintf(stderr, "Video processing aborted\n");
|
||||
return 2;
|
||||
} else if (process_result != 0) {
|
||||
fprintf(stderr, "Video processing failed\n");
|
||||
return process_result;
|
||||
} else {
|
||||
printf("Video processing completed successfully\n");
|
||||
}
|
||||
|
||||
// Calculate statistics
|
||||
time_t time_elapsed = time(NULL) - proc_ctx.start_time;
|
||||
float average_speed_fps =
|
||||
(float)proc_ctx.processed_frames / (time_elapsed > 0 ? (float)time_elapsed : 1);
|
||||
|
||||
// Print processing summary
|
||||
printf("====== Video2X %s summary ======\n", arguments.benchmark ? "Benchmark" : "Processing");
|
||||
printf("Video file processed: %s\n", arguments.in_fname);
|
||||
printf("Total frames processed: %ld\n", proc_ctx.processed_frames);
|
||||
printf("Total time taken: %lds\n", time_elapsed);
|
||||
printf("Average processing speed: %.2f FPS\n", average_speed_fps);
|
||||
|
||||
// Print additional information if not in benchmark mode
|
||||
if (!arguments.benchmark) {
|
||||
printf("Output written to: %s\n", arguments.out_fname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
307
src/video2x.pot
307
src/video2x.pot
@@ -1,307 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2020-05-22 17:51-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=cp1252\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: progress_monitor.py:42
|
||||
msgid "Upscaling Progress"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:110
|
||||
msgid "Specified or default cache directory is a file/link"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:116
|
||||
msgid "Creating cache directory {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:119
|
||||
msgid "Unable to create {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:124
|
||||
msgid "Extracted frames are being saved to: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:126
|
||||
msgid "Upscaled frames are being saved to: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:136
|
||||
msgid "Cleaning up cache directory: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:141
|
||||
msgid "Unable to delete: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:147 upscaler.py:162 upscaler.py:173
|
||||
msgid "Input and output path type mismatch"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:148
|
||||
msgid "Input is multiple files but output is not directory"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:152
|
||||
msgid "Input path {} is neither a file nor a directory"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:156 upscaler.py:178
|
||||
msgid "Input directory and output directory cannot be the same"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:163
|
||||
msgid "Input is single file but output is directory"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:166
|
||||
msgid "No suffix found in output file path"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:167
|
||||
msgid "Suffix must be specified"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:174
|
||||
msgid "Input is directory but output is existing single file"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:183
|
||||
msgid "Input path is neither a file nor a directory"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:192
|
||||
msgid "FFmpeg or FFprobe cannot be found under the specified path"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:193 upscaler.py:203
|
||||
msgid "Please check the configuration file settings"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:202
|
||||
msgid "Specified driver executable directory doesn't exist"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:229
|
||||
msgid "Failed to parse driver argument: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:261
|
||||
msgid "Unrecognized driver: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:301
|
||||
msgid "Starting progress monitor"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:306
|
||||
msgid "Starting upscaled image cleaner"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:315 upscaler.py:332
|
||||
msgid "Killing progress monitor"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:318 upscaler.py:335
|
||||
msgid "Killing upscaled image cleaner"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:339
|
||||
msgid "Terminating all processes"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:346
|
||||
msgid "Main process waiting for subprocesses to exit"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:365 upscaler.py:369
|
||||
msgid "Subprocess {} exited with code {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:375
|
||||
msgid "Stop signal received"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:380
|
||||
msgid "Subprocess execution ran into an error"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:410
|
||||
msgid "Loading files into processing queue"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:415
|
||||
msgid "Loading files from multiple paths"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:416 upscaler.py:435 upscaler.py:442
|
||||
msgid "Input path(s): {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:434
|
||||
msgid "Loading single file"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:441
|
||||
msgid "Loading files from directory"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:455
|
||||
msgid "Loaded files into processing queue"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:458
|
||||
msgid "Input file: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:485
|
||||
msgid "Starting to upscale image"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:488 upscaler.py:550
|
||||
msgid "Upscaling completed"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:502
|
||||
msgid "Reading video information"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:516
|
||||
msgid "Aborting: No video stream found"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:521
|
||||
msgid "Framerate: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:538
|
||||
msgid "Unsupported pixel format: {}"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:548
|
||||
msgid "Starting to upscale extracted frames"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:555
|
||||
msgid "File {} ({}) neither an image nor a video"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:556
|
||||
msgid "Skipping this file"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:566
|
||||
msgid "Converting extracted frames into GIF image"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:570 upscaler.py:579
|
||||
msgid "Conversion completed"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:575
|
||||
msgid "Converting extracted frames into video"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:583
|
||||
msgid "Migrating audio, subtitles and other streams to upscaled video"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:593
|
||||
msgid "Failed to migrate streams"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:594
|
||||
msgid "Trying to output video without additional streams"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:610
|
||||
msgid "Output video file exists"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:614
|
||||
msgid "Created temporary directory to contain file"
|
||||
msgstr ""
|
||||
|
||||
#: upscaler.py:617
|
||||
msgid "Writing intermediate file to: {}"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:85
|
||||
msgid ""
|
||||
"Video2X CLI Version: {}\n"
|
||||
"Upscaler Version: {}\n"
|
||||
"Author: K4YT3X\n"
|
||||
"License: GNU GPL v3\n"
|
||||
"Github Page: https://github.com/k4yt3x/video2x\n"
|
||||
"Contact: k4yt3x@k4yt3x.com"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:108
|
||||
msgid "Video2X Options"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:109
|
||||
msgid "show this help message and exit"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:110
|
||||
msgid "source video file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:111
|
||||
msgid "output video file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:112
|
||||
msgid "video2x config file path"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:114
|
||||
msgid "display version, lawful information and exit"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:117
|
||||
msgid "Upscaling Options"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:118
|
||||
msgid "upscaling driver"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:119
|
||||
msgid "scaling ratio"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:120
|
||||
msgid "number of processes to use for upscaling"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:121
|
||||
msgid "preserve extracted and upscaled frames"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:161
|
||||
msgid "This file cannot be imported"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:236
|
||||
msgid "Program completed, taking {} seconds"
|
||||
msgstr ""
|
||||
|
||||
#: video2x.py:239
|
||||
msgid "An exception has occurred"
|
||||
msgstr ""
|
||||
|
||||
267
src/video2x.py
267
src/video2x.py
@@ -1,267 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
r"""
|
||||
|
||||
__ __ _ _ ___ __ __
|
||||
\ \ / / (_) | | |__ \ \ \ / /
|
||||
\ \ / / _ __| | ___ ___ ) | \ V /
|
||||
\ \/ / | | / _` | / _ \ / _ \ / / > <
|
||||
\ / | | | (_| | | __/ | (_) | / /_ / . \
|
||||
\/ |_| \__,_| \___| \___/ |____| /_/ \_\
|
||||
|
||||
|
||||
Name: Video2X Controller
|
||||
Creator: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: June 29, 2020
|
||||
|
||||
Editor: BrianPetkovsek
|
||||
Last Modified: June 17, 2019
|
||||
|
||||
Editor: SAT3LL
|
||||
Last Modified: June 25, 2019
|
||||
|
||||
Editor: 28598519a
|
||||
Last Modified: March 23, 2020
|
||||
|
||||
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
|
||||
available at: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
(C) 2018 - 2020 K4YT3X
|
||||
|
||||
Video2X is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Video2X is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Description: Video2X is an automation software based on waifu2x image
|
||||
enlarging engine. It extracts frames from a video, enlarge it by a
|
||||
number of times without losing any details or quality, keeping lines
|
||||
smooth and edges sharp.
|
||||
"""
|
||||
|
||||
# local imports
|
||||
from bilogger import BiLogger
|
||||
from upscaler import AVAILABLE_DRIVERS
|
||||
from upscaler import UPSCALER_VERSION
|
||||
from upscaler import Upscaler
|
||||
|
||||
# built-in imports
|
||||
import argparse
|
||||
import datetime
|
||||
import gettext
|
||||
import importlib
|
||||
import locale
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
import yaml
|
||||
|
||||
# third-party imports
|
||||
from avalon_framework import Avalon
|
||||
|
||||
# internationalization constants
|
||||
DOMAIN = 'video2x'
|
||||
LOCALE_DIRECTORY = pathlib.Path(__file__).parent.absolute() / 'locale'
|
||||
|
||||
# getting default locale settings
|
||||
default_locale, encoding = locale.getdefaultlocale()
|
||||
language = gettext.translation(DOMAIN, LOCALE_DIRECTORY, [default_locale], fallback=True)
|
||||
language.install()
|
||||
_ = language.gettext
|
||||
|
||||
CLI_VERSION = '4.2.0'
|
||||
|
||||
LEGAL_INFO = _('''Video2X CLI Version: {}
|
||||
Upscaler Version: {}
|
||||
Author: K4YT3X
|
||||
License: GNU GPL v3
|
||||
Github Page: https://github.com/k4yt3x/video2x
|
||||
Contact: k4yt3x@k4yt3x.com''').format(CLI_VERSION, UPSCALER_VERSION)
|
||||
|
||||
LOGO = r'''
|
||||
__ __ _ _ ___ __ __
|
||||
\ \ / / (_) | | |__ \ \ \ / /
|
||||
\ \ / / _ __| | ___ ___ ) | \ V /
|
||||
\ \/ / | | / _` | / _ \ / _ \ / / > <
|
||||
\ / | | | (_| | | __/ | (_) | / /_ / . \
|
||||
\/ |_| \__,_| \___| \___/ |____| /_/ \_\
|
||||
'''
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
""" parse CLI arguments
|
||||
"""
|
||||
parser = argparse.ArgumentParser(prog='video2x', formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
|
||||
|
||||
# video options
|
||||
video2x_options = parser.add_argument_group(_('Video2X Options'))
|
||||
video2x_options.add_argument('-h', '--help', action='help', help=_('show this help message and exit'))
|
||||
|
||||
# if help is in arguments list
|
||||
# do not require input and output path to be specified
|
||||
require_input_output = True
|
||||
if '-h' in sys.argv or '--help' in sys.argv:
|
||||
require_input_output = False
|
||||
video2x_options.add_argument('-i', '--input', type=pathlib.Path, help=_('source video file/directory'), required=require_input_output)
|
||||
video2x_options.add_argument('-o', '--output', type=pathlib.Path, help=_('output video file/directory'), required=require_input_output)
|
||||
|
||||
video2x_options.add_argument('-c', '--config', type=pathlib.Path, help=_('video2x config file path'), action='store',
|
||||
default=pathlib.Path(__file__).parent.absolute() / 'video2x.yaml')
|
||||
video2x_options.add_argument('--log', type=pathlib.Path, help=_('log file path'),
|
||||
default=pathlib.Path(__file__).parent.absolute() / f'video2x_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.log')
|
||||
video2x_options.add_argument('--disable_logging', help=_('disable logging'), action='store_true')
|
||||
video2x_options.add_argument('-v', '--version', help=_('display version, lawful information and exit'), action='store_true')
|
||||
|
||||
# scaling options
|
||||
upscaling_options = parser.add_argument_group(_('Upscaling Options'))
|
||||
upscaling_options.add_argument('-d', '--driver', help=_('upscaling driver'), choices=AVAILABLE_DRIVERS, default='waifu2x_caffe')
|
||||
upscaling_options.add_argument('-r', '--ratio', help=_('scaling ratio'), action='store', type=float, default=2.0)
|
||||
upscaling_options.add_argument('-p', '--processes', help=_('number of processes to use for upscaling'), action='store', type=int, default=1)
|
||||
upscaling_options.add_argument('--preserve_frames', help=_('preserve extracted and upscaled frames'), action='store_true')
|
||||
|
||||
# if no driver arguments are specified
|
||||
if '--' not in sys.argv:
|
||||
video2x_args = parser.parse_args()
|
||||
return video2x_args, None
|
||||
|
||||
# if driver arguments are specified
|
||||
else:
|
||||
video2x_args = parser.parse_args(sys.argv[1:sys.argv.index('--')])
|
||||
wrapper = getattr(importlib.import_module(f'wrappers.{video2x_args.driver}'), 'WrapperMain')
|
||||
driver_args = wrapper.parse_arguments(sys.argv[sys.argv.index('--') + 1:])
|
||||
return video2x_args, driver_args
|
||||
|
||||
|
||||
def print_logo():
|
||||
"""print video2x logo"""
|
||||
print(LOGO)
|
||||
print(f'\n{"Video2X Video Enlarger".rjust(40, " ")}')
|
||||
print(f'\n{Avalon.FM.BD}{f"Version {CLI_VERSION}".rjust(36, " ")}{Avalon.FM.RST}\n')
|
||||
|
||||
|
||||
def read_config(config_file: pathlib.Path) -> dict:
|
||||
""" read video2x configurations from config file
|
||||
|
||||
Arguments:
|
||||
config_file {pathlib.Path} -- video2x configuration file pathlib.Path
|
||||
|
||||
Returns:
|
||||
dict -- dictionary of video2x configuration
|
||||
"""
|
||||
|
||||
with open(config_file, 'r') as config:
|
||||
return yaml.load(config, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
# /////////////////// Execution /////////////////// #
|
||||
|
||||
# this is not a library
|
||||
if __name__ != '__main__':
|
||||
Avalon.error(_('This file cannot be imported'))
|
||||
raise ImportError(f'{__file__} cannot be imported')
|
||||
|
||||
# print video2x logo
|
||||
print_logo()
|
||||
|
||||
# parse command line arguments
|
||||
video2x_args, driver_args = parse_arguments()
|
||||
|
||||
# display version and lawful informaition
|
||||
if video2x_args.version:
|
||||
print(LEGAL_INFO)
|
||||
sys.exit(0)
|
||||
|
||||
# redirect output to both terminal and log file
|
||||
if video2x_args.disable_logging is False:
|
||||
LOGFILE = video2x_args.log
|
||||
Avalon.debug_info(_('Redirecting console logs to {}').format(LOGFILE))
|
||||
sys.stdout = BiLogger(sys.stdout, LOGFILE)
|
||||
sys.stderr = BiLogger(sys.stderr, LOGFILE)
|
||||
|
||||
# read configurations from configuration file
|
||||
config = read_config(video2x_args.config)
|
||||
|
||||
# load waifu2x configuration
|
||||
driver_settings = config[video2x_args.driver]
|
||||
driver_settings['path'] = os.path.expandvars(driver_settings['path'])
|
||||
|
||||
# read FFmpeg configuration
|
||||
ffmpeg_settings = config['ffmpeg']
|
||||
ffmpeg_settings['ffmpeg_path'] = os.path.expandvars(ffmpeg_settings['ffmpeg_path'])
|
||||
|
||||
# read Gifski configuration
|
||||
gifski_settings = config['gifski']
|
||||
gifski_settings['gifski_path'] = os.path.expandvars(gifski_settings['gifski_path'])
|
||||
|
||||
# load video2x settings
|
||||
extracted_frame_format = config['video2x']['extracted_frame_format'].lower()
|
||||
output_file_name_format_string = config['video2x']['output_file_name_format_string']
|
||||
image_output_extension = config['video2x']['image_output_extension']
|
||||
video_output_extension = config['video2x']['video_output_extension']
|
||||
preserve_frames = config['video2x']['preserve_frames']
|
||||
|
||||
# if preserve frames specified in command line
|
||||
# overwrite config file options
|
||||
if video2x_args.preserve_frames is True:
|
||||
preserve_frames = True
|
||||
|
||||
# if cache directory not specified
|
||||
# use default path: %TEMP%\video2x
|
||||
if config['video2x']['video2x_cache_directory'] is None:
|
||||
video2x_cache_directory = (pathlib.Path(tempfile.gettempdir()) / 'video2x')
|
||||
else:
|
||||
video2x_cache_directory = pathlib.Path(config['video2x']['video2x_cache_directory'])
|
||||
|
||||
# overwrite driver_settings with driver_args
|
||||
if driver_args is not None:
|
||||
driver_args_dict = vars(driver_args)
|
||||
for key in driver_args_dict:
|
||||
if driver_args_dict[key] is not None:
|
||||
driver_settings[key] = driver_args_dict[key]
|
||||
|
||||
# start execution
|
||||
try:
|
||||
# start timer
|
||||
begin_time = time.time()
|
||||
|
||||
# initialize upscaler object
|
||||
upscaler = Upscaler(
|
||||
# required parameters
|
||||
input_path=video2x_args.input,
|
||||
output_path=video2x_args.output,
|
||||
driver_settings=driver_settings,
|
||||
ffmpeg_settings=ffmpeg_settings,
|
||||
gifski_settings=gifski_settings,
|
||||
|
||||
# optional parameters
|
||||
driver=video2x_args.driver,
|
||||
scale_ratio=video2x_args.ratio,
|
||||
processes=video2x_args.processes,
|
||||
video2x_cache_directory=video2x_cache_directory,
|
||||
extracted_frame_format=extracted_frame_format,
|
||||
output_file_name_format_string=output_file_name_format_string,
|
||||
image_output_extension=image_output_extension,
|
||||
video_output_extension=video_output_extension,
|
||||
preserve_frames=preserve_frames
|
||||
)
|
||||
|
||||
# run upscaler
|
||||
upscaler.run()
|
||||
|
||||
Avalon.info(_('Program completed, taking {} seconds').format(round((time.time() - begin_time), 5)))
|
||||
|
||||
except Exception:
|
||||
Avalon.error(_('An exception has occurred'))
|
||||
traceback.print_exc()
|
||||
182
src/video2x.yaml
182
src/video2x.yaml
@@ -1,182 +0,0 @@
|
||||
# Name: Video2X Configuration File
|
||||
# Creator: K4YT3X
|
||||
# Date Created: October 23, 2018
|
||||
# Last Modified: August 18, 2020
|
||||
# Values here are the default values. Change the value here to
|
||||
# save the default value permanently.
|
||||
# Items commented out are parameters irrelevant to this context
|
||||
# or parameters handled by Video2X internally.
|
||||
waifu2x_caffe:
|
||||
path: '%LOCALAPPDATA%\video2x\waifu2x-caffe\waifu2x-caffe-cui'
|
||||
tta: 0 # <0|1> 8x slower and slightly high quality
|
||||
gpu: 0 # gpu device no
|
||||
batch_size: 1 # input batch size
|
||||
crop_h: null # input image split size(height)
|
||||
crop_w: null # input image split size(width)
|
||||
crop_size: 128 # input image split size
|
||||
output_depth: 8 # output image chanel depth bit
|
||||
output_quality: -1 # output image quality
|
||||
process: gpu # <cpu|gpu|cudnn> process mode
|
||||
model_dir: null # path to custom model directory (don't append last / )
|
||||
scale_height: 0 # custom scale height (specifying this will overwrite scale_ratio)
|
||||
scale_width: 0 # custom scale width (specifying this will overwrite scale_ratio)
|
||||
#scale_ratio: null # custom scale ratio
|
||||
noise_level: 3 # <0|1|2|3> noise reduction level
|
||||
mode: noise_scale # <noise|scale|noise_scale|auto_scale> image processing mode
|
||||
output_extention: null # extension to output image file when output_path is (auto) or input_path is folder
|
||||
input_extention_list: null # extension to input image file when input_path is folder
|
||||
#output_path: null # path to output image file (when input_path is folder, output_path must be folder)
|
||||
#input_path: null # (required) path to input image file
|
||||
waifu2x_converter_cpp:
|
||||
path: '%LOCALAPPDATA%\video2x\waifu2x-converter-cpp\waifu2x-converter-cpp'
|
||||
#list-supported-formats: null # dump currently supported format list
|
||||
#list-opencv-formats: null # (deprecated. Use --list-supported-formats) dump opencv supported format list
|
||||
#list-processor # dump processor list
|
||||
output-format: null # The format used when running in recursive/folder mode
|
||||
png-compression: 5 # Set PNG compression level (0-9), 9 = Max compression (slowest & smallest)
|
||||
image-quality: -1 # JPEG & WebP Compression quality (-1-101, 0 being smallest size and lowest quality, -1 being default), use 101 for lossless WebP
|
||||
block-size: 0 # block size
|
||||
disable-gpu: false # disable GPU
|
||||
force-OpenCL: false # force to use OpenCL on Intel Platform
|
||||
processor: -1 # set target processor (-1 uses default device)
|
||||
jobs: 0 # number of threads launching at the same time
|
||||
model-dir: null # path to custom model directory (don't append last / ) default: models_rgb
|
||||
#scale-ratio: 2.0 # custom scale ratio
|
||||
noise-level: 1 # <0|1|2|3> noise reduction level
|
||||
mode: noise-scale # <noise|scale|noise-scale> image processing mode
|
||||
log-level: 1 # <0|1|2|3|4> Set log level
|
||||
silent: true # Enable silent mode. (same as --log-level 1)
|
||||
tta: 0 # Enable Test-Time Augmentation mode. (0 or 1)
|
||||
#generate-subdir: 0 # Generate sub folder when recursive directory is enabled.
|
||||
#auto-naming: 0 # Add postfix to output name when output path is not specified.
|
||||
#recursive-directory: 0 # Search recursively through directories to find more images to process.
|
||||
#output: null # path to output image file or directory (you should use the full path)
|
||||
#input: null # (required) path to input image file or directory (you should use the full path)
|
||||
waifu2x_ncnn_vulkan:
|
||||
path: '%LOCALAPPDATA%\video2x\waifu2x-ncnn-vulkan\waifu2x-ncnn-vulkan'
|
||||
v: null # verbose output
|
||||
#i: null # input-path: input image path (jpg/png) or directory
|
||||
#o: null # output-path: output image path (png) or directory
|
||||
'n': 2 # noise-level: denoise level (-1/0/1/2/3, default=0)
|
||||
s: 2 # scale: upscale ratio (1/2, default=2)
|
||||
t: 400 # tile-size: tile size (>=32, default=400)
|
||||
m: null # model-path: waifu2x model path (default=models-cunet)
|
||||
g: 0 # gpu-id: gpu device to use (default=0)
|
||||
j: '1:2:2' # thread count for load/proc/save (default=1:2:2)
|
||||
x: false # enable tta mode
|
||||
srmd_ncnn_vulkan:
|
||||
path: '%LOCALAPPDATA%\video2x\srmd-ncnn-vulkan\srmd-ncnn-vulkan'
|
||||
v: null # verbose output
|
||||
#i: null # input-path: input image path (jpg/png) or directory
|
||||
#o: null # output-path: output image path (png) or directory
|
||||
'n': 3 # noise-level: denoise level (-1/0/1/2/3/4/5/6/7/8/9/10, default=3)
|
||||
s: 2 # upscale ratio (2/3/4, default=2)
|
||||
t: 400 # tile-size: tile size (>=32, default=400)
|
||||
m: null # srmd model path (default=models-srmd)
|
||||
g: 0 # gpu device to use (default=0)
|
||||
j: '1:2:2' # thread count for load/proc/save (default=1:2:2)
|
||||
x: false # enable tta mode
|
||||
realsr_ncnn_vulkan:
|
||||
path: '%LOCALAPPDATA%\video2x\realsr-ncnn-vulkan\realsr-ncnn-vulkan'
|
||||
v: null # verbose output
|
||||
#i: null # input-path: input image path (jpg/png) or directory
|
||||
#o: null # output-path: output image path (png) or directory
|
||||
s: 4 # upscale ratio (4, default=4)
|
||||
t: 0 # tile size (>=32/0=auto, default=0)
|
||||
m: null # realsr model path (default=models-DF2K)
|
||||
g: 0 # gpu device to use (default=0)
|
||||
j: '1:2:2' # thread count for load/proc/save (default=1:2:2)
|
||||
x: false # enable tta mode
|
||||
anime4kcpp:
|
||||
path: '%LOCALAPPDATA%\video2x\anime4kcpp\CLI\Anime4KCPP_CLI\Anime4KCPP_CLI'
|
||||
#input: null # File for loading (string [=./pic/p1.png])
|
||||
#output: null # File for outputting (string [=output.png])
|
||||
passes: 2 # Passes for processing (int [=2])
|
||||
pushColorCount: 2 # Limit the number of color pushes (int [=2])
|
||||
strengthColor: 0.3 # Strength for pushing color,range 0 to 1,higher for thinner (double [=0.3])
|
||||
strengthGradient: 1.0 # Strength for pushing gradient,range 0 to 1,higher for sharper (double [=1])
|
||||
zoomFactor: 2.0 # zoom factor for resizing (double [=2])
|
||||
threads: 16 # Threads count for video processing (unsigned int [=16])
|
||||
fastMode: false # Faster but maybe low quality
|
||||
videoMode: false # Video process
|
||||
preview: null # Preview image
|
||||
preprocessing: false # Enable pre processing
|
||||
postprocessing: false # Enable post processing
|
||||
preFilters: 4 # Enhancement filter, only working when preProcessing is true,there are 5 options by binary:Median blur=0000001, Mean blur=0000010, CAS Sharpening=0000100, Gaussian blur weak=0001000, Gaussian blur=0010000, Bilateral filter=0100000, Bilateral filter faster=1000000, you can freely combine them, eg: Gaussian blur weak + Bilateral filter = 0001000 | 0100000 = 0101000 = 40(D) (unsigned int [=4])
|
||||
postFilters: 40 # Enhancement filter, only working when postProcessing is true,there are 5 options by binary:Median blur=0000001, Mean blur=0000010, CAS Sharpening=0000100, Gaussian blur weak=0001000, Gaussian blur=0010000, Bilateral filter=0100000, Bilateral filter faster=1000000, you can freely combine them, eg: Gaussian blur weak + Bilateral filter = 0001000 | 0100000 = 0101000 = 40(D), so you can put 40 to enable Gaussian blur weak and Bilateral filter, which also is what I recommend for image that < 1080P, 48 for image that >= 1080P, and for performance I recommend to use 72 for video that < 1080P, 80 for video that >=1080P (unsigned int [=40])
|
||||
GPUMode: false # Enable GPU acceleration
|
||||
CNNMode: false # Enable ACNet
|
||||
HDN: false # Enable HDN mode for ACNet
|
||||
HDNLevel: 1 # Set HDN level (int [=1])
|
||||
listGPUs: null # list GPUs
|
||||
platformID: 0 # Specify the platform ID (unsigned int [=0])
|
||||
deviceID: 0 # Specify the device ID (unsigned int [=0])
|
||||
codec: mp4v # Specify the codec for encoding from mp4v(recommended in Windows), dxva(for Windows), avc1(H264, recommended in Linux), vp09(very slow), hevc(not support in Windowds), av01(not support in Windowds) (string [=mp4v])
|
||||
forceFps: 0 # Set output video fps to the specifying number, 0 to disable (float [=0])
|
||||
disableProgress: false # disable progress display
|
||||
webVideo: null # process the video from URL
|
||||
alpha: false # preserve the Alpha channel for transparent image
|
||||
ffmpeg:
|
||||
ffmpeg_path: '%LOCALAPPDATA%\video2x\ffmpeg-latest-win64-static\bin'
|
||||
intermediate_file_name: 'intermediate.mkv'
|
||||
# Step 1: Frame Extraction
|
||||
# extract all frames from original input into temporary directory
|
||||
extract_frames:
|
||||
'-hwaccel': auto # automatically select hardware acceleration method
|
||||
'-y': true
|
||||
input_options: {} # empty dict, expand if necessary
|
||||
output_options:
|
||||
'-pix_fmt': rgb24 # extracted frames pixel format
|
||||
'-qscale:v': null # output image quality control for JPEG (1-31, 1 being highest)
|
||||
# Step 2: Video Assembly
|
||||
# assemble all frames back into a video with only a video track
|
||||
assemble_video:
|
||||
'-hwaccel': auto # automatically select hardware acceleration method
|
||||
'-y': true
|
||||
input_options:
|
||||
'-f': image2 # force image2 format
|
||||
output_options:
|
||||
'-vcodec': libx264 # video codec
|
||||
'-pix_fmt': 'yuv420p' # overwrite default pixel format
|
||||
'-crf': 17 # H.264 Constant Rate Factor
|
||||
'-b:v': null # target average bitrate
|
||||
'-vf': 'pad=ceil(iw/2)*2:ceil(ih/2)*2' # ensure output is divisible by 2, recommended for libx264
|
||||
'-tune': 'animation' # encoding tuning film/animation/grain/stillimage/fastdecode/zerolatency/psnr/ssim
|
||||
# Step 3: Streams Migration
|
||||
# migrate audio and subtitle streams from original
|
||||
# video into the upscaled video
|
||||
migrate_streams:
|
||||
'-hwaccel': auto # automatically select hardware acceleration method
|
||||
'-y': true
|
||||
input_options: {} # empty dict, expand if necessary
|
||||
output_options:
|
||||
'-map':
|
||||
- '0:v?' # copy video streams
|
||||
- '1:a?' # copy audio streams
|
||||
- '1:s?' # copy subtitle streams
|
||||
- '1:d?' # copy data streams
|
||||
- '1:t?' # copy fonts
|
||||
'-c': copy # copy codec for all streams
|
||||
# '-vf': 'minterpolate=''fps=60''' # minterpolate frame interpolation
|
||||
'-map_metadata': 0 # copy known metadata tags
|
||||
# '-movflags': 'use_metadata_tags' # copy custom/arbitrary metadata tags
|
||||
'-pix_fmt': null
|
||||
'-metadata': 'comment=Upscaled by Video2X'
|
||||
gifski:
|
||||
gifski_path: '%LOCALAPPDATA%\video2x\gifski\win\gifski'
|
||||
# output: null # Destination file to write to
|
||||
# fps: 20 # Animation frames per second (for PNG frames only) [default: 20]
|
||||
fast: false # 3 times faster encoding, but 10% lower quality and bigger file
|
||||
quality: 100 # Lower quality may give smaller file
|
||||
width: null # Maximum width
|
||||
height: null # Maximum height (if width is also set)
|
||||
once: false # Do not loop the GIF
|
||||
nosort: false # Use files exactly in the order given, rather than sorted
|
||||
quiet: false # Do not show a progress bar
|
||||
video2x:
|
||||
video2x_cache_directory: null # default: %TEMP%\video2x, directory where cache files are stored, will be deleted if preserve_frames is not set to true
|
||||
extracted_frame_format: png # png/jpg intermediate file format used for extracted frames during video processing
|
||||
output_file_name_format_string: "{original_file_name}_output{extension}" # format string to use for generating output file names
|
||||
image_output_extension: .png # image output extension during batch processing
|
||||
video_output_extension: .mp4 # video output extension during batch processing
|
||||
preserve_frames: false # if set to true, the cache directory won't be cleaned upon task completion
|
||||
1305
src/video2x_gui.py
1305
src/video2x_gui.py
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user