BitMiracle.LibJpeg.Classic.Internal.jpeg_marker_reader.read_restart_marker C# (CSharp) Méthode

read_restart_marker() public méthode

Read a restart marker, which is expected to appear next in the datastream; if the marker is not there, take appropriate recovery action. Returns false if suspension is required. Made public for use by entropy decoder only 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.
public read_restart_marker ( ) : bool
Résultat bool
        public bool read_restart_marker()
        {
            /* Obtain a marker unless we already did. */
            /* Note that next_marker will complain if it skips any data. */
            if (m_cinfo.m_unread_marker == 0)
            {
                if (!next_marker())
                    return false;
            }

            if (m_cinfo.m_unread_marker == ((int)JPEG_MARKER.RST0 + m_cinfo.m_marker.m_next_restart_num))
            {
                /* Normal case --- swallow the marker and let entropy decoder continue */
                m_cinfo.TRACEMS(3, J_MESSAGE_CODE.JTRC_RST, m_cinfo.m_marker.m_next_restart_num);
                m_cinfo.m_unread_marker = 0;
            }
            else
            {
                /* Uh-oh, the restart markers have been messed up. */
                /* Let the data source manager determine how to resync. */
                if (!m_cinfo.m_src.resync_to_restart(m_cinfo, m_cinfo.m_marker.m_next_restart_num))
                    return false;
            }

            /* Update next-restart state */
            m_cinfo.m_marker.m_next_restart_num = (m_cinfo.m_marker.m_next_restart_num + 1) & 7;

            return true;
        }