Git Product home page Git Product logo

Comments (4)

bitsgalore avatar bitsgalore commented on June 8, 2024 1

Hi @osamu620, thank you for the detailed explanation, this is really helpful!

So I think the main reason for my confusion here is that, based on your example, apparently ISO/IEC 15444-15:2019 assumes a bit numbering convention where (for a 2 byte variable) the most significant bit is assigned an index value of 15, and the least significant bit 0 (I was assuming the numbering was the other way around, i.e. like this).

Is this numbering scheme declared anywhere in the standard, because I can't remember having seen this before (and I've actually written a whole validator for JP2 based on the specs; I'm currently working on adding support for JPH and HTJ2K codestreams, which is how I came across this)?

This also makes me wonder about the internal consistency of the various parts of the JPEG 2000 standard. For example, Table A.36 of ISO/IEC 15444-1: 2015 refers to the 7 bits on the right side of a 1 byte parameter as the "last" bits. This is a bit confusing, as it seems to assume a numbering scheme where the bit indices increase from left to right (which is exactly the opposite of what ISO/IEC 15444-15:2019 is doing).

(BTW your explanation also made me realize that the ISO/IEC 15444-1:2015 version of the standard (which AFAIK the most recent one that isn't behind a paywall) is partially outdated, as it doesn't include the note at the bottom of Table A.10 that you're referring to.)

from openhtj2k.

osamu620 avatar osamu620 commented on June 8, 2024

Hi @bitsgalore, Thanks for raising this issue. Let me explain how Rsiz works with JPEG 2000 Part 15.

To use JPEG 2000 Part 15, a.k.a. HTJ2K, the CAP marker shall be signaled to tell decoders the capability HTJ2K features is required to decode this codestream.

The definition of Rsiz is in the spec of ISO/IEC 15444-1: 2019. Table A.10 in the spec, you can see the note at the bottom;

NOTE 1 – The two MSBs of Rsiz are used as follows:

  • 10 – Rec. ITU-T T.801 | ISO/IEC 15444-2 capabilities
  • 01 – Extended capabilities, as identified by a CAP marker segment, not including capabilities specified in Rec. ITU-T T.801 | ISO/IEC 15444-2
  • 11 – Rec. capabilities extended via a CAP marker segment

Actually, ISO/IEC 15444-1:2019 does not specify the permitted values of the Rsiz parameter when the two MSBs are set to 0b01. This is a defect of the spec. So JPEG committee will replace the second bullet of Table A.10, Note 1
with a statement that:

  • when the two MSBs are set to 0b01 and all other bits are zero, the capabilities are signaled in CAP alone and not otherwise constrained.
  • all other values are reserved.

Rsiz is 16-bit wide bit-field. According to the revised NOTE 1, the Rsiz value should be

MSB(15) 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
0b    0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0 = 0x40 00

The revised explanation in the spec will be available in the ISO/IEC 15444-1 5th edition which is now under development.

from openhtj2k.

aous72 avatar aous72 commented on June 8, 2024

Perhaps, I can chip in.
JPEG2000 employs big-endian everywhere -- not sure if other standards do that.
That is why the bytes have this order.

Cheers,
Aous.

Edit: You can join our discord server -- link valid for a week.
https://discord.gg/frneBkKf

from openhtj2k.

bitsgalore avatar bitsgalore commented on June 8, 2024

Hi @aous72 ,

Thanks. I'm aware of JPEG 2000 using Big-Endian, but Endianness only defines the order in which the bytes are interpreted (in this case: the 2 bytes that make up Csiz). It doesn't necessarily say anything about the numbering of individual bits within one or more bytes. There's a good explanation in this Stack Overflow thread:

https://stackoverflow.com/questions/16803397/can-endianness-refer-to-bits-order-in-a-byte

However, this answer mentions (under "Bit labels or bit numbering") that the most common approach for numbering bits is "to label the bits according to their significance, with bit 0 referring to the least significant bit". I wasn't aware of this convention before, but it does correspond to how ISO/IEC 15444-15 does things. Still, it would be helpful if the standard was explicit about the convention used.

EDIT: thanks for the Discord link, I just joined!

from openhtj2k.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.