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

[WIP] transformation-redux #51

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

[WIP] transformation-redux #51

wants to merge 7 commits into from

Conversation

ZoeyR
Copy link
Owner

@ZoeyR ZoeyR commented Aug 4, 2018

This is a heavy WIP PR to redo the underlying transformation system. Currently the branch has test failure for the flif_logo, some features were regressed and performance hasn't improved. I'll be evolving this PR in public to hopefully get some useful feedback.

@ZoeyR
Copy link
Owner Author

ZoeyR commented Aug 4, 2018

updated the code to get rid of dynamic dispatch and restore the original API, but now there are more failures and it actually performs worse :/. I suspect I messed up YCoCg somehow.

@ZoeyR
Copy link
Owner Author

ZoeyR commented Aug 4, 2018

I've spent some time optimizing this and I still can't get it faster than the dynamic dispatch implementation of transformations. @newpavlov you're better at optimization than me is there anything obvious I've missed?

@newpavlov
Copy link
Contributor

I have several minor ideas how code can be improved, but not sure why you get a slowdown. It will be hard to tell without playing with the code. My current suggestions are:

  • It will be nice to measure performance of the TransformationSet methods directly in the module level benchmark. (i.e. build it based on real images and then benchmark methods directly)
  • You probably don't need Transform trait any more.
  • Orig transform probably can be removed
  • Some trivial methods can be written directly into match arms
  • Not sure why you need last field in the TransformationSet, can't you just use split_last?
  • Play with inlining here and there?
  • We could remove transformations field from SecondHeader (thus making transformations info inaccessible to users), then it will be possible to make Transformation and TransofrmationSet generic over Pixel, which may simplify code a bit.

@ZoeyR
Copy link
Owner Author

ZoeyR commented Aug 5, 2018

I have the last field in the transformation set as a small optimization. We're guaranteed to have at least one transformation so it removes one bounds check.

@ZoeyR
Copy link
Owner Author

ZoeyR commented Aug 5, 2018

Making transformations general over pixel type has some issues. The first commit in this PR used that and ran into a problem: the last field of the second header is stored after the transformations, so we wouldn't be able to expose that to users.

@newpavlov
Copy link
Contributor

Yes, I've wrote about it in my comment. IIUC currently you expose only transformation names and their order, without any internal information. If you think that it's worth to expose this information (personally I don't care about it, and AFAIK libflif does not expose this information either), then it should be possible to create a dummy list.

@ZoeyR
Copy link
Owner Author

ZoeyR commented Aug 5, 2018

It's probably worth it to evaluate what information needs to be exposed to the user. The reason I exposed transformation data is that I sorely missed having it available when trying to implement this decoder. That's probably a very specific use-case though so I can see why it wouldn't be necessary. Perhaps it's better just to put it into a debug log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants