Major reorganization and rename

hotfix/mipmap-alpha-fix
Andrew Cassidy 3 years ago
parent c930d10cc4
commit ab65c0a7c8

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.17)
include(CheckIPOSupported)
include(tools/CompilerWarnings.cmake)
project(rgbcx)
project(quicktex)
# Find dependencies
find_package(Python COMPONENTS Interpreter Development REQUIRED)
@ -10,41 +10,61 @@ find_package(OpenMP)
add_subdirectory(extern/pybind11)
# Collect source files
file(GLOB SOURCE_FILES "src/rgbcx/*.cpp" "src/rgbcx/BC*/*.cpp")
file(GLOB HEADER_FILES "src/rgbcx/*.h" "src/rgbcx/BC*/*.h")
file(GLOB PYTHON_FILES "src/rgbcx/bindings/*.cpp" "src/rgbcx/bindings/*.h")
file(GLOB SOURCE_FILES
"quicktex/*.cpp"
"quicktex/compression/*.cpp"
"quicktex/compression/bc1/*.cpp"
"quicktex/compression/bc3/*.cpp"
"quicktex/compression/bc4/*.cpp"
"quicktex/compression/bc5/*.cpp"
)
file(GLOB HEADER_FILES
"quicktex/*.h"
"quicktex/compression/*.h"
"quicktex/compression/bc1/*.h"
"quicktex/compression/bc3/*.h"
"quicktex/compression/bc4/*.h"
"quicktex/compression/bc5/*.h"
"quicktex/formats/blocks/*.h"
)
file(GLOB TEST_FILES "tests/*.cpp")
set(PYTHON_FILES
"quicktex/bindings/Module.cpp"
"quicktex/compression/bindings/Decoders.cpp"
"quicktex/compression/bindings/Encoders.cpp")
# Organize source files together for some IDEs
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_FILES} ${HEADER_FILES} ${PYTHON_FILES})
# Add python module
pybind11_add_module(_rgbcx
pybind11_add_module(_quicktex
${SOURCE_FILES}
${HEADER_FILES}
${PYTHON_FILES})
add_executable(test_rgbcx
add_executable(test_quicktex
${SOURCE_FILES}
${HEADER_FILES}
${TEST_FILES})
target_link_libraries(test_rgbcx PRIVATE pybind11::embed)
target_link_libraries(test_quicktex PRIVATE pybind11::embed)
target_compile_definitions(test_rgbcx PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME_DIRECTORY}/env/lib/python3.8/site-packages")
message("\"${CMAKE_HOME_DIRECTORY}/env/lib/python3.8/site-packages\"")
target_compile_definitions(test_quicktex PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME_DIRECTORY}/env/lib/python3.8/site-packages")
# enable openMP if available
if(OpenMP_CXX_FOUND)
target_link_libraries(_rgbcx PUBLIC OpenMP::OpenMP_CXX)
endif()
if (OpenMP_CXX_FOUND)
target_link_libraries(_quicktex PUBLIC OpenMP::OpenMP_CXX)
endif ()
# Set module features, like C/C++ standards
target_compile_features(_rgbcx PUBLIC cxx_std_20 c_std_11)
target_compile_features(test_rgbcx PUBLIC cxx_std_20 c_std_11)
target_compile_features(_quicktex PUBLIC cxx_std_20 c_std_11)
target_compile_features(test_quicktex PUBLIC cxx_std_20 c_std_11)
set_project_warnings(_rgbcx)
set_project_warnings(test_rgbcx)
set_project_warnings(_quicktex)
set_project_warnings(test_quicktex)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

@ -0,0 +1,2 @@
index.rst
============

@ -30,7 +30,7 @@
#include "Vector4Int.h"
#include "ndebug.h"
namespace rgbcx {
namespace quicktex {
template <typename S, size_t N> class RowView {
public:
RowView(S *start, int pixel_stride = 1) : start(start), pixel_stride(pixel_stride) {}
@ -167,4 +167,4 @@ template <size_t M, size_t N> class ColorBlockView : public BlockView<Color, M,
using Color4x4 = ColorBlockView<4, 4>;
using Byte4x4 = BlockView<uint8_t, 4, 4>;
} // namespace rgbcx
} // namespace quicktex

@ -24,7 +24,7 @@
#include "Vector4Int.h"
#include "util.h" // for scale5To8, scale8To5, assert5bit, scale6To8
namespace rgbcx {
namespace quicktex {
Color::Color() { SetRGBA(0, 0, 0, 0xFF); }
@ -122,4 +122,4 @@ uint16_t Color::Pack565Unscaled() const { return Pack565Unscaled(r, g, b); }
Color Color::ScaleTo565() const { return Color(scale8To5(r), scale8To6(g), scale8To5(b)); }
Color Color::ScaleFrom565() const { return Color(scale5To8(r), scale6To8(g), scale5To8(b)); }
} // namespace rgbcx
} // namespace quicktex

@ -23,7 +23,7 @@
#include <cstdint> // for uint8_t, uint16_t
namespace rgbcx {
namespace quicktex {
class Vector4;
class Vector4Int;
@ -99,4 +99,4 @@ class Color {
.882353f, .898039f, .913725f, .929412f, .945098f, .960784f, .976471f, .992157f, 1e+37f};
};
#pragma pack(pop)
} // namespace rgbcx
} // namespace quicktex

@ -26,7 +26,7 @@
#include "util.h"
namespace rgbcx {
namespace quicktex {
/*
Interpolator::Interpolator() {
@ -196,4 +196,4 @@ uint8_t InterpolatorAMD::Interpolate8(uint8_t v0, uint8_t v1) const { return (v0
uint8_t InterpolatorAMD::InterpolateHalf8(uint8_t v0, uint8_t v1) const { return (v0 + v1 + 1) >> 1; }
// endregion
} // namespace rgbcx
} // namespace quicktex

@ -24,7 +24,7 @@
#include "Color.h" // for Color
namespace rgbcx {
namespace quicktex {
class Interpolator {
public:
@ -171,4 +171,4 @@ class InterpolatorAMD : public Interpolator {
Type GetType() const noexcept override { return Type::AMD; }
};
} // namespace rgbcx
} // namespace quicktex

@ -19,7 +19,7 @@
#include "Matrix4x4.h"
namespace rgbcx {
namespace quicktex {
Matrix4x4 operator*(const Matrix4x4& lhs, const Matrix4x4& rhs) {
Matrix4x4 trans_rhs = rhs.Transpose(); // 🏳️‍⚧️
@ -47,4 +47,4 @@ void Matrix4x4::Mirror() {
}
}
} // namespace rgbcx
} // namespace quicktex

@ -26,7 +26,7 @@
#include "Vector4.h"
namespace rgbcx {
namespace quicktex {
class Matrix4x4 {
public:
@ -92,4 +92,4 @@ class Matrix4x4 {
std::array<Vector4, 4> _r;
};
} // namespace rgbcx
} // namespace quicktex

@ -25,7 +25,7 @@
#include "Color.h"
namespace rgbcx {
namespace quicktex {
class Vector4 {
public:
@ -121,4 +121,4 @@ class Vector4 {
std::array<float, 4> _c;
};
} // namespace rgbcx
} // namespace quicktex

@ -25,7 +25,7 @@
#include "Color.h"
#include "Vector4.h"
namespace rgbcx {
namespace quicktex {
class Vector4Int {
public:
@ -117,4 +117,4 @@ class Vector4Int {
std::array<int, 4> _c;
};
} // namespace rgbcx
} // namespace quicktex

@ -0,0 +1 @@
from _quicktex import *

@ -22,12 +22,12 @@
#include "../Interpolator.h"
namespace py = pybind11;
namespace rgbcx::bindings {
namespace quicktex::bindings {
void InitEncoders(py::module_ &m);
void InitDecoders(py::module_ &m);
PYBIND11_MODULE(_rgbcx, m) {
PYBIND11_MODULE(_quicktex, m) {
m.doc() = "More Stuff";
using IType = Interpolator::Type;
@ -41,4 +41,4 @@ PYBIND11_MODULE(_rgbcx, m) {
InitDecoders(m);
}
} // namespace rgbcx::bindings
} // namespace quicktex::bindings

@ -21,15 +21,15 @@
#include <cmath>
#include <cstdint>
#include <memory>
#include <span>
#include <vector>
#include <memory>
#include "BlockView.h"
#include "ndebug.h"
#include "util.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "../util.h"
namespace rgbcx {
namespace quicktex {
class BlockDecoder {
public:
@ -87,4 +87,4 @@ class BlockDecoderTemplate : public BlockDecoder {
virtual size_t BlockWidth() const override { return N; }
virtual size_t BlockHeight() const override { return M; }
};
} // namespace rgbcx
} // namespace quicktex

@ -24,9 +24,9 @@
#include <memory>
#include <string>
#include "BlockView.h"
#include "../BlockView.h"
namespace rgbcx {
namespace quicktex {
class BlockEncoder {
public:
@ -89,4 +89,4 @@ template <class B, size_t M, size_t N> class BlockEncoderTemplate : public Block
virtual size_t MTThreshold() const { return SIZE_MAX; };
};
} // namespace rgbcx
} // namespace quicktex

@ -23,12 +23,12 @@
#include <cassert>
#include <cstdint>
#include "../BlockView.h"
#include "../Color.h"
#include "../ndebug.h"
#include "BC1Block.h"
#include "../../BlockView.h"
#include "../../Color.h"
#include "../../formats/blocks/BC1Block.h"
#include "../../ndebug.h"
namespace rgbcx {
namespace quicktex {
void BC1Decoder::DecodeBlock(Color4x4 dest, BC1Block *const block) const noexcept(ndebug) {
const auto l = block->GetLowColor();
const auto h = block->GetHighColor();
@ -49,4 +49,4 @@ void BC1Decoder::DecodeBlock(Color4x4 dest, BC1Block *const block) const noexcep
}
}
}
} // namespace rgbcx
} // namespace quicktex

@ -22,13 +22,13 @@
#include <memory>
#include <type_traits>
#include "../../BlockView.h"
#include "../../Interpolator.h"
#include "../../formats/blocks/BC1Block.h"
#include "../../ndebug.h"
#include "../BlockDecoder.h"
#include "../BlockView.h"
#include "../Interpolator.h"
#include "../ndebug.h"
#include "BC1Block.h"
namespace rgbcx {
namespace quicktex {
class BC1Decoder final : public BlockDecoderTemplate<BC1Block, 4, 4> {
public:
using InterpolatorPtr = std::shared_ptr<Interpolator>;
@ -45,4 +45,4 @@ class BC1Decoder final : public BlockDecoderTemplate<BC1Block, 4, 4> {
private:
const InterpolatorPtr _interpolator;
};
} // namespace rgbcx
} // namespace quicktex

@ -27,19 +27,19 @@
#include <memory>
#include <type_traits>
#include "../BlockView.h"
#include "../Color.h"
#include "../Interpolator.h"
#include "../Matrix4x4.h"
#include "../Vector4.h"
#include "../Vector4Int.h"
#include "../bitwiseEnums.h"
#include "../util.h"
#include "../../BlockView.h"
#include "../../Color.h"
#include "../../Interpolator.h"
#include "../../Matrix4x4.h"
#include "../../Vector4.h"
#include "../../Vector4Int.h"
#include "../../bitwiseEnums.h"
#include "../../util.h"
#include "Histogram.h"
#include "OrderTable.h"
#include "SingleColorTable.h"
namespace rgbcx {
namespace quicktex {
using namespace BC1;
// constructors
@ -941,4 +941,4 @@ void BC1Encoder::EndpointSearch(Color4x4 &pixels, EncodeResults &block) const {
}
}
} // namespace rgbcx
} // namespace quicktex

@ -26,14 +26,14 @@
#include <memory>
#include <type_traits>
#include "../../BlockView.h"
#include "../../Color.h"
#include "../../Interpolator.h"
#include "../../formats/blocks/BC1Block.h"
#include "../BlockEncoder.h"
#include "../BlockView.h"
#include "../Color.h"
#include "../Interpolator.h"
#include "BC1Block.h"
#include "SingleColorTable.h"
namespace rgbcx {
namespace quicktex {
class Vector4;
class BC1Encoder final : public BlockEncoderTemplate<BC1Block, 4, 4> {
@ -196,4 +196,4 @@ class BC1Encoder final : public BlockEncoderTemplate<BC1Block, 4, 4> {
void EndpointSearch(Color4x4 &pixels, EncodeResults &block) const;
};
} // namespace rgbcx
} // namespace quicktex

@ -27,10 +27,10 @@
#include <mutex>
#include <numeric>
#include "../Vector4.h"
#include "../util.h"
#include "../../Vector4.h"
#include "../../util.h"
namespace rgbcx::BC1 {
namespace quicktex::BC1 {
template <size_t N> class Histogram {
public:
using Hash = uint16_t;
@ -82,4 +82,4 @@ template <size_t N> class Histogram {
private:
std::array<uint8_t, N> _bins;
};
} // namespace rgbcx
} // namespace quicktex

@ -21,9 +21,9 @@
#include <array>
#include "../Vector4.h"
#include "../../Vector4.h"
namespace rgbcx::BC1 {
namespace quicktex::BC1 {
using Hash = uint16_t;
template <> std::atomic<bool> OrderTable<3>::generated = false;
@ -324,4 +324,4 @@ const OrderTable<3>::BestOrderArray OrderTable<3>::BestOrders = {
template class OrderTable<3>;
template class OrderTable<4>;
} // namespace rgbcx
} // namespace quicktex

@ -28,10 +28,10 @@
#include <cstdint>
#include <mutex>
#include "../Vector4.h"
#include "../../Vector4.h"
#include "Histogram.h"
namespace rgbcx::BC1 {
namespace quicktex::BC1 {
template <size_t N> class OrderTable {
public:
static constexpr unsigned HashCount = 1 << ((N - 1) * 4); // 16**(N-1)
@ -147,4 +147,4 @@ template <> const OrderTable<4>::BestOrderArray OrderTable<4>::BestOrders;
extern template class OrderTable<3>;
extern template class OrderTable<4>;
} // namespace rgbcx::BC1
} // namespace quicktex::BC1

@ -20,7 +20,7 @@
#include "OrderTable.h"
// clang-format off
namespace rgbcx::BC1 {
namespace quicktex::BC1 {
template <>
const OrderTable<4>::BestOrderArray OrderTable<4>::BestOrders = {{
@ -1966,5 +1966,5 @@ const OrderTable<4>::BestOrderArray OrderTable<4>::BestOrders = {{
{ 15,341,13,33,23,77,141,4,0,351,1,260,102,51,82,9,40,349,854,11,115,217,269,137,180,202,922,5,901,22,10,117,21,365,318,197,120,352,64,12,7,153,177,59,291,32,128,2,165,196,372,36,403,317,457,28,18,8,16,304,30,14,450,31,898,37,3,752,48,134,139,494,421,6,453,401,719,90,86,569,523,110,24,55,475,210,49,44,386,17,730,95,247,244,961,143,125,308,342,817,629,98,498,93,96,76,39,275,509,326,99,285,373,57,237,35,402,160,111,253,105,391,221,116,899,72,127,661 }
#endif
}};
} // namespace rgbcx::BC1
} // namespace quicktex::BC1
// clang-format on

@ -23,10 +23,10 @@
#include <cstdint>
#include <memory>
#include "../Interpolator.h"
#include "../util.h"
#include "../../Interpolator.h"
#include "../../util.h"
namespace rgbcx::BC1 {
namespace quicktex::BC1 {
struct BC1MatchEntry {
uint8_t high;
@ -90,4 +90,4 @@ template <size_t B, size_t N> MatchListPtr SingleColorTable(InterpolatorPtr inte
}
return matches;
}
} // namespace rgbcx
} // namespace quicktex::BC1

@ -21,14 +21,14 @@
#include <type_traits>
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC3Block.h"
#include "../../BlockView.h"
#include "../../formats/blocks/BC3Block.h"
#include "../../ndebug.h"
namespace rgbcx {
namespace quicktex {
void BC3Decoder::DecodeBlock(Color4x4 dest, BC3Block *const block) const noexcept(ndebug) {
_bc1_decoder->DecodeBlock(dest, &(block->color_block));
_bc4_decoder->DecodeBlock(dest, &(block->alpha_block), 3);
}
} // namespace rgbcx
} // namespace quicktex

@ -21,15 +21,15 @@
#include <memory>
#include "../BC1/BC1Decoder.h"
#include "../BC4/BC4Decoder.h"
#include "../../BlockView.h"
#include "../../Interpolator.h"
#include "../../formats/blocks/BC3Block.h"
#include "../../ndebug.h"
#include "../BlockDecoder.h"
#include "../BlockView.h"
#include "../Interpolator.h"
#include "../ndebug.h"
#include "BC3Block.h"
#include "../bc1/BC1Decoder.h"
#include "../bc4/BC4Decoder.h"
namespace rgbcx {
namespace quicktex {
class BC3Decoder : public BlockDecoderTemplate<BC3Block, 4, 4> {
public:
using BC1DecoderPtr = std::shared_ptr<BC1Decoder>;
@ -47,4 +47,4 @@ class BC3Decoder : public BlockDecoderTemplate<BC3Block, 4, 4> {
const BC1DecoderPtr _bc1_decoder;
const BC4DecoderPtr _bc4_decoder;
};
} // namespace rgbcx
} // namespace quicktex

@ -19,12 +19,12 @@
#include "BC3Encoder.h"
#include "../BlockView.h"
#include "BC3Block.h"
#include "../../BlockView.h"
#include "../../formats/blocks/BC3Block.h"
namespace rgbcx {
namespace quicktex {
void BC3Encoder::EncodeBlock(Color4x4 pixels, BC3Block *dest) const {
_bc1_encoder->EncodeBlock(pixels, &(dest->color_block));
_bc4_encoder->EncodeBlock(pixels, &(dest->alpha_block), 3);
}
} // namespace rgbcx
} // namespace quicktex

@ -21,14 +21,14 @@
#include <memory>
#include "../BC1/BC1Encoder.h"
#include "../BC4/BC4Encoder.h"
#include "../../BlockView.h"
#include "../../Interpolator.h"
#include "../../formats/blocks/BC3Block.h"
#include "../BlockEncoder.h"
#include "../BlockView.h"
#include "../Interpolator.h"
#include "BC3Block.h"
#include "../bc1/BC1Encoder.h"
#include "../bc4/BC4Encoder.h"
namespace rgbcx {
namespace quicktex {
class BC3Encoder : public BlockEncoderTemplate<BC3Block, 4, 4> {
public:
@ -47,4 +47,4 @@ class BC3Encoder : public BlockEncoderTemplate<BC3Block, 4, 4> {
const BC1EncoderPtr _bc1_encoder;
const BC4EncoderPtr _bc4_encoder;
};
} // namespace rgbcx
} // namespace quicktex

@ -22,11 +22,11 @@
#include <array> // for array
#include <cassert> // for assert
#include "../BlockView.h" // for ColorBlock
#include "../ndebug.h" // for ndebug
#include "BC4Block.h"
#include "../../BlockView.h" // for ColorBlock
#include "../../formats/blocks/BC4Block.h"
#include "../../ndebug.h" // for ndebug
void rgbcx::BC4Decoder::DecodeBlock(Byte4x4 dest, BC4Block *const block) const noexcept(ndebug) {
void quicktex::BC4Decoder::DecodeBlock(Byte4x4 dest, BC4Block *const block) const noexcept(ndebug) {
auto l = block->GetLowAlpha();
auto h = block->GetHighAlpha();

@ -23,12 +23,12 @@
#include <cstdint>
#include <stdexcept>
#include "../../BlockView.h"
#include "../../formats/blocks/BC4Block.h"
#include "../../ndebug.h"
#include "../BlockDecoder.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC4Block.h"
namespace rgbcx {
namespace quicktex {
class BC4Decoder : public BlockDecoderTemplate<BC4Block, 4, 4> {
public:
BC4Decoder(uint8_t channel = 3) { SetChannel(channel); }
@ -46,4 +46,4 @@ class BC4Decoder : public BlockDecoderTemplate<BC4Block, 4, 4> {
private:
uint8_t _channel;
};
} // namespace rgbcx
} // namespace quicktex

@ -24,11 +24,11 @@
#include <cstdint>
#include <utility>
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC4Block.h"
#include "../../BlockView.h"
#include "../../formats/blocks/BC4Block.h"
#include "../../ndebug.h"
namespace rgbcx {
namespace quicktex {
void BC4Encoder::EncodeBlock(Byte4x4 pixels, BC4Block *const dest) const noexcept(ndebug) {
auto flattened = pixels.Flatten();
auto minmax = std::minmax_element(flattened.begin(), flattened.end());
@ -70,4 +70,4 @@ void BC4Encoder::EncodeBlock(Byte4x4 pixels, BC4Block *const dest) const noexcep
dest->PackSelectors(selectors);
}
} // namespace rgbcx
} // namespace quicktex

@ -23,12 +23,12 @@
#include <cstdint>
#include <stdexcept>
#include "../../BlockView.h"
#include "../../formats/blocks/BC4Block.h"
#include "../../ndebug.h"
#include "../BlockEncoder.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC4Block.h"
namespace rgbcx {
namespace quicktex {
class BC4Encoder : public BlockEncoderTemplate<BC4Block, 4, 4> {
public:
@ -47,4 +47,4 @@ class BC4Encoder : public BlockEncoderTemplate<BC4Block, 4, 4> {
private:
uint8_t _channel;
};
} // namespace rgbcx
} // namespace quicktex

@ -19,14 +19,14 @@
#include "BC5Decoder.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC5Block.h"
#include "../../BlockView.h"
#include "../../ndebug.h"
#include "../../formats/blocks/BC5Block.h"
namespace rgbcx {
namespace quicktex {
void BC5Decoder::DecodeBlock(Color4x4 dest, BC5Block *const block) const noexcept(ndebug) {
_chan0_decoder->DecodeBlock(dest, &block->chan0_block);
_chan1_decoder->DecodeBlock(dest, &block->chan1_block);
}
} // namespace rgbcx
} // namespace quicktex

@ -24,13 +24,13 @@
#include <tuple>
#include <type_traits>
#include "../BC4/BC4Decoder.h"
#include "../../BlockView.h"
#include "../../ndebug.h"
#include "../bc4/BC4Decoder.h"
#include "../BlockDecoder.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC5Block.h"
#include "../../formats/blocks/BC5Block.h"
namespace rgbcx {
namespace quicktex {
class BC5Decoder : public BlockDecoderTemplate<BC5Block, 4, 4> {
public:
using ChannelPair = std::tuple<uint8_t, uint8_t>;
@ -54,4 +54,4 @@ class BC5Decoder : public BlockDecoderTemplate<BC5Block, 4, 4> {
const BC4DecoderPtr _chan0_decoder;
const BC4DecoderPtr _chan1_decoder;
};
} // namespace rgbcx
} // namespace quicktex

@ -19,9 +19,9 @@
#include "BC5Encoder.h"
namespace rgbcx {
namespace quicktex {
void BC5Encoder::EncodeBlock(Color4x4 pixels, BC5Block *dest) const {
_chan0_encoder->EncodeBlock(pixels, &(dest->chan0_block));
_chan1_encoder->EncodeBlock(pixels, &(dest->chan1_block));
}
} // namespace rgbcx
} // namespace quicktex

@ -24,13 +24,13 @@
#include <tuple>
#include <type_traits>
#include "../BC4/BC4Encoder.h"
#include "../../BlockView.h"
#include "../../ndebug.h"
#include "../bc4/BC4Encoder.h"
#include "../BlockEncoder.h"
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC5Block.h"
#include "../../formats/blocks/BC5Block.h"
namespace rgbcx {
namespace quicktex {
class BC5Encoder : public BlockEncoderTemplate<BC5Block, 4, 4> {
public:
using ChannelPair = std::tuple<uint8_t, uint8_t>;
@ -54,4 +54,4 @@ class BC5Encoder : public BlockEncoderTemplate<BC5Block, 4, 4> {
const BC4EncoderPtr _chan0_encoder;
const BC4EncoderPtr _chan1_encoder;
};
} // namespace rgbcx
} // namespace quicktex

@ -19,20 +19,20 @@
#include <pybind11/pybind11.h>
#include <array>
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <string>
#include <array>
#include "../BC1/BC1Decoder.h"
#include "../BC3/BC3Decoder.h"
#include "../BC4/BC4Decoder.h"
#include "../BC5/BC5Decoder.h"
#include "../BlockDecoder.h"
#include "../bc1/BC1Decoder.h"
#include "../bc3/BC3Decoder.h"
#include "../bc4/BC4Decoder.h"
#include "../bc5/BC5Decoder.h"
namespace py = pybind11;
namespace rgbcx::bindings {
namespace quicktex::bindings {
py::bytes DecodeImage(const BlockDecoder &self, py::bytes encoded, unsigned image_width, unsigned image_height) {
if (image_width % self.BlockWidth() != 0) throw std::invalid_argument("Width is not an even multiple of block_width");
@ -92,4 +92,4 @@ void InitDecoders(py::module_ &m) {
bc5_decoder.def_property_readonly("bc4_decoders", &BC5Decoder::GetBC4Decoders);
}
} // namespace rgbcx::bindings
} // namespace quicktex::bindings

@ -24,18 +24,19 @@
#include <stdexcept>
#include <string>
#include "../BC1/BC1Encoder.h"
#include "../BC3/BC3Encoder.h"
#include "../BC5/BC5Encoder.h"
#include "../../Color.h"
#include "../../Interpolator.h"
#include "../BlockEncoder.h"
#include "../Color.h"
#include "../Interpolator.h"
#include "../bc1/BC1Encoder.h"
#include "../bc3/BC3Encoder.h"
#include "../bc4/BC4Encoder.h"
#include "../bc5/BC5Encoder.h"
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
namespace py = pybind11;
namespace rgbcx::bindings {
namespace quicktex::bindings {
py::bytes EncodeImage(const BlockEncoder &self, py::bytes decoded, unsigned image_width, unsigned image_height) {
if (image_width % self.BlockWidth() != 0) throw std::invalid_argument("Width is not an even multiple of block_width");
@ -132,4 +133,4 @@ void InitEncoders(py::module_ &m) {
bc5_encoder.def_property("channels", &BC5Encoder::GetChannels, &BC5Encoder::SetChannels);
bc5_encoder.def_property_readonly("bc4_decoders", &BC5Encoder::GetBC4Encoders);
}
} // namespace rgbcx::bindings
} // namespace quicktex::bindings

@ -24,10 +24,10 @@
#include <cstdint>
#include <cstdlib>
#include "../Color.h"
#include "../util.h"
#include "../../Color.h"
#include "../../util.h"
namespace rgbcx {
namespace quicktex {
#pragma pack(push, 1)
class BC1Block {
@ -82,4 +82,4 @@ class BC1Block {
std::array<uint8_t, 4> selectors;
};
#pragma pack(pop)
} // namespace rgbcx
} // namespace quicktex

@ -19,10 +19,10 @@
#pragma once
#include "../BC1/BC1Block.h"
#include "../BC4/BC4Block.h"
#include "BC1Block.h"
#include "BC4Block.h"
namespace rgbcx {
namespace quicktex {
#pragma pack(push, 1)
class BC3Block {
@ -31,4 +31,4 @@ class BC3Block {
BC1Block color_block;
};
#pragma pack(pop)
} // namespace rgbcx
} // namespace quicktex

@ -24,11 +24,11 @@
#include <cstdint>
#include <cstdlib>
#include "../BC1/BC1Block.h"
#include "../Color.h"
#include "../util.h"
#include "../../Color.h"
#include "../../util.h"
#include "BC1Block.h"
namespace rgbcx {
namespace quicktex {
#pragma pack(push, 1)
class BC4Block {
@ -119,4 +119,4 @@ class BC4Block {
std::array<uint8_t, SelectorSize> selectors;
};
#pragma pack(pop)
} // namespace rgbcx
} // namespace quicktex

@ -19,9 +19,9 @@
#pragma once
#include "../BC4/BC4Block.h"
#include "BC4Block.h"
namespace rgbcx {
namespace quicktex {
#pragma pack(push, 1)
class BC5Block {
@ -30,4 +30,4 @@ class BC5Block {
BC4Block chan1_block;
};
#pragma pack(pop)
} // namespace rgbcx
} // namespace quicktex

@ -102,20 +102,21 @@ class CMakeBuild(build_ext):
# The information here can also be placed in setup.cfg - better separation of
# logic and declaration, and simpler if you include description/version in a file.
setup(
name="rgbcx",
name="quicktex",
version="0.0.1",
author="Andrew Cassidy",
author_email="drewcassidy@me.com",
description="",
description="A fast block compression library for python",
long_description="",
ext_modules=[CMakeExtension("_rgbcx")],
python_requires=">=3.6",
ext_modules=[CMakeExtension("_quicktex")],
cmdclass={"build_ext": CMakeBuild},
packages=find_packages('src'),
package_dir={'': 'src'},
packages=find_packages('.'),
package_dir={'': '.'},
install_requires=["Pillow"],
extras_require={
"tests": ["nose", "parameterized"],
"docs": ["sphinx"],
"docs": ["sphinx", "myst-parser", "sphinx-rtd-theme"],
},
zip_safe=False,
)

@ -1 +0,0 @@
from _rgbcx import *

@ -1,25 +0,0 @@
/* Python-rgbcx Texture Compression Library
Copyright (C) 2021 Andrew Cassidy <drewcassidy@me.com>
Partially derived from rgbcx.h written by Richard Geldreich <richgel99@gmail.com>
and licenced under the public domain
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "BC1/BC1Decoder.h"
#include "BC3/BC3Decoder.h"
#include "BC4/BC4Decoder.h"
#include "BC5/BC5Decoder.h"
Loading…
Cancel
Save