#!/bin/csh

set in = grid_rgb.ppm

set formatList = ( l la rgb rgba )
set typeList = ( u8 u16 f32 )
set colorList = ( auto linear print )
set bitDepthList = ( u8 u10 u12 u16 )
set packList = ( true false )
set channelList = ( interleave planar )
set endianList = ( msb lsb )

foreach format ($formatList)
  foreach type ($typeList)
    foreach color ($colorList)
      foreach bitDepth ($bitDepthList)
        foreach pack ($packList)
          foreach channel ($channelList)
            foreach endian ($endianList)
        
              set out = "out"
              set out = ${out}-format_${format}
              set out = ${out}-type_${type}
              set out = ${out}-color_${color}
              set out = ${out}-bitDepth_${bitDepth}
              set out = ${out}-pack_${pack}
              set out = ${out}-channel_${channel}
              set out = ${out}-endian_${endian}
              set out = ${out}.dpx
          
              ../../bin/djop \
                $in $out \
                -saveFormat $format \
                -saveType $type \
                -saveAttr dpx color $color \
                -saveAttr dpx "bit depth" $bitDepth \
                -saveAttr dpx pack $pack \
                -saveAttr dpx channels $channel \
                -saveAttr dpx endian $endian
              if ($status != 0) then
                exit 1
              endif
          
            end
          end
        end
      end
    end
  end
end
