IWYU pass

This commit is contained in:
Andrew Cassidy 2021-03-11 02:18:40 -08:00
parent b77a5acfb6
commit ab0d4b30af
14 changed files with 38 additions and 18 deletions

View File

@ -20,6 +20,7 @@
#pragma once
#include <memory>
#include <type_traits>
#include "../BlockDecoder.h"
#include "../BlockView.h"
@ -32,7 +33,7 @@ class BC1Decoder final : public BlockDecoderTemplate<BC1Block, 4, 4> {
public:
using InterpolatorPtr = std::shared_ptr<Interpolator>;
BC1Decoder(Interpolator::Type type = Interpolator::Type::Ideal, bool write_alpha = false)
: _interpolator(Interpolator::MakeInterpolator(type)), write_alpha(write_alpha) {}
: write_alpha(write_alpha), _interpolator(Interpolator::MakeInterpolator(type)) {}
void DecodeBlock(Color4x4 dest, BC1Block *const block) const noexcept(ndebug) override;
@ -40,6 +41,7 @@ class BC1Decoder final : public BlockDecoderTemplate<BC1Block, 4, 4> {
constexpr bool WritesAlpha() const { return write_alpha; }
bool write_alpha;
private:
const InterpolatorPtr _interpolator;
};

View File

@ -29,6 +29,7 @@
#include "../BlockView.h"
#include "../Color.h"
#include "../Interpolator.h"
#include "../Matrix4x4.h"
#include "../Vector4.h"
#include "../Vector4Int.h"
@ -45,7 +46,6 @@ using namespace BC1;
BC1Encoder::BC1Encoder(Interpolator::Type type, unsigned int level, bool allow_3color, bool allow_3color_black)
: _interpolator(Interpolator::MakeInterpolator(type)) {
OrderTable<3>::Generate();
OrderTable<4>::Generate();

View File

@ -21,17 +21,19 @@
#include <array>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <type_traits>
#include "../BlockEncoder.h"
#include "../BlockView.h"
#include "../Color.h"
#include "../Interpolator.h"
#include "BC1Block.h"
#include "SingleColorTable.h"
namespace rgbcx {
class Interpolator;
class Vector4;
class BC1Encoder final : public BlockEncoderTemplate<BC1Block, 4, 4> {

View File

@ -24,7 +24,9 @@
#include <atomic>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <mutex>
#include "../Vector4.h"
#include "Histogram.h"

View File

@ -19,8 +19,8 @@
#include "BC3Decoder.h"
#include "../BC1/BC1Decoder.h"
#include "../BC4/BC4Decoder.h"
#include <type_traits>
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC3Block.h"

View File

@ -19,12 +19,14 @@
#include "BC4Encoder.h"
#include <algorithm> // for minmax_element
#include <array> // for array
#include <cstdint> // for uint8_t
#include <utility> // for pair
#include <algorithm>
#include <array>
#include <cstdint>
#include <utility>
#include "BC4Block.h" // for BC4Block
#include "../BlockView.h"
#include "../ndebug.h"
#include "BC4Block.h"
namespace rgbcx {
void BC4Encoder::EncodeBlock(Byte4x4 pixels, BC4Block *const dest) const noexcept(ndebug) {

View File

@ -19,11 +19,10 @@
#pragma once
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <tuple>
#include <type_traits>
#include "../BC4/BC4Decoder.h"
#include "../BlockDecoder.h"

View File

@ -23,6 +23,7 @@
#include <cstdint>
#include <span>
#include <vector>
#include <memory>
#include "BlockView.h"
#include "ndebug.h"
@ -75,7 +76,7 @@ class BlockDecoderTemplate : public BlockDecoder {
assert(pixel_x + N <= image_width);
unsigned top_left = pixel_x + (pixel_y * image_width);
auto dest = DecodedBlock(&decoded[top_left], image_width);
auto dest = DecodedBlock(&decoded[top_left], (int)image_width);
DecodeBlock(dest, &blocks[x + block_width * y]);
}

View File

@ -55,7 +55,6 @@ template <class B, size_t M, size_t N> class BlockEncoderTemplate : public Block
unsigned block_width = image_width / N;
unsigned block_height = image_height / M;
unsigned block_count = block_width * block_height;
auto blocks = reinterpret_cast<B *>(encoded);
@ -64,7 +63,7 @@ template <class B, size_t M, size_t N> class BlockEncoderTemplate : public Block
// As a result, this is sometimes left as a serial operation despite being embarassingly parallelizable
// threshold for number of blocks before multithreading is set by overriding MTThreshold()
#pragma omp parallel for if (block_count >= MTThreshold())
#pragma omp parallel for if (block_width * block_height >= MTThreshold())
for (unsigned y = 0; y < block_height; y++) {
for (unsigned x = 0; x < block_width; x++) {
unsigned pixel_x = x * N;

View File

@ -30,7 +30,7 @@ Color::Color() { SetRGBA(0, 0, 0, 0xFF); }
Color::Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { SetRGBA(r, g, b, a); }
Color::Color(Vector4Int v) { SetRGBA(v[0], v[1], v[2], v[3]); }
Color::Color(Vector4Int v) { SetRGBA((uint8_t)v[0], (uint8_t)v[1], (uint8_t)v[2], (uint8_t)v[3]); }
uint16_t Color::Pack565Unscaled(uint8_t r, uint8_t g, uint8_t b) {
assert5bit(r);

View File

@ -20,6 +20,8 @@
#pragma once
#include <array>
#include <cassert>
#include <cstddef>
#include <functional>
#include "Vector4.h"

View File

@ -19,14 +19,17 @@
#include <pybind11/pybind11.h>
#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 "../bitwiseEnums.h"
namespace py = pybind11;
namespace rgbcx::bindings {

View File

@ -19,11 +19,15 @@
#include <pybind11/pybind11.h>
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <string>
#include "../BC1/BC1Encoder.h"
#include "../BlockEncoder.h"
#include "../bitwiseEnums.h"
#include "../Color.h"
#include "../Interpolator.h"
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)

View File

@ -20,6 +20,10 @@
// This file allows for easy debugging in CLion or other IDEs that dont natively support cross-debugging between Python and C++
#include <pybind11/embed.h>
#include <array>
#include <string>
namespace py = pybind11;
#define STRINGIFY(x) #x