1 // Copyright 2018 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef ASTC_CODEC_DECODER_WEIGHT_INFILL_H_ 16 #define ASTC_CODEC_DECODER_WEIGHT_INFILL_H_ 17 18 #include "src/decoder/footprint.h" 19 20 #include <vector> 21 22 namespace astc_codec { 23 24 // Returns the number of bits used to represent the weight grid at the target 25 // dimensions and weight range. 26 int CountBitsForWeights(int weight_dim_x, int weight_dim_y, 27 int target_weight_range); 28 29 // Performs weight infill of a grid of weights of size |dim_x * dim_y|. The 30 // weights are fit using the algorithm laid out in Section C.2.18 of the ASTC 31 // specification. Weights are expected to be passed unquantized and the returned 32 // grid will be unquantized as well (i.e. each weight within the range [0, 64]). 33 std::vector<int> InfillWeights(const std::vector<int>& weights, 34 Footprint footprint, int dim_x, int dim_y); 35 36 } // namespace astc_codec 37 38 #endif // ASTC_CODEC_DECODER_WEIGHT_INFILL_H_ 39