nvidia-texture-tools/src/nvtt/bc7/shapes_three.h
nathaniel.reed@gmail.com ab316deeaa Add BC7 support. It's incredibly slow - ~60 seconds to compress a 512x512 image, on a Core i7 - but it works.
- Added AVPCL compressor to projects and got it building with VC9 and VC10.
- Removed unused command line interface & file read/write code from AVPCL.
- Convert AVPCL to use NV vector math lib, asserts, etc.
- Convert AVPCL to use double instead of float.
- Added 4x4 symmetric eigensolver, for AVPCL; it's based on the existing 3x3 one, but I had to rewrite the Householder reduction stage.  As with ZOH, using the eigensolver (instead of SVD) gives a ~25% speedup without significantly affecting RMSE.
- Encapsulate ZOH and AVPCL stuff into their own namespaces to keep everything separate.
- Added some missing vector operators to the nvmath lib.
2013-12-07 02:17:08 +00:00

133 lines
5.3 KiB
C

/*
Copyright 2007 nVidia, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
*/
#ifndef _AVPCL_SHAPES_THREE_H
#define _AVPCL_SHAPES_THREE_H
// shapes for 3 regions
#define NREGIONS 3
#define NSHAPES 64
#define SHAPEBITS 6
static int shapes[NSHAPES*16] =
{
0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 2, 2,
0, 0, 1, 1, 0, 0, 1, 1, 2, 0, 0, 1, 0, 0, 2, 2,
0, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1, 0, 0, 1, 1,
2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 0, 1, 1, 1,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1,
1, 1, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1,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 0,15,10, 0,15, 8,
0, 8,15, 0,15, 3, 0, 3,15, 0, 5,10,
0, 6,10, 0,10, 8, 0, 8, 9, 0,15,10,
0,15, 6, 0, 3,15, 0,15, 8, 0, 5,15,
0,15, 3, 0,15, 6, 0,15, 6, 0,15, 8,
0, 3,15, 0,15, 3, 0, 5,15, 0, 5,15,
0, 5,15, 0, 8,15, 0, 5,15, 0,10,15,
0, 5,15, 0,10,15, 0, 8,15, 0,13,15,
0,15, 3, 0,12,15, 0, 3,15, 0, 3, 8
};
#define SHAPEINDEX_TO_COMPRESSED_INDICES(si,region) shapeindex_to_compressed_indices[(si)*3+(region)]
#endif