Only flag (underline) predictions on long echo delay
This commit is contained in:
+7
-1
@@ -22,7 +22,9 @@ void OverlayCell::apply( Framebuffer &fb ) const
|
|||||||
|
|
||||||
if ( !(*(fb.get_mutable_cell( row, col )) == replacement) ) {
|
if ( !(*(fb.get_mutable_cell( row, col )) == replacement) ) {
|
||||||
*(fb.get_mutable_cell( row, col )) = replacement;
|
*(fb.get_mutable_cell( row, col )) = replacement;
|
||||||
fb.get_mutable_cell( row, col )->renditions.bold = true; /* XXX */
|
if ( flag ) {
|
||||||
|
fb.get_mutable_cell( row, col )->renditions.underlined = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +124,9 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( SRTT > 150 ) flagging = true; /* start underlining predicted chars */
|
||||||
|
if ( SRTT < 100 ) flagging = false; /* use some hysterisis to avoid annoying flicker */
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayCell::OverlayCell( uint64_t expiration_time, int s_row, int s_col, int background_color )
|
OverlayCell::OverlayCell( uint64_t expiration_time, int s_row, int s_col, int background_color )
|
||||||
@@ -342,6 +347,7 @@ void PredictionEngine::new_user_byte( char the_byte, const Framebuffer &fb )
|
|||||||
coc->replacement = *existing_cell;
|
coc->replacement = *existing_cell;
|
||||||
coc->replacement.contents.clear();
|
coc->replacement.contents.clear();
|
||||||
coc->replacement.contents.push_back( the_byte );
|
coc->replacement.contents.push_back( the_byte );
|
||||||
|
coc->flag = flagging;
|
||||||
|
|
||||||
ccm->new_col++;
|
ccm->new_col++;
|
||||||
ccm->expiration_time = now + prediction_len();
|
ccm->expiration_time = now + prediction_len();
|
||||||
|
|||||||
+5
-2
@@ -21,12 +21,14 @@ namespace Overlay {
|
|||||||
class OverlayElement {
|
class OverlayElement {
|
||||||
public:
|
public:
|
||||||
uint64_t prediction_time, expiration_time;
|
uint64_t prediction_time, expiration_time;
|
||||||
|
bool flag; /* whether to bold for the user */
|
||||||
|
|
||||||
virtual void apply( Framebuffer &fb ) const = 0;
|
virtual void apply( Framebuffer &fb ) const = 0;
|
||||||
virtual Validity get_validity( const Framebuffer & ) const;
|
virtual Validity get_validity( const Framebuffer & ) const;
|
||||||
|
|
||||||
OverlayElement( uint64_t s_expiration_time ) : prediction_time( timestamp() ),
|
OverlayElement( uint64_t s_expiration_time ) : prediction_time( timestamp() ),
|
||||||
expiration_time( s_expiration_time ) {}
|
expiration_time( s_expiration_time ),
|
||||||
|
flag( false ) {}
|
||||||
virtual ~OverlayElement() {}
|
virtual ~OverlayElement() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,6 +114,7 @@ namespace Overlay {
|
|||||||
/* use the TCP timeout algorithm to measure appropriate echo prediction timeout */
|
/* use the TCP timeout algorithm to measure appropriate echo prediction timeout */
|
||||||
bool RTT_hit;
|
bool RTT_hit;
|
||||||
double SRTT, RTTVAR;
|
double SRTT, RTTVAR;
|
||||||
|
bool flagging;
|
||||||
int prediction_len( void );
|
int prediction_len( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -119,7 +122,7 @@ namespace Overlay {
|
|||||||
void new_user_byte( char the_byte, const Framebuffer &fb );
|
void new_user_byte( char the_byte, const Framebuffer &fb );
|
||||||
void calculate_score( const Framebuffer &fb );
|
void calculate_score( const Framebuffer &fb );
|
||||||
|
|
||||||
PredictionEngine() : score( 0 ), RTT_hit( false ), SRTT( 1000 ), RTTVAR( 500 ) {}
|
PredictionEngine() : score( 0 ), RTT_hit( false ), SRTT( 1000 ), RTTVAR( 500 ), flagging( false ) {}
|
||||||
|
|
||||||
int get_score( void ) { return score; }
|
int get_score( void ) { return score; }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user