regression.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. #!/bin/sh
  2. #
  3. # automatic regression test for ffmpeg
  4. #
  5. #
  6. #set -x
  7. # Even in the 21st century some diffs are not supporting -u.
  8. diff -u "$0" "$0" > /dev/null 2>&1
  9. if [ $? -eq 0 ]; then
  10. diff_cmd="diff -u"
  11. else
  12. diff_cmd="diff"
  13. fi
  14. diff -w "$0" "$0" > /dev/null 2>&1
  15. if [ $? -eq 0 ]; then
  16. diff_cmd="$diff_cmd -w"
  17. fi
  18. set -e
  19. datadir="./data"
  20. logfile="$datadir/ffmpeg.regression"
  21. outfile="$datadir/a-"
  22. # tests to do
  23. if [ "$1" = "mpeg4" ] ; then
  24. do_mpeg4=y
  25. elif [ "$1" = "mpeg" ] ; then
  26. do_mpeg=y
  27. do_mpeg2=y
  28. elif [ "$1" = "ac3" ] ; then
  29. do_ac3=y
  30. elif [ "$1" = "huffyuv" ] ; then
  31. do_huffyuv=y
  32. elif [ "$1" = "mpeg2thread" ] ; then
  33. do_mpeg2thread=y
  34. elif [ "$1" = "snow" ] ; then
  35. do_snow=y
  36. elif [ "$1" = "snowll" ] ; then
  37. do_snowll=y
  38. elif [ "$1" = "libavtest" ] ; then
  39. do_libav=y
  40. logfile="$datadir/libav.regression"
  41. outfile="$datadir/b-"
  42. else
  43. do_mpeg=y
  44. do_mpeg2=y
  45. do_mpeg2thread=y
  46. do_msmpeg4v2=y
  47. do_msmpeg4=y
  48. do_wmv1=y
  49. do_wmv2=y
  50. do_h261=y
  51. do_h263=y
  52. do_h263p=y
  53. do_mpeg4=y
  54. do_huffyuv=y
  55. do_mjpeg=y
  56. do_ljpeg=y
  57. do_rv10=y
  58. do_rv20=y
  59. do_mp2=y
  60. do_ac3=y
  61. do_g726=y
  62. do_adpcm_ima_wav=y
  63. do_adpcm_ms=y
  64. do_rc=y
  65. do_mpeg4adv=y
  66. do_mpeg4thread=y
  67. do_mpeg4nr=y
  68. do_mpeg1b=y
  69. do_asv1=y
  70. do_asv2=y
  71. do_flv=y
  72. do_ffv1=y
  73. do_error=y
  74. do_svq1=y
  75. do_snow=y
  76. do_snowll=y
  77. do_adpcm_yam=y
  78. do_dv=y
  79. fi
  80. # various files
  81. ffmpeg="../ffmpeg_g"
  82. tiny_psnr="./tiny_psnr"
  83. reffile="$2"
  84. benchfile="$datadir/ffmpeg.bench"
  85. raw_src="$3/%02d.pgm"
  86. raw_dst="$datadir/out.yuv"
  87. raw_ref="$datadir/ref.yuv"
  88. pcm_src="asynth1.sw"
  89. pcm_dst="$datadir/out.wav"
  90. pcm_ref="$datadir/ref.wav"
  91. if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
  92. do_md5sum() { md5sum -b $1; }
  93. elif [ -x /sbin/md5 ]; then
  94. do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
  95. else
  96. do_md5sum() { echo No md5sum program found; }
  97. fi
  98. # create the data directory if it does not exists
  99. mkdir -p $datadir
  100. do_ffmpeg()
  101. {
  102. f="$1"
  103. shift
  104. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
  105. $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
  106. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
  107. rm -f /tmp/ffmpeg$$
  108. do_md5sum $f >> $logfile
  109. if [ $f = $raw_dst ] ; then
  110. $tiny_psnr $f $raw_ref >> $logfile
  111. elif [ $f = $pcm_dst ] ; then
  112. $tiny_psnr $f $pcm_ref 2 >> $logfile
  113. else
  114. wc -c $f >> $logfile
  115. fi
  116. expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
  117. echo `cat $datadir/bench2.tmp` $f >> $benchfile
  118. }
  119. do_ffmpeg_crc()
  120. {
  121. f="$1"
  122. shift
  123. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc
  124. $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
  125. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
  126. rm -f /tmp/ffmpeg$$
  127. echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
  128. }
  129. do_ffmpeg_nocheck()
  130. {
  131. f="$1"
  132. shift
  133. echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
  134. $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
  135. egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
  136. rm -f /tmp/ffmpeg$$
  137. expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
  138. echo `cat $datadir/bench2.tmp` $f >> $benchfile
  139. }
  140. echo "ffmpeg regression test" > $logfile
  141. echo "ffmpeg benchmarks" > $benchfile
  142. ###################################
  143. # generate reference for quality check
  144. do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
  145. do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
  146. ###################################
  147. if [ -n "$do_mpeg" ] ; then
  148. # mpeg1 encoding
  149. file=${outfile}mpeg1.mpg
  150. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
  151. # mpeg1 decoding
  152. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  153. fi
  154. ###################################
  155. if [ -n "$do_mpeg2" ] ; then
  156. # mpeg2 encoding
  157. file=${outfile}mpeg2.mpg
  158. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file
  159. # mpeg2 decoding
  160. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  161. # mpeg2 encoding
  162. file=${outfile}mpeg2.mpg
  163. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct int -dct int -f mpeg1video $file
  164. # mpeg2 decoding
  165. do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
  166. # mpeg2 encoding interlaced
  167. file=${outfile}mpeg2i.mpg
  168. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme $file
  169. # mpeg2 decoding
  170. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  171. fi
  172. ###################################
  173. if [ -n "$do_mpeg2thread" ] ; then
  174. # mpeg2 encoding interlaced
  175. file=${outfile}mpeg2thread.mpg
  176. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 $file
  177. # mpeg2 decoding
  178. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  179. # mpeg2 encoding interlaced
  180. file=${outfile}mpeg2reuse.mpg
  181. do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 $file
  182. # mpeg2 decoding
  183. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  184. fi
  185. ###################################
  186. if [ -n "$do_msmpeg4v2" ] ; then
  187. # msmpeg4 encoding
  188. file=${outfile}msmpeg4v2.avi
  189. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
  190. # msmpeg4v2 decoding
  191. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  192. fi
  193. ###################################
  194. if [ -n "$do_msmpeg4" ] ; then
  195. # msmpeg4 encoding
  196. file=${outfile}msmpeg4.avi
  197. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
  198. # msmpeg4 decoding
  199. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  200. fi
  201. ###################################
  202. if [ -n "$do_wmv1" ] ; then
  203. # wmv1 encoding
  204. file=${outfile}wmv1.avi
  205. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
  206. # wmv1 decoding
  207. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  208. fi
  209. ###################################
  210. if [ -n "$do_wmv2" ] ; then
  211. # wmv2 encoding
  212. file=${outfile}wmv2.avi
  213. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
  214. # wmv2 decoding
  215. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  216. fi
  217. ###################################
  218. if [ -n "$do_h261" ] ; then
  219. # h261 encoding
  220. file=${outfile}h261.avi
  221. do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file
  222. # h261 decoding
  223. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  224. fi
  225. ###################################
  226. if [ -n "$do_h263" ] ; then
  227. # h263 encoding
  228. file=${outfile}h263.avi
  229. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
  230. # h263 decoding
  231. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  232. fi
  233. ###################################
  234. if [ -n "$do_h263p" ] ; then
  235. # h263p encoding
  236. file=${outfile}h263p.avi
  237. do_ffmpeg $file -y -qscale 2 -flags +umv+aiv+aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
  238. # h263p decoding
  239. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  240. fi
  241. ###################################
  242. if [ -n "$do_mpeg4" ] ; then
  243. # mpeg4
  244. file=${outfile}odivx.mp4
  245. do_ffmpeg $file -y -flags +mv4 -mbd bits -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  246. # mpeg4 decoding
  247. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  248. fi
  249. ###################################
  250. if [ -n "$do_huffyuv" ] ; then
  251. # huffyuv
  252. file=${outfile}huffyuv.avi
  253. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file
  254. # huffyuv decoding
  255. do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst
  256. fi
  257. ###################################
  258. if [ -n "$do_rc" ] ; then
  259. # mpeg4 rate control
  260. file=${outfile}mpeg4-rc.avi
  261. do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  262. # mpeg4 rate control decoding
  263. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  264. fi
  265. ###################################
  266. if [ -n "$do_mpeg4adv" ] ; then
  267. # mpeg4
  268. file=${outfile}mpeg4-adv.avi
  269. do_ffmpeg $file -y -qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  270. # mpeg4 decoding
  271. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  272. fi
  273. ###################################
  274. if [ -n "$do_mpeg4thread" ] ; then
  275. # mpeg4
  276. file=${outfile}mpeg4-thread.avi
  277. do_ffmpeg $file -y -b 500 -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
  278. # mpeg4 decoding
  279. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  280. fi
  281. ###################################
  282. if [ -n "$do_mpeg4adv" ] ; then
  283. # mpeg4
  284. file=${outfile}mpeg4-Q.avi
  285. do_ffmpeg $file -y -qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  286. # mpeg4 decoding
  287. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  288. fi
  289. ###################################
  290. if [ -n "$do_error" ] ; then
  291. # damaged mpeg4
  292. file=${outfile}error-mpeg4-adv.avi
  293. do_ffmpeg $file -y -qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  294. # damaged mpeg4 decoding
  295. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  296. fi
  297. ###################################
  298. if [ -n "$do_mpeg4nr" ] ; then
  299. # noise reduction
  300. file=${outfile}mpeg4-nr.avi
  301. do_ffmpeg $file -y -qscale 8 -flags +mv4 -mbd rd -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
  302. # mpeg4 decoding
  303. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  304. fi
  305. ###################################
  306. if [ -n "$do_mpeg1b" ] ; then
  307. # mpeg1
  308. file=${outfile}mpeg1b.mpg
  309. do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file
  310. # mpeg1 decoding
  311. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  312. fi
  313. ###################################
  314. if [ -n "$do_mjpeg" ] ; then
  315. # mjpeg
  316. file=${outfile}mjpeg.avi
  317. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file
  318. # mjpeg decoding
  319. do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
  320. fi
  321. ###################################
  322. if [ -n "$do_ljpeg" ] ; then
  323. # ljpeg
  324. file=${outfile}ljpeg.avi
  325. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file
  326. # ljpeg decoding
  327. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  328. fi
  329. ###################################
  330. if [ -n "$do_rv10" ] ; then
  331. # rv10 encoding
  332. file=${outfile}rv10.rm
  333. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
  334. # rv10 decoding
  335. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  336. fi
  337. ###################################
  338. if [ -n "$do_rv20" ] ; then
  339. # rv20 encoding
  340. file=${outfile}rv20.rm
  341. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file
  342. # rv20 decoding
  343. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  344. fi
  345. ###################################
  346. if [ -n "$do_asv1" ] ; then
  347. # asv1 encoding
  348. file=${outfile}asv1.avi
  349. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
  350. # asv1 decoding
  351. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  352. fi
  353. ###################################
  354. if [ -n "$do_asv2" ] ; then
  355. # asv2 encoding
  356. file=${outfile}asv2.avi
  357. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file
  358. # asv2 decoding
  359. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  360. fi
  361. ###################################
  362. if [ -n "$do_flv" ] ; then
  363. # flv encoding
  364. file=${outfile}flv.flv
  365. do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file
  366. # flv decoding
  367. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  368. fi
  369. ###################################
  370. if [ -n "$do_ffv1" ] ; then
  371. # ffv1 encoding
  372. file=${outfile}ffv1.avi
  373. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file
  374. # ffv1 decoding
  375. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  376. fi
  377. ###################################
  378. if [ -n "$do_snow" ] ; then
  379. # snow encoding
  380. file=${outfile}snow.avi
  381. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 $file
  382. # snow decoding
  383. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  384. fi
  385. ###################################
  386. if [ -n "$do_snowll" ] ; then
  387. # snow encoding
  388. file=${outfile}snow53.avi
  389. do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -flags +mv4+qpel $file
  390. # snow decoding
  391. do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
  392. fi
  393. ###################################
  394. if [ -n "$do_dv" ] ; then
  395. # dv encoding
  396. file=${outfile}dv.dv
  397. do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -an $file
  398. # dv decoding
  399. do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst
  400. fi
  401. ###################################
  402. if [ -n "$do_svq1" ] ; then
  403. # svq1 encoding
  404. file=${outfile}svq1.mov
  405. do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file
  406. # svq1 decoding
  407. do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
  408. fi
  409. ###################################
  410. if [ -n "$do_mp2" ] ; then
  411. # mp2 encoding
  412. file=${outfile}mp2.mp2
  413. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
  414. # mp2 decoding
  415. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  416. $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
  417. fi
  418. ###################################
  419. if [ -n "$do_ac3" ] ; then
  420. # ac3 encoding
  421. file=${outfile}ac3.rm
  422. do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
  423. # ac3 decoding
  424. #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  425. fi
  426. ###################################
  427. if [ -n "$do_g726" ] ; then
  428. # g726 encoding
  429. file=${outfile}g726.wav
  430. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
  431. # g726 decoding
  432. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  433. fi
  434. ###################################
  435. if [ -n "$do_adpcm_ima_wav" ] ; then
  436. # encoding
  437. file=${outfile}adpcm_ima.wav
  438. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
  439. # decoding
  440. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  441. fi
  442. ###################################
  443. if [ -n "$do_adpcm_ms" ] ; then
  444. # encoding
  445. file=${outfile}adpcm_ms.wav
  446. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
  447. # decoding
  448. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  449. fi
  450. ###################################
  451. if [ -n "$do_adpcm_yam" ] ; then
  452. # encoding
  453. file=${outfile}adpcm_yam.wav
  454. do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
  455. # decoding
  456. do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
  457. fi
  458. ###################################
  459. # libav testing
  460. ###################################
  461. if [ -n "$do_libav" ] ; then
  462. # avi
  463. file=${outfile}libav.avi
  464. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  465. do_ffmpeg_crc $file -i $file
  466. # asf
  467. file=${outfile}libav.asf
  468. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  469. do_ffmpeg_crc $file -i $file -r 25
  470. # rm
  471. file=${outfile}libav.rm
  472. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  473. # broken
  474. #do_ffmpeg_crc $file -i $file
  475. # mpegps
  476. file=${outfile}libav.mpg
  477. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  478. do_ffmpeg_crc $file -i $file
  479. # mpegts
  480. file=${outfile}libav.ts
  481. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  482. do_ffmpeg_crc $file -i $file
  483. # swf (decode audio only)
  484. file=${outfile}libav.swf
  485. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  486. do_ffmpeg_crc $file -i $file
  487. # ffm
  488. file=${outfile}libav.ffm
  489. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
  490. do_ffmpeg_crc $file -i $file
  491. # flv
  492. file=${outfile}libav.flv
  493. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
  494. do_ffmpeg_crc $file -i $file
  495. # mov
  496. file=${outfile}libav.mov
  497. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
  498. do_ffmpeg_crc $file -i $file
  499. # nut
  500. file=${outfile}libav.nut
  501. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
  502. do_ffmpeg_crc $file -i $file
  503. # dv
  504. file=${outfile}libav.dv
  505. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 2 $file
  506. do_ffmpeg_crc $file -i $file
  507. ####################
  508. # streamed images
  509. # mjpeg
  510. #file=${outfile}libav.mjpeg
  511. #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  512. #do_ffmpeg_crc $file -i $file
  513. # pbmpipe
  514. file=${outfile}libav.pbm
  515. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  516. do_ffmpeg_crc $file -f image2pipe -i $file
  517. # pgmpipe
  518. file=${outfile}libav.pgm
  519. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  520. do_ffmpeg_crc $file -f image2pipe -i $file
  521. # ppmpipe
  522. file=${outfile}libav.ppm
  523. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
  524. do_ffmpeg_crc $file -f image2pipe -i $file
  525. # gif
  526. file=${outfile}libav.gif
  527. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  528. #do_ffmpeg_crc $file -i $file
  529. # yuv4mpeg
  530. file=${outfile}libav.y4m
  531. do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
  532. #do_ffmpeg_crc $file -i $file
  533. ####################
  534. # image formats
  535. # pgm (we do not do md5 on image files yet)
  536. file=${outfile}libav%02d.pgm
  537. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
  538. do_ffmpeg_crc $file -i $file
  539. # ppm (we do not do md5 on image files yet)
  540. file=${outfile}libav%02d.ppm
  541. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
  542. do_ffmpeg_crc $file -i $file
  543. # jpeg (we do not do md5 on image files yet)
  544. file=${outfile}libav%02d.jpg
  545. $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
  546. do_ffmpeg_crc $file -f image2 -i $file
  547. ####################
  548. # audio only
  549. # wav
  550. file=${outfile}libav.wav
  551. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  552. do_ffmpeg_crc $file -i $file
  553. # alaw
  554. file=${outfile}libav.al
  555. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  556. do_ffmpeg_crc $file -i $file
  557. # mulaw
  558. file=${outfile}libav.ul
  559. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  560. do_ffmpeg_crc $file -i $file
  561. # au
  562. file=${outfile}libav.au
  563. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  564. do_ffmpeg_crc $file -i $file
  565. # mmf
  566. file=${outfile}libav.mmf
  567. do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
  568. do_ffmpeg_crc $file -i $file
  569. ####################
  570. # pix_fmt conversions
  571. conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
  572. yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
  573. monob pal8"
  574. for pix_fmt in $conversions ; do
  575. file=${outfile}libav-${pix_fmt}.yuv
  576. do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
  577. -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
  578. do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
  579. -f rawvideo -s 352x288 -pix_fmt yuv444p $file
  580. done
  581. fi
  582. if $diff_cmd "$logfile" "$reffile" ; then
  583. echo
  584. echo Regression test succeeded.
  585. exit 0
  586. else
  587. echo
  588. echo Regression test: Error.
  589. exit 1
  590. fi