Opened 12 years ago Closed 7 years ago #1013 closed defect (invalid)missing read_bits(1) when pcm_flag is decoded as 1
Description
The spec (9.2.3.2.4) requires that if we decode pcm_flag and it is one, no renormalization is done and a bit is read from the bitstream and it must be one.
It seems that the reference software has not implemented the reading of this bit one yet when we decode value one of pcm_flag.
As far as I understand, the decoding of pcm_flag is done in Void TDecSbac::parseIPCMInfo. In this function, m_pcTDecBinIf->decodeBinTrm(uiSymbol) is called to decode pcm_flag. There is no bit reading from the bitstream if pcm_flag is one in the function decodeBinTrm(uiSymbol). Then m_pcTDecBinIf->decodePCMAlignBits() is called to read bits until byte-alignment. m_pcTDecBinIf->decodePCMAlignBits() is equal to the following pseudo-code in the spec :
while (!byte_aligned())
Change History (6)comment:1 Changed 12 years ago by DefaultCC Plugin
comment:2 Changed 12 years ago by fbossen
comment:3 Changed 10 years ago by Parabola
I think this may still be an issue.
In our parser, which is written in a domain-specific language very similar to the syntax tables in the text, code looks more-or-less exactly like that in chapter 7 of the text. There is one exception in the syntax for coding unit: if (pcm_flag[x0][y0)]) { pcm_alignment_one_bit() f(1) <-- not in the text while (!byte_aligned()) pcm_alignment_zero_bit() f(1)
This allows pcm_flag to be handled by the exact same termination routine as elements end_of_slice_segment and end_of_subset_one_bit. The latter two elements are always followed by rbsp_stop_one_bit and alignment_bit_equal_to_one respectively. I can't see why pcm_flag doesn't also get a "one bit" in the text.
Unless someone can explain how pcm_flag is special (in which case I apologise for reopening a can of worms), the coding unit syntax could be incorrect. comment:4 Changed 10 years ago by dthoang
I am looking at the published edition 1.0 specification Rec. ITU-T H.265 (04/2013) and see this. if( pcm_flag[ x0 ][ y0 ] ) { while( !byte_aligned( ) ) pcm_alignment_zero_bit f(1) pcm_sample( x0, y0, log2CbSize ) } else {
This is not that same as what you quoted. comment:5 Changed 10 years ago by Parabola
Yes, that is the problem. I think the text may be incorrect and so proposed a correction. Your published excerpt is different to my proposed. My theory is that there should be a pcm_alignment_one_bit in the text (all versions). Since this text has been reviewed so much now, I am hesitant to believe that this theory could be correct. But Parabola may be the only company that has "compiled" and run the syntax tables in the text of the standard..? comment:6 Changed 7 years ago by bbross
For end_of_slice_segment_flag the ‘one bit’ corresponds with rbsp_stop_one_bit – part of subclause 7.3.2.11 rbsp_trailing_bits(), part of subclause 7.3.2.10 rbsp_slice_segment_trailing_bits(), which follows slice_segment_data, which terminates with a end_of_slice_segment_flag equal to one, so again a redundant ‘one bit’ is avoided.
For end_of_subset_one_bit the ‘one bit’ corresponds with alignment_bit_equal_to_one – part of subclause 7.3.2.12 byte_alignment(), which follows end_of_subset_one_bit so avoids a redundant ‘one bit’.
In both cases, a one-valued flag decoded at a lower level syntax table is effectively reused as a flag required to be one at a higher level syntax table(where CABAC decoding is terminated). Note: See
TracTickets for help on using
tickets. | This list contains all users that will be notified about changes made to this ticket. These roles will be notified: Reporter, Owner, Subscriber, Participant
|
I believe you are misreading 9.2.3.2.4: where does it say that a bit has to be read? The "last bit" refers to the most recently read bit, not one that you have to read additionally.