Mercurial > libavcodec.hg
comparison mpegvideo.c @ 2327:5e5cf598a48b libavcodec
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
author | michael |
---|---|
date | Thu, 28 Oct 2004 10:12:57 +0000 |
parents | 3a8e557a8226 |
children | ada3891b859d |
comparison
equal
deleted
inserted
replaced
2326:fe1986d6230f | 2327:5e5cf598a48b |
---|---|
1078 return -1; | 1078 return -1; |
1079 avctx->delay=0; | 1079 avctx->delay=0; |
1080 s->low_delay=1; | 1080 s->low_delay=1; |
1081 break; | 1081 break; |
1082 #ifdef CONFIG_RISKY | 1082 #ifdef CONFIG_RISKY |
1083 case CODEC_ID_H261: | |
1084 s->out_format = FMT_H261; | |
1085 avctx->delay=0; | |
1086 s->low_delay=1; | |
1087 break; | |
1083 case CODEC_ID_H263: | 1088 case CODEC_ID_H263: |
1084 if (h263_get_picture_format(s->width, s->height) == 7) { | 1089 if (h263_get_picture_format(s->width, s->height) == 7) { |
1085 av_log(avctx, AV_LOG_INFO, "Input picture size isn't suitable for h263 codec! try h263+\n"); | 1090 av_log(avctx, AV_LOG_INFO, "Input picture size isn't suitable for h263 codec! try h263+\n"); |
1086 return -1; | 1091 return -1; |
1087 } | 1092 } |
1197 | 1202 |
1198 ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); | 1203 ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); |
1199 | 1204 |
1200 #ifdef CONFIG_ENCODERS | 1205 #ifdef CONFIG_ENCODERS |
1201 #ifdef CONFIG_RISKY | 1206 #ifdef CONFIG_RISKY |
1207 if (s->out_format == FMT_H261) | |
1208 ff_h261_encode_init(s); | |
1202 if (s->out_format == FMT_H263) | 1209 if (s->out_format == FMT_H263) |
1203 h263_encode_init(s); | 1210 h263_encode_init(s); |
1204 if(s->msmpeg4_version) | 1211 if(s->msmpeg4_version) |
1205 ff_msmpeg4_encode_init(s); | 1212 ff_msmpeg4_encode_init(s); |
1206 #endif | 1213 #endif |
1213 int j= s->dsp.idct_permutation[i]; | 1220 int j= s->dsp.idct_permutation[i]; |
1214 #ifdef CONFIG_RISKY | 1221 #ifdef CONFIG_RISKY |
1215 if(s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ | 1222 if(s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ |
1216 s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; | 1223 s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; |
1217 s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; | 1224 s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; |
1218 }else if(s->out_format == FMT_H263){ | 1225 }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ |
1219 s->intra_matrix[j] = | 1226 s->intra_matrix[j] = |
1220 s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; | 1227 s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; |
1221 }else | 1228 }else |
1222 #endif | 1229 #endif |
1223 { /* mpeg1/2 */ | 1230 { /* mpeg1/2 */ |
4125 case CODEC_ID_MSMPEG4V3: | 4132 case CODEC_ID_MSMPEG4V3: |
4126 case CODEC_ID_WMV1: | 4133 case CODEC_ID_WMV1: |
4127 msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; | 4134 msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; |
4128 case CODEC_ID_WMV2: | 4135 case CODEC_ID_WMV2: |
4129 ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; | 4136 ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; |
4137 case CODEC_ID_H261: | |
4138 ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; | |
4130 case CODEC_ID_H263: | 4139 case CODEC_ID_H263: |
4131 case CODEC_ID_H263P: | 4140 case CODEC_ID_H263P: |
4132 case CODEC_ID_FLV1: | 4141 case CODEC_ID_FLV1: |
4133 case CODEC_ID_RV10: | 4142 case CODEC_ID_RV10: |
4134 h263_encode_mb(s, s->block, motion_x, motion_y); break; | 4143 h263_encode_mb(s, s->block, motion_x, motion_y); break; |
4493 | 4502 |
4494 ff_set_qscale(s, s->qscale); | 4503 ff_set_qscale(s, s->qscale); |
4495 ff_init_block_index(s); | 4504 ff_init_block_index(s); |
4496 | 4505 |
4497 for(mb_x=0; mb_x < s->mb_width; mb_x++) { | 4506 for(mb_x=0; mb_x < s->mb_width; mb_x++) { |
4498 const int xy= mb_y*s->mb_stride + mb_x; | 4507 int xy= mb_y*s->mb_stride + mb_x; // removed const, H261 needs to adjust this |
4499 int mb_type= s->mb_type[xy]; | 4508 int mb_type= s->mb_type[xy]; |
4500 // int d; | 4509 // int d; |
4501 int dmin= INT_MAX; | 4510 int dmin= INT_MAX; |
4502 int dir; | 4511 int dir; |
4503 | 4512 |
4504 s->mb_x = mb_x; | 4513 s->mb_x = mb_x; |
4514 s->mb_y = mb_y; // moved into loop, can get changed by H.261 | |
4505 ff_update_block_index(s); | 4515 ff_update_block_index(s); |
4516 | |
4517 if(s->codec_id == CODEC_ID_H261){ | |
4518 ff_h261_reorder_mb_index(s); | |
4519 xy= s->mb_y*s->mb_stride + s->mb_x; | |
4520 } | |
4506 | 4521 |
4507 /* write gob / video packet header */ | 4522 /* write gob / video packet header */ |
4508 #ifdef CONFIG_RISKY | 4523 #ifdef CONFIG_RISKY |
4509 if(s->rtp_mode){ | 4524 if(s->rtp_mode){ |
4510 int current_packet_size, is_gob_start; | 4525 int current_packet_size, is_gob_start; |
5213 switch(s->out_format) { | 5228 switch(s->out_format) { |
5214 case FMT_MJPEG: | 5229 case FMT_MJPEG: |
5215 mjpeg_picture_header(s); | 5230 mjpeg_picture_header(s); |
5216 break; | 5231 break; |
5217 #ifdef CONFIG_RISKY | 5232 #ifdef CONFIG_RISKY |
5233 case FMT_H261: | |
5234 ff_h261_encode_picture_header(s, picture_number); | |
5235 break; | |
5218 case FMT_H263: | 5236 case FMT_H263: |
5219 if (s->codec_id == CODEC_ID_WMV2) | 5237 if (s->codec_id == CODEC_ID_WMV2) |
5220 ff_wmv2_encode_picture_header(s, picture_number); | 5238 ff_wmv2_encode_picture_header(s, picture_number); |
5221 else if (s->h263_msmpeg4) | 5239 else if (s->h263_msmpeg4) |
5222 msmpeg4_encode_picture_header(s, picture_number); | 5240 msmpeg4_encode_picture_header(s, picture_number); |