Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Remove code disabled as of 3.0 #4487

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/include/OpenImageIO/fmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,6 @@ OIIO_NAMESPACE_BEGIN
#endif


#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(2,0,0) \
&& OIIO_VERSION_LESS(2,7,0) && !defined(OIIO_INTERNAL)
// Helper template to let us tell if two types are the same.
// C++11 defines this, keep in OIIO namespace for back compat.
// DEPRECATED(2.0) -- clients should switch OIIO::is_same -> std::is_same.
using std::is_same;

// For back compatibility: expose these in the OIIO namespace.
// DEPRECATED(2.0) -- clients should switch OIIO:: -> std:: for these.
using std::isfinite;
using std::isinf;
using std::isnan;
#endif


// Define math constants just in case they aren't included (Windows is a
// little finicky about this, only defining these if _USE_MATH_DEFINES is
// defined before <cmath> is included, which is hard to control).
Expand Down Expand Up @@ -198,16 +183,6 @@ floor2(int x) noexcept
}


#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(2,1,0) \
&& OIIO_VERSION_LESS(2,7,0) && !defined(OIIO_INTERNAL)
// Old names -- DEPRECATED(2.1)
OIIO_DEPRECATED("use ceil2")
inline OIIO_HOSTDEVICE int pow2roundup(int x) { return ceil2(x); }
OIIO_DEPRECATED("use floor2")
inline OIIO_HOSTDEVICE int pow2rounddown(int x) { return floor2(x); }
#endif



/// Round value up to the next whole multiple. For example,
/// `round_to_multiple(10,10) == 10`, `round_to_multiple(17,10) == 20`, and
Expand Down
6 changes: 0 additions & 6 deletions src/include/OpenImageIO/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
#include <OpenImageIO/oiioversion.h>
#include <OpenImageIO/string_view.h>

// We should never have included fmath.h here. But we did, oops. Once we're
// allowed to break back compatibility, remove it.
#if OIIO_VERSION < OIIO_MAKE_VERSION(3,0,0)
# include <OpenImageIO/fmath.h>
#endif

#include <OpenImageIO/span.h>


Expand Down
17 changes: 0 additions & 17 deletions src/include/OpenImageIO/imageio.h
Original file line number Diff line number Diff line change
Expand Up @@ -951,23 +951,6 @@ class OIIO_API ImageInput {

/// @}

#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(2,2,0) && OIIO_VERSION_LESS(2,7,0) \
&& !defined(OIIO_DOXYGEN) && !defined(OIIO_INTERNAL)
OIIO_DEPRECATED("Use the modern form of create instead (2.2)")
static unique_ptr create (const std::string& filename, bool do_open,
const ImageSpec *config,
string_view plugin_searchpath) {
return create(filename, do_open, config, nullptr, plugin_searchpath);
}
OIIO_DEPRECATED("Use the modern form of create instead (2.1)")
static unique_ptr create (const std::string& filename,
const std::string& plugin_searchpath) {
return create(filename, false, nullptr, nullptr, plugin_searchpath);
}
OIIO_DEPRECATED("destroy is no longer needed (2.1)")
static void destroy (ImageInput *x) { delete x; }
#endif

protected:
ImageInput ();
public:
Expand Down
16 changes: 1 addition & 15 deletions src/include/OpenImageIO/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class basic_string_view {

/// Construct from char*, use strlen to determine length.
constexpr basic_string_view(const CharT* chars) noexcept
: m_chars(chars), m_len(chars ? cestrlen(chars) : 0) { }
: m_chars(chars), m_len(chars ? Traits::length(chars) : 0) { }

/// Construct from std::string. Remember that a string_view doesn't have
/// its own copy of the characters, so don't use the `string_view` after
Expand Down Expand Up @@ -479,20 +479,6 @@ class basic_string_view {
return last;
}

// Guaranteed constexpr length of a C string
static constexpr size_t cestrlen(const charT* chars) {
#if OIIO_CPLUSPLUS_VERSION >= 17
return Traits::length(chars);
#else
if (chars == nullptr)
return 0;
size_t len = 0;
while (chars[len] != 0)
len++;
return len;
#endif
}

class traits_eq {
public:
constexpr traits_eq (CharT ch) noexcept : ch(ch) {}
Expand Down
11 changes: 0 additions & 11 deletions src/include/OpenImageIO/strutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,17 +867,6 @@ struct OIIO_UTIL_API StringILess {
/// to a UTF-16 encoded wide char string, wstring.
std::wstring OIIO_UTIL_API utf8_to_utf16wstring (string_view utf8str) noexcept;

#if OPENIMAGEIO_VERSION < 30000
/// Old name for utf8_to_utf16wstring. Will be deprecated for OIIO 2.5+ and
/// removed for OIIO 3.0. Use utf8_to_utf16wstring which is more clear that
/// this particular conversion from utf8 to utf16 returns a std::wstring and
/// not a std::u16string.
#if OPENIMAGEIO_VERSION >= 20500
OIIO_DEPRECATED("Use utf8_to_utf16wstring instead")
#endif
std::wstring OIIO_UTIL_API utf8_to_utf16 (string_view utf8str) noexcept;
#endif

/// Conversion from wstring UTF-16 to a UTF-8 std::string. This is the
/// standard way to convert from Windows wide character strings used for
/// filenames into the UTF-8 strings OIIO expects for filenames when passed to
Expand Down
45 changes: 0 additions & 45 deletions src/include/OpenImageIO/typedesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,37 +338,6 @@ struct OIIO_UTIL_API TypeDesc {
static BASETYPE basetype_merge(TypeDesc a, TypeDesc b, TypeDesc c) {
return basetype_merge(basetype_merge(a, b), c);
}

#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(1,8,0) && OIIO_VERSION_LESS(2,7,0) && !defined(OIIO_DOXYGEN)
// DEPRECATED(1.8): These static const member functions were mildly
// problematic because they required external linkage (and possibly
// even static initialization order fiasco) and were a memory reference
// that incurred some performance penalty and inability to optimize.
// Please instead use the out-of-class constexpr versions below. We
// will eventually remove these.
#ifdef __INTEL_COMPILER
# define OIIO_DEPRECATED_TYPEDESC_STATICS
#else
# define OIIO_DEPRECATED_TYPEDESC_STATICS \
OIIO_DEPRECATED("Use the version that takes a tostring_formatting struct (1.8)")
#endif
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeFloat;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeColor;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeString;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeInt;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeHalf;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypePoint;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeVector;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeNormal;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeMatrix;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeMatrix33;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeMatrix44;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeTimeCode;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeKeyCode;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeFloat4;
OIIO_DEPRECATED_TYPEDESC_STATICS static const TypeDesc TypeRational;
#endif
#undef OIIO_DEPRECATED_TYPEDESC_STATICS
};

// Validate that TypeDesc can be used directly as POD in a C interface.
Expand Down Expand Up @@ -421,20 +390,6 @@ OIIO_INLINE_CONSTEXPR TypeDesc TypeUstringhash(TypeDesc::USTRINGHASH);



#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(2,1,0) && OIIO_VERSION_LESS(2,7,0)
// DEPRECATED(2.1)
OIIO_DEPRECATED("Use the version that takes a tostring_formatting struct")
OIIO_UTIL_API
std::string tostring (TypeDesc type, const void *data,
const char *float_fmt, // E.g. "%g"
const char *string_fmt = "%s", // E.g. "\"%s\""
const char aggregate_delim[2] = "()", // Both sides of vector
const char *aggregate_sep = ",", // E.g. ", "
const char array_delim[2] = "{}", // Both sides of array
const char *array_sep = ","); // E.g. "; "
#endif


/// A template mechanism for getting the a base type from C type
///
template<typename T> struct BaseTypeFromC {};
Expand Down
1 change: 1 addition & 0 deletions src/libOpenImageIO/imagebufalgo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <OpenImageIO/argparse.h>
#include <OpenImageIO/benchmark.h>
#include <OpenImageIO/color.h>
#include <OpenImageIO/half.h>
#include <OpenImageIO/imagebuf.h>
#include <OpenImageIO/imagebufalgo.h>
#include <OpenImageIO/imagebufalgo_util.h>
Expand Down
29 changes: 0 additions & 29 deletions src/libOpenImageIO/imageio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,38 +1023,9 @@ add_dither(int nchannels, int width, int height, int depth, float* data,
unsigned int ditherseed, int chorigin, int xorigin, int yorigin,
int zorigin)
{
#if OIIO_VERSION < OIIO_MAKE_VERSION(2, 4, 0)
// Old: uniform random noise
ImageSpec::auto_stride(xstride, ystride, zstride, sizeof(float), nchannels,
width, height);
char* plane = (char*)data;
for (int z = 0; z < depth; ++z, plane += zstride) {
char* scanline = plane;
for (int y = 0; y < height; ++y, scanline += ystride) {
char* pixel = scanline;
uint32_t ba = (z + zorigin) * 1311 + yorigin + y;
uint32_t bb = ditherseed + (chorigin << 24);
uint32_t bc = xorigin;
for (int x = 0; x < width; ++x, pixel += xstride) {
float* val = (float*)pixel;
for (int c = 0; c < nchannels; ++c, ++val, ++bc) {
bjhash::bjmix(ba, bb, bc);
int channel = c + chorigin;
if (channel == alpha_channel || channel == z_channel)
continue;
float dither
= bc / float(std::numeric_limits<uint32_t>::max());
*val += ditheramplitude * (dither - 0.5f);
}
}
}
}
#else
// New: Use blue noise for our dither
add_bluenoise(nchannels, width, height, depth, data, xstride, ystride,
zstride, ditheramplitude, alpha_channel, z_channel,
ditherseed, chorigin, xorigin, yorigin, zorigin);
#endif
}


Expand Down
11 changes: 0 additions & 11 deletions src/libutil/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,17 +626,6 @@ Filesystem::read_text_file(string_view filename, std::string& str, size_t size)
return true;
}

#if OIIO_VERSION_LESS(2, 6, 0)
// Backwards link compatibility with the old 2-argument version
namespace Filesystem {
bool
read_text_file(string_view filename, std::string& str)
{
return read_text_file(filename, str, 0);
}
} // namespace Filesystem
#endif



/// Read the entire contents of the named file and place it in str,
Expand Down
52 changes: 0 additions & 52 deletions src/libutil/typedesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,26 +669,6 @@ tostring(TypeDesc type, const void* data, const tostring_formatting& fmt)



#if OIIO_VERSION_LESS(2, 7, 0)
// Old deprecated one
std::string
tostring(TypeDesc type, const void* data, const char* float_fmt,
const char* string_fmt, const char aggregate_delim[2],
const char* aggregate_sep, const char array_delim[2],
const char* array_sep)
{
tostring_formatting fmt("%d", float_fmt, string_fmt, "%p",
std::string(aggregate_delim + 0, 1).c_str(),
std::string(aggregate_delim + 1, 1).c_str(),
aggregate_sep,
std::string(array_delim + 0, 1).c_str(),
std::string(array_delim + 1, 1).c_str(), array_sep);
return tostring(type, data, fmt);
}
#endif



namespace {

template<typename T = int>
Expand Down Expand Up @@ -929,36 +909,4 @@ TypeDesc::basetype_merge(TypeDesc at, TypeDesc bt)
return FLOAT;
}



#if OIIO_VERSION_LESS(2, 7, 0)
// Static members of pre-constructed types
// DEPRECATED(1.8)
OIIO_PRAGMA_WARNING_PUSH
OIIO_GCC_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
const TypeDesc TypeDesc::TypeFloat(TypeDesc::FLOAT);
const TypeDesc TypeDesc::TypeColor(TypeDesc::FLOAT, TypeDesc::VEC3,
TypeDesc::COLOR);
const TypeDesc TypeDesc::TypePoint(TypeDesc::FLOAT, TypeDesc::VEC3,
TypeDesc::POINT);
const TypeDesc TypeDesc::TypeVector(TypeDesc::FLOAT, TypeDesc::VEC3,
TypeDesc::VECTOR);
const TypeDesc TypeDesc::TypeNormal(TypeDesc::FLOAT, TypeDesc::VEC3,
TypeDesc::NORMAL);
const TypeDesc TypeDesc::TypeMatrix33(TypeDesc::FLOAT, TypeDesc::MATRIX33);
const TypeDesc TypeDesc::TypeMatrix44(TypeDesc::FLOAT, TypeDesc::MATRIX44);
const TypeDesc TypeDesc::TypeMatrix = TypeDesc::TypeMatrix44;
const TypeDesc TypeDesc::TypeString(TypeDesc::STRING);
const TypeDesc TypeDesc::TypeInt(TypeDesc::INT);
const TypeDesc TypeDesc::TypeHalf(TypeDesc::HALF);
const TypeDesc TypeDesc::TypeTimeCode(TypeDesc::UINT, TypeDesc::SCALAR,
TypeDesc::TIMECODE, 2);
const TypeDesc TypeDesc::TypeKeyCode(TypeDesc::INT, TypeDesc::SCALAR,
TypeDesc::KEYCODE, 7);
const TypeDesc TypeDesc::TypeFloat4(TypeDesc::FLOAT, TypeDesc::VEC4);
const TypeDesc TypeDesc::TypeRational(TypeDesc::INT, TypeDesc::VEC2,
TypeDesc::RATIONAL);
OIIO_PRAGMA_WARNING_PUSH
#endif

OIIO_NAMESPACE_END
12 changes: 0 additions & 12 deletions src/python/py_paramvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,10 @@ declare_paramvalue(py::module& m)
[](const ParamValue& self) {
return PY_STR(self.name().string());
})
#if OIIO_VERSION_LESS(3, 0, 0)
.def_property_readonly("type",
[](const ParamValue& self) {
return PY_STR(self.type().c_str());
})
// FIXME: This implementation of `type` is almost certainly a
// mistake. This should return p.type(), just a TypeDesc, not a
// string. I think this was an error introduced in the Python
// binding overhaul of OIIO 2.0. We can't break back compatibility
// by changing it until 3.0. It should really look like this:
#else
.def_property_readonly("type",
[](const ParamValue& self) {
return self.type();
})
#endif
.def_property_readonly("value",
[](const ParamValue& self) {
return make_pyobject(self.data(),
Expand Down
2 changes: 0 additions & 2 deletions src/testtex/testtex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ plain_tex_region_batch(ImageBuf& image, ustring filename, Mapping2DWide mapping,
}
if (stochastic) {
// Hash the pixel coords to get a pseudo-random variant
#if OIIO_VERSION_GREATER_EQUAL(2, 4, 0)
constexpr float inv
= 1.0f / float(std::numeric_limits<uint32_t>::max());
for (int i = 0; i < BatchWidth; ++i) {
Expand All @@ -840,7 +839,6 @@ plain_tex_region_batch(ImageBuf& image, ustring filename, Mapping2DWide mapping,
else
opt.rnd[i] = bjhash::bjfinal(x + i, y) * inv;
}
#endif
}

int npoints = std::min(BatchWidth, roi.xend - x);
Expand Down
Loading