comparison h263.c @ 1411:c2e63cb94d06 libavcodec

custom quant matrix encoding support
author michaelni
date Fri, 22 Aug 2003 22:18:08 +0000
parents e380ac39024a
children a7a9df478e46
comparison
equal deleted inserted replaced
1410:524c904a66b8 1411:c2e63cb94d06
1857 } 1857 }
1858 1858
1859 s->quant_precision=5; 1859 s->quant_precision=5;
1860 put_bits(&s->pb, 1, 0); /* not 8 bit == false */ 1860 put_bits(&s->pb, 1, 0); /* not 8 bit == false */
1861 put_bits(&s->pb, 1, s->mpeg_quant); /* quant type= (0=h263 style)*/ 1861 put_bits(&s->pb, 1, s->mpeg_quant); /* quant type= (0=h263 style)*/
1862 if(s->mpeg_quant) put_bits(&s->pb, 2, 0); /* no custom matrixes */ 1862
1863 if(s->mpeg_quant){
1864 ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
1865 ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
1866 }
1863 1867
1864 if (vo_ver_id != 1) 1868 if (vo_ver_id != 1)
1865 put_bits(&s->pb, 1, s->quarter_sample); 1869 put_bits(&s->pb, 1, s->quarter_sample);
1866 put_bits(&s->pb, 1, 1); /* complexity estimation disable */ 1870 put_bits(&s->pb, 1, 1); /* complexity estimation disable */
1867 s->resync_marker= s->rtp_mode; 1871 s->resync_marker= s->rtp_mode;
4549 if(s->shape == GRAY_SHAPE && vo_ver_id != 1){ 4553 if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
4550 printf("Gray shape not supported\n"); 4554 printf("Gray shape not supported\n");
4551 skip_bits(gb, 4); //video_object_layer_shape_extension 4555 skip_bits(gb, 4); //video_object_layer_shape_extension
4552 } 4556 }
4553 4557
4554 skip_bits1(gb); /* marker */ 4558 check_marker(gb, "before time_increment_resolution");
4555 4559
4556 s->time_increment_resolution = get_bits(gb, 16); 4560 s->time_increment_resolution = get_bits(gb, 16);
4557 4561
4558 s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1; 4562 s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1;
4559 if (s->time_increment_bits < 1) 4563 if (s->time_increment_bits < 1)
4560 s->time_increment_bits = 1; 4564 s->time_increment_bits = 1;
4561 skip_bits1(gb); /* marker */ 4565
4566 check_marker(gb, "before fixed_vop_rate");
4562 4567
4563 if (get_bits1(gb) != 0) { /* fixed_vop_rate */ 4568 if (get_bits1(gb) != 0) { /* fixed_vop_rate */
4564 skip_bits(gb, s->time_increment_bits); 4569 skip_bits(gb, s->time_increment_bits);
4565 } 4570 }
4566 4571
4646 } 4651 }
4647 4652
4648 /* replicate last value */ 4653 /* replicate last value */
4649 for(; i<64; i++){ 4654 for(; i<64; i++){
4650 int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ]; 4655 int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
4651 s->intra_matrix[j]= v; 4656 s->intra_matrix[j]= last;
4652 s->chroma_intra_matrix[j]= v; 4657 s->chroma_intra_matrix[j]= last;
4653 } 4658 }
4654 } 4659 }
4655 4660
4656 /* load custom non intra matrix */ 4661 /* load custom non intra matrix */
4657 if(get_bits1(gb)){ 4662 if(get_bits1(gb)){
4840 } 4845 }
4841 4846
4842 printf("my guess is %d bits ;)\n",s->time_increment_bits); 4847 printf("my guess is %d bits ;)\n",s->time_increment_bits);
4843 } 4848 }
4844 4849
4845 time_increment= get_bits(gb, s->time_increment_bits); 4850 if(IS_3IV1) time_increment= get_bits1(gb); //FIXME investigate further
4851 else time_increment= get_bits(gb, s->time_increment_bits);
4852
4853 // printf("%d %X\n", s->time_increment_bits, time_increment);
4846 //printf(" type:%d modulo_time_base:%d increment:%d\n", s->pict_type, time_incr, time_increment); 4854 //printf(" type:%d modulo_time_base:%d increment:%d\n", s->pict_type, time_incr, time_increment);
4847 if(s->pict_type!=B_TYPE){ 4855 if(s->pict_type!=B_TYPE){
4848 s->last_time_base= s->time_base; 4856 s->last_time_base= s->time_base;
4849 s->time_base+= time_incr; 4857 s->time_base+= time_incr;
4850 s->time= s->time_base*s->time_increment_resolution + time_increment; 4858 s->time= s->time_base*s->time_increment_resolution + time_increment;