comparison targa.c @ 4364:05e932ddaaa9 libavcodec

rename BE/LE_8/16/32 to AV_RL/B_8/16/32
author alex
date Fri, 19 Jan 2007 22:12:59 +0000
parents c9e0315f9954
children ce643a22f049
comparison
equal deleted inserted replaced
4363:9b7662fa4905 4364:05e932ddaaa9
59 switch(depth){ 59 switch(depth){
60 case 1: 60 case 1:
61 *dst = *src; 61 *dst = *src;
62 break; 62 break;
63 case 2: 63 case 2:
64 *((uint16_t*)dst) = LE_16(src); 64 *((uint16_t*)dst) = AV_RL16(src);
65 break; 65 break;
66 case 3: 66 case 3:
67 dst[0] = src[0]; 67 dst[0] = src[0];
68 dst[1] = src[1]; 68 dst[1] = src[1];
69 dst[2] = src[2]; 69 dst[2] = src[2];
70 break; 70 break;
71 case 4: 71 case 4:
72 *((uint32_t*)dst) = LE_32(src); 72 *((uint32_t*)dst) = AV_RL32(src);
73 break; 73 break;
74 } 74 }
75 dst += depth; 75 dst += depth;
76 if(!type) 76 if(!type)
77 src += depth; 77 src += depth;
102 102
103 /* parse image header */ 103 /* parse image header */
104 idlen = *buf++; 104 idlen = *buf++;
105 pal = *buf++; 105 pal = *buf++;
106 compr = *buf++; 106 compr = *buf++;
107 first_clr = LE_16(buf); buf += 2; 107 first_clr = AV_RL16(buf); buf += 2;
108 colors = LE_16(buf); buf += 2; 108 colors = AV_RL16(buf); buf += 2;
109 csize = *buf++; 109 csize = *buf++;
110 x = LE_16(buf); buf += 2; 110 x = AV_RL16(buf); buf += 2;
111 y = LE_16(buf); buf += 2; 111 y = AV_RL16(buf); buf += 2;
112 w = LE_16(buf); buf += 2; 112 w = AV_RL16(buf); buf += 2;
113 h = LE_16(buf); buf += 2; 113 h = AV_RL16(buf); buf += 2;
114 bpp = *buf++; 114 bpp = *buf++;
115 flags = *buf++; 115 flags = *buf++;
116 //skip identifier if any 116 //skip identifier if any
117 buf += idlen; 117 buf += idlen;
118 s->bpp = bpp; 118 s->bpp = bpp;
198 for(y = 0; y < s->height; y++){ 198 for(y = 0; y < s->height; y++){
199 #ifdef WORDS_BIGENDIAN 199 #ifdef WORDS_BIGENDIAN
200 if((s->bpp + 1) >> 3 == 2){ 200 if((s->bpp + 1) >> 3 == 2){
201 uint16_t *dst16 = (uint16_t*)dst; 201 uint16_t *dst16 = (uint16_t*)dst;
202 for(x = 0; x < s->width; x++) 202 for(x = 0; x < s->width; x++)
203 dst16[x] = LE_16(buf + x * 2); 203 dst16[x] = AV_RL16(buf + x * 2);
204 }else if((s->bpp + 1) >> 3 == 4){ 204 }else if((s->bpp + 1) >> 3 == 4){
205 uint32_t *dst32 = (uint32_t*)dst; 205 uint32_t *dst32 = (uint32_t*)dst;
206 for(x = 0; x < s->width; x++) 206 for(x = 0; x < s->width; x++)
207 dst32[x] = LE_32(buf + x * 4); 207 dst32[x] = AV_RL32(buf + x * 4);
208 }else 208 }else
209 #endif 209 #endif
210 memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3)); 210 memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3));
211 211
212 dst += stride; 212 dst += stride;