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

Add dwa support to core #1402

Merged
merged 34 commits into from
May 16, 2023

Conversation

kdt3rd
Copy link
Contributor

@kdt3rd kdt3rd commented May 7, 2023

Seems to work, although am noticing a small number of ULPs difference in the dct coding between C/C++ for some numbers, can't tell if I should be worried, or if it's just different math ops ordering causing slightly different rounding

This includes a few other (internal) refactors and fixes noticed along the way

Copy link
Member

@cary-ilm cary-ilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted some place where you left "throw Iex" commented out from the original cpp, do you want to clean that up or is it helpful to leave in?

Also, I may have missed some discussion, but you seem to have merged in @meshula's commits from #1385, was that intentional? That PR hasn't been committed yet, should it be closed in favor of this?

Otherwise, I've looked this over and it looks good to me, thanks!


if (*size <= 3) return EXR_ERR_CORRUPT_CHUNK;

//throw IEX_NAMESPACE::InputExc ("Error uncompressing DWA data"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left them to note the error string, intending to produce a similar message via report error at some point...

if (out->_cscIdx < -1 || out->_cscIdx >= 3)
{
return EXR_ERR_CORRUPT_CHUNK;
//throw IEX_NAMESPACE::InputExc ("Error uncompressing DWA data"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead, and a few below as well

// the C++ classes used to have one buffer size for compress / uncompress
// but here we want to do zero-ish copy...
uint8_t* outBufferEnd = me->_decode->unpacked_buffer;
//if (outBufferSize > me->_decode->unpacked_alloc_size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead?

if (version > 2)
{
return EXR_ERR_BAD_CHUNK_LEADER;
//throw IEX_NAMESPACE::InputExc (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@meshula
Copy link
Contributor

meshula commented May 13, 2023

I didn't expect that my PR would chain on to Kimball's PR like that.

I'll try closing my PR in expectation of reopening versus the main repo.

@meshula
Copy link
Contributor

meshula commented May 13, 2023

Ok, closing my PR didn't do it, I guess those changes are actually committed into Kimball's tree. I have follow up work to those commits which I can open on the main repo. after this is landed. My preference would be to not land openexr-c.c and h though as they are not ready for review or distribution. I have follow up work to complete what's in that interface.

@cary-ilm
Copy link
Member

We'd like to include the dwa support in a 3.1.8 release, but the single-file openexr-c.c seems better suited to a 3.2/4.0 release, doesn't it? @kdt3rd , don't you think you should back those commits out of this PR?

@kdt3rd
Copy link
Contributor Author

kdt3rd commented May 13, 2023

@cary-ilm yes, I did not actually accept Nick's PR on my branch, it's interesting that it is chaining up to here... ah, the vagaries of github PRs...

@meshula
Copy link
Contributor

meshula commented May 14, 2023

Well it's even weirder because my PR was on the main repo, not yours! I have a different PR on your repo, but that has commits not appearing here. I've closed both of them in hopes of untangling things.

@kdt3rd
Copy link
Contributor Author

kdt3rd commented May 14, 2023

fyi, have confirmed Nick's commits are not in my local branch at all. I need to rebase onto a branch that removes the old mac os build that keeps timing out, so that should process should re-clean the history. I have one pending fix to push in the dwa support, and another difference in the decoder side to track down, then I think this will be ready to go

kdt3rd added 22 commits May 16, 2023 12:41
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
… headers

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
… C++

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Older versions of MSVC have issues with specifying C11 for use of
stdalign.h and alignas macro. Work around this by targeting the lower
level macros / declspec

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Core should now compile with
-Weverything
-Wno-reserved-identifier
-Wno-covered-switch-default
-Wno-cast-align
-Wno-overlength-strings

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
@meshula
Copy link
Contributor

meshula commented May 16, 2023

Looks like you hit all the structural points I bumped into when I put openexr-c.c together. I'll start work to bounce it off our internal build system on the assumption that this is ready to land.

Copy link
Contributor

@meshula meshula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good ~ I've already run your previous iteration through our internal build system, and got it working loading textures and sent 'em to gpu. I had a pile of "pedantic" and other clean ups, seems like you've hit the lot, with luck I can strip my clean ups in favor of using these commits "raw". I think it's ready to land, on the basis of the passing unit tests, and on the basis of my local exr reader working properly with your previous iteration.

@kdt3rd kdt3rd merged commit 7c40603 into AcademySoftwareFoundation:main May 16, 2023
@kdt3rd kdt3rd deleted the add_dwa_support_to_core branch May 16, 2023 07:39
kdt3rd added a commit to kdt3rd/openexr that referenced this pull request May 20, 2023
* Fix nodiscard warning on gcc 13
* Add buffer range checks to huf code
* Refactor cpuid code for use in dwa
* Fix issue with big endian deep encoding of chunk table
* refactor to expose byte reordering zip compression uses for dwa
* expose option flag to enable headers to be more easily like old style
headers
* fix potential issue with piz and not able to compress data small
enough
* Restore piz tests
* Initial implementation of DWAA/B compression for Core
* write with legacy header during tests to make comparing bytes in files
easier
* Initial support for validating exact match in file output between C /
C++
* Enable DWAA/DWAB tests
* Older versions of MSVC have issues with specifying C11 for use of
stdalign.h and alignas macro. Work around this by targeting the lower
level macros / declspec instead of using C11 stdalign.h
* Add unit test for x86 cpu id checks
* Add alignment helper utility
* Add missing include guards
* Fix pedantic warnings
* Fix compile warnings. Core should now compile with
-Weverything
-Wno-reserved-identifier
-Wno-covered-switch-default
-Wno-cast-align
-Wno-overlength-strings

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
kdt3rd added a commit that referenced this pull request May 20, 2023
* Add dwa support to core (#1402)

* Fix nodiscard warning on gcc 13
* Add buffer range checks to huf code
* Refactor cpuid code for use in dwa
* Fix issue with big endian deep encoding of chunk table
* refactor to expose byte reordering zip compression uses for dwa
* expose option flag to enable headers to be more easily like old style
headers
* fix potential issue with piz and not able to compress data small
enough
* Restore piz tests
* Initial implementation of DWAA/B compression for Core
* write with legacy header during tests to make comparing bytes in files
easier
* Initial support for validating exact match in file output between C /
C++
* Enable DWAA/DWAB tests
* Older versions of MSVC have issues with specifying C11 for use of
stdalign.h and alignas macro. Work around this by targeting the lower
level macros / declspec instead of using C11 stdalign.h
* Add unit test for x86 cpu id checks
* Add alignment helper utility
* Add missing include guards
* Fix pedantic warnings
* Fix compile warnings. Core should now compile with
-Weverything
-Wno-reserved-identifier
-Wno-covered-switch-default
-Wno-cast-align
-Wno-overlength-strings

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>

* Add #include <cmath> for isnan (#1414)

Signed-off-by: Cary Phillips <cary@ilm.com>

* Fix initialization after merge

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>

---------

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Co-authored-by: Cary Phillips <cary@ilm.com>
@cary-ilm cary-ilm added the v3.1.8 label Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants