BitMiracle.LibJpeg.Classic.Internal.huff_entropy_encoder.emit_restart_s C# (CSharp) Method

emit_restart_s() private method

Emit a restart marker and resynchronize predictions.
private emit_restart_s ( savable_state state, int restart_num ) : bool
state savable_state
restart_num int
return bool
        private bool emit_restart_s(savable_state state, int restart_num)
        {
            if (!flush_bits_s(state))
                return false;

            if (!emit_byte_s(0xFF))
                return false;

            if (!emit_byte_s((int)(JPEG_MARKER.RST0 + restart_num)))
                return false;

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

            /* The restart counter is not updated until we successfully write the MCU. */
            return true;
        }