Mercurial > libavcodec.hg
comparison 4xm.c @ 1295:5c67ef6498ed libavcodec
fix 4xm yuv->rgb565 transform
author | michaelni |
---|---|
date | Sun, 01 Jun 2003 10:56:36 +0000 |
parents | 6896bc2f3bf5 |
children | 37dc515e3dac |
comparison
equal
deleted
inserted
replaced
1294:6896bc2f3bf5 | 1295:5c67ef6498ed |
---|---|
414 static inline void idct_put(FourXContext *f, int x, int y){ | 414 static inline void idct_put(FourXContext *f, int x, int y){ |
415 DCTELEM (*block)[64]= f->block; | 415 DCTELEM (*block)[64]= f->block; |
416 int stride= f->current_picture.linesize[0]>>1; | 416 int stride= f->current_picture.linesize[0]>>1; |
417 int i; | 417 int i; |
418 uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x; | 418 uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x; |
419 | 419 |
420 for(i=0; i<6; i++) idct(block[i]); | 420 for(i=0; i<4; i++){ |
421 block[i][0] += 0x80*8*8; | |
422 idct(block[i]); | |
423 } | |
424 | |
425 if(!(f->avctx->flags&CODEC_FLAG_GRAY)){ | |
426 for(i=4; i<6; i++) idct(block[i]); | |
427 } | |
421 | 428 |
422 for(y=0; y<8; y++){ | 429 for(y=0; y<8; y++){ |
423 for(x=0; x<8; x++){ | 430 for(x=0; x<8; x++){ |
424 DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize | 431 DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize |
425 int cb= block[4][x + 8*y] + 0x80; | 432 int cb= block[4][x + 8*y]; |
426 int cr= block[5][x + 8*y] + 0x80; | 433 int cr= block[5][x + 8*y]; |
427 int cg= (cb + cr)>>1; | 434 int cg= (cb + cr)>>1; |
428 int y; | 435 int y; |
429 | 436 |
430 cb+=cb - 0x80; | 437 cb+=cb; |
431 | 438 |
432 y = temp[0]; | 439 y = temp[0]; |
433 dst[0 ]= ((y+cb)>>3) + (((y+cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); | 440 dst[0 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); |
434 y = temp[1]; | 441 y = temp[1]; |
435 dst[1 ]= ((y+cb)>>3) + (((y+cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); | 442 dst[1 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); |
436 y = temp[8]; | 443 y = temp[8]; |
437 dst[ stride]= ((y+cb)>>3) + (((y+cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); | 444 dst[ stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); |
438 y = temp[9]; | 445 y = temp[9]; |
439 dst[1+stride]= ((y+cb)>>3) + (((y+cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); | 446 dst[1+stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8); |
440 dst += 2; | 447 dst += 2; |
441 } | 448 } |
442 dst += 2*stride - 2*8; | 449 dst += 2*stride - 2*8; |
443 } | 450 } |
444 // if(!(f->avctx->flags&CODEC_FLAG_GRAY)){ | |
445 } | 451 } |
446 | 452 |
447 static int decode_i_mb(FourXContext *f){ | 453 static int decode_i_mb(FourXContext *f){ |
448 int i; | 454 int i; |
449 | 455 |