h->next_slice_index = s->gb.index + 8*show_bits (&s->gb, 8*length) + 8*length;
h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits (&s->gb, 8*length) + 8*length;
static int svq3_decode_slice_header (H264Context *h) {  MpegEncContext *const s = (MpegEncContext *) h;  const int mb_xy = s->mb_x + s->mb_y*s->mb_stride;  int i, header;  header = get_bits (&s->gb, 8);  if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {    /* TODO: what? */    av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);    return -1;  } else {    int length = (header >> 5) & 3;    h->next_slice_index = s->gb.index + 8*show_bits (&s->gb, 8*length) + 8*length;    if (h->next_slice_index > s->gb.size_in_bits){      av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");      return -1;    }    s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);    s->gb.index += 8;    if (length > 0) {      memcpy ((uint8_t *) &s->gb.buffer[s->gb.index >> 3],             &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));    }  }  if ((i = svq3_get_ue_golomb (&s->gb)) == INVALID_VLC || i >= 3){    av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i);    return -1;  }  h->slice_type = golomb_to_pict_type[i];  if ((header & 0x9F) == 2) {    i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));    s->mb_skip_run = get_bits (&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));  } else {    get_bits1 (&s->gb);    s->mb_skip_run = 0;  }  h->slice_num = get_bits (&s->gb, 8);  s->qscale = get_bits (&s->gb, 5);  s->adaptive_quant = get_bits1 (&s->gb);  /* unknown fields */  get_bits1 (&s->gb);  if (h->unknown_svq3_flag) {    get_bits1 (&s->gb);  }  get_bits1 (&s->gb);  get_bits (&s->gb, 2);  while (get_bits1 (&s->gb)) {    get_bits (&s->gb, 8);  }  /* reset intra predictors and invalidate motion vector references */  if (s->mb_x > 0) {    memset (h->intra4x4_pred_mode[mb_xy - 1], -1, 4*sizeof(int8_t));    memset (h->intra4x4_pred_mode[mb_xy - s->mb_x], -1, 8*sizeof(int8_t)*s->mb_x);  }  if (s->mb_y > 0) {    memset (h->intra4x4_pred_mode[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));    if (s->mb_x > 0) {      h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] = -1;    }  }  return 0;}