You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Make two functions out of #define hackery.
Patch by Sebastian Vater, cdgs D basty A googlemail Originally committed as revision 22970 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
				
					committed by
					
						 Carl Eugen Hoyos
						Carl Eugen Hoyos
					
				
			
			
				
	
			
			
			
						parent
						
							90bc36b063
						
					
				
				
					commit
					687dc3555d
				
			| @@ -87,27 +87,44 @@ static av_cold int decode_init(AVCodecContext *avctx) | |||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Decode interleaved plane buffer |  * Decode interleaved plane buffer up to 8bpp | ||||||
|  |  * @param dst Destination buffer | ||||||
|  |  * @param buf Source buffer | ||||||
|  |  * @param buf_size | ||||||
|  |  * @param bps bits_per_coded_sample (must be <= 8) | ||||||
|  |  * @param plane plane number to decode as | ||||||
|  |  */ | ||||||
|  | static void decodeplane8(uint8_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane) | ||||||
|  | { | ||||||
|  |     GetBitContext gb; | ||||||
|  |     int i, b; | ||||||
|  |     init_get_bits(&gb, buf, buf_size * 8); | ||||||
|  |     for(i = 0; i < (buf_size * 8 + bps - 1) / bps; i++) { | ||||||
|  |         for (b = 0; b < bps; b++) { | ||||||
|  |             dst[ i*bps + b ] |= get_bits1(&gb) << plane; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Decode interleaved plane buffer up to 24bpp | ||||||
|  * @param dst Destination buffer |  * @param dst Destination buffer | ||||||
|  * @param buf Source buffer |  * @param buf Source buffer | ||||||
|  * @param buf_size |  * @param buf_size | ||||||
|  * @param bps bits_per_coded_sample |  * @param bps bits_per_coded_sample | ||||||
|  * @param plane plane number to decode as |  * @param plane plane number to decode as | ||||||
|  */ |  */ | ||||||
| #define DECLARE_DECODEPLANE(suffix, type) \ | static void decodeplane32(uint32_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane) | ||||||
| static void decodeplane##suffix(void *dst, const uint8_t *const buf, int buf_size, int bps, int plane) \ | { | ||||||
| { \ |     GetBitContext gb; | ||||||
|     GetBitContext gb; \ |     int i, b; | ||||||
|     int i, b; \ |     init_get_bits(&gb, buf, buf_size * 8); | ||||||
|     init_get_bits(&gb, buf, buf_size * 8); \ |     for(i = 0; i < (buf_size * 8 + bps - 1) / bps; i++) { | ||||||
|     for(i = 0; i < (buf_size * 8 + bps - 1) / bps; i++) { \ |         for (b = 0; b < bps; b++) { | ||||||
|         for (b = 0; b < bps; b++) { \ |             dst[ i*bps + b ] |= get_bits1(&gb) << plane; | ||||||
|             ((type *)dst)[ i*bps + b ] |= get_bits1(&gb) << plane; \ |         } | ||||||
|         } \ |     } | ||||||
|     } \ |  | ||||||
| } | } | ||||||
| DECLARE_DECODEPLANE(8, uint8_t) |  | ||||||
| DECLARE_DECODEPLANE(32, uint32_t) |  | ||||||
|  |  | ||||||
| static int decode_frame_ilbm(AVCodecContext *avctx, | static int decode_frame_ilbm(AVCodecContext *avctx, | ||||||
|                             void *data, int *data_size, |                             void *data, int *data_size, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user