comparison h263.c @ 1424:39ebefd82728 libavcodec

fixing CODEC_FLAG_GLOBAL_HEADER
author michaelni
date Tue, 26 Aug 2003 20:14:28 +0000
parents a7a9df478e46
children 460e5ead6722
comparison
equal deleted inserted replaced
1423:2e590fee59bd 1424:39ebefd82728
67 int n, int coded, int intra, int rvlc); 67 int n, int coded, int intra, int rvlc);
68 static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr); 68 static int h263_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr);
69 #ifdef CONFIG_ENCODERS 69 #ifdef CONFIG_ENCODERS
70 static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n, 70 static void mpeg4_inv_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
71 int dir); 71 int dir);
72 static void mpeg4_encode_visual_object_header(MpegEncContext * s);
73 static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number);
72 #endif //CONFIG_ENCODERS 74 #endif //CONFIG_ENCODERS
73 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s); 75 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s);
74 static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr); 76 static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, uint16_t **dc_val_ptr, int *dir_ptr);
75 77
76 #ifdef CONFIG_ENCODERS 78 #ifdef CONFIG_ENCODERS
1577 s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len; 1579 s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len;
1578 s->inter_ac_vlc_last_length= uni_mpeg4_inter_rl_len + 128*64; 1580 s->inter_ac_vlc_last_length= uni_mpeg4_inter_rl_len + 128*64;
1579 s->luma_dc_vlc_length= uni_DCtab_lum_len; 1581 s->luma_dc_vlc_length= uni_DCtab_lum_len;
1580 s->chroma_dc_vlc_length= uni_DCtab_chrom_len; 1582 s->chroma_dc_vlc_length= uni_DCtab_chrom_len;
1581 s->ac_esc_length= 7+2+1+6+1+12+1; 1583 s->ac_esc_length= 7+2+1+6+1+12+1;
1584
1585 if(s->flags & CODEC_FLAG_GLOBAL_HEADER){
1586 s->avctx->extradata= av_malloc(1024);
1587 init_put_bits(&s->pb, s->avctx->extradata, 1024, NULL, NULL);
1588
1589 mpeg4_encode_visual_object_header(s);
1590 mpeg4_encode_vol_header(s, 0, 0);
1591
1592 // ff_mpeg4_stuffing(&s->pb); ?
1593 flush_put_bits(&s->pb);
1594 s->avctx->extradata_size= (get_bit_count(&s->pb)+7)>>3;
1595 }
1596
1582 break; 1597 break;
1583 case CODEC_ID_H263P: 1598 case CODEC_ID_H263P:
1584 s->fcode_tab= umv_fcode_tab; 1599 s->fcode_tab= umv_fcode_tab;
1585 s->min_qcoeff= -127; 1600 s->min_qcoeff= -127;
1586 s->max_qcoeff= 127; 1601 s->max_qcoeff= 127;
1713 1728
1714 /* must be called before writing the header */ 1729 /* must be called before writing the header */
1715 void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){ 1730 void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){
1716 int time_div, time_mod; 1731 int time_div, time_mod;
1717 1732
1718 if(s->pict_type==I_TYPE){ //we will encode a vol header
1719 int dummy;
1720 av_reduce(&s->time_increment_resolution, &dummy, s->avctx->frame_rate, s->avctx->frame_rate_base, (1<<16)-1);
1721
1722 s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1;
1723 }
1724
1725 if(s->current_picture.pts) 1733 if(s->current_picture.pts)
1726 s->time= (s->current_picture.pts*s->time_increment_resolution + 500*1000)/(1000*1000); 1734 s->time= (s->current_picture.pts*s->time_increment_resolution + 500*1000)/(1000*1000);
1727 else 1735 else
1728 s->time= av_rescale(picture_number*(int64_t)s->avctx->frame_rate_base, s->time_increment_resolution, s->avctx->frame_rate); 1736 s->time= av_rescale(picture_number*(int64_t)s->avctx->frame_rate_base, s->time_increment_resolution, s->avctx->frame_rate);
1729 time_div= s->time/s->time_increment_resolution; 1737 time_div= s->time/s->time_increment_resolution;