title: h264 u(v) decode of frame_num, pic_order_cnt_lsb and slice_group_change_cycle
body: <p>According to "Slice Header Syntax" (described in ITU-T Rec. h264), <code>frame_num</code>, <code>pic_order_cnt_lsb</code> and <code>slice_group_change_cycle</code> have <code>u(v)</code> descriptor, which is the unsigned integer using variable number of bits. </p>
  
  <p>The doc states that </p>
  
  <blockquote>
    <p>"the number of bits varies in a manner dependent on the value of other
    syntax elements."</p>
  </blockquote>
  
  <p>Do you know how to figure out the number of bits used to store <code>frame_num</code>, <code>pic_order_cnt_lsb</code> and <code>slice_group_change_cycle</code>?</p>
  
  <p>[The cited documentation points to <code>read_bits(n)</code> function, unfortunately I cannot figure it out by myself. Can you help?]</p>