Revert "using autorelease pools"

This reverts commit 7e0e6ef86e8501a090b5c300d68d5a942eb113cc.
Fix retain cycles.
Fix dead store analyzer warnings
Extract 3d transform creation to a function
Remove some commented code
No need to generate an intermediate JPEG
Phil's improvements!