BitMiracle.LibJpeg.Classic.Internal.huff_entropy_decoder.process_restart C# (CSharp) Method

process_restart() private method

Check for a restart marker and resynchronize decoder. Returns false if must suspend.
private process_restart ( ) : bool
return bool
        private bool process_restart()
        {
            finish_pass_huff();

            /* Advance past the RSTn marker */
            if (!m_cinfo.m_marker.read_restart_marker())
                return false;

            /* Re-initialize DC predictions to 0 */
            for (int ci = 0; ci < m_cinfo.m_comps_in_scan; ci++)
                m_saved.last_dc_val[ci] = 0;

            /* Re-init EOB run count, too */
            m_saved.EOBRUN = 0;

            /* Reset restart counter */
            m_restarts_to_go = m_cinfo.m_restart_interval;

            /* Reset out-of-data flag, unless read_restart_marker left us smack up
             * against a marker.  In that case we will end up treating the next data
             * segment as empty, and we can avoid producing bogus output pixels by
             * leaving the flag set.
             */
            if (m_cinfo.m_unread_marker == 0)
                m_insufficient_data = false;

            return true;
        }