2020-02-20 08:39:09 +11:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
###############################
|
|
|
|
# ECHOMIX #
|
|
|
|
###############################
|
|
|
|
|
|
|
|
SRCDIR="Fist"
|
|
|
|
DSTDIR="Pong"
|
|
|
|
FTMP="/dev/shm/tmp.fimg"
|
|
|
|
FDST="/dev/shm/foo.fimg"
|
|
|
|
|
|
|
|
# ------------------------------------------------------------
|
|
|
|
|
|
|
|
# count the nomber of picz in the source directory
|
|
|
|
#
|
|
|
|
NBRE=$(ls -1 ${SRCDIR}/*.fimg | wc -l)
|
|
|
|
|
|
|
|
# compute the echo picz offset
|
|
|
|
#
|
|
|
|
OFFS=$(( NBRE / 4 ))
|
|
|
|
|
|
|
|
# ------------------------------------------------------------
|
|
|
|
# MAIN LOOP
|
|
|
|
|
|
|
|
for idx in $(seq 0 $NBRE)
|
|
|
|
do
|
|
|
|
# build the two input filenames ...
|
|
|
|
#
|
2023-07-08 21:17:16 +11:00
|
|
|
imgA=$(printf "$SRCDIR/%05d.fimg" $idx)
|
2020-02-20 08:39:09 +11:00
|
|
|
vb=$(( $(( idx + OFFS )) % NBRE))
|
2023-07-08 21:17:16 +11:00
|
|
|
imgB=$(printf "$SRCDIR/%05d.fimg" $vb)
|
2020-02-20 08:39:09 +11:00
|
|
|
|
2020-02-21 11:34:07 +11:00
|
|
|
# ... and the output filename
|
2020-02-20 08:39:09 +11:00
|
|
|
#
|
|
|
|
dst=$(printf "%s/%05d.png" ${DSTDIR} $idx)
|
|
|
|
|
|
|
|
printf " %20s %20s %8df %20s\n" $imgA $imgB $vb $dst
|
|
|
|
|
|
|
|
# trying to autocompute the mixing coefficient
|
|
|
|
#
|
|
|
|
compute=" s(${idx} / 16) "
|
|
|
|
K=$(echo $compute | bc -l)
|
|
|
|
printf " %25s => %8.3f\n" "$compute" $K
|
|
|
|
|
|
|
|
# do the hard floating computation
|
|
|
|
#
|
|
|
|
fimgfx -v cos010 ${imgB} ${FTMP}
|
|
|
|
fimgops -k ${K} ${FTMP} ${imgA} mix ${FDST}
|
|
|
|
|
|
|
|
# write the output as PNG for video encoding
|
|
|
|
#
|
|
|
|
fimg2png ${FDST} ${dst}
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# ------------------------------------------------------------
|