Path: blob/master/thirdparty/basis_universal/encoder/basisu_basis_file.h
9912 views
// basisu_basis_file.h1// Copyright (C) 2024 Binomial LLC. All Rights Reserved.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 at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// 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 and13// limitations under the License.14#pragma once15#include "../transcoder/basisu_file_headers.h"16#include "basisu_backend.h"1718namespace basisu19{20class basisu_file21{22BASISU_NO_EQUALS_OR_COPY_CONSTRUCT(basisu_file);2324public:25basisu_file()26{27}2829void clear()30{31m_comp_data.clear();3233clear_obj(m_header);34m_images_descs.clear();3536m_header_file_ofs = 0;37m_slice_descs_file_ofs = 0;38m_endpoint_cb_file_ofs = 0;39m_selector_cb_file_ofs = 0;40m_tables_file_ofs = 0;41m_first_image_file_ofs = 0;42m_total_file_size = 0;43}4445bool init(const basisu_backend_output& encoder_output, basist::basis_texture_type tex_type, uint32_t userdata0, uint32_t userdata1, bool y_flipped, uint32_t us_per_frame);4647const uint8_vec &get_compressed_data() const { return m_comp_data; }4849private:50basist::basis_file_header m_header;51basisu::vector<basist::basis_slice_desc> m_images_descs;5253uint8_vec m_comp_data;5455uint32_t m_header_file_ofs;56uint32_t m_slice_descs_file_ofs;57uint32_t m_endpoint_cb_file_ofs;58uint32_t m_selector_cb_file_ofs;59uint32_t m_tables_file_ofs;60uint32_t m_first_image_file_ofs;61uint32_t m_total_file_size;6263void create_header(const basisu_backend_output& encoder_output, basist::basis_texture_type tex_type, uint32_t userdata0, uint32_t userdata1, bool y_flipped, uint32_t us_per_frame);64bool create_image_descs(const basisu_backend_output& encoder_output);65void create_comp_data(const basisu_backend_output& encoder_output);66void fixup_crcs();67};6869} // namespace basisu707172