# HG changeset patch # User michael # Date 1186933647 0 # Node ID 80ee0d3dd53e7be81b21613a06f8fed6ec701b8d # Parent cd266411b11aa0602194b78221448d195d4826be support ifr2 from Toy-Story2_better-image-quality.4xa diff -r cd266411b11a -r 80ee0d3dd53e 4xm.c --- a/4xm.c Sun Aug 12 13:50:06 2007 +0000 +++ b/4xm.c Sun Aug 12 15:47:27 2007 +0000 @@ -575,6 +575,49 @@ return ptr; } +static int mix(int c0, int c1){ + int blue = 2*(c0&0x001F) + (c1&0x001F); + int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5; + int red = 2*(c0>>10) + (c1>>10); + return red/3*1024 + green/3*32 + blue/3; +} + +static int decode_i2_frame(FourXContext *f, uint8_t *buf, int length){ + int x, y, x2, y2; + const int width= f->avctx->width; + const int height= f->avctx->height; + uint16_t *dst= (uint16_t*)f->current_picture.data[0]; + const int stride= f->current_picture.linesize[0]>>1; + + for(y=0; y>2) + 8*(y2>>2); + dst[y2*stride+x2]= color[(bits>>index)&3]; + } + } + dst+=16; + } + dst += 16*stride - width; + } + + return 0; +} + static int decode_i_frame(FourXContext *f, uint8_t *buf, int length){ int x, y; const int width= f->avctx->width; @@ -702,7 +745,11 @@ return -1; } - if(frame_4cc == ff_get_fourcc("ifrm") || frame_4cc == ff_get_fourcc("ifr2")){ + if(frame_4cc == ff_get_fourcc("ifr2")){ + p->pict_type= I_TYPE; + if(decode_i2_frame(f, buf-4, frame_size) < 0) + return -1; + }else if(frame_4cc == ff_get_fourcc("ifrm")){ p->pict_type= I_TYPE; if(decode_i_frame(f, buf, frame_size) < 0) return -1;