Speedup for + preaveraged darkframe.

modularize
Sofus Albert Høgsbro Rose 2016-03-27 00:12:53 +01:00
parent 1c768280d9
commit cec8a0c40e
1 changed files with 19 additions and 13 deletions

View File

@ -162,9 +162,10 @@ help () { #This is a little too much @ this point...
echo -e " --> Use -w<mode> (no space)." echo -e " --> Use -w<mode> (no space)."
echo -e " --> 0: Auto WB (Requires Python Deps). 1: Camera WB. 2: No Change.\n" echo -e " --> 0: Auto WB (Requires Python Deps). 1: Camera WB. 2: No Change.\n"
echo -e " -F<path> DARKFRAME - This is the path to the dark frame MLV." echo -e " -F<path> DARKFRAME - This is the path to the dark frame MLV, for noise reduction."
echo -e " --> This is a noise reduction technique: Record 5 sec w/lens cap on & same settings as footage." echo -e " --> This is a noise reduction technique: Record 5 sec w/lens cap on & same settings as footage."
echo -e " --> Pass in that MLV file (must be MLV) as <path> to get noise reduction on all passed MLV files.\n" echo -e " --> Pass in that MLV file (not .RAW) as <path> to get noise reduction on all passed MLV files."
echo -e " --> If the file extension is '.darkframe', the file will be used as the preaveraged dark frame.\n"
echo -e " -A[int] WHITE_SPD - This is the amount of samples from which AWB will be calculated." echo -e " -A[int] WHITE_SPD - This is the amount of samples from which AWB will be calculated."
echo -e " -->About this many frames, averaged over the course of the sequence, will be used to do AWB.\n" echo -e " -->About this many frames, averaged over the course of the sequence, will be used to do AWB.\n"
@ -505,7 +506,7 @@ for ARG in $*; do
$MLV_BP -o $gen_bad $ARG $MLV_BP -o $gen_bad $ARG
fi fi
#~ if [ $DUAL_ISO == true ]; then #Brute force grid in everything. Experiment. #~ if [ $DUAL_ISO == true ]; then #Brute force grid in everything. Experiment gone wrong...
#~ echo "" > $gen_bad #~ echo "" > $gen_bad
#~ echo $gen_bad #~ echo $gen_bad
#~ mapfile < $gen_bad #~ mapfile < $gen_bad
@ -551,11 +552,18 @@ for ARG in $*; do
if [ $DARKFRAME != "" ]; then if [ $DARKFRAME != "" ]; then
echo -e "\e[1m${TRUNC_ARG}:\e[0m Creating darkframe for subtraction...\n" echo -e "\e[1m${TRUNC_ARG}:\e[0m Creating darkframe for subtraction...\n"
avgFrame="${TMP}/darkframe.MLV" avgFrame="${TMP}/avg.darkframe" #The path to the averaged darkframe file.
newArg="${TMP}/subtracted.MLV"
$MLV_DUMP -o "${avgFrame}" -a $DARKFRAME >/dev/null 2>/dev/null darkBase="$(basename "$ARG")"
$MLV_DUMP -o $newArg -s $avgFrame $ARG >/dev/null 2>/dev/null darkExt="${BASE##*.}"
if [ darkExt != 'darkframe' ]; then
$MLV_DUMP -o "${avgFrame}" -a $DARKFRAME >/dev/null 2>/dev/null
else
cp $DARKFRAME $avgFrame #Copy the preaveraged frame if the extension is .darkframe.
fi
DARK_PROC="-s ${avgFrame}"
fi fi
#Dump to DNG sequence, perhaps subtracting darkframe. #Dump to DNG sequence, perhaps subtracting darkframe.
@ -567,20 +575,18 @@ for ARG in $*; do
else else
echo -e "\e[1m${TRUNC_ARG}:\e[0m Dumping to DNG Sequence...\n" echo -e "\e[1m${TRUNC_ARG}:\e[0m Dumping to DNG Sequence...\n"
if [ $DARKFRAME != "" ]; then #Whether or not to use the newArg subtracted MLV. if [ $DARKFRAME != "" ]; then #Just to let the user know that darkframe subtraction is impossible with RAW.
inputFile=$newArg
rawStat="*Skipping Darkframe subtraction for RAW file ${TRUNC_ARG}." rawStat="*Skipping Darkframe subtraction for RAW file ${TRUNC_ARG}."
else else
inputFile=$ARG
rawStat="\c" rawStat="\c"
fi fi
if [ $EXT == "MLV" ] || [ $EXT == "mlv" ]; then if [ $EXT == "MLV" ] || [ $EXT == "mlv" ]; then
FPS=`${MLV_DUMP} -v -m ${inputFile} | grep FPS | awk 'FNR == 1 {print $3}'` FPS=`${MLV_DUMP} -v -m ${ARG} | grep FPS | awk 'FNR == 1 {print $3}'`
$MLV_DUMP $inputFile -o "${TMP}/${TRUNC_ARG}_" --dng --no-cs >/dev/null 2>/dev/null $MLV_DUMP $ARG $DARK_PROC -o "${TMP}/${TRUNC_ARG}_" --dng --no-cs >/dev/null 2>/dev/null
elif [ $EXT == "RAW" ] || [ $EXT == "raw" ]; then elif [ $EXT == "RAW" ] || [ $EXT == "raw" ]; then
echo -e $rawStat echo -e $rawStat
FPS=`$RAW_DUMP $inputFile "${TMP}/${TRUNC_ARG}_" | awk '/FPS/ { print $3; }'` #Run the dump while awking for the FPS. FPS=`$RAW_DUMP $ARG "${TMP}/${TRUNC_ARG}_" | awk '/FPS/ { print $3; }'` #Run the dump while awking for the FPS.
fi fi
FRAMES=$(find ${TMP} -name "*.dng" | wc -l) FRAMES=$(find ${TMP} -name "*.dng" | wc -l)