osamu620 / OpenHTJ2K

An open source implementation of ITU-T Rec.814 | ISO 15444-15 (a.k.a. HTJ2K).
BSD 3-Clause "New" or "Revised" License
36 stars 10 forks source link

encoder feature request : support multiple HT sets #37

Open boxerab opened 3 years ago

boxerab commented 3 years ago

This would be a first step towards adding rate control to the encoder.

@osamu620 the simplest approach would be, as you suggested in another issue, to only perform cleanup pass in each HT set.

osamu620 commented 3 years ago

I think so. There is an open discussion: We should determine a value, let me say p, for the bitplane number from the LSB, for each HT set. The current implementation takes zero for p (means all bitplanes are in one HT cleanup pass.) For example, like PCRD-opt, we should somehow have to have criteria to have several candidates for p values in accordance with a distortion estimation.

boxerab commented 3 years ago

@osamu620 thanks - is it difficult to change the current block encoder so that is takes a non-zero p value ?

osamu620 commented 3 years ago

@boxerab It is not difficult. https://github.com/osamu620/OpenHTJ2K/blob/557095b78bacdba05e0f74b3157e0942ac0e9271/source/core/coding/ht_block_encoding.cpp#L45

To do so with non-zero p value, the above function shall be modified to include only bitplanes from the MSB down to p th bitplane. The MsgSgn and sigma values would be also changed.

The major part of the work would be the implementation of distortion estimation AND HT SigProp and MagRef encoding to generate HT Refinement segment. If a code block has HT SigProp and MagRef passes, the total number of coding passes in the block is three. (If no MagRef, the number is two)

osamu620 commented 3 years ago

@boxerab If I provide an initial modification to the function, would it be a starting point to accomplish the whole work? If so, I would be happy to provide it. Please wait for a couple of days because I'm busy with teaching commitments..

boxerab commented 3 years ago

@osamu620 that would be great! I have some more optimisations to do, and then I can work on SigProp and MagRef passes, which are quite similar to Part 1 block coder passes.