comparison fraps.c @ 7535:699c33b2eabf libavcodec

Simplify colour conversion in Fraps as suggested by Michael
author kostya
date Mon, 11 Aug 2008 05:11:05 +0000
parents 6b13ee6a63ca
children 6f0821e1f899
comparison
equal deleted inserted replaced
7534:4891fe700813 7535:699c33b2eabf
140 unsigned int x, y; 140 unsigned int x, y;
141 const uint32_t *buf32; 141 const uint32_t *buf32;
142 uint32_t *luma1,*luma2,*cb,*cr; 142 uint32_t *luma1,*luma2,*cb,*cr;
143 uint32_t offs[4]; 143 uint32_t offs[4];
144 int i, j, is_chroma, planes; 144 int i, j, is_chroma, planes;
145 int R, G, B, Y, U, V;
146 145
147 146
148 header = AV_RL32(buf); 147 header = AV_RL32(buf);
149 version = header & 0xff; 148 version = header & 0xff;
150 header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ 149 header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
330 } 329 }
331 } 330 }
332 // convert pseudo-YUV into real RGB 331 // convert pseudo-YUV into real RGB
333 for(j = 0; j < avctx->height; j++){ 332 for(j = 0; j < avctx->height; j++){
334 for(i = 0; i < avctx->width; i++){ 333 for(i = 0; i < avctx->width; i++){
335 U = f->data[0][0 + i*3 + j*f->linesize[0]]; 334 f->data[0][0 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
336 Y = f->data[0][1 + i*3 + j*f->linesize[0]]; 335 f->data[0][2 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
337 V = f->data[0][2 + i*3 + j*f->linesize[0]];
338 R = Y + (int8_t)U;
339 G = Y;
340 B = Y + (int8_t)V;
341 f->data[0][0 + i*3 + j*f->linesize[0]] = R;
342 f->data[0][1 + i*3 + j*f->linesize[0]] = G;
343 f->data[0][2 + i*3 + j*f->linesize[0]] = B;
344 } 336 }
345 } 337 }
346 break; 338 break;
347 } 339 }
348 340