Skip to content

Instantly share code, notes, and snippets.

@WyohKnott
Created August 11, 2017 06:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WyohKnott/72a7f35d28062bf48610a4aea92af788 to your computer and use it in GitHub Desktop.
Save WyohKnott/72a7f35d28062bf48610a4aea92af788 to your computer and use it in GitHub Desktop.
Sagittaire benchmark for Linux https://forum.doom9.org/showthread.php?t=174393
#!/bin/bash
cpuinfo > cpuinfo.txt
# -----------------------------------------------------------
#
# Encodage H264 1080p24 8 bits profil "slower" avec optimisation "grain"
#
# -----------------------------------------------------------
ffmpeg -i Sample/Sample_1080p.ts -an -f rawvideo - | x264 --input-res 1920x1080 --fps 24.000 - -o Output/x264_1080p.264 --crf 20 --preset slower --tune grain --ssim --psnr --no-progress 2>&1 | tee test1.log
mkvmerge --default-duration 0:24fps Output/x264_1080p.264 -o Output/x264_1080p.mkv
# -----------------------------------------------------------
#
# Encodage HEVC 2160p24 10 bits HDR profil "medium" avec optimisation "grain"
#
# -----------------------------------------------------------
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --bframes 3 --min-keyint 1 --qcomp 0.75 --ssim --psnr --colorprim bt2020 --transfer smpte-st-2084 --colormatrix bt2020nc --aud --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(16085,16885)L(10000000,1)" --max-cll "1000,400" --hdr --no-progress 2>&1 | tee test2.log
mkvmerge --default-duration 0:23.976fps Output/x265_2160p.265 Sample/Exodus_UHD_HDR_Exodus_draft.mka -o Output/x265_2160p.mkv
# -----------------------------------------------------------
#
# Décodage HEVC 2160p24 10 bits HDR
#
# -----------------------------------------------------------
ffmpeg -i Output/x265_2160p.mkv -benchmark -f null - 2>&1 | tee test3.log
# -----------------------------------------------------------
#
# SMID Benchmark, verifier que le CPU est bien compatible avec les instructions testées
#
# -----------------------------------------------------------
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --frames 100 2>&1 | tee test4.log
has_MMX2=0
has_SSE=0
has_SSE2=0
has_SSE2Fast=0
has_SSE3=0
has_SSSE3=0
has_SSE4=0
has_SSE41=0
has_SSE42=0
has_AVX=0
has_AVX2=0
has_FMA3=0
has_FMA4=0
has_LZCNT=0
has_BMI1=0
has_BMI2=0
has_XOP=0
cpu_name=$(sed -n '4p' cpuinfo.txt | sed -e 's/ @.*//' | sed -e 's/Intel\|AMD\|CPU//gI' | sed -e 's/(R)//gI' | sed -e 's/(TM)//gI' | sed -e 's/Brand: //gI')
if grep -q "MMX2" test2.log
then
has_MMX2=1
fi
if grep -q "SSE" test2.log
then
has_SSE=1
fi
if grep -q "SSE2" test2.log
then
has_SSE2=1
fi
if grep -q "SSE2Fast" test2.log
then
has_SSE2Fast=1
fi
if grep -q "SSE3" test2.log
then
has_SSE3=1
fi
if grep -q "SSSE3" test2.log
then
has_SSSE3=1
fi
if grep -q "SSE4" test2.log
then
has_SSE4=1
fi
if grep -q "SSE4.1" test2.log
then
has_SSE41=1
fi
if grep -q "SSE4.2" test2.log
then
has_SSE42=1
fi
if grep -q "AVX" test2.log
then
has_AVX=1
fi
if grep -q "AVX2" test2.log
then
has_AVX2=1
fi
if grep -q "FMA3" test2.log
then
has_FMA3=1
fi
if grep -q "FMA4" test2.log
then
has_FMA4=1
fi
if grep -q "BMI1" test2.log
then
has_BMI1=1
fi
if grep -q "BMI2" test2.log
then
has_BMI2=1
fi
if grep -q "XOP" test2.log
then
has_XOP=1
fi
if [ "$has_MMX2" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm MMX2 --frames 100 2>&1 | tee test5.log
fi
if [ "$has_SSE2Fast" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm SSE --frames 100 2>&1 | tee test6.log
fi
if [ "$has_SSE2Fast" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm SSE2fast --frames 100 2>&1 | tee test7.log
fi
if [ "$has_SSSE3" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm SSSE3 --frames 100 2>&1 | tee test8.log
fi
if [ "$has_SSE42" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm SSE4.2 --frames 100 2>&1 | tee test9.log
fi
if [ "$has_AVX" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm AVX --frames 100 2>&1 | tee test10.log
fi
if [ "$has_AVX2" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm AVX2 --frames 100 2>&1 | tee test11.log
fi
if [ "$has_AVX" -eq 1 ] && [ "$has_FMA3" -eq 1 ] && [ "$has_LZCNT" -eq 1 ] && [ "$has_BMI2" -eq 1 ] && [ "$has_AVX2" -eq 1 ]
then
ffmpeg -i Sample/Exodus_UHD_HDR_Exodus_draft.mp4 -an -f rawvideo - | x265 --input-res 3840x2160 --fps 23.976 - -o Output/x265_2160p.265 --input-depth 10 --output-depth 10 --crf 24 --preset medium --tune grain --ssim --psnr --asm AVX,FMA3,LZCNT,BMI2,AVX2 --frames 100 2>&1 | tee test12.log
fi
if [ -f test1.log ]
then
result1=$(grep "encoded" test1.log | sed -e 's/.*frames, \(.*\) fps.*/\1/')
else
result1="N/A"
fi
if [ -f test2.log ]
then
result2=$(grep "encoded" test2.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result1="N/A"
fi
if [ -f test3.log ]
then
result3=$(grep "frame= 1146" test3.log | sed -e 's/.*1146 fps=\(.*\) q=.*/\1/')
else
result3="N/A"
fi
if [ -f test4.log ]
then
result4=$(grep "encoded" test4.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result4="N/A"
fi
if [ -f test5.log ]
then
result5=$(grep "encoded" test5.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result5="N/A"
fi
if [ -f test6.log ]
then
result6=$(grep "encoded" test6.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result6="N/A"
fi
if [ -f test7.log ]
then
result7=$(grep "encoded" test7.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result7="N/A"
fi
if [ -f test8.log ]
then
result8=$(grep "encoded" test8.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result8="N/A"
fi
if [ -f test9.log ]
then
result9=$(grep "encoded" test9.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result9="N/A"
fi
if [ -f test10.log ]
then
result10=$(grep "encoded" test10.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result10="N/A"
fi
if [ -f test11.log ]
then
result11=$(grep "encoded" test11.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result11="N/A"
fi
if [ -f test12.log ]
then
result12=$(grep "encoded" test12.log | sed -e 's/.*(\(.*\) fps.*/\1/')
else
result12="N/A"
fi
echo "|---------------------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|" | tee results.log
echo "| CPU | x264 | x265 | LAVC | auto | MMX2 | SSE | SSE2 | SSE3 | SSE4 | AVX | AVX2 | All | " | tee -a results.log
echo "|---------------------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|---------| " | tee -a results.log
echo "| $cpu_name | $result1 | $result2 | $result3 | $result4 | $result5 | $result6 | $result7 | $result8 | $result9 | $result10 | $result11 | $result12 | " | tee -a results.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment