Mercurial > libavcodec.hg
comparison h263.c @ 9093:e9ba8210d495 libavcodec
Factor out block decoding in ff_h263_decode_mb()
author | kostya |
---|---|
date | Mon, 02 Mar 2009 17:18:49 +0000 |
parents | 2bf694251330 |
children | b626fed816d7 |
comparison
equal
deleted
inserted
replaced
9092:65f47b345904 | 9093:e9ba8210d495 |
---|---|
4003 skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ | 4003 skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */ |
4004 mot_val[0] = mx; | 4004 mot_val[0] = mx; |
4005 mot_val[1] = my; | 4005 mot_val[1] = my; |
4006 } | 4006 } |
4007 } | 4007 } |
4008 | |
4009 /* decode each block */ | |
4010 for (i = 0; i < 6; i++) { | |
4011 if (h263_decode_block(s, block[i], i, cbp&32) < 0) | |
4012 return -1; | |
4013 cbp+=cbp; | |
4014 } | |
4015 | |
4016 if(s->obmc){ | |
4017 if(s->pict_type == FF_P_TYPE && s->mb_x+1<s->mb_width && s->mb_num_left != 1) | |
4018 preview_obmc(s); | |
4019 } | |
4020 } else if(s->pict_type==FF_B_TYPE) { | 4008 } else if(s->pict_type==FF_B_TYPE) { |
4021 int mb_type; | 4009 int mb_type; |
4022 const int stride= s->b8_stride; | 4010 const int stride= s->b8_stride; |
4023 int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ]; | 4011 int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ]; |
4024 int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ]; | 4012 int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ]; |
4103 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; | 4091 mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; |
4104 } | 4092 } |
4105 } | 4093 } |
4106 | 4094 |
4107 s->current_picture.mb_type[xy]= mb_type; | 4095 s->current_picture.mb_type[xy]= mb_type; |
4108 | |
4109 /* decode each block */ | |
4110 for (i = 0; i < 6; i++) { | |
4111 if (h263_decode_block(s, block[i], i, cbp&32) < 0) | |
4112 return -1; | |
4113 cbp+=cbp; | |
4114 } | |
4115 } else { /* I-Frame */ | 4096 } else { /* I-Frame */ |
4116 do{ | 4097 do{ |
4117 cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); | 4098 cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); |
4118 if (cbpc < 0){ | 4099 if (cbpc < 0){ |
4119 av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); | 4100 av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); |
4144 } | 4125 } |
4145 cbp = (cbpc & 3) | (cbpy << 2); | 4126 cbp = (cbpc & 3) | (cbpy << 2); |
4146 if (dquant) { | 4127 if (dquant) { |
4147 h263_decode_dquant(s); | 4128 h263_decode_dquant(s); |
4148 } | 4129 } |
4149 | 4130 } |
4150 /* decode each block */ | 4131 |
4151 for (i = 0; i < 6; i++) { | 4132 /* decode each block */ |
4152 if (h263_decode_block(s, block[i], i, cbp&32) < 0) | 4133 for (i = 0; i < 6; i++) { |
4153 return -1; | 4134 if (h263_decode_block(s, block[i], i, cbp&32) < 0) |
4154 cbp+=cbp; | 4135 return -1; |
4155 } | 4136 cbp+=cbp; |
4137 } | |
4138 | |
4139 if(s->obmc && !s->mb_intra){ | |
4140 if(s->pict_type == FF_P_TYPE && s->mb_x+1<s->mb_width && s->mb_num_left != 1) | |
4141 preview_obmc(s); | |
4156 } | 4142 } |
4157 end: | 4143 end: |
4158 | 4144 |
4159 /* per-MB end of slice check */ | 4145 /* per-MB end of slice check */ |
4160 { | 4146 { |