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

UCG1 Specification #34

Merged
merged 15 commits into from
Feb 1, 2016
Merged

UCG1 Specification #34

merged 15 commits into from
Feb 1, 2016

Conversation

ardera
Copy link
Contributor

@ardera ardera commented Jan 20, 2016

UCG (Universal Compressed Graphics) is an image file format with the goal to achieve greater compression than paintutils files. Images stored in UCG can be up to 65535 pixels wide and 65535 pixels high, and can have up to 17colors per pixel (the 16 base colors and 1 transparent "color"). Images stored using the UCG file format are normally 10-40% of the size of the same image stored in paintutils format. To achieve this, the format uses a combination of Huffman Codes & Run-length Encoding.
UCG is implemented in: https://github.com/ardera/libucg (for simple encoding & decoding)
and: https://github.com/ardera/xaif (functionality of libucg + image manipulation and more userfriendly interface)

@ardera ardera changed the title Added UCG Image Format version 3 Specification UCG Image Format version 3 Specification Jan 20, 2016
@viluon
Copy link
Collaborator

viluon commented Jan 20, 2016

@ardera you might want to name this UCG3. However, why is this version 3? First off, that is not semantic versioning, secondly, this is the very first version of the standard.

| ---------- | ----------------- |
| Type | Image file format |
| MIME | ``image/ucg`` |
| Extensions | ``.ucg`` |
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should include a version key-value pair as well, as stated by https://github.com/oeed/CraftOS-Standards/blob/master/Standard%20Proposal%20Guidelines.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Does Version kv-pair mean the Specification or the standard?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd guess that is correct in your case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Semantic versioning is not suitable for file formats. First, file formats are tested very thoroughly, so small patches are unwanted and don't really appear. Updates in general are unwanted for file formats. PNG has not been updated since 1999, although there are many better compression algorithms out there now than the one PNG uses; and the probable reason is backwards compatibility.

Also, when you use a two value version tag like MAJOR.MINOR, and you want to compare if yours is greater than another version, you would just do

if 256*major1 + minor1 > 256*major2 + minor2 then
  -- ...
end

To get the value of a word, you do 256*firstbyte + secondbyte. Notice the similarity? In practice, you would just read the version of a file as a word instead of a byte. I decided, I don't need this one byte more just to know if the decoder is able to read the file or not.

This is not the very first version of this file format. There were versions before that oeed and me used, and there were versions of libucg before that used these UCG versions. If I release libucg on the forums, I also release the older versions. Of course, noone's gonna use these, but I decided I don't fall back to version 1, because it'd miss the point of versioning.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Semantic versioning is the way to go. Nobody said you have to use it in your file format header.

(bump @demhydraz )

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wanted to see your approval of my statement @demhydraz.

Added a version key-value pair in the "Quick Overview" section. "version" means the version of this Specification, since new format version are going to be published under UCG4, UCG5, etc.
@oeed
Copy link
Owner

oeed commented Jan 21, 2016

To be honest, I actually kinda agree with @viluon. I'd use public version numbers. Using 3 might just confuse people. I'm certainly not using any old versions, there's no code that supports it in Silica either.

@ardera
Copy link
Contributor Author

ardera commented Jan 21, 2016

Okay @oeed, but you would have to delete all UCG files then;
Working on this now

@ardera ardera changed the title UCG Image Format version 3 Specification UCG1 Specification Jan 21, 2016
UCG3 is now called UCG1, and the version byte of files encoded with this specification now equals 1 instead of 3.
@oeed
Copy link
Owner

oeed commented Jan 21, 2016

I'll just chuck them in a hex editor and change the 03 to 01 (that'll work, right?)

@oeed
Copy link
Owner

oeed commented Jan 22, 2016

I think this is ready for a forums proposal release. As this is a brand new, non-meta standard it needs to receive feedback and approval from the CC community.

Essentially, make a topic in General with, at minimum, a direct link to this page and the most recent version of the proposal (i.e. this). You may also want to explain the format a bit. You don't need to got in to much detail if you don't want to (although it's obviously up to you), but giving a fairly brief outline as to the advantages of the format would be a good idea.

@oeed
Copy link
Owner

oeed commented Jan 22, 2016

@demhydraz it's always been a requirement. The reason we haven't been doing it is none of the proposals yet have actually been new proposals. Says so in the original forums post "When they do that they will also need to create a topic in General with a link to the pull request so people are aware of the proposal."

@ardera
Copy link
Contributor Author

ardera commented Jan 22, 2016

@oeed Why shall I link this pull request discussion in the forum post?

@ardera ardera closed this Jan 22, 2016
@ardera ardera reopened this Jan 22, 2016
@oeed
Copy link
Owner

oeed commented Jan 22, 2016

@ardera the forums post needs a link to the pull request so people can interact with the discussion here and see changes. I was going to enforce having people commenting here and not the forums, but that just won't happen.

@oeed
Copy link
Owner

oeed commented Jan 24, 2016

With @demhydraz's terminology #36 file, the 'byte' and 'word' definitions can be removed @ardera. I'd just link to the document and say they're big endian.

Otherwise I don't see any other issues that need to be fixed, We'll wait a few days and see if there are any other issues mentioned on the forums post and then till be merged.

@viluon
Copy link
Collaborator

viluon commented Jan 25, 2016

Not ready to merge. I noticed quite a few weird sentences, I'm gonna fix them up and make a PR on ardera's fork

@ardera
Copy link
Contributor Author

ardera commented Jan 25, 2016

@viluon Yeah, sorry; English is not my mother language
@oeed The byte section is necessary, it specifies how to read the bits of a byte. (Which bit is the first to process). (maybe it'd be good if @demhydraz also explained some bit-order and byte-order terms in the Terminology standard)

ardera and others added 4 commits January 25, 2016 15:34
* Many sections rewritten
* Numerous improvements to both grammar and visual style
* Fixed malformed table
* Hexadecimal values and most reserved data types are now formatted in code blocks
* Lua is Lua, not "lua"
* Provided links to Wikipedia articles on related topics in the introduction
* Fixed version (UCG, not UCGv3)
* Other changes I don't even remember, see the diff for details
@viluon
Copy link
Collaborator

viluon commented Jan 25, 2016

You should have waited for me @ardera, see #1. The changes I made are far more extensive.

@oeed
Copy link
Owner

oeed commented Jan 25, 2016

You still have the thing explaining big endian, it's not needed.

removed Endianess explanation
added bit-endianess
@oeed
Copy link
Owner

oeed commented Feb 1, 2016

You seem to have general approval and there haven't been any objections. So, well done @ardera, congratulations on being the first official 'new' proposal!

oeed added a commit that referenced this pull request Feb 1, 2016
@oeed oeed merged commit 41e9850 into oeed:master Feb 1, 2016
@viluon
Copy link
Collaborator

viluon commented Feb 1, 2016

🎉 indeed @demhydraz! Congrats @ardera 👏 I think we are all looking to further collaboration with you!

@ardera
Copy link
Contributor Author

ardera commented Feb 2, 2016

Thank you! @viluon

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

Successfully merging this pull request may close these issues.

None yet

3 participants