forked from shihuade/Conformance-Test-Openh264
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_UpdateCodec.sh
executable file
·147 lines (145 loc) · 3.25 KB
/
run_UpdateCodec.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
#!/bin/bash
#***************************************************************************************
#brief: build and copy codec to Codec folder
#
# usage: run_UpdateCodec.sh ${CodecDir}
#
#date: 5/08/2014 Created
#***************************************************************************************
runYUVDumpMacroOpen()
{
if [ ! $# -eq 1 ]
then
echo "useage: runYUVDumpMacroOpen \${Openh264Dir}"
return 1
fi
local File=$1
local TempFile="${File}.Team.h"
local OpenLine="#define WELS_TESTBED"
local PreviousLine=""
if [ ! -f "$File" ]
then
echo "file ${File} does not exist! when tring to open YUV dump macro "
return 1
fi
echo "">${TempFile}
while read line
do
if [[ ${PreviousLine} =~ "#define AS264_COMMON_H_" ]]
then
echo "${OpenLine}">>${TempFile}
fi
echo "${line}">>${TempFile}
PreviousLine=$line
done < ${File}
rm -f ${File}
mv ${TempFile} ${File}
}
#useage: ./runBuildCodec ${Openh264Dir}
runBuildCodec()
{
if [ ! $# -eq 1 ]
then
echo "useage: ./runBuildCodec \${Openh264Dir}"
return 1
fi
local OpenH264Dir=$1
local CurrentDir=`pwd`
local BuildLog="${CurrentDir}/build.log"
if [ ! -d ${OpenH264Dir} ]
then
echo "openh264 dir is not right!"
return 1
fi
cd ${OpenH264Dir}
make clean >${BuildLog}
make >>${BuildLog}
if [ ! -e h264enc ]
then
echo "encoder build failed"
cd ${CurrentDir}
return 1
elif [ ! -e h264dec ]
then
echo "decoder build failed"
cd ${CurrentDir}
return 1
else
cd ${CurrentDir}
return 0
fi
}
#useage: runCopyFile ${Openh264Dir}
runCopyFile()
{
if [ ! $# -eq 1 ]
then
echo "useage: runCopyFile \${Openh264Dir}"
return 1
fi
local OpenH264Dir=$1
local CodecDir="Codec"
cp -f ${OpenH264Dir}/h264enc ${CodecDir}
cp -f ${OpenH264Dir}/h264dec ${CodecDir}
cp -f ${OpenH264Dir}/testbin/layer2.cfg ${CodecDir}/layer0.cfg
cp -f ${OpenH264Dir}/testbin/layer2.cfg ${CodecDir}/layer1.cfg
cp -f ${OpenH264Dir}/testbin/layer2.cfg ${CodecDir}/layer2.cfg
cp -f ${OpenH264Dir}/testbin/layer2.cfg ${CodecDir}/layer3.cfg
cp -f ${OpenH264Dir}/testbin/welsenc.cfg ${CodecDir}
}
#useage: ./run_UpdateCodec.sh ${Openh264Dir}
runMain()
{
if [ ! $# -eq 1 ]
then
echo "useage: ./run_UpdateCodec.sh \${Openh264Dir}"
return 1
fi
local Openh264Dir=$1
local CurrentDir=`pwd`
local YUVDumpMacroFileName="as264_common.h"
local YUVDumpMacroFileDir="codec/encoder/core/inc"
local TestBitStreamFileDir=""
local YUVDumpMacroFile=""
if [ ! -d ${Openh264Dir} ]
then
echo "openh264 dir ${Openh264Dir} does not exist!"
echo "useage: ./run_UpdateCodec.sh \${Openh264Dir}"
exit 1
fi
cd ${Openh264Dir}
Openh264Dir=`pwd`
cd ${CurrentDir}
YUVDumpMacroFile="${Openh264Dir}/${YUVDumpMacroFileDir}/${YUVDumpMacroFileName}"
echo ""
echo "enable macro for Rec YUV dump!"
echo "file is ${YUVDumpMacroFile}"
echo ""
runYUVDumpMacroOpen "${YUVDumpMacroFile}"
if [ ! $? -eq 0 ]
then
echo "YUV Dump file failed!"
exit 1
fi
echo ""
echo "building codec"
echo ""
runBuildCodec ${Openh264Dir}
if [ ! $? -eq 0 ]
then
echo "Codec Build failed"
exit 1
fi
echo ""
echo "copying h264 codec"
echo ""
runCopyFile ${Openh264Dir}
if [ ! $? -eq 0 ]
then
echo "copy files failed"
exit 1
fi
return 0
}
Openh264Dir=$1
runMain ${Openh264Dir}