1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

FRAPS: Do not needlessly use reget_buffer.

Codec has only I- and skip-frames, so there is no
need for reget_buffer, change it so it works with
get_buffer.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
Reimar Döffinger 2012-01-28 23:07:54 +01:00
parent 05741d70c7
commit 6a9b565e0a
3 changed files with 17 additions and 54 deletions

View File

@ -167,14 +167,27 @@ static int decode_frame(AVCodecContext *avctx,
buf_size, needed_size);
return -1;
}
/* bit 31 means same as previous pic */
if (header & (1U<<31)) {
*data_size = 0;
return buf_size;
}
} else {
/* skip frame */
if (buf_size == 8) {
*data_size = 0;
return buf_size;
}
}
f->pict_type = AV_PICTURE_TYPE_I;
f->key_frame = 1;
f->reference = 3;
f->buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE;
f->reference = 0;
f->buffer_hints = FF_BUFFER_HINTS_VALID;
if (avctx->get_buffer(avctx, f)) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
switch(version) {
case 0:
@ -186,15 +199,6 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
if (avctx->reget_buffer(avctx, f)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
/* bit 31 means same as previous pic */
if (header & (1U<<31)) {
f->pict_type = AV_PICTURE_TYPE_P;
f->key_frame = 0;
} else {
buf32=(const uint32_t*)buf;
for(y=0; y<avctx->height/2; y++){
luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ];
@ -210,25 +214,14 @@ static int decode_frame(AVCodecContext *avctx,
*cb++ = *buf32++;
}
}
}
break;
case 1:
/* Fraps v1 is an upside-down BGR24 */
if (avctx->reget_buffer(avctx, f)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
/* bit 31 means same as previous pic */
if (header & (1U<<31)) {
f->pict_type = AV_PICTURE_TYPE_P;
f->key_frame = 0;
} else {
for(y=0; y<avctx->height; y++)
memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
&buf[y*avctx->width*3],
3*avctx->width);
}
break;
case 2:
@ -237,16 +230,6 @@ static int decode_frame(AVCodecContext *avctx,
* Fraps v2 is Huffman-coded YUV420 planes
* Fraps v4 is virtually the same
*/
if (avctx->reget_buffer(avctx, f)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
/* skip frame */
if(buf_size == 8) {
f->pict_type = AV_PICTURE_TYPE_P;
f->key_frame = 0;
break;
}
if (AV_RL32(buf) != FPS_TAG || buf_size < planes*1024 + 24) {
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
return -1;
@ -274,16 +257,6 @@ static int decode_frame(AVCodecContext *avctx,
case 3:
case 5:
/* Virtually the same as version 4, but is for RGB24 */
if (avctx->reget_buffer(avctx, f)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
/* skip frame */
if(buf_size == 8) {
f->pict_type = AV_PICTURE_TYPE_P;
f->key_frame = 0;
break;
}
if (AV_RL32(buf) != FPS_TAG || buf_size < planes*1024 + 24) {
av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
return -1;

View File

@ -1,10 +1,2 @@
0, 0, 1179648, 0x99f80436
0, 3000, 1179648, 0x99f80436
0, 6000, 1179648, 0x99f80436
0, 9000, 1179648, 0x99f80436
0, 12000, 1179648, 0x99f80436
0, 15000, 1179648, 0xe8ae7a30
0, 18000, 1179648, 0xe8ae7a30
0, 21000, 1179648, 0xe8ae7a30
0, 24000, 1179648, 0xe8ae7a30
0, 27000, 1179648, 0xe8ae7a30

View File

@ -2,8 +2,6 @@
0, 3000, 589824, 0xcd740f79
0, 6000, 589824, 0x16f8f90e
0, 9000, 589824, 0x1aaaceba
0, 12000, 589824, 0x1aaaceba
0, 15000, 589824, 0x902e8fe4
0, 18000, 589824, 0x019a4443
0, 21000, 589824, 0x019a4443
0, 24000, 589824, 0x04eff6c6