You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	mss12: avoid unnecessary division in arith*_get_bit()
That division can be replaced with a comparison: ((c->value - c->low) << 1) + 1 >= range By expanding 'range' definition and simplifying this inequation we obtain the final expression. Suggested by Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
This commit is contained in:
		
				
					committed by
					
						 Kostya Shishkov
						Kostya Shishkov
					
				
			
			
				
	
			
			
			
						parent
						
							6ceef07b21
						
					
				
				
					commit
					9699b3a2d7
				
			| @@ -103,7 +103,7 @@ av_cold int ff_mss12_decode_end(MSS12Context *ctx); | ||||
| static int arith ## VERSION ## _get_bit(ArithCoder *c)                  \ | ||||
| {                                                                       \ | ||||
|     int range = c->high - c->low + 1;                                   \ | ||||
|     int bit   = (((c->value - c->low) << 1) + 1) / range;               \ | ||||
|     int bit   = 2 * c->value - c->low >= c->high;                       \ | ||||
|                                                                         \ | ||||
|     if (bit)                                                            \ | ||||
|         c->low += range >> 1;                                           \ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user