FFmpeg
ituh263dec.c
Go to the documentation of this file.
1 /*
2  * ITU H.263 bitstream decoder
3  * Copyright (c) 2000,2001 Fabrice Bellard
4  * H.263+ support.
5  * Copyright (c) 2001 Juan J. Sierralta P
6  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 /**
26  * @file
27  * H.263 decoder.
28  */
29 
30 #define UNCHECKED_BITSTREAM_READER 1
31 #include <limits.h>
32 
33 #include "libavutil/attributes.h"
34 #include "libavutil/imgutils.h"
35 #include "libavutil/internal.h"
36 #include "libavutil/mathematics.h"
37 #include "libavutil/mem_internal.h"
38 #include "avcodec.h"
39 #include "mpegvideo.h"
40 #include "h263.h"
41 #include "h263data.h"
42 #include "internal.h"
43 #include "mathops.h"
44 #include "mpegutils.h"
45 #include "unary.h"
46 #include "flv.h"
47 #include "rv10.h"
48 #include "mpeg4video.h"
49 #include "mpegvideodata.h"
50 
51 // The defines below define the number of bits that are read at once for
52 // reading vlc values. Changing these may improve speed and data cache needs
53 // be aware though that decreasing them may need the number of stages that is
54 // passed to get_vlc* to be increased.
55 #define H263_MBTYPE_B_VLC_BITS 6
56 #define CBPC_B_VLC_BITS 3
57 
58 static const int h263_mb_type_b_map[15]= {
71  0, //stuffing
74 };
75 
77  if(s->avctx->debug&FF_DEBUG_PICT_INFO){
78  av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n",
79  s->qscale, av_get_picture_type_char(s->pict_type),
80  s->gb.size_in_bits, 1-s->no_rounding,
81  s->obmc ? " AP" : "",
82  s->umvplus ? " UMV" : "",
83  s->h263_long_vectors ? " LONG" : "",
84  s->h263_plus ? " +" : "",
85  s->h263_aic ? " AIC" : "",
86  s->alt_inter_vlc ? " AIV" : "",
87  s->modified_quant ? " MQ" : "",
88  s->loop_filter ? " LOOP" : "",
89  s->h263_slice_structured ? " SS" : "",
90  s->avctx->framerate.num, s->avctx->framerate.den
91  );
92  }
93 }
94 
95 /***********************************************/
96 /* decoding */
97 
104 
105 /* init vlcs */
106 
107 /* XXX: find a better solution to handle static init */
109 {
110  static volatile int done = 0;
111 
112  if (!done) {
115  ff_h263_intra_MCBPC_code, 1, 1, 72);
118  ff_h263_inter_MCBPC_code, 1, 1, 198);
120  &ff_h263_cbpy_tab[0][1], 2, 1,
121  &ff_h263_cbpy_tab[0][0], 2, 1, 64);
123  &ff_mvtab[0][1], 2, 1,
124  &ff_mvtab[0][0], 2, 1, 538);
129  &ff_h263_mbtype_b_tab[0][1], 2, 1,
130  &ff_h263_mbtype_b_tab[0][0], 2, 1, 80);
132  &ff_cbpc_b_tab[0][1], 2, 1,
133  &ff_cbpc_b_tab[0][0], 2, 1, 8);
134  done = 1;
135  }
136 }
137 
139 {
140  int i, mb_pos;
141 
142  for (i = 0; i < 6; i++)
143  if (s->mb_num - 1 <= ff_mba_max[i])
144  break;
145  mb_pos = get_bits(&s->gb, ff_mba_length[i]);
146  s->mb_x = mb_pos % s->mb_width;
147  s->mb_y = mb_pos / s->mb_width;
148 
149  return mb_pos;
150 }
151 
152 /**
153  * Decode the group of blocks header or slice header.
154  * @return <0 if an error occurred
155  */
157 {
158  unsigned int val, gob_number;
159  int left;
160 
161  /* Check for GOB Start Code */
162  val = show_bits(&s->gb, 16);
163  if(val)
164  return -1;
165 
166  /* We have a GBSC probably with GSTUFF */
167  skip_bits(&s->gb, 16); /* Drop the zeros */
168  left= get_bits_left(&s->gb);
169  left = FFMIN(left, 32);
170  //MN: we must check the bits left or we might end in an infinite loop (or segfault)
171  for(;left>13; left--){
172  if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
173  }
174  if(left<=13)
175  return -1;
176 
177  if(s->h263_slice_structured){
178  if(check_marker(s->avctx, &s->gb, "before MBA")==0)
179  return -1;
180 
182 
183  if(s->mb_num > 1583)
184  if(check_marker(s->avctx, &s->gb, "after MBA")==0)
185  return -1;
186 
187  s->qscale = get_bits(&s->gb, 5); /* SQUANT */
188  if(check_marker(s->avctx, &s->gb, "after SQUANT")==0)
189  return -1;
190  skip_bits(&s->gb, 2); /* GFID */
191  }else{
192  gob_number = get_bits(&s->gb, 5); /* GN */
193  s->mb_x= 0;
194  s->mb_y= s->gob_index* gob_number;
195  skip_bits(&s->gb, 2); /* GFID */
196  s->qscale = get_bits(&s->gb, 5); /* GQUANT */
197  }
198 
199  if(s->mb_y >= s->mb_height)
200  return -1;
201 
202  if(s->qscale==0)
203  return -1;
204 
205  return 0;
206 }
207 
208 /**
209  * Decode the group of blocks / video packet header / slice header (MPEG-4 Studio).
210  * @return bit position of the resync_marker, or <0 if none was found
211  */
213  int left, pos, ret;
214 
215  /* In MPEG-4 studio mode look for a new slice startcode
216  * and decode slice header */
217  if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) {
218  align_get_bits(&s->gb);
219 
220  while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_STARTCODE) {
221  get_bits(&s->gb, 8);
222  }
223 
224  if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_STARTCODE)
225  return get_bits_count(&s->gb);
226  else
227  return -1;
228  }
229 
230  if(s->codec_id==AV_CODEC_ID_MPEG4){
231  skip_bits1(&s->gb);
232  align_get_bits(&s->gb);
233  }
234 
235  if(show_bits(&s->gb, 16)==0){
236  pos= get_bits_count(&s->gb);
237  if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
238  ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data);
239  else
241  if(ret>=0)
242  return pos;
243  }
244  //OK, it's not where it is supposed to be ...
245  s->gb= s->last_resync_gb;
246  align_get_bits(&s->gb);
247  left= get_bits_left(&s->gb);
248 
249  for(;left>16+1+5+5; left-=8){
250  if(show_bits(&s->gb, 16)==0){
251  GetBitContext bak= s->gb;
252 
253  pos= get_bits_count(&s->gb);
254  if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
255  ret= ff_mpeg4_decode_video_packet_header(s->avctx->priv_data);
256  else
258  if(ret>=0)
259  return pos;
260 
261  s->gb= bak;
262  }
263  skip_bits(&s->gb, 8);
264  }
265 
266  return -1;
267 }
268 
270 {
271  int code, val, sign, shift;
273 
274  if (code == 0)
275  return pred;
276  if (code < 0)
277  return 0xffff;
278 
279  sign = get_bits1(&s->gb);
280  shift = f_code - 1;
281  val = code;
282  if (shift) {
283  val = (val - 1) << shift;
284  val |= get_bits(&s->gb, shift);
285  val++;
286  }
287  if (sign)
288  val = -val;
289  val += pred;
290 
291  /* modulo decoding */
292  if (!s->h263_long_vectors) {
293  val = sign_extend(val, 5 + f_code);
294  } else {
295  /* horrible H.263 long vector mode */
296  if (pred < -31 && val < -63)
297  val += 64;
298  if (pred > 32 && val > 63)
299  val -= 64;
300 
301  }
302  return val;
303 }
304 
305 
306 /* Decode RVLC of H.263+ UMV */
308 {
309  int code = 0, sign;
310 
311  if (get_bits1(&s->gb)) /* Motion difference = 0 */
312  return pred;
313 
314  code = 2 + get_bits1(&s->gb);
315 
316  while (get_bits1(&s->gb))
317  {
318  code <<= 1;
319  code += get_bits1(&s->gb);
320  if (code >= 32768) {
321  avpriv_request_sample(s->avctx, "Huge DMV");
322  return 0xffff;
323  }
324  }
325  sign = code & 1;
326  code >>= 1;
327 
328  code = (sign) ? (pred - code) : (pred + code);
329  ff_tlog(s->avctx,"H.263+ UMV Motion = %d\n", code);
330  return code;
331 
332 }
333 
334 /**
335  * read the next MVs for OBMC. yes this is an ugly hack, feel free to send a patch :)
336  */
338  GetBitContext gb= s->gb;
339 
340  int cbpc, i, pred_x, pred_y, mx, my;
341  int16_t *mot_val;
342  const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
343  const int stride= s->b8_stride*2;
344 
345  for(i=0; i<4; i++)
346  s->block_index[i]+= 2;
347  for(i=4; i<6; i++)
348  s->block_index[i]+= 1;
349  s->mb_x++;
350 
351  av_assert2(s->pict_type == AV_PICTURE_TYPE_P);
352 
353  do{
354  if (get_bits1(&s->gb)) {
355  /* skip mb */
356  mot_val = s->current_picture.motion_val[0][s->block_index[0]];
357  mot_val[0 ]= mot_val[2 ]=
358  mot_val[0+stride]= mot_val[2+stride]= 0;
359  mot_val[1 ]= mot_val[3 ]=
360  mot_val[1+stride]= mot_val[3+stride]= 0;
361 
362  s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
363  goto end;
364  }
366  }while(cbpc == 20);
367 
368  if(cbpc & 4){
369  s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
370  }else{
372  if (cbpc & 8) {
373  if(s->modified_quant){
374  if(get_bits1(&s->gb)) skip_bits(&s->gb, 1);
375  else skip_bits(&s->gb, 5);
376  }else
377  skip_bits(&s->gb, 2);
378  }
379 
380  if ((cbpc & 16) == 0) {
381  s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
382  /* 16x16 motion prediction */
383  mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
384  if (s->umvplus)
385  mx = h263p_decode_umotion(s, pred_x);
386  else
387  mx = ff_h263_decode_motion(s, pred_x, 1);
388 
389  if (s->umvplus)
390  my = h263p_decode_umotion(s, pred_y);
391  else
392  my = ff_h263_decode_motion(s, pred_y, 1);
393 
394  mot_val[0 ]= mot_val[2 ]=
395  mot_val[0+stride]= mot_val[2+stride]= mx;
396  mot_val[1 ]= mot_val[3 ]=
397  mot_val[1+stride]= mot_val[3+stride]= my;
398  } else {
399  s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
400  for(i=0;i<4;i++) {
401  mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
402  if (s->umvplus)
403  mx = h263p_decode_umotion(s, pred_x);
404  else
405  mx = ff_h263_decode_motion(s, pred_x, 1);
406 
407  if (s->umvplus)
408  my = h263p_decode_umotion(s, pred_y);
409  else
410  my = ff_h263_decode_motion(s, pred_y, 1);
411  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
412  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
413  mot_val[0] = mx;
414  mot_val[1] = my;
415  }
416  }
417  }
418 end:
419 
420  for(i=0; i<4; i++)
421  s->block_index[i]-= 2;
422  for(i=4; i<6; i++)
423  s->block_index[i]-= 1;
424  s->mb_x--;
425 
426  s->gb= gb;
427 }
428 
430  static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
431 
432  if(s->modified_quant){
433  if(get_bits1(&s->gb))
434  s->qscale= ff_modified_quant_tab[get_bits1(&s->gb)][ s->qscale ];
435  else
436  s->qscale= get_bits(&s->gb, 5);
437  }else
438  s->qscale += quant_tab[get_bits(&s->gb, 2)];
439  ff_set_qscale(s, s->qscale);
440 }
441 
442 static int h263_decode_block(MpegEncContext * s, int16_t * block,
443  int n, int coded)
444 {
445  int level, i, j, run;
446  RLTable *rl = &ff_h263_rl_inter;
447  const uint8_t *scan_table;
448  GetBitContext gb= s->gb;
449 
450  scan_table = s->intra_scantable.permutated;
451  if (s->h263_aic && s->mb_intra) {
452  rl = &ff_rl_intra_aic;
453  i = 0;
454  if (s->ac_pred) {
455  if (s->h263_aic_dir)
456  scan_table = s->intra_v_scantable.permutated; /* left */
457  else
458  scan_table = s->intra_h_scantable.permutated; /* top */
459  }
460  } else if (s->mb_intra) {
461  /* DC coef */
462  if (CONFIG_RV10_DECODER && s->codec_id == AV_CODEC_ID_RV10) {
463  if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) {
464  int component, diff;
465  component = (n <= 3 ? 0 : n - 4 + 1);
466  level = s->last_dc[component];
467  if (s->rv10_first_dc_coded[component]) {
468  diff = ff_rv_decode_dc(s, n);
469  if (diff < 0)
470  return -1;
471  level += diff;
472  level = level & 0xff; /* handle wrap round */
473  s->last_dc[component] = level;
474  } else {
475  s->rv10_first_dc_coded[component] = 1;
476  }
477  } else {
478  level = get_bits(&s->gb, 8);
479  if (level == 255)
480  level = 128;
481  }
482  }else{
483  level = get_bits(&s->gb, 8);
484  if((level&0x7F) == 0){
485  av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
486  if (s->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT))
487  return -1;
488  }
489  if (level == 255)
490  level = 128;
491  }
492  block[0] = level;
493  i = 1;
494  } else {
495  i = 0;
496  }
497  if (!coded) {
498  if (s->mb_intra && s->h263_aic)
499  goto not_coded;
500  s->block_last_index[n] = i - 1;
501  return 0;
502  }
503 retry:
504  {
505  OPEN_READER(re, &s->gb);
506  i--; // offset by -1 to allow direct indexing of scan_table
507  for(;;) {
508  UPDATE_CACHE(re, &s->gb);
509  GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
510  if (run == 66) {
511  if (level){
512  CLOSE_READER(re, &s->gb);
513  av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
514  return -1;
515  }
516  /* escape */
517  if (CONFIG_FLV_DECODER && s->h263_flv > 1) {
518  int is11 = SHOW_UBITS(re, &s->gb, 1);
519  SKIP_CACHE(re, &s->gb, 1);
520  run = SHOW_UBITS(re, &s->gb, 7) + 1;
521  if (is11) {
522  SKIP_COUNTER(re, &s->gb, 1 + 7);
523  UPDATE_CACHE(re, &s->gb);
524  level = SHOW_SBITS(re, &s->gb, 11);
525  SKIP_COUNTER(re, &s->gb, 11);
526  } else {
527  SKIP_CACHE(re, &s->gb, 7);
528  level = SHOW_SBITS(re, &s->gb, 7);
529  SKIP_COUNTER(re, &s->gb, 1 + 7 + 7);
530  }
531  } else {
532  run = SHOW_UBITS(re, &s->gb, 7) + 1;
533  SKIP_CACHE(re, &s->gb, 7);
534  level = (int8_t)SHOW_UBITS(re, &s->gb, 8);
535  SKIP_COUNTER(re, &s->gb, 7 + 8);
536  if(level == -128){
537  UPDATE_CACHE(re, &s->gb);
538  if (s->codec_id == AV_CODEC_ID_RV10) {
539  /* XXX: should patch encoder too */
540  level = SHOW_SBITS(re, &s->gb, 12);
541  SKIP_COUNTER(re, &s->gb, 12);
542  }else{
543  level = SHOW_UBITS(re, &s->gb, 5);
544  SKIP_CACHE(re, &s->gb, 5);
545  level |= SHOW_SBITS(re, &s->gb, 6) * (1<<5);
546  SKIP_COUNTER(re, &s->gb, 5 + 6);
547  }
548  }
549  }
550  } else {
551  if (SHOW_UBITS(re, &s->gb, 1))
552  level = -level;
553  SKIP_COUNTER(re, &s->gb, 1);
554  }
555  i += run;
556  if (i >= 64){
557  CLOSE_READER(re, &s->gb);
558  // redo update without last flag, revert -1 offset
559  i = i - run + ((run-1)&63) + 1;
560  if (i < 64) {
561  // only last marker, no overrun
562  block[scan_table[i]] = level;
563  break;
564  }
565  if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
566  //Looks like a hack but no, it's the way it is supposed to work ...
567  rl = &ff_rl_intra_aic;
568  i = 0;
569  s->gb= gb;
570  s->bdsp.clear_block(block);
571  goto retry;
572  }
573  av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra);
574  return -1;
575  }
576  j = scan_table[i];
577  block[j] = level;
578  }
579  }
580 not_coded:
581  if (s->mb_intra && s->h263_aic) {
583  i = 63;
584  }
585  s->block_last_index[n] = i;
586  return 0;
587 }
588 
589 static int h263_skip_b_part(MpegEncContext *s, int cbp)
590 {
591  LOCAL_ALIGNED_32(int16_t, dblock, [64]);
592  int i, mbi;
593  int bli[6];
594 
595  /* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly
596  * but real value should be restored in order to be used later (in OBMC condition)
597  */
598  mbi = s->mb_intra;
599  memcpy(bli, s->block_last_index, sizeof(bli));
600  s->mb_intra = 0;
601  for (i = 0; i < 6; i++) {
602  if (h263_decode_block(s, dblock, i, cbp&32) < 0)
603  return -1;
604  cbp+=cbp;
605  }
606  s->mb_intra = mbi;
607  memcpy(s->block_last_index, bli, sizeof(bli));
608  return 0;
609 }
610 
611 static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
612 {
613  int c, mv = 1;
614 
615  if (pb_frame < 3) { // h.263 Annex G and i263 PB-frame
616  c = get_bits1(gb);
617  if (pb_frame == 2 && c)
618  mv = !get_bits1(gb);
619  } else { // h.263 Annex M improved PB-frame
620  mv = get_unary(gb, 0, 4) + 1;
621  c = mv & 1;
622  mv = !!(mv & 2);
623  }
624  if(c)
625  *cbpb = get_bits(gb, 6);
626  return mv;
627 }
628 
629 #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
630 #define tab_bias (tab_size / 2)
631 static inline void set_one_direct_mv(MpegEncContext *s, Picture *p, int i)
632 {
633  int xy = s->block_index[i];
634  uint16_t time_pp = s->pp_time;
635  uint16_t time_pb = s->pb_time;
636  int p_mx, p_my;
637 
638  p_mx = p->motion_val[0][xy][0];
639  if ((unsigned)(p_mx + tab_bias) < tab_size) {
640  s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias];
641  s->mv[1][i][0] = s->direct_scale_mv[1][p_mx + tab_bias];
642  } else {
643  s->mv[0][i][0] = p_mx * time_pb / time_pp;
644  s->mv[1][i][0] = p_mx * (time_pb - time_pp) / time_pp;
645  }
646  p_my = p->motion_val[0][xy][1];
647  if ((unsigned)(p_my + tab_bias) < tab_size) {
648  s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias];
649  s->mv[1][i][1] = s->direct_scale_mv[1][p_my + tab_bias];
650  } else {
651  s->mv[0][i][1] = p_my * time_pb / time_pp;
652  s->mv[1][i][1] = p_my * (time_pb - time_pp) / time_pp;
653  }
654 }
655 
656 /**
657  * @return the mb_type
658  */
660 {
661  const int mb_index = s->mb_x + s->mb_y * s->mb_stride;
662  Picture *p = &s->next_picture;
663  int colocated_mb_type = p->mb_type[mb_index];
664  int i;
665 
666  if (s->codec_tag == AV_RL32("U263") && p->f->pict_type == AV_PICTURE_TYPE_I) {
667  p = &s->last_picture;
668  colocated_mb_type = p->mb_type[mb_index];
669  }
670 
671  if (IS_8X8(colocated_mb_type)) {
672  s->mv_type = MV_TYPE_8X8;
673  for (i = 0; i < 4; i++)
674  set_one_direct_mv(s, p, i);
676  } else {
677  set_one_direct_mv(s, p, 0);
678  s->mv[0][1][0] =
679  s->mv[0][2][0] =
680  s->mv[0][3][0] = s->mv[0][0][0];
681  s->mv[0][1][1] =
682  s->mv[0][2][1] =
683  s->mv[0][3][1] = s->mv[0][0][1];
684  s->mv[1][1][0] =
685  s->mv[1][2][0] =
686  s->mv[1][3][0] = s->mv[1][0][0];
687  s->mv[1][1][1] =
688  s->mv[1][2][1] =
689  s->mv[1][3][1] = s->mv[1][0][1];
690  s->mv_type = MV_TYPE_8X8;
691  // Note see prev line
693  }
694 }
695 
697  int16_t block[6][64])
698 {
699  int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
700  int16_t *mot_val;
701  const int xy= s->mb_x + s->mb_y * s->mb_stride;
702  int cbpb = 0, pb_mv_count = 0;
703 
704  av_assert2(!s->h263_pred);
705 
706  if (s->pict_type == AV_PICTURE_TYPE_P) {
707  do{
708  if (get_bits1(&s->gb)) {
709  /* skip mb */
710  s->mb_intra = 0;
711  for(i=0;i<6;i++)
712  s->block_last_index[i] = -1;
713  s->mv_dir = MV_DIR_FORWARD;
714  s->mv_type = MV_TYPE_16X16;
715  s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
716  s->mv[0][0][0] = 0;
717  s->mv[0][0][1] = 0;
718  s->mb_skipped = !(s->obmc | s->loop_filter);
719  goto end;
720  }
722  if (cbpc < 0){
723  av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
724  return SLICE_ERROR;
725  }
726  }while(cbpc == 20);
727 
728  s->bdsp.clear_blocks(s->block[0]);
729 
730  dquant = cbpc & 8;
731  s->mb_intra = ((cbpc & 4) != 0);
732  if (s->mb_intra) goto intra;
733 
734  if(s->pb_frame && get_bits1(&s->gb))
735  pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
736  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
737 
738  if (cbpy < 0) {
739  av_log(s->avctx, AV_LOG_ERROR, "cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
740  return SLICE_ERROR;
741  }
742 
743  if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
744  cbpy ^= 0xF;
745 
746  cbp = (cbpc & 3) | (cbpy << 2);
747  if (dquant) {
749  }
750 
751  s->mv_dir = MV_DIR_FORWARD;
752  if ((cbpc & 16) == 0) {
753  s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0;
754  /* 16x16 motion prediction */
755  s->mv_type = MV_TYPE_16X16;
756  ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
757  if (s->umvplus)
758  mx = h263p_decode_umotion(s, pred_x);
759  else
760  mx = ff_h263_decode_motion(s, pred_x, 1);
761 
762  if (mx >= 0xffff)
763  return SLICE_ERROR;
764 
765  if (s->umvplus)
766  my = h263p_decode_umotion(s, pred_y);
767  else
768  my = ff_h263_decode_motion(s, pred_y, 1);
769 
770  if (my >= 0xffff)
771  return SLICE_ERROR;
772  s->mv[0][0][0] = mx;
773  s->mv[0][0][1] = my;
774 
775  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
776  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
777  } else {
778  s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0;
779  s->mv_type = MV_TYPE_8X8;
780  for(i=0;i<4;i++) {
781  mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
782  if (s->umvplus)
783  mx = h263p_decode_umotion(s, pred_x);
784  else
785  mx = ff_h263_decode_motion(s, pred_x, 1);
786  if (mx >= 0xffff)
787  return SLICE_ERROR;
788 
789  if (s->umvplus)
790  my = h263p_decode_umotion(s, pred_y);
791  else
792  my = ff_h263_decode_motion(s, pred_y, 1);
793  if (my >= 0xffff)
794  return SLICE_ERROR;
795  s->mv[0][i][0] = mx;
796  s->mv[0][i][1] = my;
797  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
798  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
799  mot_val[0] = mx;
800  mot_val[1] = my;
801  }
802  }
803  } else if(s->pict_type==AV_PICTURE_TYPE_B) {
804  int mb_type;
805  const int stride= s->b8_stride;
806  int16_t *mot_val0 = s->current_picture.motion_val[0][2 * (s->mb_x + s->mb_y * stride)];
807  int16_t *mot_val1 = s->current_picture.motion_val[1][2 * (s->mb_x + s->mb_y * stride)];
808 // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
809 
810  //FIXME ugly
811  mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]=
812  mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]=
813  mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]=
814  mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0;
815 
816  do{
818  if (mb_type < 0){
819  av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y);
820  return SLICE_ERROR;
821  }
822 
823  mb_type= h263_mb_type_b_map[ mb_type ];
824  }while(!mb_type);
825 
826  s->mb_intra = IS_INTRA(mb_type);
827  if(HAS_CBP(mb_type)){
828  s->bdsp.clear_blocks(s->block[0]);
829  cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
830  if(s->mb_intra){
831  dquant = IS_QUANT(mb_type);
832  goto intra;
833  }
834 
835  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
836 
837  if (cbpy < 0){
838  av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
839  return SLICE_ERROR;
840  }
841 
842  if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
843  cbpy ^= 0xF;
844 
845  cbp = (cbpc & 3) | (cbpy << 2);
846  }else
847  cbp=0;
848 
849  av_assert2(!s->mb_intra);
850 
851  if(IS_QUANT(mb_type)){
853  }
854 
855  if(IS_DIRECT(mb_type)){
857  mb_type |= set_direct_mv(s);
858  }else{
859  s->mv_dir = 0;
860  s->mv_type= MV_TYPE_16X16;
861 //FIXME UMV
862 
863  if(USES_LIST(mb_type, 0)){
864  int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
865  s->mv_dir = MV_DIR_FORWARD;
866 
867  if (s->umvplus)
868  mx = h263p_decode_umotion(s, pred_x);
869  else
870  mx = ff_h263_decode_motion(s, pred_x, 1);
871  if (mx >= 0xffff)
872  return SLICE_ERROR;
873 
874  if (s->umvplus)
875  my = h263p_decode_umotion(s, pred_y);
876  else
877  my = ff_h263_decode_motion(s, pred_y, 1);
878  if (my >= 0xffff)
879  return SLICE_ERROR;
880 
881  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
882  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
883 
884  s->mv[0][0][0] = mx;
885  s->mv[0][0][1] = my;
886  mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
887  mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
888  }
889 
890  if(USES_LIST(mb_type, 1)){
891  int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &pred_x, &pred_y);
892  s->mv_dir |= MV_DIR_BACKWARD;
893 
894  if (s->umvplus)
895  mx = h263p_decode_umotion(s, pred_x);
896  else
897  mx = ff_h263_decode_motion(s, pred_x, 1);
898  if (mx >= 0xffff)
899  return SLICE_ERROR;
900 
901  if (s->umvplus)
902  my = h263p_decode_umotion(s, pred_y);
903  else
904  my = ff_h263_decode_motion(s, pred_y, 1);
905  if (my >= 0xffff)
906  return SLICE_ERROR;
907 
908  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
909  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
910 
911  s->mv[1][0][0] = mx;
912  s->mv[1][0][1] = my;
913  mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
914  mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
915  }
916  }
917 
918  s->current_picture.mb_type[xy] = mb_type;
919  } else { /* I-Frame */
920  do{
922  if (cbpc < 0){
923  av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
924  return SLICE_ERROR;
925  }
926  }while(cbpc == 8);
927 
928  s->bdsp.clear_blocks(s->block[0]);
929 
930  dquant = cbpc & 4;
931  s->mb_intra = 1;
932 intra:
933  s->current_picture.mb_type[xy] = MB_TYPE_INTRA;
934  if (s->h263_aic) {
935  s->ac_pred = get_bits1(&s->gb);
936  if(s->ac_pred){
937  s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED;
938 
939  s->h263_aic_dir = get_bits1(&s->gb);
940  }
941  }else
942  s->ac_pred = 0;
943 
944  if(s->pb_frame && get_bits1(&s->gb))
945  pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
946  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
947  if(cbpy<0){
948  av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
949  return SLICE_ERROR;
950  }
951  cbp = (cbpc & 3) | (cbpy << 2);
952  if (dquant) {
954  }
955 
956  pb_mv_count += !!s->pb_frame;
957  }
958 
959  while(pb_mv_count--){
960  ff_h263_decode_motion(s, 0, 1);
961  ff_h263_decode_motion(s, 0, 1);
962  }
963 
964  /* decode each block */
965  for (i = 0; i < 6; i++) {
966  if (h263_decode_block(s, block[i], i, cbp&32) < 0)
967  return -1;
968  cbp+=cbp;
969  }
970 
971  if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0)
972  return -1;
973  if(s->obmc && !s->mb_intra){
974  if(s->pict_type == AV_PICTURE_TYPE_P && s->mb_x+1<s->mb_width && s->mb_num_left != 1)
975  preview_obmc(s);
976  }
977 end:
978 
979  if (get_bits_left(&s->gb) < 0)
980  return AVERROR_INVALIDDATA;
981 
982  /* per-MB end of slice check */
983  {
984  int v= show_bits(&s->gb, 16);
985 
986  if (get_bits_left(&s->gb) < 16) {
987  v >>= 16 - get_bits_left(&s->gb);
988  }
989 
990  if(v==0)
991  return SLICE_END;
992  }
993 
994  return SLICE_OK;
995 }
996 
997 /* Most is hardcoded; should extend to handle all H.263 streams. */
999 {
1000  int format, width, height, i, ret;
1001  uint32_t startcode;
1002 
1003  align_get_bits(&s->gb);
1004 
1005  if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) {
1006  av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n");
1007  }
1008 
1009  startcode= get_bits(&s->gb, 22-8);
1010 
1011  for(i= get_bits_left(&s->gb); i>24; i-=8) {
1012  startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
1013 
1014  if(startcode == 0x20)
1015  break;
1016  }
1017 
1018  if (startcode != 0x20) {
1019  av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
1020  return -1;
1021  }
1022  /* temporal reference */
1023  i = get_bits(&s->gb, 8); /* picture timestamp */
1024 
1025  i -= (i - (s->picture_number & 0xFF) + 128) & ~0xFF;
1026 
1027  s->picture_number= (s->picture_number&~0xFF) + i;
1028 
1029  /* PTYPE starts here */
1030  if (check_marker(s->avctx, &s->gb, "in PTYPE") != 1) {
1031  return -1;
1032  }
1033  if (get_bits1(&s->gb) != 0) {
1034  av_log(s->avctx, AV_LOG_ERROR, "Bad H.263 id\n");
1035  return -1; /* H.263 id */
1036  }
1037  skip_bits1(&s->gb); /* split screen off */
1038  skip_bits1(&s->gb); /* camera off */
1039  skip_bits1(&s->gb); /* freeze picture release off */
1040 
1041  format = get_bits(&s->gb, 3);
1042  /*
1043  0 forbidden
1044  1 sub-QCIF
1045  10 QCIF
1046  7 extended PTYPE (PLUSPTYPE)
1047  */
1048 
1049  if (format != 7 && format != 6) {
1050  s->h263_plus = 0;
1051  /* H.263v1 */
1052  width = ff_h263_format[format][0];
1054  if (!width)
1055  return -1;
1056 
1057  s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
1058 
1059  s->h263_long_vectors = get_bits1(&s->gb);
1060 
1061  if (get_bits1(&s->gb) != 0) {
1062  av_log(s->avctx, AV_LOG_ERROR, "H.263 SAC not supported\n");
1063  return -1; /* SAC: off */
1064  }
1065  s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
1066  s->unrestricted_mv = s->h263_long_vectors || s->obmc;
1067 
1068  s->pb_frame = get_bits1(&s->gb);
1069  s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
1070  skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
1071 
1072  s->width = width;
1073  s->height = height;
1074  s->avctx->sample_aspect_ratio= (AVRational){12,11};
1075  s->avctx->framerate = (AVRational){ 30000, 1001 };
1076  } else {
1077  int ufep;
1078 
1079  /* H.263v2 */
1080  s->h263_plus = 1;
1081  ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */
1082 
1083  /* ufep other than 0 and 1 are reserved */
1084  if (ufep == 1) {
1085  /* OPPTYPE */
1086  format = get_bits(&s->gb, 3);
1087  ff_dlog(s->avctx, "ufep=1, format: %d\n", format);
1088  s->custom_pcf= get_bits1(&s->gb);
1089  s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
1090  if (get_bits1(&s->gb) != 0) {
1091  av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
1092  }
1093  s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
1094  s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */
1095  s->loop_filter= get_bits1(&s->gb);
1096  s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter;
1097  if(s->avctx->lowres)
1098  s->loop_filter = 0;
1099 
1100  s->h263_slice_structured= get_bits1(&s->gb);
1101  if (get_bits1(&s->gb) != 0) {
1102  av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");
1103  }
1104  if (get_bits1(&s->gb) != 0) {
1105  av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");
1106  }
1107  s->alt_inter_vlc= get_bits1(&s->gb);
1108  s->modified_quant= get_bits1(&s->gb);
1109  if(s->modified_quant)
1110  s->chroma_qscale_table= ff_h263_chroma_qscale_table;
1111 
1112  skip_bits(&s->gb, 1); /* Prevent start code emulation */
1113 
1114  skip_bits(&s->gb, 3); /* Reserved */
1115  } else if (ufep != 0) {
1116  av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);
1117  return -1;
1118  }
1119 
1120  /* MPPTYPE */
1121  s->pict_type = get_bits(&s->gb, 3);
1122  switch(s->pict_type){
1123  case 0: s->pict_type= AV_PICTURE_TYPE_I;break;
1124  case 1: s->pict_type= AV_PICTURE_TYPE_P;break;
1125  case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break;
1126  case 3: s->pict_type= AV_PICTURE_TYPE_B;break;
1127  case 7: s->pict_type= AV_PICTURE_TYPE_I;break; //ZYGO
1128  default:
1129  return -1;
1130  }
1131  skip_bits(&s->gb, 2);
1132  s->no_rounding = get_bits1(&s->gb);
1133  skip_bits(&s->gb, 4);
1134 
1135  /* Get the picture dimensions */
1136  if (ufep) {
1137  if (format == 6) {
1138  /* Custom Picture Format (CPFMT) */
1139  s->aspect_ratio_info = get_bits(&s->gb, 4);
1140  ff_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
1141  /* aspect ratios:
1142  0 - forbidden
1143  1 - 1:1
1144  2 - 12:11 (CIF 4:3)
1145  3 - 10:11 (525-type 4:3)
1146  4 - 16:11 (CIF 16:9)
1147  5 - 40:33 (525-type 16:9)
1148  6-14 - reserved
1149  */
1150  width = (get_bits(&s->gb, 9) + 1) * 4;
1151  check_marker(s->avctx, &s->gb, "in dimensions");
1152  height = get_bits(&s->gb, 9) * 4;
1153  ff_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
1154  if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
1155  /* expected dimensions */
1156  s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);
1157  s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);
1158  }else{
1159  s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
1160  }
1161  } else {
1162  width = ff_h263_format[format][0];
1164  s->avctx->sample_aspect_ratio= (AVRational){12,11};
1165  }
1166  s->avctx->sample_aspect_ratio.den <<= s->ehc_mode;
1167  if ((width == 0) || (height == 0))
1168  return -1;
1169  s->width = width;
1170  s->height = height;
1171 
1172  if(s->custom_pcf){
1173  int gcd;
1174  s->avctx->framerate.num = 1800000;
1175  s->avctx->framerate.den = 1000 + get_bits1(&s->gb);
1176  s->avctx->framerate.den *= get_bits(&s->gb, 7);
1177  if(s->avctx->framerate.den == 0){
1178  av_log(s, AV_LOG_ERROR, "zero framerate\n");
1179  return -1;
1180  }
1181  gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num);
1182  s->avctx->framerate.den /= gcd;
1183  s->avctx->framerate.num /= gcd;
1184  }else{
1185  s->avctx->framerate = (AVRational){ 30000, 1001 };
1186  }
1187  }
1188 
1189  if(s->custom_pcf){
1190  skip_bits(&s->gb, 2); //extended Temporal reference
1191  }
1192 
1193  if (ufep) {
1194  if (s->umvplus) {
1195  if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
1196  skip_bits1(&s->gb);
1197  }
1198  if(s->h263_slice_structured){
1199  if (get_bits1(&s->gb) != 0) {
1200  av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n");
1201  }
1202  if (get_bits1(&s->gb) != 0) {
1203  av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n");
1204  }
1205  }
1206  if (s->pict_type == AV_PICTURE_TYPE_B) {
1207  skip_bits(&s->gb, 4); //ELNUM
1208  if (ufep == 1) {
1209  skip_bits(&s->gb, 4); // RLNUM
1210  }
1211  }
1212  }
1213 
1214  s->qscale = get_bits(&s->gb, 5);
1215  }
1216 
1217  if ((ret = av_image_check_size(s->width, s->height, 0, s)) < 0)
1218  return ret;
1219 
1220  if (!(s->avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
1221  if ((s->width * s->height / 256 / 8) > get_bits_left(&s->gb))
1222  return AVERROR_INVALIDDATA;
1223  }
1224 
1225  s->mb_width = (s->width + 15) / 16;
1226  s->mb_height = (s->height + 15) / 16;
1227  s->mb_num = s->mb_width * s->mb_height;
1228 
1229  if (s->pb_frame) {
1230  skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */
1231  if (s->custom_pcf)
1232  skip_bits(&s->gb, 2); //extended Temporal reference
1233  skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
1234  }
1235 
1236  if (s->pict_type!=AV_PICTURE_TYPE_B) {
1237  s->time = s->picture_number;
1238  s->pp_time = s->time - s->last_non_b_time;
1239  s->last_non_b_time = s->time;
1240  }else{
1241  s->time = s->picture_number;
1242  s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
1243  if (s->pp_time <=s->pb_time ||
1244  s->pp_time <= s->pp_time - s->pb_time ||
1245  s->pp_time <= 0){
1246  s->pp_time = 2;
1247  s->pb_time = 1;
1248  }
1250  }
1251 
1252  /* PEI */
1253  if (skip_1stop_8data_bits(&s->gb) < 0)
1254  return AVERROR_INVALIDDATA;
1255 
1256  if(s->h263_slice_structured){
1257  if (check_marker(s->avctx, &s->gb, "SEPB1") != 1) {
1258  return -1;
1259  }
1260 
1262 
1263  if (check_marker(s->avctx, &s->gb, "SEPB2") != 1) {
1264  return -1;
1265  }
1266  }
1267  s->f_code = 1;
1268 
1269  if (s->pict_type == AV_PICTURE_TYPE_B)
1270  s->low_delay = 0;
1271 
1272  if(s->h263_aic){
1273  s->y_dc_scale_table=
1274  s->c_dc_scale_table= ff_aic_dc_scale_table;
1275  }else{
1276  s->y_dc_scale_table=
1277  s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
1278  }
1279 
1281  if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){
1282  int i,j;
1283  for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
1284  av_log(s->avctx, AV_LOG_DEBUG, "\n");
1285  for(i=0; i<13; i++){
1286  for(j=0; j<3; j++){
1287  int v= get_bits(&s->gb, 8);
1288  v |= get_sbits(&s->gb, 8) * (1 << 8);
1289  av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);
1290  }
1291  av_log(s->avctx, AV_LOG_DEBUG, "\n");
1292  }
1293  for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
1294  }
1295 
1296  return 0;
1297 }
IS_8X8
#define IS_8X8(a)
Definition: mpegutils.h:88
MB_TYPE_L0
#define MB_TYPE_L0
Definition: mpegutils.h:66
stride
int stride
Definition: mace.c:144
MV_TYPE_16X16
#define MV_TYPE_16X16
1 vector for the whole mb
Definition: mpegvideo.h:255
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
h263data.h
FF_ASPECT_EXTENDED
#define FF_ASPECT_EXTENDED
Definition: h263.h:30
level
uint8_t level
Definition: svq3.c:204
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:603
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:850
ff_h263_show_pict_info
void ff_h263_show_pict_info(MpegEncContext *s)
Print picture info if FF_DEBUG_PICT_INFO is set.
Definition: ituh263dec.c:76
mem_internal.h
ff_h263_pred_acdc
void ff_h263_pred_acdc(MpegEncContext *s, int16_t *block, int n)
Definition: h263.c:231
ff_mpeg1_dc_scale_table
const uint8_t ff_mpeg1_dc_scale_table[128]
Definition: mpegvideodata.c:33
INIT_VLC_STATIC
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
Definition: vlc.h:120
mv
static const int8_t mv[256][2]
Definition: 4xm.c:79
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:220
MV_DIRECT
#define MV_DIRECT
bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4)
Definition: mpegvideo.h:253
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:62
internal.h
MB_TYPE_INTRA4x4
#define MB_TYPE_INTRA4x4
Definition: mpegutils.h:50
MB_TYPE_16x16
#define MB_TYPE_16x16
Definition: mpegutils.h:53
h263_decode_dquant
static void h263_decode_dquant(MpegEncContext *s)
Definition: ituh263dec.c:429
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:798
ff_mpeg4_decode_video_packet_header
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
Decode the next video packet.
Definition: mpeg4videodec.c:445
h263_mb_type_b_map
static const int h263_mb_type_b_map[15]
Definition: ituh263dec.c:58
mpegvideo.h
AV_EF_COMPLIANT
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
Definition: avcodec.h:1339
mathematics.h
MB_TYPE_L1
#define MB_TYPE_L1
Definition: mpegutils.h:67
UPDATE_CACHE
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:179
Picture
Picture.
Definition: mpegpicture.h:45
h263_decode_block
static int h263_decode_block(MpegEncContext *s, int16_t *block, int n, int coded)
Definition: ituh263dec.c:442
ff_h263_decode_mba
int ff_h263_decode_mba(MpegEncContext *s)
Definition: ituh263dec.c:138
mpegutils.h
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1303
MV_DIR_BACKWARD
#define MV_DIR_BACKWARD
Definition: mpegvideo.h:252
av_gcd
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition: mathematics.c:36
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:468
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:380
SKIP_CACHE
#define SKIP_CACHE(name, gb, num)
Definition: get_bits.h:181
ff_h263_decode_mb
int ff_h263_decode_mb(MpegEncContext *s, int16_t block[6][64])
Definition: ituh263dec.c:696
INTRA_MCBPC_VLC_BITS
#define INTRA_MCBPC_VLC_BITS
Definition: h263.h:38
ff_h263_pred_motion
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
Definition: h263.c:318
ff_h263_pixel_aspect
const AVRational ff_h263_pixel_aspect[16]
Definition: h263data.c:273
preview_obmc
static void preview_obmc(MpegEncContext *s)
read the next MVs for OBMC.
Definition: ituh263dec.c:337
RLTable
RLTable.
Definition: rl.h:39
GetBitContext
Definition: get_bits.h:62
USES_LIST
#define USES_LIST(a, list)
Definition: mpegutils.h:98
H263_MV_VLC_BITS
#define H263_MV_VLC_BITS
Definition: h263.h:37
MB_TYPE_CBP
#define MB_TYPE_CBP
Definition: mpegutils.h:70
val
static double val(void *priv, double ch)
Definition: aeval.c:76
SLICE_END
#define SLICE_END
end marker found
Definition: mpegvideo.h:511
HAS_CBP
#define HAS_CBP(a)
Definition: mpegutils.h:100
flv.h
CBPY_VLC_BITS
#define CBPY_VLC_BITS
Definition: h263.h:40
AV_EF_BITSTREAM
#define AV_EF_BITSTREAM
detect bitstream specification deviations
Definition: avcodec.h:1333
ff_cbpc_b_tab
const uint8_t ff_cbpc_b_tab[4][2]
Definition: h263data.c:75
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
INIT_FIRST_VLC_RL
#define INIT_FIRST_VLC_RL(rl, static_size)
Definition: rl.h:86
av_cold
#define av_cold
Definition: attributes.h:90
cbpc_b_vlc
static VLC cbpc_b_vlc
Definition: ituh263dec.c:103
MB_TYPE_ACPRED
#define MB_TYPE_ACPRED
Definition: mpegutils.h:59
h263_decode_gob_header
static int h263_decode_gob_header(MpegEncContext *s)
Decode the group of blocks header or slice header.
Definition: ituh263dec.c:156
CLOSE_READER
#define CLOSE_READER(name, gb)
Definition: get_bits.h:150
ff_h263_decode_init_vlc
av_cold void ff_h263_decode_init_vlc(void)
Definition: ituh263dec.c:108
width
#define width
ff_h263_chroma_qscale_table
const uint8_t ff_h263_chroma_qscale_table[32]
Definition: h263data.c:260
s
#define s(width, name)
Definition: cbs_vp9.c:257
SHOW_SBITS
#define SHOW_SBITS(name, gb, num)
Definition: get_bits.h:213
set_one_direct_mv
static void set_one_direct_mv(MpegEncContext *s, Picture *p, int i)
Definition: ituh263dec.c:631
get_sbits
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:360
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
limits.h
IS_INTRA
#define IS_INTRA(x, y)
ff_h263_resync
int ff_h263_resync(MpegEncContext *s)
Decode the group of blocks / video packet header / slice header (MPEG-4 Studio).
Definition: ituh263dec.c:212
tab_size
#define tab_size
Definition: ituh263dec.c:629
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:136
run
uint8_t run
Definition: svq3.c:203
tab_bias
#define tab_bias
Definition: ituh263dec.c:630
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
MB_TYPE_8x8
#define MB_TYPE_8x8
Definition: mpegutils.h:56
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:499
ff_set_qscale
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
Definition: mpegvideo.c:2351
mathops.h
ff_mba_max
const uint16_t ff_mba_max[6]
Definition: h263data.c:265
MB_TYPE_QUANT
#define MB_TYPE_QUANT
Definition: mpegutils.h:69
ff_h263_decode_picture_header
int ff_h263_decode_picture_header(MpegEncContext *s)
Definition: ituh263dec.c:998
ff_h263_inter_MCBPC_vlc
VLC ff_h263_inter_MCBPC_vlc
Definition: ituh263dec.c:99
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ff_h263_intra_MCBPC_vlc
VLC ff_h263_intra_MCBPC_vlc
Definition: ituh263dec.c:98
get_unary
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
MV_TYPE_8X8
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
Definition: mpegvideo.h:256
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:29
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:414
ff_h263_rl_inter
RLTable ff_h263_rl_inter
Definition: h263data.c:159
ff_h263_mv_vlc
VLC ff_h263_mv_vlc
Definition: ituh263dec.c:101
ff_h263_cbpy_tab
const uint8_t ff_h263_cbpy_tab[16][2]
Definition: h263data.c:82
ff_rl_intra_aic
RLTable ff_rl_intra_aic
Definition: h263data.c:228
MB_TYPE_SKIP
#define MB_TYPE_SKIP
Definition: mpegutils.h:61
format
ofilter format
Definition: ffmpeg_filter.c:172
h263_mbtype_b_vlc
static VLC h263_mbtype_b_vlc
Definition: ituh263dec.c:102
OPEN_READER
#define OPEN_READER(name, gb)
Definition: get_bits.h:139
INTER_MCBPC_VLC_BITS
#define INTER_MCBPC_VLC_BITS
Definition: h263.h:39
height
#define height
mpegvideodata.h
attributes.h
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:539
Picture::motion_val
int16_t(*[2] motion_val)[2]
Definition: mpegpicture.h:53
ff_h263_inter_MCBPC_bits
const uint8_t ff_h263_inter_MCBPC_bits[28]
Definition: h263data.c:47
rv10.h
IS_DIRECT
#define IS_DIRECT(a)
Definition: mpegutils.h:83
unary.h
H263_MBTYPE_B_VLC_BITS
#define H263_MBTYPE_B_VLC_BITS
Definition: ituh263dec.c:55
ff_rv_decode_dc
int ff_rv_decode_dc(MpegEncContext *s, int n)
Definition: rv10.c:81
av_get_picture_type_char
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
Definition: utils.c:83
MB_TYPE_L0L1
#define MB_TYPE_L0L1
Definition: mpegutils.h:68
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
AV_CODEC_ID_RV10
@ AV_CODEC_ID_RV10
Definition: codec_id.h:55
SKIP_COUNTER
#define SKIP_COUNTER(name, gb, num)
Definition: get_bits.h:186
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:447
internal.h
IS_QUANT
#define IS_QUANT(a)
Definition: mpegutils.h:94
h263_skip_b_part
static int h263_skip_b_part(MpegEncContext *s, int cbp)
Definition: ituh263dec.c:589
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
ff_h263_format
const uint16_t ff_h263_format[8][2]
Definition: h263data.c:236
CBPC_B_VLC_BITS
#define CBPC_B_VLC_BITS
Definition: ituh263dec.c:56
avcodec.h
GET_RL_VLC
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)
Definition: get_bits.h:739
ret
ret
Definition: filter_design.txt:187
SLICE_OK
#define SLICE_OK
Definition: mpegvideo.h:509
pred
static const float pred[4]
Definition: siprdata.h:259
ff_aic_dc_scale_table
const uint8_t ff_aic_dc_scale_table[32]
Definition: h263data.c:245
align_get_bits
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:694
TEX_VLC_BITS
#define TEX_VLC_BITS
Definition: dvdec.c:132
pos
unsigned int pos
Definition: spdifenc.c:412
ff_mpeg4_init_direct_mv
void ff_mpeg4_init_direct_mv(MpegEncContext *s)
Definition: mpeg4video.c:83
ff_mvtab
const uint8_t ff_mvtab[33][2]
Definition: h263data.c:88
left
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
Definition: snow.txt:386
AV_CODEC_FLAG2_CHUNKS
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
Definition: avcodec.h:306
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
ff_h263_intra_MCBPC_bits
const uint8_t ff_h263_intra_MCBPC_bits[9]
Definition: h263data.c:33
skip_1stop_8data_bits
static int skip_1stop_8data_bits(GetBitContext *gb)
Definition: get_bits.h:855
Picture::mb_type
uint32_t * mb_type
types and macros are defined in mpegutils.h
Definition: mpegpicture.h:56
ff_h263_intra_MCBPC_code
const uint8_t ff_h263_intra_MCBPC_code[9]
Definition: h263data.c:32
SHOW_UBITS
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:212
AV_PICTURE_TYPE_B
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:276
mpeg4video.h
Picture::f
struct AVFrame * f
Definition: mpegpicture.h:46
VLC
Definition: vlc.h:26
sign_extend
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:130
ff_mba_length
const uint8_t ff_mba_length[7]
Definition: h263data.c:269
h263p_decode_umotion
static int h263p_decode_umotion(MpegEncContext *s, int pred)
Definition: ituh263dec.c:307
shift
static int shift(int a, int b)
Definition: sonic.c:83
ff_h263_inter_MCBPC_code
const uint8_t ff_h263_inter_MCBPC_code[28]
Definition: h263data.c:38
INIT_VLC_RL
#define INIT_VLC_RL(rl, static_size)
Definition: rl.h:73
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:275
set_direct_mv
static int set_direct_mv(MpegEncContext *s)
Definition: ituh263dec.c:659
ff_modified_quant_tab
const uint8_t ff_modified_quant_tab[2][32]
Definition: h263data.c:250
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:37
check_marker
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
Definition: get_bits.h:613
SLICE_ERROR
#define SLICE_ERROR
Definition: mpegvideo.h:510
diff
static av_always_inline int diff(const uint32_t a, const uint32_t b)
Definition: vf_palettegen.c:139
h263_get_modb
static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
Definition: ituh263dec.c:611
ff_tlog
#define ff_tlog(ctx,...)
Definition: internal.h:205
MV_DIR_FORWARD
#define MV_DIR_FORWARD
Definition: mpegvideo.h:251
imgutils.h
MB_TYPE_DIRECT2
#define MB_TYPE_DIRECT2
Definition: mpegutils.h:58
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
ff_h263_mbtype_b_tab
const uint8_t ff_h263_mbtype_b_tab[15][2]
Definition: h263data.c:57
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
av_image_check_size
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
Definition: imgutils.c:318
ff_h263_init_rl_inter
av_cold void ff_h263_init_rl_inter(void)
Definition: h263.c:47
ff_h263_decode_motion
int ff_h263_decode_motion(MpegEncContext *s, int pred, int f_code)
Definition: ituh263dec.c:269
ff_h263_cbpy_vlc
VLC ff_h263_cbpy_vlc
Definition: ituh263dec.c:100
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:71
VLC::table
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
SLICE_STARTCODE
#define SLICE_STARTCODE
Definition: mpeg4video.h:66
RLTable::rl_vlc
RL_VLC_ELEM * rl_vlc[32]
decoding only
Definition: rl.h:48
MB_TYPE_INTRA
#define MB_TYPE_INTRA
Definition: mpegutils.h:72
re
float re
Definition: fft.c:78
h263.h