-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo6_sum.sh
executable file
·152 lines (99 loc) · 3.27 KB
/
demo6_sum.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Get the inputFile for YUVs
inputYUVFileName=Gen/Input-Sequnces/$1.txt
# Get the inputFile for GOPs
inputGOPFileName=Gen/GOP-Types/$2.txt
# Get the inputFile for POCs
inputPOCFileName=Gen/Input-FrameStat/$3.txt
# Get the inputFile for all Bits and PSNR statistics
inputAllBitsPsnrFileName=Gen/Input-FrameStat/$4.txt
# Get the number of sequences
noSeq=$(cat $inputYUVFileName | wc -l )
# echo $noSeq
#echo Please enter the number of Sequences to encode
#read -e noSeq
# Number of Encoder CFG files you would like to run on a sequence
#echo How many encoder CFG files you would like to run on a sequence?
#read -e noCases
# Get the number of cases
noCases=$(cat $inputGOPFileName | wc -l )
# echo $noCases
# Get the number of Qps
echo How many Qp values do you use for encoding?
read -e noQp
# Get the first Qp
echo Please enter the start of the Qp range
read -e startQp
# Get the Qp step size
echo Please enter your Qp step size
read -e stepSizeQp
# echo “Reminder: This bash file takes a parameter which case”
# http://unix.stackexchange.com/questions/88100/importing-data-from-a-text-file-to-a-bash-script
declare -a yuv_symbols=($(cat $inputYUVFileName| tr '\n' ' '))
# Read YUVs from TXT file
i=1
j=0
#loopCount=$(($noSeq*2))
for (( i = 1; i <= noSeq; i++ ))
do
# echo ${yuv_symbols[$j]}
yuv_file[$i]=${yuv_symbols[j]}
# echo ${yuv_file[$i]}
let "j+=1" # Increment by 2 to get all coulmns
# echo ${yuv_symbols[$j]}
cfg_file[$i]=${yuv_symbols[j]}
let "j+=1" # Increment by 2 to get all coulmns
# echo ${cfg_file[$i]}
done
# To make it start with startQp
scaleQpIndex=0
#Create the Qp range
for ((i = 1; i<=noQp;i++))
do
Qp[$i]=$(($startQp + $scaleQpIndex*$stepSizeQp))
let "scaleQpIndex+=1"
done
#**********************
# Get the GOP structure names
declare -a gop_type_files=($(cat $inputGOPFileName| tr '\n' ' '))
txt_fileNamesIndex=1
# Parse to get the txt_fileNames
for (( i = 1; i <= noSeq; i++ ))
do
current_yuv="${yuv_file[$i]}"
echo $current_yuv
current_cfg="${cfg_file[$i]}"
# For every case
for (( caseId = 1; caseId <= noCases; caseId++ ))
do
# For every Qp value
for (( qpId = 1; qpId <= noQp; qpId++ ))
do
txt_fileNames[txt_fileNamesIndex]=$current_yuv"_"${Qp[$qpId]}"_"$caseId
let "txt_fileNamesIndex+=1"
done
done
done
echo "#******#******#******#******#******#******#******#******#******#******"
# Loop on the sequences for every case
for (( i = 1; i <= noSeq; i++ ))
do
current_yuv="${yuv_file[$i]}"
echo $current_yuv
current_cfg="${cfg_file[$i]}"
#Output file
#current_out=Gen/Seq-FramesStat/Union"_"$current_yuv.txt
current_out=Gen/Seq-FramesStat/partial_UnionBitsPsnr.txt
#echo -e "***********$current_yuv Sequence***********" >> "$current_out"
echo '--------------------------------------'
echo "Analysis of" $noCases "case for" $current_yuv " sequence"
# For every case
for (( caseId = 1; caseId <= noCases; caseId++ ))
do
# Put a seperator between array arguments
./d_calcOverallPerf.sh $current_yuv @ $caseId @ "${Qp[@]}" \
@ $noQp @ $inputAllBitsPsnrFileName @ $current_cfg.cfg
done
done
echo "Frames Statistics all Done"
echo "#******#******#******#******#******#******#******#******#******#******"
#******#******#******#******#******#******#******#******#******#******