source: 3DVCSoftware/branches/HTM-DEV-0.1-dev/source/App/utils/BitrateTargeting/encode.shl

Last change on this file was 324, checked in by tech, 12 years ago

Initial development version for update to latest HM version.
Includes MV-HEVC and basic extensions for 3D-HEVC.

File size: 6.2 KB
Line 
1# The copyright in this software is being made available under the BSD
2# License, included below. This software may be subject to other third party
3# and contributor rights, including patent rights, and no such rights are
4# granted under this license. 
5#
6# Copyright (c) 2010-2012, ITU/ISO/IEC
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions are met:
11#
12#  * Redistributions of source code must retain the above copyright notice,
13#    this list of conditions and the following disclaimer.
14#  * Redistributions in binary form must reproduce the above copyright notice,
15#    this list of conditions and the following disclaimer in the documentation
16#    and/or other materials provided with the distribution.
17#  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18#    be used to endorse or promote products derived from this software without
19#    specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31# THE POSSIBILITY OF SUCH DAMAGE.
32
33# This files contains shell code that is common to both encodeCommand.sh and targetBitrates.sh.
34
35# Run this function to validate a "-option value" pair of arguments
36function checkDollarTwo {
37  if [[ "" == $2 ]] ; then
38    printf "An argument must follow $1.\n" >&2
39    outputUsageAndExit
40  fi
41}
42
43# If the second argument is empty (not provided), output an error message and the usage, and then exit
44function verifyProvided {
45  if [[ "" == $2 ]] ; then
46    printf "The $1 parameter must be provided.\n" >&2
47    outputUsageAndExit
48  fi
49}
50
51function verifyNotDirectory {
52  if [[ `printf "$2\n" | grep '/$'` != "" ]] ; then
53    printf "The $1 parameter cannot be a directory.\n" >&2
54    outputUsageAndExit
55  fi
56}
57
58function verifyDirectory {
59  if [[ "" == `printf "$2\n" | grep '/$'` ]] ; then
60    printf "The $1 parameter must be a directory.\n" >&2
61    outputUsageAndExit
62  fi
63}
64
65function verifyConfigurationIdentifier {
66  case $configurationIdentifier in
67    ldLC) ;;
68    raLC) ;;
69    inLC) ;;
70    ldHE) ;;
71    raHE) ;;
72    inHE) ;;
73    *)
74      printf "The provided $CONFIGURATION_IDENTIFIER_STRING is invalid.  It must be \"ldLC\", \"raLC\", \"inLC\", \"ldHE\", \"raHE\", or \"inHE\".\n" >&2
75      outputUsageAndExit
76      ;;
77  esac
78}
79
80function verifyQ {
81  case $1 in
82    22)  ;;
83    27)  ;;
84    32)  ;;
85    37)  ;;
86    *)
87      printf "The provided $Q_STRING, \"$1\", is invalid.  It must be \"22\", \"27\", \"32\", or \"37\".\n" >&2
88      outputUsageAndExit
89    ;;
90  esac
91}
92
93Q_OPTION="-q"
94EXECUTABLE_OPTION="-e"
95CONFIGURATION_IDENTIFIER_OPTION="-ci"
96OUTPUT_DIRECTORY_OPTION="-o"
97EXTRA_ARGUMENTS_OPTION="-ea"
98CONFIGURATION_PATH_OPTION="-cp"
99CONFIGURATION_DIRECTORY_OPTION="-cd"
100
101Q_STRING="q ($Q_OPTION)"
102CONFIGURATION_IDENTIFIER_STRING="configuration identifier ($CONFIGURATION_IDENTIFIER_OPTION)"
103INPUT_NAME_STRING="input name"
104OUTPUT_DIRECTORY_STRING="output directory ($OUTPUT_DIRECTORY_OPTION)"
105
106USAGE_INDENT="  "
107INPUT_NAME_USAGE_STRING=inputName
108CONFIGURATION_IDENTIFIER_USAGE_STRING=configurationIdentifier
109Q_USAGE_STRING=q
110OUTPUT_DIRECTORY_USAGE_STRING=outputDirectory
111EXTRA_ARGUMENTS_USAGE_STRING=extraArguments
112
113function outputConfigurationIdentifierUsage {
114  echo "${USAGE_INDENT}$CONFIGURATION_IDENTIFIER_USAGE_STRING specifies the configuration (ldHE, ldLC, raHE, raLC, inHE, or inLC)." >&2
115}
116
117function outputQUsage {
118  echo "${USAGE_INDENT}$Q_USAGE_STRING is the QP value (22, 27, 32, or 37)." >&2
119}
120
121function outputOutputDirectoryUsage {
122  echo "${USAGE_INDENT}$OUTPUT_DIRECTORY_USAGE_STRING is the directory that will contain the output log, YUV, and bin." >&2
123}
124
125function outputInputNameUsage {
126  echo "${USAGE_INDENT}$INPUT_NAME_USAGE_STRING is the name of the input sequence.  Must be one of the following:" >&2
127  echo "${USAGE_INDENT}${USAGE_INDENT}NebutaFestival_2560x1600_60_10bit_crop" >&2
128  echo "${USAGE_INDENT}${USAGE_INDENT}SteamLocomotiveTrain_2560x1600_60_10bit_crop" >&2
129  echo "${USAGE_INDENT}${USAGE_INDENT}Traffic_2560x1600_30_crop" >&2
130  echo "${USAGE_INDENT}${USAGE_INDENT}PeopleOnStreet_2560x1600_30_crop" >&2
131  echo "${USAGE_INDENT}${USAGE_INDENT}BQTerrace_1920x1080_60" >&2
132  echo "${USAGE_INDENT}${USAGE_INDENT}BasketballDrive_1920x1080_50" >&2
133  echo "${USAGE_INDENT}${USAGE_INDENT}Cactus_1920x1080_50" >&2
134  echo "${USAGE_INDENT}${USAGE_INDENT}Kimono1_1920x1080_24" >&2
135  echo "${USAGE_INDENT}${USAGE_INDENT}ParkScene_1920x1080_24" >&2
136  echo "${USAGE_INDENT}${USAGE_INDENT}vidyo1_720p_60" >&2
137  echo "${USAGE_INDENT}${USAGE_INDENT}vidyo3_720p_60" >&2
138  echo "${USAGE_INDENT}${USAGE_INDENT}vidyo4_720p_60" >&2
139  echo "${USAGE_INDENT}${USAGE_INDENT}RaceHorses_832x480_30" >&2
140  echo "${USAGE_INDENT}${USAGE_INDENT}BQMall_832x480_60" >&2
141  echo "${USAGE_INDENT}${USAGE_INDENT}PartyScene_832x480_50" >&2
142  echo "${USAGE_INDENT}${USAGE_INDENT}BasketballDrill_832x480_50" >&2
143  echo "${USAGE_INDENT}${USAGE_INDENT}RaceHorses_416x240_30" >&2
144  echo "${USAGE_INDENT}${USAGE_INDENT}BQSquare_416x240_60" >&2
145  echo "${USAGE_INDENT}${USAGE_INDENT}BlowingBubbles_416x240_50" >&2
146  echo "${USAGE_INDENT}${USAGE_INDENT}BasketballPass_416x240_50" >&2
147  echo "${USAGE_INDENT}${USAGE_INDENT}BasketballDrillText_832x480_50" >&2
148  echo "${USAGE_INDENT}${USAGE_INDENT}Chinaspeed_1024x768_30" >&2
149  echo "${USAGE_INDENT}${USAGE_INDENT}SlideEditing_1280x720_30" >&2
150  echo "${USAGE_INDENT}${USAGE_INDENT}SlideShow_1280x720_20" >&2
151}
Note: See TracBrowser for help on using the repository browser.