comparison h263.c @ 1278:483db104bb7b libavcodec

truncated h263 decoding support / H263-ES "demuxer"
author michaelni
date Thu, 22 May 2003 14:12:22 +0000
parents a979fab41ed8
children 44c94325810c
comparison
equal deleted inserted replaced
1277:f3152eb76f1a 1278:483db104bb7b
3900 } 3900 }
3901 3901
3902 /* most is hardcoded. should extend to handle all h263 streams */ 3902 /* most is hardcoded. should extend to handle all h263 streams */
3903 int h263_decode_picture_header(MpegEncContext *s) 3903 int h263_decode_picture_header(MpegEncContext *s)
3904 { 3904 {
3905 int format, width, height; 3905 int format, width, height, i;
3906 3906 uint32_t startcode;
3907 /* picture start code */ 3907
3908 if (get_bits_long(&s->gb, 22) != 0x20) { 3908 align_get_bits(&s->gb);
3909
3910 startcode= get_bits(&s->gb, 22-8);
3911
3912 for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>0; i--) {
3913 startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
3914
3915 if(startcode == 0x20)
3916 break;
3917 }
3918
3919 if (startcode != 0x20) {
3909 fprintf(stderr, "Bad picture start code\n"); 3920 fprintf(stderr, "Bad picture start code\n");
3910 return -1; 3921 return -1;
3911 } 3922 }
3912 /* temporal reference */ 3923 /* temporal reference */
3913 s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */ 3924 s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
3986 } 3997 }
3987 if (get_bits1(&s->gb) != 0) { /* Advanced Intra Coding (AIC) */ 3998 if (get_bits1(&s->gb) != 0) { /* Advanced Intra Coding (AIC) */
3988 s->h263_aic = 1; 3999 s->h263_aic = 1;
3989 } 4000 }
3990 4001
3991 skip_bits(&s->gb, 7); 4002 if (get_bits1(&s->gb) != 0) {
3992 /* these are the 7 bits: (in order of appearence */ 4003 fprintf(stderr, "Deblocking Filter not supported\n");
3993 /* Deblocking Filter */ 4004 }
3994 /* Slice Structured */ 4005 if (get_bits1(&s->gb) != 0) {
3995 /* Reference Picture Selection */ 4006 fprintf(stderr, "Slice Structured not supported\n");
3996 /* Independent Segment Decoding */ 4007 }
3997 /* Alternative Inter VLC */ 4008 if (get_bits1(&s->gb) != 0) {
3998 /* Modified Quantization */ 4009 fprintf(stderr, "Reference Picture Selection not supported\n");
3999 /* Prevent start code emulation */ 4010 }
4011 if (get_bits1(&s->gb) != 0) {
4012 fprintf(stderr, "Independent Segment Decoding not supported\n");
4013 }
4014 if (get_bits1(&s->gb) != 0) {
4015 fprintf(stderr, "Alternative Inter VLC not supported\n");
4016 }
4017 if (get_bits1(&s->gb) != 0) {
4018 fprintf(stderr, "Modified Quantization not supported\n");
4019 }
4020
4021 skip_bits(&s->gb, 1); /* Prevent start code emulation */
4000 4022
4001 skip_bits(&s->gb, 3); /* Reserved */ 4023 skip_bits(&s->gb, 3); /* Reserved */
4002 } else if (ufep != 0) { 4024 } else if (ufep != 0) {
4003 fprintf(stderr, "Bad UFEP type (%d)\n", ufep); 4025 fprintf(stderr, "Bad UFEP type (%d)\n", ufep);
4004 return -1; 4026 return -1;
4070 }else{ 4092 }else{
4071 s->y_dc_scale_table= 4093 s->y_dc_scale_table=
4072 s->c_dc_scale_table= ff_mpeg1_dc_scale_table; 4094 s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
4073 } 4095 }
4074 4096
4097 if(s->avctx->debug&FF_DEBUG_PICT_INFO){
4098 printf("qp:%d %c size:%d rnd:%d %s %s %s %s\n",
4099 s->qscale, av_get_pict_type_char(s->pict_type),
4100 s->gb.size_in_bits, 1-s->no_rounding,
4101 s->mv_type == MV_TYPE_8X8 ? "ADV" : "",
4102 s->umvplus ? "UMV" : "",
4103 s->h263_long_vectors ? "LONG" : "",
4104 s->h263_plus ? "+" : ""
4105 );
4106 }
4107
4108
4075 return 0; 4109 return 0;
4076 } 4110 }
4077 4111
4078 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s) 4112 static void mpeg4_decode_sprite_trajectory(MpegEncContext * s)
4079 { 4113 {