// DIE's signature file
// Author: LinXP
// doc-ref: http://powervr-graphics.github.io/WebGL_SDK/WebGL_SDK/Documentation/Specifications/PVR%20File%20Format.Specification.pdf
init("image","");

function detect(bShowType,bShowVersion,bShowOptions)
{
    var  PixelFormat = ['PVRTC 2bpp RGB', 'PVRTC 2bpp RGBA', 'PVRTC 4bpp RGB', 'PVRTC 4bpp RGBA', 'PVRTC-II 2bpp', 'PVRTC-II 4bpp',
        'ETC1', 'BC1\\DXT1', 'DXT2', 'BC2\\DXT3', 'DXT4', 'BC3\\DXT5', 'BC4', 'BC5', 'BC6', 'BC7', 'UYVY', 'YUY2', 'BW1bpp', 'R9G9B9E5 Shared Exponent', 'RGBG8888', 'GRGB8888', 
        'ETC2 RGB', 'ETC2 RGBA', 'ETC2 RGB A1', 'EAC R11', 'EAC RG11', 
        'ASTC_4x4','ASTC_5x4','ASTC_5x5','ASTC_6x5','ASTC_6x6','ASTC_8x5','ASTC_8x6','ASTC_8x8','ASTC_10x5','ASTC_10x6','ASTC_10x8','ASTC_10x10',
        'ASTC_12x10','ASTC_12x12','ASTC_3x3x3','ASTC_4x3x3','ASTC_4x4x3', 'ASTC_4x4x4','ASTC_5x4x4','ASTC_5x5x4','ASTC_5x5x5','ASTC_6x5x5','ASTC_6x6x5','ASTC_6x6x6'];

    if(Binary.getSize()>=0x34)
    {
        if(Binary.compare("'PVR'03"))
        {
            bDetected=true;
            sName="PowerVR PVR texture (.PVR)";
            if(Binary.isVerbose())
            {
                sOption(Binary.read_uint32(0x18)+"x"+Binary.read_uint32(0x1c));
                sOption(PixelFormat[Binary.read_uint64(0x08)]);
                if (Binary.read_uint32(0x10)) {sOption("Linear RGB");} else {sOption("Standard RGB");}
            }
        }


    }

    return result(bShowType,bShowVersion,bShowOptions);
}