Skip to content

Commit

Permalink
init: added single video editing codes layout
Browse files Browse the repository at this point in the history
Since we already supported video upscaling, we can proceed to develop
its codes layout. Hence, let's setup its layout with placeholding
functions.

This patch adds single video editing codes layout in init/ directory.

Co-authored-by: Shuralyov, Jean <jean.shuralyov@proton.me>
Co-authored-by: Galyna, Cory <cory.galyna@gmail.com>
Co-authored-by: (Holloway) Chew, Kean Ho <hollowaykeanho@gmail.com>
Signed-off-by: (Holloway) Chew, Kean Ho <hollowaykeanho@gmail.com>
  • Loading branch information
3 people committed Feb 11, 2024
1 parent 5d0be0f commit 9ba0c87
Show file tree
Hide file tree
Showing 16 changed files with 1,122 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/git-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ jobs:
id: upscaler_image_unscale_single
run: |
./tests/01_test_upscale_image_single.sh.ps1
- name: Execute Upscaler's Single Video Upscale
id: upscaler_video_unscale_single
run: |
./tests/02_test_upscale_video_single.sh.ps1
72 changes: 72 additions & 0 deletions init/services/compilers/ffmpeg.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# BSD 3-Clause License
#
# Copyright (c) 2024, (Holloway) Chew, Kean Ho
# 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 name of the copyright holder 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 COPYRIGHT HOLDER 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.
. "${env:LIBS_UPSCALER}\services\i18n\report-simulation.ps1"
. "${env:LIBS_UPSCALER}\services\io\os.ps1"
. "${env:LIBS_UPSCALER}\services\io\fs.ps1"
. "${env:LIBS_UPSCALER}\services\io\strings.ps1"




function FFMPEG-Is-Available {
if ((STRINGS-Is-Empty "${env:UPSCALER_TEST_MODE}") -ne 0) {
$null = I18N-Report-Simulation "ffmpeg & ffprobe"
return 0
}

# execute
$___process = OS-Is-Command-Available "ffmpeg"
if ($___process -ne 0) {
return 1
}

$___process = OS-Is-Command-Available "ffprobe"
if ($___process -ne 0) {
return 1
}


# report status
return 0
}




function FFMPEG-Video-Dissect {
return 0
}




function FFMPEG-Video-Reassemble {
return 0
}
80 changes: 80 additions & 0 deletions init/services/compilers/ffmpeg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/sh
#
# BSD 3-Clause License
#
# Copyright (c) 2023, (Holloway) Chew, Kean Ho
# 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 name of the copyright holder 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 COPYRIGHT HOLDER 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.
. "${LIBS_UPSCALER}/services/i18n/report-simulation.sh"
. "${LIBS_UPSCALER}/services/io/os.sh"
. "${LIBS_UPSCALER}/services/io/fs.sh"
. "${LIBS_UPSCALER}/services/io/strings.sh"




FFMPEG_Is_Available() {
# execute
if [ ! "$(STRINGS_Is_Empty "$UPSCALER_TEST_MODE")" = "0" ]; then
I18N_Report_Simulation "ffmpeg & ffprobe"
return 0
fi

OS_Is_Command_Available "ffmpeg"
if [ $? -ne 0 ]; then
return 1
fi

OS_Is_Command_Available "ffprobe"
if [ $? -ne 0 ]; then
return 1
fi


# report status
return 0
}




FFMPEG_Video_Dissect() {
#___input="$1"
#___output="$2"

return 0
}




FFMPEG_Video_Reassemble() {
#___input="$1"
#___output="$2"

return 0
}
123 changes: 122 additions & 1 deletion init/services/compilers/upscaler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,131 @@
# 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.
. "${env:LIBS_UPSCALER}\services\i18n\report-simulation.ps1"
. "${env:LIBS_UPSCALER}\services\io\os.ps1"
. "${env:LIBS_UPSCALER}\services\io\fs.ps1"
. "${env:LIBS_UPSCALER}\services\io\strings.ps1"
. "${env:LIBS_UPSCALER}\services\i18n\report-simulation.ps1"




function UPSCALER-Batch-Load {
param(
[string]$___video,
[string]$___model,
[string]$___scale,
[string]$___format,
[string]$___parallel,
[string]$___gpu,
[string]$___input,
[string]$___output
)


# validate input
if ( ((STRINGS-Is-Empty "${___video}") -eq 0) -or
((STRINGS-Is-Empty "${___model}") -eq 0) -or
((STRINGS-Is-Empty "${___scale}") -eq 0) -or
((STRINGS-Is-Empty "${___format}") -eq 0) -or
((STRINGS-Is-Empty "${___parallel}") -eq 0) -or
((STRINGS-Is-Empty "${___gpu}") -eq 0) -or
((STRINGS-Is-Empty "${___input}") -eq 0) -or
((STRINGS-Is-Empty "${___output}") -eq 0)) {
return 1
}


if ((STRINGS-Is-Empty "$(UPSCALER-Program-Get)") -eq 0) {
return 1
}


# report status
return 0
}




function UPSCALER-Batch-Run {
param(
[string]$___video,
[string]$___model,
[string]$___scale,
[string]$___format,
[string]$___parallel,
[string]$___gpu,
[string]$___input,
[string]$___output
)


# validate input
if ( ((STRINGS-Is-Empty "${___video}") -eq 0) -or
((STRINGS-Is-Empty "${___model}") -eq 0) -or
((STRINGS-Is-Empty "${___scale}") -eq 0) -or
((STRINGS-Is-Empty "${___format}") -eq 0) -or
((STRINGS-Is-Empty "${___parallel}") -eq 0) -or
((STRINGS-Is-Empty "${___gpu}") -eq 0) -or
((STRINGS-Is-Empty "${___input}") -eq 0) -or
((STRINGS-Is-Empty "${___output}") -eq 0)) {
return 1
}


# execute
if ((STRINGS-Is-Empty "${env:UPSCALER_TEST_MODE}") -ne 0) {
$null = I18N-Report-Simulation "$(UPSCALER-Program-Get) ${___cmd}"
$null = FS-Make-Housing-Directory "${___output}"
$null = FS-Remove-Silently "${___output}"
$___process = FS-Copy-File "${___input}" "${___output}"
if ($___process -eq 0) {
return 0
}
}


# report status
return 0
}




function UPSCALER-Batch-Setup {
param(
[string]$___video,
[string]$___model,
[string]$___scale,
[string]$___format,
[string]$___parallel,
[string]$___gpu,
[string]$___input,
[string]$___output
)


# validate input
if ( ((STRINGS-Is-Empty "${___video}") -eq 0) -or
((STRINGS-Is-Empty "${___model}") -eq 0) -or
((STRINGS-Is-Empty "${___scale}") -eq 0) -or
((STRINGS-Is-Empty "${___format}") -eq 0) -or
((STRINGS-Is-Empty "${___parallel}") -eq 0) -or
((STRINGS-Is-Empty "${___gpu}") -eq 0) -or
((STRINGS-Is-Empty "${___input}") -eq 0) -or
((STRINGS-Is-Empty "${___output}") -eq 0)) {
return 1
}


if ((STRINGS-Is-Empty "$(UPSCALER-Program-Get)") -eq 0) {
return 1
}


# report status
return 0
}



Expand Down

0 comments on commit 9ba0c87

Please sign in to comment.