41 #define FPS_TAG MKTAG('F', 'P', 'S', 'x')
79 static int huff_cmp(
const void *va,
const void *vb){
80 const Node *
a = va, *
b = vb;
81 return (a->
count - b->count)*256 + a->
sym - b->sym;
96 for(i = 0; i < 256; i++)
97 nodes[i].count = bytestream_get_le32(&src);
108 for(j = 0; j < h; j++){
109 for(i = 0; i < w*step; i += step){
114 if(j) dst[i] += dst[i -
stride];
115 else if(Uoff) dst[i] += 0x80;
128 void *
data,
int *got_frame,
132 int buf_size = avpkt->
size;
137 unsigned int version,header_size;
139 const uint32_t *buf32;
140 uint32_t *luma1,*luma2,*
cb,*
cr;
143 const int planes = 3;
149 version = header & 0xff;
150 header_size = (header & (1<<30))? 8 : 4;
154 "This file is encoded with Fraps version %d. " \
155 "This codec can only decode versions <= 5.\n", version);
162 unsigned needed_size = avctx->
width*avctx->
height*3;
163 if (version == 0) needed_size /= 2;
164 needed_size += header_size;
166 if (header & (1
U<<31)) {
170 if (buf_size != needed_size) {
172 "Invalid frame length %d (should be %d)\n",
173 buf_size, needed_size);
186 for(i = 0; i < planes; i++) {
187 offs[i] =
AV_RL32(buf + 4 + i * 4);
188 if(offs[i] >= buf_size - header_size || (i && offs[i] <= offs[i - 1] + 1024)) {
193 offs[planes] = buf_size - header_size;
194 for(i = 0; i < planes; i++) {
223 if ( (avctx->
width % 8) != 0 || (avctx->
height % 2) != 0 ) {
229 buf32=(
const uint32_t*)buf;
230 for(y=0; y<avctx->
height/2; y++){
235 for(x=0; x<avctx->
width; x+=8){
248 for(y=0; y<avctx->
height; y++)
250 &buf[y*avctx->
width*3],
260 for(i = 0; i < planes; i++){
263 avctx->
height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
272 for(i = 0; i < planes; i++){
274 avctx->
width, avctx->
height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
281 for(j = 0; j < avctx->
height; j++){
283 while (out < line_end) {