Revision 59743d16
libavcodec/h263.c  

487  487 
} 
488  488  
489  489 
/** 
490 
* init s>current_picture.qscale_table from s>lambda_table 

491 
*/ 

492 
static void ff_init_qscale_tab(MpegEncContext *s){ 

493 
int8_t * const qscale_table= s>current_picture.qscale_table; 

494 
int i; 

495  
496 
for(i=0; i<s>mb_num; i++){ 

497 
unsigned int lam= s>lambda_table[ s>mb_index2xy[i] ]; 

498 
int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); 

499 
qscale_table[ s>mb_index2xy[i] ]= clip(qp, s>avctx>qmin, s>avctx>qmax); 

500 
} 

501 
} 

502  
503 
/** 

490  504 
* modify qscale so that encoding is acually possible in h263 (limit difference to 2..2) 
491  505 
*/ 
492  506 
void ff_clean_h263_qscales(MpegEncContext *s){ 
493  507 
int i; 
494  508 
int8_t * const qscale_table= s>current_picture.qscale_table; 
495  509  
510 
ff_init_qscale_tab(s); 

511  
496  512 
for(i=1; i<s>mb_num; i++){ 
497  513 
if(qscale_table[ s>mb_index2xy[i] ]  qscale_table[ s>mb_index2xy[i1] ] >2) 
498  514 
qscale_table[ s>mb_index2xy[i] ]= qscale_table[ s>mb_index2xy[i1] ]+2; 
...  ...  
507  523 
int mb_xy= s>mb_index2xy[i]; 
508  524  
509  525 
if(qscale_table[mb_xy] != qscale_table[s>mb_index2xy[i1]] && (s>mb_type[mb_xy]&CANDIDATE_MB_TYPE_INTER4V)){ 
510 
s>mb_type[mb_xy]&= ~CANDIDATE_MB_TYPE_INTER4V; 

511  526 
s>mb_type[mb_xy]= CANDIDATE_MB_TYPE_INTER; 
512  527 
} 
513  528 
} 
tests/ffmpeg.regression.ref  

79  79 
657582 ./data/ampeg4qprd.avi 
80  80 
5b620f592a795b1caad323ab3fab0859 *./data/out.yuv 
81  81 
stddev: 12.12 PSNR:26.45 bytes:7602176 
82 
b41b9915af65da1c03f17f59a1806d0e *./data/ampeg4adap.avi


83 
400192 ./data/ampeg4adap.avi


84 
9dffb8079a1666c054514ab02d9d4871 *./data/out.yuv


85 
stddev: 14.68 PSNR:24.78 bytes:7602176


82 
94c5a5e14f51e04b173d72eb0648b206 *./data/ampeg4adap.avi


83 
400190 ./data/ampeg4adap.avi


84 
8e5842fc2b92afa362bfcf17f339d47f *./data/out.yuv


85 
stddev: 14.67 PSNR:24.79 bytes:7602176


86  86 
5fff534f0b958547dfdb811d4f289931 *./data/ampeg4thread.avi 
87  87 
761170 ./data/ampeg4thread.avi 
88  88 
fe1d119938f8a26174b38eeaa18dff85 *./data/out.yuv 
tests/rotozoom.regression.ref  

79  79 
235016 ./data/ampeg4qprd.avi 
80  80 
224969c07440a23b376521c484936e75 *./data/out.yuv 
81  81 
stddev: 4.24 PSNR:35.56 bytes:7602176 
82 
62c7e87076d4741eb99d76e3ec424db0 *./data/ampeg4adap.avi


83 
205456 ./data/ampeg4adap.avi


84 
fe20d6bd1aa019196fb6426fdd0f4779 *./data/out.yuv


85 
stddev: 4.08 PSNR:35.91 bytes:7602176


82 
7ecfbb848740d316e2fcf573b32cb848 *./data/ampeg4adap.avi


83 
205454 ./data/ampeg4adap.avi


84 
c9225addf2e620e0094d26e805693af1 *./data/out.yuv


85 
stddev: 4.05 PSNR:35.96 bytes:7602176


86  86 
8cd8940d7451925784536fe9b2f2a5e3 *./data/ampeg4thread.avi 
87  87 
254260 ./data/ampeg4thread.avi 
88  88 
d160a4224ea1af66c85178912f8d3a7c *./data/out.yuv 
Also available in: Unified diff