Skip to content

Commit 295effe

Browse files
committed
Merge remote-tracking branch 'upstream/main' into _imgui
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
2 parents 9a7e4a0 + 296d490 commit 295effe

19 files changed

Lines changed: 194 additions & 28 deletions

File tree

CONTRIBUTING.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
2+
<!-- Copyright Contributors to the OpenImageIO Project. -->
3+
4+
15
Contributing to OpenImageIO
26
===========================
37

@@ -70,6 +74,26 @@ If confidentiality precludes a public question or issue for any reason, you
7074
may contact us privately at [security@openimageio.org](security@openimageio.org).
7175

7276

77+
Policy on AI Tools
78+
------------------
79+
80+
Please read our [Policy on AI Coding Assistants](docs/dev/AI_Policy.md)
81+
before contributing or particpating in the project in any way mediated by "AI"
82+
assistants.
83+
84+
High-level summary:
85+
- Human must always be in the loop, and is the responsible party for
86+
the contents of a PR (including fully understanding and being able
87+
to explain, defend, and modify it in response to review comments).
88+
- Interact with the project and community yourself, not by agent.
89+
- Disclose what tools you used and how. At a minimum, we require an
90+
"Assisted-by: TOOL/MODEL" line in the commit comments and PR description.
91+
- Don't waste maintainer's time with low quality PRs.
92+
93+
Please do read the whole [Policy on AI Coding Assistants](docs/dev/AI_Policy.md)
94+
for all the details.
95+
96+
7397
Contributor License Agreement (CLA) and Intellectual Property
7498
-------------------------------------------------------------
7599

@@ -230,33 +254,33 @@ repository. The protocol is like this:
230254
your own repository on GitHub, and then clone it to get a repository on your
231255
local machine.
232256

233-
1. Edit, compile, and test your changes. Run clang-format (see the
257+
2. Edit, compile, and test your changes. Run clang-format (see the
234258
instructions on coding style below).
235259

236-
1. Push your changes to your fork (each unrelated pull request to a separate
260+
3. Push your changes to your fork (each unrelated pull request to a separate
237261
"topic branch", please).
238262

239-
1. Make a "pull request" on GitHub for your patch.
263+
4. Make a "pull request" on GitHub for your patch.
240264

241-
2. If your patch will induce a major compatibility break, or has a design
265+
5. If your patch will induce a major compatibility break, or has a design
242266
component that deserves extended discussion or debate among the wider OIIO
243267
community, then it may be prudent to email oiio-dev pointing everybody to
244268
the pull request URL and discussing any issues you think are important.
245269

246-
1. All pull requests automatically launch CI jobs on GitHub Actions to
270+
6. All pull requests automatically launch CI jobs on GitHub Actions to
247271
ensure that the build completes and that the tests suite runs correctly, for
248272
a variety of platform, compiler, library, and flag combinations. The status
249273
of the CI tests for your PR will be displayed on the GitHub PR page. We will
250274
not accept PRs that don't build cleanly or pass the existing testsuite.
251275

252-
1. The reviewer will look over the code and critique on the "comments" area.
276+
7. The reviewer will look over the code and critique on the "comments" area.
253277
Reviewers may ask for changes, explain problems they found, congratulate the
254278
author on a clever solution, etc. But until somebody says "LGTM" (looks good
255279
to me), the code should not be committed. Sometimes this takes a few rounds
256280
of give and take. Please don't take it hard if your first try is not
257281
accepted. It happens to all of us.
258282

259-
1. After approval, one of the senior developers (with commit approval to the
283+
8. After approval, one of the senior developers (with commit approval to the
260284
official main repository) will merge your fixes into the main branch.
261285

262286
Please see the [Code Review](docs/dev/CodeReview.md) document for more

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ by first name.
44
If you know of somebody that I missed or have corrections, please email:
55
lg@openimageio.org
66

7+
* Aamir Raza
78
* Aaron Colwell
89
* Adam Mains
910
* Akihiro Yamasaki

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ pull request (PR) mechanism.
144144
description of the major classes and their relationships.
145145
* [CONTRIBUTING](CONTRIBUTING.md) has detailed instructions about the
146146
development process.
147+
* [AI Policy](docs/dev/AI_Policy.md) decribes our policies on AI coding
148+
assistance tools.
147149
* [ROADMAP](docs/ROADMAP.md) is a high-level overview of the current
148150
development priorities for the next annual release, expected in September,
149151
2024.

src/build-scripts/ci-build.bash

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export OIIO_SRC_DIR=${OIIO_SRC_DIR:=$PWD}
1313
export OIIO_BUILD_DIR=${OIIO_BUILD_DIR:=${OIIO_SRC_DIR}/build}
1414
export OIIO_INSTALL_DIR=${OIIO_INSTALL_DIR:=${OIIO_SRC_DIR}/dist}
1515
export OIIO_CMAKE_BUILD_TYPE=${OIIO_CMAKE_BUILD_TYPE:=${CMAKE_BUILD_TYPE:=Release}}
16+
# Allow OIIO_specific overrides for CC, CXX
17+
if [[ "$OIIO_CC" != "" ]] ; then
18+
CC=$OIIO_CC
19+
fi
20+
if [[ "$OIIO_CXX" != "" ]] ; then
21+
CXX=$OIIO_CXX
22+
fi
1623

1724
if [[ "$USE_SIMD" != "" ]] ; then
1825
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"

src/build-scripts/gh-installdeps.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ else
117117
if [[ "${USE_PYTHON}" != "0" ]] ; then
118118
time sudo apt-get -q install -y python3-numpy
119119
fi
120+
: ${PIP_SUFFIX:=}
120121
if [[ "${PIP_INSTALLS}" != "" ]] ; then
121-
time pip3 install ${PIP_INSTALLS}
122+
time pip3${PIP_SUFFIX} install ${PIP_INSTALLS}
122123
fi
123124

124125
if [[ "$USE_LIBHEIF" != "0" ]] ; then

src/doc/oiiotool.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Control flow
269269
Scriptability is provided by the use of control flow statements.
270270
The usual programming constructs are supported:
271271

272-
* Conditionals : `--if` *condition* `--then` *commands...* `--else` *commands...* `--endif`
272+
* Conditionals : `--if` *condition* *commands...* `--else` *commands...* `--endif`
273273

274274
* General looping: `--while` *condition* *commands...* `--endwhile`
275275

src/libOpenImageIO/exif.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ tiff_data_size(const TIFFDirEntry& dir)
178178

179179

180180

181+
// N.B. We have to turn undefined behavior sanitizer off for this function
182+
// because ubsan will complain about tifftype being an invalid enum value in
183+
// cases where the value really is corrupted and invalid -- but the switch
184+
// statement here is nonetheless safe because it just returns TypeUnknown in
185+
// such cases.
186+
OIIO_NO_SANITIZE_UNDEFINED
181187
TypeDesc
182188
tiff_datatype_to_typedesc(TIFFDataType tifftype, size_t tiffcount)
183189
{
@@ -208,6 +214,7 @@ tiff_datatype_to_typedesc(TIFFDataType tifftype, size_t tiffcount)
208214
case TIFF_SLONG8: return TypeDesc(TypeDesc::INT64, tiffcount);
209215
case TIFF_IFD8: return TypeUnknown;
210216
#endif
217+
default: break;
211218
}
212219
return TypeUnknown;
213220
}

src/libOpenImageIO/imagebufalgo.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,10 +1614,20 @@ ImageBufAlgo::fillholes_pushpull(ImageBuf& dst, const ImageBuf& src, ROI roi,
16141614

16151615
// First, make a writable copy of the original image (converting
16161616
// to float as a convenience) as the top level of the pyramid.
1617+
// Shift everything to origin (0,0) with full=data so that resize
1618+
// correctly maps the entire data extent between pyramid levels,
1619+
// even when the data window is offset from the display window.
16171620
ImageSpec topspec = src.spec();
16181621
topspec.set_format(TypeDesc::FLOAT);
1619-
ImageBuf* top = new ImageBuf(topspec);
1620-
paste(*top, topspec.x, topspec.y, topspec.z, 0, src);
1622+
topspec.full_x = 0;
1623+
topspec.full_y = 0;
1624+
topspec.full_width = topspec.width;
1625+
topspec.full_height = topspec.height;
1626+
topspec.x = 0;
1627+
topspec.y = 0;
1628+
topspec.z = 0;
1629+
ImageBuf* top = new ImageBuf(topspec);
1630+
paste(*top, -src.spec().x, -src.spec().y, -src.spec().z, 0, src);
16211631
pyramid.emplace_back(top);
16221632

16231633
// Construct the rest of the pyramid by successive x/2 resizing and

src/libutil/strutil_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,14 @@ test_string_view()
13281328
Strutil::print("addr cstr={:p}, s={:p}, ustring={:p}, sr={:p}, c_str(sr)={:p}\n",
13291329
(void*)cstr, (void*)s.c_str(), (void*)ustring(cstr).c_str(), (void*)sr.data(),
13301330
(void*)OIIO::c_str(sr));
1331+
1332+
// Test some edge cases for fmt formatting
1333+
string_view empty(""), uninit;
1334+
Strutil::print("Test print empty string_view: '{}'\n", empty);
1335+
Strutil::print("Test print default initialized string_view: '{}'\n", uninit);
1336+
OIIO_CHECK_EQUAL(empty, uninit);
1337+
OIIO_CHECK_EQUAL(Strutil::format("{}", empty),
1338+
Strutil::format("{}", uninit));
13311339
}
13321340

13331341

src/libutil/ustring.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ ustring::make_unique(string_view strref)
522522
size_t bin = rm.lock_bin(hash);
523523

524524
hash_t orighash = hash;
525-
size_t binmask = orighash & (~rm.nobin_mask());
525+
size_t binbits = orighash & (~rm.nobin_mask());
526526
size_t num_rehashes = 0;
527527

528528
while (1) {
@@ -546,16 +546,31 @@ ustring::make_unique(string_view strref)
546546
break;
547547
}
548548
// Rehash, but keep the bin bits identical so we always rehash into
549-
// the same (locked) bin.
550-
hash = (hash & binmask)
551-
| (farmhash::Fingerprint(hash) & rm.nobin_mask());
549+
// the same (locked) bin. But watch out for rehashing that returns the
550+
// identical non-bin part as before -- that will enter an infinite
551+
// loop if we're not careful!
552+
hash_t old_nonbin_bits = hash & rm.nobin_mask();
553+
hash_t new_nonbin_bits = farmhash::Fingerprint(hash) & rm.nobin_mask();
554+
if (OIIO_UNLIKELY(old_nonbin_bits == new_nonbin_bits)) {
555+
new_nonbin_bits = (new_nonbin_bits + 7) & rm.nobin_mask();
556+
# ifndef NDEBUG
557+
std::string s = Strutil::escape_chars(strref);
558+
print(stderr, "IDEMPOTENT RE-HASH! |{}|\n", s);
559+
for (auto c : s)
560+
print(stderr, c > 0 ? "{:c}" : "\\{:03o}",
561+
static_cast<unsigned char>(c));
562+
print(stderr, "\n");
563+
# endif
564+
}
565+
hash = binbits | new_nonbin_bits;
552566
++num_rehashes;
553567
// Strutil::print("COLLISION \"{}\" {:08x} vs \"{}\"\n",
554568
// strref, orighash, rev->second);
555569
{
556570
std::lock_guard<std::mutex> lock(collision_mutex);
557571
all_hash_collisions.emplace_back(rev->second, rev->first);
558572
}
573+
OIIO_ASSERT(num_rehashes < 100000); // Something is very wrong
559574
}
560575
rm.unlock_bin(bin);
561576

0 commit comments

Comments
 (0)