41 #define FPS_TAG MKTAG('F', 'P', 'S', 'x')
79 static int huff_cmp(
const void *va,
const void *vb)
81 const Node *
a = va, *
b = vb;
82 return (a->
count - b->count)*256 + a->
sym - b->sym;
97 for (i = 0; i < 256; i++)
98 nodes[i].count = bytestream_get_le32(&src);
109 for (j = 0; j < h; j++) {
110 for (i = 0; i < w*step; i += step) {
116 dst[i] += dst[i -
stride];
131 void *
data,
int *got_frame,
136 int buf_size = avpkt->
size;
140 unsigned int version,header_size;
142 const uint32_t *buf32;
143 uint32_t *luma1,*luma2,*
cb,*
cr;
145 int i, j, ret, is_chroma;
146 const int planes = 3;
151 version = header & 0xff;
152 header_size = (header & (1<<30))? 8 : 4;
156 "This file is encoded with Fraps version %d. " \
157 "This codec can only decode versions <= 5.\n", version);
164 unsigned needed_size = avctx->
width * avctx->
height * 3;
165 if (version == 0) needed_size /= 2;
166 needed_size += header_size;
168 if (header & (1
U<<31)) {
172 if (buf_size != needed_size) {
174 "Invalid frame length %d (should be %d)\n",
175 buf_size, needed_size);
188 for (i = 0; i < planes; i++) {
189 offs[i] =
AV_RL32(buf + 4 + i * 4);
190 if (offs[i] >= buf_size - header_size || (i && offs[i] <= offs[i - 1] + 1024)) {
195 offs[planes] = buf_size - header_size;
196 for (i = 0; i < planes; i++) {
225 if (((avctx->
width % 8) != 0) || ((avctx->
height % 2) != 0)) {
231 buf32 = (
const uint32_t*)buf;
232 for (y = 0; y < avctx->
height / 2; y++) {
233 luma1 = (uint32_t*)&f->
data[0][ y * 2 * f->
linesize[0] ];
234 luma2 = (uint32_t*)&f->
data[0][ (y * 2 + 1) * f->
linesize[0] ];
237 for (x = 0; x < avctx->
width; x += 8) {
250 for (y = 0; y<avctx->
height; y++)
252 &buf[y * avctx->
width * 3],
262 for (i = 0; i < planes; i++) {
265 avctx->
width >> is_chroma,
266 avctx->
height >> is_chroma,
267 buf + offs[i], offs[i + 1] - offs[i],
268 is_chroma, 1)) < 0) {
277 for (i = 0; i < planes; i++) {
280 buf + offs[i], offs[i + 1] - offs[i], 0, 3)) < 0) {
287 for (j = 0; j < avctx->
height; j++) {
289 while (out < line_end) {