/* This is called by the entropy decoder after it has read an appropriate number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder has already read a marker from the data source. Under normal conditions cinfo->unread_marker will be reset to 0 before returning; if not reset, it holds a marker which the decoder will be unable to read past.  */
read_restart_marker(j_decompress_ptr cinfo)
/* This is called by the entropy decoder after it has read an appropriate number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder has already read a marker from the data source. Under normal conditions cinfo->unread_marker will be reset to 0 before returning; if not reset, it holds a marker which the decoder will be unable to read past.  */
read_restart_marker(j_decompress_ptr cinfo)
{
  if (cinfo->unread_marker == 0) {
    if (! next_marker(cinfo))
      return FALSE;
  }
  if (cinfo->unread_marker ==
      ((int) M_RST0 + cinfo->marker->next_restart_num)) {
    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
    cinfo->unread_marker = 0;
  } else {
    if (! (*cinfo->src->resync_to_restart) (cinfo,
					    cinfo->marker->next_restart_num))
      return FALSE;
  }
  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
  return TRUE;
}