40 #define FPS_TAG MKTAG('F', 'P', 'S', 'x')
78 static int huff_cmp(
const void *va,
const void *vb){
79 const Node *
a = va, *
b = vb;
80 return (a->
count - b->count)*256 + a->
sym - b->sym;
95 for(i = 0; i < 256; i++)
96 nodes[i].count = bytestream_get_le32(&src);
107 for(j = 0; j < h; j++){
113 if(j) dst[i] += dst[i -
stride];
114 else if(Uoff) dst[i] += 0x80;
127 void *
data,
int *got_frame,
131 int buf_size = avpkt->
size;
136 unsigned int version,header_size;
138 const uint32_t *buf32;
139 uint32_t *luma1,*luma2,*cb,*cr;
141 int i, j, is_chroma, planes;
145 version = header & 0xff;
146 header_size = (header & (1<<30))? 8 : 4;
150 "This file is encoded with Fraps version %d. " \
151 "This codec can only decode versions <= 5.\n", version);
156 if (header_size == 8)
169 if ( (buf_size != avctx->
width*avctx->
height*3/2+header_size) &&
170 (buf_size != header_size) ) {
172 "Invalid frame length %d (should be %d)\n",
173 buf_size, avctx->
width*avctx->
height*3/2+header_size);
177 if (( (avctx->
width % 8) != 0) || ( (avctx->
height % 2) != 0 )) {
196 buf32=(
const uint32_t*)buf;
197 for(y=0; y<avctx->
height/2; y++){
202 for(x=0; x<avctx->
width; x+=8){
203 *(luma1++) = *(buf32++);
204 *(luma1++) = *(buf32++);
205 *(luma2++) = *(buf32++);
206 *(luma2++) = *(buf32++);
207 *(cr++) = *(buf32++);
208 *(cb++) = *(buf32++);
216 if ( (buf_size != avctx->
width*avctx->
height*3+header_size) &&
217 (buf_size != header_size) ) {
219 "Invalid frame length %d (should be %d)\n",
220 buf_size, avctx->
width*avctx->
height*3+header_size);
237 for(y=0; y<avctx->
height; y++)
239 &buf[y*avctx->
width*3],
271 for(i = 0; i < planes; i++) {
272 offs[i] =
AV_RL32(buf + 4 + i * 4);
273 if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
278 offs[planes] = buf_size;
279 for(i = 0; i < planes; i++){
282 offs[i + 1] - offs[i] - 1024);
286 avctx->
height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
316 for(i = 0; i < planes; i++) {
317 offs[i] =
AV_RL32(buf + 4 + i * 4);
318 if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
323 offs[planes] = buf_size;
324 for(i = 0; i < planes; i++){
326 offs[i + 1] - offs[i] - 1024);
330 avctx->
width, avctx->
height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
336 for(j = 0; j < avctx->
height; j++){
337 for(i = 0; i < avctx->
width; i++){