c - How do you understand this line from H264 specifications -


in h264 (mpeg4 part 10 avc) specifications available here, can read following on page 59 (a little bit simplified clarity of question on so):

for(i8x8 = 0; i8x8 < 4; i8x8++)    for(i4x4 = 0; i4x4 < 4; i4x4++)       if(codedblockpatternluma & (1 << i8x8))        dosomething() 

i wondering how interpret content of if statement. looking @ other implementations seems test done check whether it's 0 or not. seems make more sense, otherwise condition can evaluated true when i8x8 0. how understand that?

it testing whether or not particular bit set. 1 << i8x8 taking "1" bit , shifting left variable number of spaces, &'ing codedblockpatternluma see if bit set. if pattern 10101010 , i8x8 2, pattern gets anded 100, 10101010 & 00000100 = 00000000, bit not set. if pattern 01010101, , anded 00000100 bit set, , true.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -