comparison ffv1.c @ 1345:daf951f32697 libavcodec

merge U and V statistics, 33% reduction in memory requirement, compression rate better for some files worse for others, worst compression rate loss 0.05%
author michaelni
date Sat, 05 Jul 2003 14:18:07 +0000
parents c4e6ed5319e7
children 047b1dff5976
comparison
equal deleted inserted replaced
1344:447b88b784ee 1345:daf951f32697
485 common_init(avctx); 485 common_init(avctx);
486 486
487 s->version=0; 487 s->version=0;
488 s->ac= avctx->coder_type; 488 s->ac= avctx->coder_type;
489 489
490 s->plane_count=3; 490 s->plane_count=2;
491 for(i=0; i<256; i++){ 491 for(i=0; i<256; i++){
492 s->quant_table[0][i]= quant11[i]; 492 s->quant_table[0][i]= quant11[i];
493 s->quant_table[1][i]= 11*quant11[i]; 493 s->quant_table[1][i]= 11*quant11[i];
494 if(avctx->context_model==0){ 494 if(avctx->context_model==0){
495 s->quant_table[2][i]= 11*11*quant11[i]; 495 s->quant_table[2][i]= 11*11*quant11[i];
604 const int chroma_height= -((-height)>>f->chroma_v_shift); 604 const int chroma_height= -((-height)>>f->chroma_v_shift);
605 605
606 encode_plane(f, p->data[0], width, height, p->linesize[0], 0); 606 encode_plane(f, p->data[0], width, height, p->linesize[0], 0);
607 607
608 encode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1); 608 encode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
609 encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 2); 609 encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
610 } 610 }
611 emms_c(); 611 emms_c();
612 612
613 f->picture_number++; 613 f->picture_number++;
614 614
749 get_symbol(c, state, 0, 7); //YUV cs type 749 get_symbol(c, state, 0, 7); //YUV cs type
750 get_cabac(c, state); //no chroma = false 750 get_cabac(c, state); //no chroma = false
751 f->chroma_h_shift= get_symbol(c, state, 0, 7); 751 f->chroma_h_shift= get_symbol(c, state, 0, 7);
752 f->chroma_v_shift= get_symbol(c, state, 0, 7); 752 f->chroma_v_shift= get_symbol(c, state, 0, 7);
753 get_cabac(c, state); //transparency plane 753 get_cabac(c, state); //transparency plane
754 f->plane_count= 3; 754 f->plane_count= 2;
755 755
756 switch(16*f->chroma_h_shift + f->chroma_v_shift){ 756 switch(16*f->chroma_h_shift + f->chroma_v_shift){
757 case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break; 757 case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break;
758 case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break; 758 case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break;
759 case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break; 759 case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break;
868 const int chroma_width = -((-width )>>f->chroma_h_shift); 868 const int chroma_width = -((-width )>>f->chroma_h_shift);
869 const int chroma_height= -((-height)>>f->chroma_v_shift); 869 const int chroma_height= -((-height)>>f->chroma_v_shift);
870 decode_plane(f, p->data[0], width, height, p->linesize[0], 0); 870 decode_plane(f, p->data[0], width, height, p->linesize[0], 0);
871 871
872 decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1); 872 decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
873 decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 2); 873 decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
874 } 874 }
875 875
876 emms_c(); 876 emms_c();
877 877
878 f->picture_number++; 878 f->picture_number++;