h264: rewrite has_b_frame calculation code,