ac3enc: remove a branch in asym_quant() by doing 2 shifts
This commit is contained in:
		
							parent
							
								
									0e4dbe2996
								
							
						
					
					
						commit
						f21fb76b1b
					
				| @ -1123,15 +1123,9 @@ static inline int sym_quant(int c, int e, int levels) | |||||||
|  */ |  */ | ||||||
| static inline int asym_quant(int c, int e, int qbits) | static inline int asym_quant(int c, int e, int qbits) | ||||||
| { | { | ||||||
|     int lshift, m, v; |     int m, v; | ||||||
| 
 | 
 | ||||||
|     lshift = e + qbits - 24; |     v = (((c << e) >> (24 - qbits)) + 1) >> 1; | ||||||
|     if (lshift >= 0) |  | ||||||
|         v = c << lshift; |  | ||||||
|     else |  | ||||||
|         v = c >> (-lshift); |  | ||||||
|     /* rounding */ |  | ||||||
|     v = (v + 1) >> 1; |  | ||||||
|     m = (1 << (qbits-1)); |     m = (1 << (qbits-1)); | ||||||
|     if (v >= m) |     if (v >= m) | ||||||
|         v = m - 1; |         v = m - 1; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user