mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
fraps: optimize pseudo-YUV to RGB conversion.
With gcc 4.6 this part of the code is ca. 4x faster, resulting in an overall speedup of around 5% for fate-fraps-v5 sample. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
7df9937fcc
commit
7fabef1f01
@ -140,6 +140,7 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
uint32_t offs[4];
|
uint32_t offs[4];
|
||||||
int i, j, is_chroma;
|
int i, j, is_chroma;
|
||||||
const int planes = 3;
|
const int planes = 3;
|
||||||
|
uint8_t *out;
|
||||||
|
|
||||||
|
|
||||||
header = AV_RL32(buf);
|
header = AV_RL32(buf);
|
||||||
@ -281,12 +282,16 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out = f->data[0];
|
||||||
// convert pseudo-YUV into real RGB
|
// convert pseudo-YUV into real RGB
|
||||||
for(j = 0; j < avctx->height; j++){
|
for(j = 0; j < avctx->height; j++){
|
||||||
for(i = 0; i < avctx->width; i++){
|
uint8_t *line_end = out + 3*avctx->width;
|
||||||
f->data[0][0 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
|
while (out < line_end) {
|
||||||
f->data[0][2 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
|
out[0] += out[1];
|
||||||
|
out[2] += out[1];
|
||||||
|
out += 3;
|
||||||
}
|
}
|
||||||
|
out += f->linesize[0] - 3*avctx->width;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user