comparison fraps.c @ 7529:6b13ee6a63ca libavcodec

R and B components are stored as a differences to G component in Fraps v5. This fixes roundup issue 574.
author kostya
date Sun, 10 Aug 2008 18:15:38 +0000
parents e943e1409077
children 699c33b2eabf
comparison
equal deleted inserted replaced
7528:553ec99ac3b0 7529:6b13ee6a63ca
139 unsigned int version,header_size; 139 unsigned int version,header_size;
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, is_chroma, planes; 144 int i, j, is_chroma, planes;
145 int R, G, B, Y, U, V;
145 146
146 147
147 header = AV_RL32(buf); 148 header = AV_RL32(buf);
148 version = header & 0xff; 149 version = header & 0xff;
149 header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ 150 header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
321 } 322 }
322 offs[planes] = buf_size; 323 offs[planes] = buf_size;
323 for(i = 0; i < planes; i++){ 324 for(i = 0; i < planes; i++){
324 s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE); 325 s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
325 if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0], 326 if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
326 avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 1, 3) < 0) { 327 avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
327 av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i); 328 av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
328 return -1; 329 return -1;
330 }
331 }
332 // convert pseudo-YUV into real RGB
333 for(j = 0; j < avctx->height; j++){
334 for(i = 0; i < avctx->width; i++){
335 U = f->data[0][0 + i*3 + j*f->linesize[0]];
336 Y = 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;
329 } 344 }
330 } 345 }
331 break; 346 break;
332 } 347 }
333 348