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 "avcodec.h"
38 #include "mpegvideo.h"
39 #include "h263.h"
40 #include "h263data.h"
41 #include "internal.h"
42 #include "mathops.h"
43 #include "mpegutils.h"
44 #include "unary.h"
45 #include "flv.h"
46 #include "rv10.h"
47 #include "mpeg4video.h"
48 #include "mpegvideodata.h"
49 
50 // The defines below define the number of bits that are read at once for
51 // reading vlc values. Changing these may improve speed and data cache needs
52 // be aware though that decreasing them may need the number of stages that is
53 // passed to get_vlc* to be increased.
54 #define MV_VLC_BITS 9
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 
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",
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" : "",
91  );
92  }
93 }
94 
95 /***********************************************/
96 /* decoding */
97 
101 static VLC mv_vlc;
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) {
113  INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
115  ff_h263_intra_MCBPC_code, 1, 1, 72);
116  INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
118  ff_h263_inter_MCBPC_code, 1, 1, 198);
119  INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
120  &ff_h263_cbpy_tab[0][1], 2, 1,
121  &ff_h263_cbpy_tab[0][0], 2, 1, 64);
122  INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33,
123  &ff_mvtab[0][1], 2, 1,
124  &ff_mvtab[0][0], 2, 1, 538);
129  INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
130  &ff_h263_mbtype_b_tab[0][1], 2, 1,
131  &ff_h263_mbtype_b_tab[0][0], 2, 1, 80);
132  INIT_VLC_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4,
133  &ff_cbpc_b_tab[0][1], 2, 1,
134  &ff_cbpc_b_tab[0][0], 2, 1, 8);
135  done = 1;
136  }
137 }
138 
140 {
141  int i, mb_pos;
142 
143  for (i = 0; i < 6; i++)
144  if (s->mb_num - 1 <= ff_mba_max[i])
145  break;
146  mb_pos = get_bits(&s->gb, ff_mba_length[i]);
147  s->mb_x = mb_pos % s->mb_width;
148  s->mb_y = mb_pos / s->mb_width;
149 
150  return mb_pos;
151 }
152 
153 /**
154  * Decode the group of blocks header or slice header.
155  * @return <0 if an error occurred
156  */
158 {
159  unsigned int val, gob_number;
160  int left;
161 
162  /* Check for GOB Start Code */
163  val = show_bits(&s->gb, 16);
164  if(val)
165  return -1;
166 
167  /* We have a GBSC probably with GSTUFF */
168  skip_bits(&s->gb, 16); /* Drop the zeros */
169  left= get_bits_left(&s->gb);
170  left = FFMIN(left, 32);
171  //MN: we must check the bits left or we might end in an infinite loop (or segfault)
172  for(;left>13; left--){
173  if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
174  }
175  if(left<=13)
176  return -1;
177 
178  if(s->h263_slice_structured){
179  if(check_marker(s->avctx, &s->gb, "before MBA")==0)
180  return -1;
181 
183 
184  if(s->mb_num > 1583)
185  if(check_marker(s->avctx, &s->gb, "after MBA")==0)
186  return -1;
187 
188  s->qscale = get_bits(&s->gb, 5); /* SQUANT */
189  if(check_marker(s->avctx, &s->gb, "after SQUANT")==0)
190  return -1;
191  skip_bits(&s->gb, 2); /* GFID */
192  }else{
193  gob_number = get_bits(&s->gb, 5); /* GN */
194  s->mb_x= 0;
195  s->mb_y= s->gob_index* gob_number;
196  skip_bits(&s->gb, 2); /* GFID */
197  s->qscale = get_bits(&s->gb, 5); /* GQUANT */
198  }
199 
200  if(s->mb_y >= s->mb_height)
201  return -1;
202 
203  if(s->qscale==0)
204  return -1;
205 
206  return 0;
207 }
208 
209 /**
210  * Decode the group of blocks / video packet header / slice header (MPEG-4 Studio).
211  * @return bit position of the resync_marker, or <0 if none was found
212  */
214  int left, pos, ret;
215 
216  /* In MPEG-4 studio mode look for a new slice startcode
217  * and decode slice header */
219  align_get_bits(&s->gb);
220 
221  while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_START_CODE) {
222  get_bits(&s->gb, 8);
223  }
224 
225  if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_START_CODE)
226  return get_bits_count(&s->gb);
227  else
228  return -1;
229  }
230 
231  if(s->codec_id==AV_CODEC_ID_MPEG4){
232  skip_bits1(&s->gb);
233  align_get_bits(&s->gb);
234  }
235 
236  if(show_bits(&s->gb, 16)==0){
237  pos= get_bits_count(&s->gb);
238  if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
240  else
241  ret= h263_decode_gob_header(s);
242  if(ret>=0)
243  return pos;
244  }
245  //OK, it's not where it is supposed to be ...
246  s->gb= s->last_resync_gb;
247  align_get_bits(&s->gb);
248  left= get_bits_left(&s->gb);
249 
250  for(;left>16+1+5+5; left-=8){
251  if(show_bits(&s->gb, 16)==0){
252  GetBitContext bak= s->gb;
253 
254  pos= get_bits_count(&s->gb);
255  if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
257  else
258  ret= h263_decode_gob_header(s);
259  if(ret>=0)
260  return pos;
261 
262  s->gb= bak;
263  }
264  skip_bits(&s->gb, 8);
265  }
266 
267  return -1;
268 }
269 
271 {
272  int code, val, sign, shift;
273  code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
274 
275  if (code == 0)
276  return pred;
277  if (code < 0)
278  return 0xffff;
279 
280  sign = get_bits1(&s->gb);
281  shift = f_code - 1;
282  val = code;
283  if (shift) {
284  val = (val - 1) << shift;
285  val |= get_bits(&s->gb, shift);
286  val++;
287  }
288  if (sign)
289  val = -val;
290  val += pred;
291 
292  /* modulo decoding */
293  if (!s->h263_long_vectors) {
294  val = sign_extend(val, 5 + f_code);
295  } else {
296  /* horrible H.263 long vector mode */
297  if (pred < -31 && val < -63)
298  val += 64;
299  if (pred > 32 && val > 63)
300  val -= 64;
301 
302  }
303  return val;
304 }
305 
306 
307 /* Decode RVLC of H.263+ UMV */
309 {
310  int code = 0, sign;
311 
312  if (get_bits1(&s->gb)) /* Motion difference = 0 */
313  return pred;
314 
315  code = 2 + get_bits1(&s->gb);
316 
317  while (get_bits1(&s->gb))
318  {
319  code <<= 1;
320  code += get_bits1(&s->gb);
321  if (code >= 32768) {
322  avpriv_request_sample(s->avctx, "Huge DMV");
323  return 0xffff;
324  }
325  }
326  sign = code & 1;
327  code >>= 1;
328 
329  code = (sign) ? (pred - code) : (pred + code);
330  ff_tlog(s->avctx,"H.263+ UMV Motion = %d\n", code);
331  return code;
332 
333 }
334 
335 /**
336  * read the next MVs for OBMC. yes this is an ugly hack, feel free to send a patch :)
337  */
339  GetBitContext gb= s->gb;
340 
341  int cbpc, i, pred_x, pred_y, mx, my;
342  int16_t *mot_val;
343  const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
344  const int stride= s->b8_stride*2;
345 
346  for(i=0; i<4; i++)
347  s->block_index[i]+= 2;
348  for(i=4; i<6; i++)
349  s->block_index[i]+= 1;
350  s->mb_x++;
351 
353 
354  do{
355  if (get_bits1(&s->gb)) {
356  /* skip mb */
357  mot_val = s->current_picture.motion_val[0][s->block_index[0]];
358  mot_val[0 ]= mot_val[2 ]=
359  mot_val[0+stride]= mot_val[2+stride]= 0;
360  mot_val[1 ]= mot_val[3 ]=
361  mot_val[1+stride]= mot_val[3+stride]= 0;
362 
364  goto end;
365  }
366  cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
367  }while(cbpc == 20);
368 
369  if(cbpc & 4){
371  }else{
372  get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
373  if (cbpc & 8) {
374  if(s->modified_quant){
375  if(get_bits1(&s->gb)) skip_bits(&s->gb, 1);
376  else skip_bits(&s->gb, 5);
377  }else
378  skip_bits(&s->gb, 2);
379  }
380 
381  if ((cbpc & 16) == 0) {
383  /* 16x16 motion prediction */
384  mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
385  if (s->umvplus)
386  mx = h263p_decode_umotion(s, pred_x);
387  else
388  mx = ff_h263_decode_motion(s, pred_x, 1);
389 
390  if (s->umvplus)
391  my = h263p_decode_umotion(s, pred_y);
392  else
393  my = ff_h263_decode_motion(s, pred_y, 1);
394 
395  mot_val[0 ]= mot_val[2 ]=
396  mot_val[0+stride]= mot_val[2+stride]= mx;
397  mot_val[1 ]= mot_val[3 ]=
398  mot_val[1+stride]= mot_val[3+stride]= my;
399  } else {
401  for(i=0;i<4;i++) {
402  mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
403  if (s->umvplus)
404  mx = h263p_decode_umotion(s, pred_x);
405  else
406  mx = ff_h263_decode_motion(s, pred_x, 1);
407 
408  if (s->umvplus)
409  my = h263p_decode_umotion(s, pred_y);
410  else
411  my = ff_h263_decode_motion(s, pred_y, 1);
412  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
413  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
414  mot_val[0] = mx;
415  mot_val[1] = my;
416  }
417  }
418  }
419 end:
420 
421  for(i=0; i<4; i++)
422  s->block_index[i]-= 2;
423  for(i=4; i<6; i++)
424  s->block_index[i]-= 1;
425  s->mb_x--;
426 
427  s->gb= gb;
428 }
429 
431  static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
432 
433  if(s->modified_quant){
434  if(get_bits1(&s->gb))
436  else
437  s->qscale= get_bits(&s->gb, 5);
438  }else
439  s->qscale += quant_tab[get_bits(&s->gb, 2)];
440  ff_set_qscale(s, s->qscale);
441 }
442 
443 static int h263_decode_block(MpegEncContext * s, int16_t * block,
444  int n, int coded)
445 {
446  int level, i, j, run;
447  RLTable *rl = &ff_h263_rl_inter;
448  const uint8_t *scan_table;
449  GetBitContext gb= s->gb;
450 
451  scan_table = s->intra_scantable.permutated;
452  if (s->h263_aic && s->mb_intra) {
453  rl = &ff_rl_intra_aic;
454  i = 0;
455  if (s->ac_pred) {
456  if (s->h263_aic_dir)
457  scan_table = s->intra_v_scantable.permutated; /* left */
458  else
459  scan_table = s->intra_h_scantable.permutated; /* top */
460  }
461  } else if (s->mb_intra) {
462  /* DC coef */
463  if (CONFIG_RV10_DECODER && s->codec_id == AV_CODEC_ID_RV10) {
464  if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) {
465  int component, diff;
466  component = (n <= 3 ? 0 : n - 4 + 1);
467  level = s->last_dc[component];
468  if (s->rv10_first_dc_coded[component]) {
469  diff = ff_rv_decode_dc(s, n);
470  if (diff == 0xffff)
471  return -1;
472  level += diff;
473  level = level & 0xff; /* handle wrap round */
474  s->last_dc[component] = level;
475  } else {
476  s->rv10_first_dc_coded[component] = 1;
477  }
478  } else {
479  level = get_bits(&s->gb, 8);
480  if (level == 255)
481  level = 128;
482  }
483  }else{
484  level = get_bits(&s->gb, 8);
485  if((level&0x7F) == 0){
486  av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
488  return -1;
489  }
490  if (level == 255)
491  level = 128;
492  }
493  block[0] = level;
494  i = 1;
495  } else {
496  i = 0;
497  }
498  if (!coded) {
499  if (s->mb_intra && s->h263_aic)
500  goto not_coded;
501  s->block_last_index[n] = i - 1;
502  return 0;
503  }
504 retry:
505  {
506  OPEN_READER(re, &s->gb);
507  i--; // offset by -1 to allow direct indexing of scan_table
508  for(;;) {
509  UPDATE_CACHE(re, &s->gb);
510  GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
511  if (run == 66) {
512  if (level){
513  CLOSE_READER(re, &s->gb);
514  av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
515  return -1;
516  }
517  /* escape */
518  if (CONFIG_FLV_DECODER && s->h263_flv > 1) {
519  int is11 = SHOW_UBITS(re, &s->gb, 1);
520  SKIP_CACHE(re, &s->gb, 1);
521  run = SHOW_UBITS(re, &s->gb, 7) + 1;
522  if (is11) {
523  SKIP_COUNTER(re, &s->gb, 1 + 7);
524  UPDATE_CACHE(re, &s->gb);
525  level = SHOW_SBITS(re, &s->gb, 11);
526  SKIP_COUNTER(re, &s->gb, 11);
527  } else {
528  SKIP_CACHE(re, &s->gb, 7);
529  level = SHOW_SBITS(re, &s->gb, 7);
530  SKIP_COUNTER(re, &s->gb, 1 + 7 + 7);
531  }
532  } else {
533  run = SHOW_UBITS(re, &s->gb, 7) + 1;
534  SKIP_CACHE(re, &s->gb, 7);
535  level = (int8_t)SHOW_UBITS(re, &s->gb, 8);
536  SKIP_COUNTER(re, &s->gb, 7 + 8);
537  if(level == -128){
538  UPDATE_CACHE(re, &s->gb);
539  if (s->codec_id == AV_CODEC_ID_RV10) {
540  /* XXX: should patch encoder too */
541  level = SHOW_SBITS(re, &s->gb, 12);
542  SKIP_COUNTER(re, &s->gb, 12);
543  }else{
544  level = SHOW_UBITS(re, &s->gb, 5);
545  SKIP_CACHE(re, &s->gb, 5);
546  level |= SHOW_SBITS(re, &s->gb, 6) * (1<<5);
547  SKIP_COUNTER(re, &s->gb, 5 + 6);
548  }
549  }
550  }
551  } else {
552  if (SHOW_UBITS(re, &s->gb, 1))
553  level = -level;
554  SKIP_COUNTER(re, &s->gb, 1);
555  }
556  i += run;
557  if (i >= 64){
558  CLOSE_READER(re, &s->gb);
559  // redo update without last flag, revert -1 offset
560  i = i - run + ((run-1)&63) + 1;
561  if (i < 64) {
562  // only last marker, no overrun
563  block[scan_table[i]] = level;
564  break;
565  }
566  if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
567  //Looks like a hack but no, it's the way it is supposed to work ...
568  rl = &ff_rl_intra_aic;
569  i = 0;
570  s->gb= gb;
571  s->bdsp.clear_block(block);
572  goto retry;
573  }
574  av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra);
575  return -1;
576  }
577  j = scan_table[i];
578  block[j] = level;
579  }
580  }
581 not_coded:
582  if (s->mb_intra && s->h263_aic) {
583  ff_h263_pred_acdc(s, block, n);
584  i = 63;
585  }
586  s->block_last_index[n] = i;
587  return 0;
588 }
589 
590 static int h263_skip_b_part(MpegEncContext *s, int cbp)
591 {
592  LOCAL_ALIGNED_32(int16_t, dblock, [64]);
593  int i, mbi;
594  int bli[6];
595 
596  /* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly
597  * but real value should be restored in order to be used later (in OBMC condition)
598  */
599  mbi = s->mb_intra;
600  memcpy(bli, s->block_last_index, sizeof(bli));
601  s->mb_intra = 0;
602  for (i = 0; i < 6; i++) {
603  if (h263_decode_block(s, dblock, i, cbp&32) < 0)
604  return -1;
605  cbp+=cbp;
606  }
607  s->mb_intra = mbi;
608  memcpy(s->block_last_index, bli, sizeof(bli));
609  return 0;
610 }
611 
612 static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
613 {
614  int c, mv = 1;
615 
616  if (pb_frame < 3) { // h.263 Annex G and i263 PB-frame
617  c = get_bits1(gb);
618  if (pb_frame == 2 && c)
619  mv = !get_bits1(gb);
620  } else { // h.263 Annex M improved PB-frame
621  mv = get_unary(gb, 0, 4) + 1;
622  c = mv & 1;
623  mv = !!(mv & 2);
624  }
625  if(c)
626  *cbpb = get_bits(gb, 6);
627  return mv;
628 }
629 
630 #define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
631 #define tab_bias (tab_size / 2)
632 static inline void set_one_direct_mv(MpegEncContext *s, Picture *p, int i)
633 {
634  int xy = s->block_index[i];
635  uint16_t time_pp = s->pp_time;
636  uint16_t time_pb = s->pb_time;
637  int p_mx, p_my;
638 
639  p_mx = p->motion_val[0][xy][0];
640  if ((unsigned)(p_mx + tab_bias) < tab_size) {
641  s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias];
642  s->mv[1][i][0] = s->direct_scale_mv[1][p_mx + tab_bias];
643  } else {
644  s->mv[0][i][0] = p_mx * time_pb / time_pp;
645  s->mv[1][i][0] = p_mx * (time_pb - time_pp) / time_pp;
646  }
647  p_my = p->motion_val[0][xy][1];
648  if ((unsigned)(p_my + tab_bias) < tab_size) {
649  s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias];
650  s->mv[1][i][1] = s->direct_scale_mv[1][p_my + tab_bias];
651  } else {
652  s->mv[0][i][1] = p_my * time_pb / time_pp;
653  s->mv[1][i][1] = p_my * (time_pb - time_pp) / time_pp;
654  }
655 }
656 
657 /**
658  * @return the mb_type
659  */
661 {
662  const int mb_index = s->mb_x + s->mb_y * s->mb_stride;
663  Picture *p = &s->next_picture;
664  int colocated_mb_type = p->mb_type[mb_index];
665  int i;
666 
667  if (s->codec_tag == AV_RL32("U263") && p->f->pict_type == AV_PICTURE_TYPE_I) {
668  p = &s->last_picture;
669  colocated_mb_type = p->mb_type[mb_index];
670  }
671 
672  if (IS_8X8(colocated_mb_type)) {
673  s->mv_type = MV_TYPE_8X8;
674  for (i = 0; i < 4; i++)
675  set_one_direct_mv(s, p, i);
677  } else {
678  set_one_direct_mv(s, p, 0);
679  s->mv[0][1][0] =
680  s->mv[0][2][0] =
681  s->mv[0][3][0] = s->mv[0][0][0];
682  s->mv[0][1][1] =
683  s->mv[0][2][1] =
684  s->mv[0][3][1] = s->mv[0][0][1];
685  s->mv[1][1][0] =
686  s->mv[1][2][0] =
687  s->mv[1][3][0] = s->mv[1][0][0];
688  s->mv[1][1][1] =
689  s->mv[1][2][1] =
690  s->mv[1][3][1] = s->mv[1][0][1];
691  s->mv_type = MV_TYPE_8X8;
692  // Note see prev line
694  }
695 }
696 
698  int16_t block[6][64])
699 {
700  int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
701  int16_t *mot_val;
702  const int xy= s->mb_x + s->mb_y * s->mb_stride;
703  int cbpb = 0, pb_mv_count = 0;
704 
705  av_assert2(!s->h263_pred);
706 
707  if (s->pict_type == AV_PICTURE_TYPE_P) {
708  do{
709  if (get_bits1(&s->gb)) {
710  /* skip mb */
711  s->mb_intra = 0;
712  for(i=0;i<6;i++)
713  s->block_last_index[i] = -1;
714  s->mv_dir = MV_DIR_FORWARD;
715  s->mv_type = MV_TYPE_16X16;
717  s->mv[0][0][0] = 0;
718  s->mv[0][0][1] = 0;
719  s->mb_skipped = !(s->obmc | s->loop_filter);
720  goto end;
721  }
722  cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
723  if (cbpc < 0){
724  av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
725  return SLICE_ERROR;
726  }
727  }while(cbpc == 20);
728 
729  s->bdsp.clear_blocks(s->block[0]);
730 
731  dquant = cbpc & 8;
732  s->mb_intra = ((cbpc & 4) != 0);
733  if (s->mb_intra) goto intra;
734 
735  if(s->pb_frame && get_bits1(&s->gb))
736  pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
737  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
738 
739  if (cbpy < 0) {
740  av_log(s->avctx, AV_LOG_ERROR, "cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
741  return SLICE_ERROR;
742  }
743 
744  if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
745  cbpy ^= 0xF;
746 
747  cbp = (cbpc & 3) | (cbpy << 2);
748  if (dquant) {
750  }
751 
752  s->mv_dir = MV_DIR_FORWARD;
753  if ((cbpc & 16) == 0) {
755  /* 16x16 motion prediction */
756  s->mv_type = MV_TYPE_16X16;
757  ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
758  if (s->umvplus)
759  mx = h263p_decode_umotion(s, pred_x);
760  else
761  mx = ff_h263_decode_motion(s, pred_x, 1);
762 
763  if (mx >= 0xffff)
764  return SLICE_ERROR;
765 
766  if (s->umvplus)
767  my = h263p_decode_umotion(s, pred_y);
768  else
769  my = ff_h263_decode_motion(s, pred_y, 1);
770 
771  if (my >= 0xffff)
772  return SLICE_ERROR;
773  s->mv[0][0][0] = mx;
774  s->mv[0][0][1] = my;
775 
776  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
777  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
778  } else {
780  s->mv_type = MV_TYPE_8X8;
781  for(i=0;i<4;i++) {
782  mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y);
783  if (s->umvplus)
784  mx = h263p_decode_umotion(s, pred_x);
785  else
786  mx = ff_h263_decode_motion(s, pred_x, 1);
787  if (mx >= 0xffff)
788  return SLICE_ERROR;
789 
790  if (s->umvplus)
791  my = h263p_decode_umotion(s, pred_y);
792  else
793  my = ff_h263_decode_motion(s, pred_y, 1);
794  if (my >= 0xffff)
795  return SLICE_ERROR;
796  s->mv[0][i][0] = mx;
797  s->mv[0][i][1] = my;
798  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
799  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
800  mot_val[0] = mx;
801  mot_val[1] = my;
802  }
803  }
804  } else if(s->pict_type==AV_PICTURE_TYPE_B) {
805  int mb_type;
806  const int stride= s->b8_stride;
807  int16_t *mot_val0 = s->current_picture.motion_val[0][2 * (s->mb_x + s->mb_y * stride)];
808  int16_t *mot_val1 = s->current_picture.motion_val[1][2 * (s->mb_x + s->mb_y * stride)];
809 // const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
810 
811  //FIXME ugly
812  mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]=
813  mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]=
814  mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]=
815  mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0;
816 
817  do{
818  mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2);
819  if (mb_type < 0){
820  av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y);
821  return SLICE_ERROR;
822  }
823 
824  mb_type= h263_mb_type_b_map[ mb_type ];
825  }while(!mb_type);
826 
827  s->mb_intra = IS_INTRA(mb_type);
828  if(HAS_CBP(mb_type)){
829  s->bdsp.clear_blocks(s->block[0]);
830  cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
831  if(s->mb_intra){
832  dquant = IS_QUANT(mb_type);
833  goto intra;
834  }
835 
836  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
837 
838  if (cbpy < 0){
839  av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
840  return SLICE_ERROR;
841  }
842 
843  if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
844  cbpy ^= 0xF;
845 
846  cbp = (cbpc & 3) | (cbpy << 2);
847  }else
848  cbp=0;
849 
850  av_assert2(!s->mb_intra);
851 
852  if(IS_QUANT(mb_type)){
854  }
855 
856  if(IS_DIRECT(mb_type)){
858  mb_type |= set_direct_mv(s);
859  }else{
860  s->mv_dir = 0;
862 //FIXME UMV
863 
864  if(USES_LIST(mb_type, 0)){
865  int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
866  s->mv_dir = MV_DIR_FORWARD;
867 
868  if (s->umvplus)
869  mx = h263p_decode_umotion(s, pred_x);
870  else
871  mx = ff_h263_decode_motion(s, pred_x, 1);
872  if (mx >= 0xffff)
873  return SLICE_ERROR;
874 
875  if (s->umvplus)
876  my = h263p_decode_umotion(s, pred_y);
877  else
878  my = ff_h263_decode_motion(s, pred_y, 1);
879  if (my >= 0xffff)
880  return SLICE_ERROR;
881 
882  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
883  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
884 
885  s->mv[0][0][0] = mx;
886  s->mv[0][0][1] = my;
887  mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
888  mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
889  }
890 
891  if(USES_LIST(mb_type, 1)){
892  int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &pred_x, &pred_y);
893  s->mv_dir |= MV_DIR_BACKWARD;
894 
895  if (s->umvplus)
896  mx = h263p_decode_umotion(s, pred_x);
897  else
898  mx = ff_h263_decode_motion(s, pred_x, 1);
899  if (mx >= 0xffff)
900  return SLICE_ERROR;
901 
902  if (s->umvplus)
903  my = h263p_decode_umotion(s, pred_y);
904  else
905  my = ff_h263_decode_motion(s, pred_y, 1);
906  if (my >= 0xffff)
907  return SLICE_ERROR;
908 
909  if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
910  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
911 
912  s->mv[1][0][0] = mx;
913  s->mv[1][0][1] = my;
914  mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
915  mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
916  }
917  }
918 
919  s->current_picture.mb_type[xy] = mb_type;
920  } else { /* I-Frame */
921  do{
922  cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
923  if (cbpc < 0){
924  av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
925  return SLICE_ERROR;
926  }
927  }while(cbpc == 8);
928 
929  s->bdsp.clear_blocks(s->block[0]);
930 
931  dquant = cbpc & 4;
932  s->mb_intra = 1;
933 intra:
935  if (s->h263_aic) {
936  s->ac_pred = get_bits1(&s->gb);
937  if(s->ac_pred){
939 
940  s->h263_aic_dir = get_bits1(&s->gb);
941  }
942  }else
943  s->ac_pred = 0;
944 
945  if(s->pb_frame && get_bits1(&s->gb))
946  pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
947  cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
948  if(cbpy<0){
949  av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
950  return SLICE_ERROR;
951  }
952  cbp = (cbpc & 3) | (cbpy << 2);
953  if (dquant) {
955  }
956 
957  pb_mv_count += !!s->pb_frame;
958  }
959 
960  while(pb_mv_count--){
961  ff_h263_decode_motion(s, 0, 1);
962  ff_h263_decode_motion(s, 0, 1);
963  }
964 
965  /* decode each block */
966  for (i = 0; i < 6; i++) {
967  if (h263_decode_block(s, block[i], i, cbp&32) < 0)
968  return -1;
969  cbp+=cbp;
970  }
971 
972  if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0)
973  return -1;
974  if(s->obmc && !s->mb_intra){
975  if(s->pict_type == AV_PICTURE_TYPE_P && s->mb_x+1<s->mb_width && s->mb_num_left != 1)
976  preview_obmc(s);
977  }
978 end:
979 
980  if (get_bits_left(&s->gb) < 0)
981  return AVERROR_INVALIDDATA;
982 
983  /* per-MB end of slice check */
984  {
985  int v= show_bits(&s->gb, 16);
986 
987  if (get_bits_left(&s->gb) < 16) {
988  v >>= 16 - get_bits_left(&s->gb);
989  }
990 
991  if(v==0)
992  return SLICE_END;
993  }
994 
995  return SLICE_OK;
996 }
997 
998 /* Most is hardcoded; should extend to handle all H.263 streams. */
1000 {
1001  int format, width, height, i, ret;
1002  uint32_t startcode;
1003 
1004  align_get_bits(&s->gb);
1005 
1006  if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) {
1007  av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n");
1008  }
1009 
1010  startcode= get_bits(&s->gb, 22-8);
1011 
1012  for(i= get_bits_left(&s->gb); i>24; i-=8) {
1013  startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
1014 
1015  if(startcode == 0x20)
1016  break;
1017  }
1018 
1019  if (startcode != 0x20) {
1020  av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
1021  return -1;
1022  }
1023  /* temporal reference */
1024  i = get_bits(&s->gb, 8); /* picture timestamp */
1025 
1026  i -= (i - (s->picture_number & 0xFF) + 128) & ~0xFF;
1027 
1028  s->picture_number= (s->picture_number&~0xFF) + i;
1029 
1030  /* PTYPE starts here */
1031  if (check_marker(s->avctx, &s->gb, "in PTYPE") != 1) {
1032  return -1;
1033  }
1034  if (get_bits1(&s->gb) != 0) {
1035  av_log(s->avctx, AV_LOG_ERROR, "Bad H.263 id\n");
1036  return -1; /* H.263 id */
1037  }
1038  skip_bits1(&s->gb); /* split screen off */
1039  skip_bits1(&s->gb); /* camera off */
1040  skip_bits1(&s->gb); /* freeze picture release off */
1041 
1042  format = get_bits(&s->gb, 3);
1043  /*
1044  0 forbidden
1045  1 sub-QCIF
1046  10 QCIF
1047  7 extended PTYPE (PLUSPTYPE)
1048  */
1049 
1050  if (format != 7 && format != 6) {
1051  s->h263_plus = 0;
1052  /* H.263v1 */
1053  width = ff_h263_format[format][0];
1054  height = ff_h263_format[format][1];
1055  if (!width)
1056  return -1;
1057 
1059 
1060  s->h263_long_vectors = get_bits1(&s->gb);
1061 
1062  if (get_bits1(&s->gb) != 0) {
1063  av_log(s->avctx, AV_LOG_ERROR, "H.263 SAC not supported\n");
1064  return -1; /* SAC: off */
1065  }
1066  s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
1067  s->unrestricted_mv = s->h263_long_vectors || s->obmc;
1068 
1069  s->pb_frame = get_bits1(&s->gb);
1070  s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
1071  skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
1072 
1073  s->width = width;
1074  s->height = height;
1075  s->avctx->sample_aspect_ratio= (AVRational){12,11};
1076  s->avctx->framerate = (AVRational){ 30000, 1001 };
1077  } else {
1078  int ufep;
1079 
1080  /* H.263v2 */
1081  s->h263_plus = 1;
1082  ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */
1083 
1084  /* ufep other than 0 and 1 are reserved */
1085  if (ufep == 1) {
1086  /* OPPTYPE */
1087  format = get_bits(&s->gb, 3);
1088  ff_dlog(s->avctx, "ufep=1, format: %d\n", format);
1089  s->custom_pcf= get_bits1(&s->gb);
1090  s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
1091  if (get_bits1(&s->gb) != 0) {
1092  av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
1093  }
1094  s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
1095  s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */
1096  s->loop_filter= get_bits1(&s->gb);
1097  s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter;
1098  if(s->avctx->lowres)
1099  s->loop_filter = 0;
1100 
1102  if (get_bits1(&s->gb) != 0) {
1103  av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");
1104  }
1105  if (get_bits1(&s->gb) != 0) {
1106  av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");
1107  }
1108  s->alt_inter_vlc= get_bits1(&s->gb);
1109  s->modified_quant= get_bits1(&s->gb);
1110  if(s->modified_quant)
1112 
1113  skip_bits(&s->gb, 1); /* Prevent start code emulation */
1114 
1115  skip_bits(&s->gb, 3); /* Reserved */
1116  } else if (ufep != 0) {
1117  av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);
1118  return -1;
1119  }
1120 
1121  /* MPPTYPE */
1122  s->pict_type = get_bits(&s->gb, 3);
1123  switch(s->pict_type){
1124  case 0: s->pict_type= AV_PICTURE_TYPE_I;break;
1125  case 1: s->pict_type= AV_PICTURE_TYPE_P;break;
1126  case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break;
1127  case 3: s->pict_type= AV_PICTURE_TYPE_B;break;
1128  case 7: s->pict_type= AV_PICTURE_TYPE_I;break; //ZYGO
1129  default:
1130  return -1;
1131  }
1132  skip_bits(&s->gb, 2);
1133  s->no_rounding = get_bits1(&s->gb);
1134  skip_bits(&s->gb, 4);
1135 
1136  /* Get the picture dimensions */
1137  if (ufep) {
1138  if (format == 6) {
1139  /* Custom Picture Format (CPFMT) */
1140  s->aspect_ratio_info = get_bits(&s->gb, 4);
1141  ff_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
1142  /* aspect ratios:
1143  0 - forbidden
1144  1 - 1:1
1145  2 - 12:11 (CIF 4:3)
1146  3 - 10:11 (525-type 4:3)
1147  4 - 16:11 (CIF 16:9)
1148  5 - 40:33 (525-type 16:9)
1149  6-14 - reserved
1150  */
1151  width = (get_bits(&s->gb, 9) + 1) * 4;
1152  check_marker(s->avctx, &s->gb, "in dimensions");
1153  height = get_bits(&s->gb, 9) * 4;
1154  ff_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
1156  /* expected dimensions */
1157  s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);
1158  s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);
1159  }else{
1161  }
1162  } else {
1163  width = ff_h263_format[format][0];
1164  height = ff_h263_format[format][1];
1165  s->avctx->sample_aspect_ratio= (AVRational){12,11};
1166  }
1168  if ((width == 0) || (height == 0))
1169  return -1;
1170  s->width = width;
1171  s->height = height;
1172 
1173  if(s->custom_pcf){
1174  int gcd;
1175  s->avctx->framerate.num = 1800000;
1176  s->avctx->framerate.den = 1000 + get_bits1(&s->gb);
1177  s->avctx->framerate.den *= get_bits(&s->gb, 7);
1178  if(s->avctx->framerate.den == 0){
1179  av_log(s, AV_LOG_ERROR, "zero framerate\n");
1180  return -1;
1181  }
1182  gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num);
1183  s->avctx->framerate.den /= gcd;
1184  s->avctx->framerate.num /= gcd;
1185  }else{
1186  s->avctx->framerate = (AVRational){ 30000, 1001 };
1187  }
1188  }
1189 
1190  if(s->custom_pcf){
1191  skip_bits(&s->gb, 2); //extended Temporal reference
1192  }
1193 
1194  if (ufep) {
1195  if (s->umvplus) {
1196  if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
1197  skip_bits1(&s->gb);
1198  }
1199  if(s->h263_slice_structured){
1200  if (get_bits1(&s->gb) != 0) {
1201  av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n");
1202  }
1203  if (get_bits1(&s->gb) != 0) {
1204  av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n");
1205  }
1206  }
1207  if (s->pict_type == AV_PICTURE_TYPE_B) {
1208  skip_bits(&s->gb, 4); //ELNUM
1209  if (ufep == 1) {
1210  skip_bits(&s->gb, 4); // RLNUM
1211  }
1212  }
1213  }
1214 
1215  s->qscale = get_bits(&s->gb, 5);
1216  }
1217 
1218  if ((ret = av_image_check_size(s->width, s->height, 0, s)) < 0)
1219  return ret;
1220 
1221  if (!(s->avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
1222  if ((s->width * s->height / 256 / 8) > get_bits_left(&s->gb))
1223  return AVERROR_INVALIDDATA;
1224  }
1225 
1226  s->mb_width = (s->width + 15) / 16;
1227  s->mb_height = (s->height + 15) / 16;
1228  s->mb_num = s->mb_width * s->mb_height;
1229 
1230  if (s->pb_frame) {
1231  skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */
1232  if (s->custom_pcf)
1233  skip_bits(&s->gb, 2); //extended Temporal reference
1234  skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
1235  }
1236 
1237  if (s->pict_type!=AV_PICTURE_TYPE_B) {
1238  s->time = s->picture_number;
1239  s->pp_time = s->time - s->last_non_b_time;
1240  s->last_non_b_time = s->time;
1241  }else{
1242  s->time = s->picture_number;
1243  s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
1244  if (s->pp_time <=s->pb_time ||
1245  s->pp_time <= s->pp_time - s->pb_time ||
1246  s->pp_time <= 0){
1247  s->pp_time = 2;
1248  s->pb_time = 1;
1249  }
1251  }
1252 
1253  /* PEI */
1254  if (skip_1stop_8data_bits(&s->gb) < 0)
1255  return AVERROR_INVALIDDATA;
1256 
1257  if(s->h263_slice_structured){
1258  if (check_marker(s->avctx, &s->gb, "SEPB1") != 1) {
1259  return -1;
1260  }
1261 
1262  ff_h263_decode_mba(s);
1263 
1264  if (check_marker(s->avctx, &s->gb, "SEPB2") != 1) {
1265  return -1;
1266  }
1267  }
1268  s->f_code = 1;
1269 
1270  if (s->pict_type == AV_PICTURE_TYPE_B)
1271  s->low_delay = 0;
1272 
1273  if(s->h263_aic){
1274  s->y_dc_scale_table=
1276  }else{
1277  s->y_dc_scale_table=
1279  }
1280 
1282  if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){
1283  int i,j;
1284  for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
1285  av_log(s->avctx, AV_LOG_DEBUG, "\n");
1286  for(i=0; i<13; i++){
1287  for(j=0; j<3; j++){
1288  int v= get_bits(&s->gb, 8);
1289  v |= get_sbits(&s->gb, 8) * (1 << 8);
1290  av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);
1291  }
1292  av_log(s->avctx, AV_LOG_DEBUG, "\n");
1293  }
1294  for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
1295  }
1296 
1297  return 0;
1298 }
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:602
av_cold void ff_h263_decode_init_vlc(void)
Definition: ituh263dec.c:108
int rv10_first_dc_coded[3]
Definition: mpegvideo.h:421
#define ff_tlog(ctx,...)
Definition: internal.h:75
#define SLICE_ERROR
Definition: mpegvideo.h:517
AVRational framerate
Definition: avcodec.h:3111
const char const char void * val
Definition: avisynth_c.h:863
int aspect_ratio_info
Definition: mpegvideo.h:402
int picture_number
Definition: mpegvideo.h:127
#define MB_TYPE_L1
Definition: mpegutils.h:68
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
ScanTable intra_v_scantable
Definition: mpegvideo.h:93
static int h263_decode_gob_header(MpegEncContext *s)
Decode the group of blocks header or slice header.
Definition: ituh263dec.c:157
static int shift(int a, int b)
Definition: sonic.c:82
VLC ff_h263_inter_MCBPC_vlc
Definition: ituh263dec.c:99
#define CBPY_VLC_BITS
Definition: h263.h:39
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
Definition: mpegvideo.h:188
const uint16_t ff_mba_max[6]
Definition: h263data.c:267
#define MB_TYPE_DIRECT2
Definition: mpegutils.h:59
float re
Definition: fft.c:82
static void set_one_direct_mv(MpegEncContext *s, Picture *p, int i)
Definition: ituh263dec.c:632
misc image utilities
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
Definition: vlc.h:75
void(* clear_block)(int16_t *block)
Definition: blockdsp.h:36
#define avpriv_request_sample(...)
#define SKIP_COUNTER(name, gb, num)
Definition: get_bits.h:185
#define tab_bias
Definition: ituh263dec.c:631
static int check_marker(void *logctx, GetBitContext *s, const char *msg)
Definition: get_bits.h:612
RLTable ff_rl_intra_aic
Definition: h263data.c:230
int num
Numerator.
Definition: rational.h:59
enum AVCodecID codec_id
Definition: mpegvideo.h:112
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
Definition: avcodec.h:2715
int obmc
overlapped block motion compensation
Definition: mpegvideo.h:366
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
Definition: avcodec.h:1950
#define MB_TYPE_INTRA
Definition: mpegutils.h:73
static int h263_decode_block(MpegEncContext *s, int16_t *block, int n, int coded)
Definition: ituh263dec.c:443
int studio_profile
Definition: mpegvideo.h:384
#define AV_EF_BITSTREAM
detect bitstream specification deviations
Definition: avcodec.h:2709
mpegvideo header.
#define HAS_CBP(a)
Definition: mpegutils.h:101
const uint16_t ff_h263_format[8][2]
Definition: h263data.c:238
uint8_t permutated[64]
Definition: idctdsp.h:33
uint8_t run
Definition: svq3.c:206
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries...
Definition: avcodec.h:948
#define SLICE_OK
Definition: mpegvideo.h:516
int mb_num
number of MBs of a picture
Definition: mpegvideo.h:133
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate.The lists are not just lists
#define MB_TYPE_INTRA4x4
Definition: mpegutils.h:51
RLTable.
Definition: rl.h:39
int qscale
QP.
Definition: mpegvideo.h:204
static int get_sbits(GetBitContext *s, int n)
Definition: get_bits.h:359
int h263_aic
Advanced INTRA Coding (AIC)
Definition: mpegvideo.h:87
int16_t * ff_h263_pred_motion(MpegEncContext *s, int block, int dir, int *px, int *py)
Definition: h263.c:307
Macro definitions for various function/variable attributes.
#define SLICE_START_CODE
Definition: mpegvideo.h:75
int modified_quant
Definition: mpegvideo.h:379
#define USES_LIST(a, list)
Definition: mpegutils.h:99
int alt_inter_vlc
alternative inter vlc
Definition: mpegvideo.h:378
int mb_num_left
number of MBs left in this video packet (for partitioned Slices only)
Definition: mpegvideo.h:359
int64_t time
time of current frame
Definition: mpegvideo.h:390
const uint8_t ff_mpeg1_dc_scale_table[128]
Definition: mpegvideodata.c:34
#define MV_DIRECT
bidirectional mode where the difference equals the MV of the last P/S/I-Frame (MPEG-4) ...
Definition: mpegvideo.h:264
The exact code depends on how similar the blocks are and how related they are to the block
uint8_t
#define av_cold
Definition: attributes.h:82
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:2657
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
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
static VLC h263_mbtype_b_vlc
Definition: ituh263dec.c:102
int ff_rv_decode_dc(MpegEncContext *s, int n)
Definition: rv10.c:198
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
Definition: mpegvideo.h:284
H.263 tables.
#define MB_TYPE_16x16
Definition: mpegutils.h:54
Picture current_picture
copy of the current picture structure.
Definition: mpegvideo.h:180
GetBitContext last_resync_gb
used to search for the next resync marker
Definition: mpegvideo.h:358
#define MB_TYPE_ACPRED
Definition: mpegutils.h:60
#define height
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
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:88
#define ff_dlog(a,...)
const uint8_t ff_h263_intra_MCBPC_bits[9]
Definition: h263data.c:35
uint16_t pp_time
time distance between the last 2 p,s,i frames
Definition: mpegvideo.h:392
const uint8_t ff_mba_length[7]
Definition: h263data.c:271
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:129
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
Definition: avcodec.h:2810
static int h263_skip_b_part(MpegEncContext *s, int cbp)
Definition: ituh263dec.c:590
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
Definition: mpegvideo.h:120
#define av_log(a,...)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
Definition: mpegvideo.c:2338
#define MB_TYPE_QUANT
Definition: mpegutils.h:70
const uint8_t ff_h263_mbtype_b_tab[15][2]
Definition: h263data.c:59
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
#define H263_MBTYPE_B_VLC_BITS
Definition: ituh263dec.c:55
int h263_plus
H.263+ headers.
Definition: mpegvideo.h:109
uint8_t ff_h263_static_rl_table_store[2][2][2 *MAX_RUN+MAX_LEVEL+3]
Definition: h263data.c:31
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:178
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int last_dc[3]
last DC values for MPEG-1
Definition: mpegvideo.h:185
const uint8_t ff_h263_inter_MCBPC_code[28]
Definition: h263data.c:40
int16_t direct_scale_mv[2][64]
precomputed to avoid divisions in ff_mpeg4_set_direct_mv
Definition: mpegvideo.h:280
int mb_skipped
MUST BE SET only during DECODING.
Definition: mpegvideo.h:195
const uint8_t ff_modified_quant_tab[2][32]
Definition: h263data.c:252
void(* clear_blocks)(int16_t *blocks)
Definition: blockdsp.h:37
int unrestricted_mv
mv can point outside of the coded picture
Definition: mpegvideo.h:223
int ff_h263_decode_motion(MpegEncContext *s, int pred, int f_code)
Definition: ituh263dec.c:270
#define MB_TYPE_CBP
Definition: mpegutils.h:71
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static const int h263_mb_type_b_map[15]
Definition: ituh263dec.c:58
int h263_slice_structured
Definition: mpegvideo.h:377
#define INTER_MCBPC_VLC_BITS
Definition: h263.h:38
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition: mathematics.c:37
void ff_mpeg4_init_direct_mv(MpegEncContext *s)
Definition: mpeg4video.c:71
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx)
Decode the next video packet.
int low_delay
no reordering needed / has no B-frames
Definition: mpegvideo.h:406
static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
Definition: ituh263dec.c:612
GetBitContext gb
Definition: mpegvideo.h:448
#define CLOSE_READER(name, gb)
Definition: get_bits.h:149
#define INIT_VLC_RL(rl, static_size)
Definition: rl.h:63
#define GET_RL_VLC(level, run, name, gb, table, bits,max_depth, need_update)
Definition: get_bits.h:738
Definition: vlc.h:26
common internal API header
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:282
const uint8_t ff_h263_inter_MCBPC_bits[28]
Definition: h263data.c:49
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:378
const uint8_t ff_h263_chroma_qscale_table[32]
Definition: h263data.c:262
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:2700
#define FFMIN(a, b)
Definition: common.h:96
#define IS_DIRECT(a)
Definition: mpegutils.h:84
int umvplus
== H.263+ && unrestricted_mv
Definition: mpegvideo.h:375
#define width
int16_t(*[2] motion_val)[2]
Definition: mpegpicture.h:53
Picture.
Definition: mpegpicture.h:45
int size_in_bits
Definition: get_bits.h:68
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:446
#define s(width, name)
Definition: cbs_vp9.c:257
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:797
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:86
int n
Definition: avisynth_c.h:760
int pb_frame
PB-frame mode (0 = none, 1 = base, 2 = improved)
Definition: mpegvideo.h:106
VLC ff_h263_cbpy_vlc
Definition: ituh263dec.c:100
int ff_h263_decode_mba(MpegEncContext *s)
Definition: ituh263dec.c:139
RL_VLC_ELEM * rl_vlc[32]
decoding only
Definition: rl.h:48
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:211
static int h263p_decode_umotion(MpegEncContext *s, int pred)
Definition: ituh263dec.c:308
int block_index[6]
index to current MB in block based arrays with edges
Definition: mpegvideo.h:293
static const float pred[4]
Definition: siprdata.h:259
static const int8_t mv[256][2]
Definition: 4xm.c:77
#define MB_TYPE_8x8
Definition: mpegutils.h:57
#define MV_TYPE_16X16
1 vector for the whole mb
Definition: mpegvideo.h:266
#define MV_VLC_BITS
Definition: ituh263dec.c:54
const uint8_t ff_aic_dc_scale_table[32]
Definition: h263data.c:247
#define MV_DIR_BACKWARD
Definition: mpegvideo.h:263
int64_t last_non_b_time
Definition: mpegvideo.h:391
#define FF_ASPECT_EXTENDED
Definition: h263.h:30
Libavcodec external API header.
int h263_flv
use flv H.263 header
Definition: mpegvideo.h:110
BlockDSPContext bdsp
Definition: mpegvideo.h:226
int debug
debug
Definition: avcodec.h:2656
const uint8_t ff_h263_intra_MCBPC_code[9]
Definition: h263data.c:34
static int set_direct_mv(MpegEncContext *s)
Definition: ituh263dec.c:660
ScanTable intra_scantable
Definition: mpegvideo.h:91
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:100
#define IS_QUANT(a)
Definition: mpegutils.h:95
#define OPEN_READER(name, gb)
Definition: get_bits.h:138
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:206
av_cold int ff_rl_init(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
Definition: rl.c:39
#define SLICE_END
end marker found
Definition: mpegvideo.h:518
VLC ff_h263_intra_MCBPC_vlc
Definition: ituh263dec.c:98
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:538
ScanTable intra_h_scantable
Definition: mpegvideo.h:92
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
Rational number (pair of numerator and denominator).
Definition: rational.h:58
struct AVFrame * f
Definition: mpegpicture.h:46
#define CBPC_B_VLC_BITS
Definition: ituh263dec.c:56
RLTable ff_h263_rl_inter
Definition: h263data.c:161
static VLC mv_vlc
Definition: ituh263dec.c:101
int ff_h263_resync(MpegEncContext *s)
Decode the group of blocks / video packet header / slice header (MPEG-4 Studio).
Definition: ituh263dec.c:213
#define SKIP_CACHE(name, gb, num)
Definition: get_bits.h:180
const uint8_t ff_cbpc_b_tab[4][2]
Definition: h263data.c:77
int f_code
forward MV resolution
Definition: mpegvideo.h:238
#define MB_TYPE_SKIP
Definition: mpegutils.h:62
const uint8_t ff_h263_cbpy_tab[16][2]
Definition: h263data.c:84
#define tab_size
Definition: ituh263dec.c:630
int ff_h263_decode_picture_header(MpegEncContext *s)
Definition: ituh263dec.c:999
#define MV_DIR_FORWARD
Definition: mpegvideo.h:262
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:212
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:130
static void h263_decode_dquant(MpegEncContext *s)
Definition: ituh263dec.c:430
int h263_pred
use MPEG-4/H.263 ac/dc predictions
Definition: mpegvideo.h:105
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
const AVRational ff_h263_pixel_aspect[16]
Definition: h263data.c:275
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
Definition: mpegvideo.h:189
uint8_t level
Definition: svq3.c:207
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
Definition: mpegvideo.h:276
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
Definition: mpegvideo.h:131
MpegEncContext.
Definition: mpegvideo.h:81
#define LOCAL_ALIGNED_32(t, v,...)
Definition: internal.h:137
struct AVCodecContext * avctx
Definition: mpegvideo.h:98
#define SHOW_SBITS(name, gb, num)
Definition: get_bits.h:212
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:104
#define MB_TYPE_L0L1
Definition: mpegutils.h:69
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
Definition: mpegvideo.h:130
void ff_h263_pred_acdc(MpegEncContext *s, int16_t *block, int n)
Definition: h263.c:220
#define TEX_VLC_BITS
Definition: dv.h:99
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
Picture last_picture
copy of the previous picture structure.
Definition: mpegvideo.h:162
Bi-dir predicted.
Definition: avutil.h:276
int den
Denominator.
Definition: rational.h:60
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (H.263)
Definition: mpegvideo.h:190
#define IS_INTRA(x, y)
void * priv_data
Definition: avcodec.h:1598
static av_always_inline int diff(const uint32_t a, const uint32_t b)
static VLC cbpc_b_vlc
Definition: ituh263dec.c:103
void ff_h263_show_pict_info(MpegEncContext *s)
Print picture info if FF_DEBUG_PICT_INFO is set.
Definition: ituh263dec.c:76
#define IS_8X8(a)
Definition: mpegutils.h:89
int16_t(* block)[64]
points to one of the following blocks
Definition: mpegvideo.h:508
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
Picture next_picture
copy of the next picture structure.
Definition: mpegvideo.h:168
static const uint8_t * align_get_bits(GetBitContext *s)
Definition: get_bits.h:693
int flags2
AV_CODEC_FLAG2_*.
Definition: avcodec.h:1658
int chroma_qscale
chroma QP
Definition: mpegvideo.h:205
int frame_number
Frame counter, set by libavcodec.
Definition: avcodec.h:2262
static void preview_obmc(MpegEncContext *s)
read the next MVs for OBMC.
Definition: ituh263dec.c:338
uint32_t * mb_type
types and macros are defined in mpegutils.h
Definition: mpegpicture.h:56
int rv10_version
RV10 version: 0 or 3.
Definition: mpegvideo.h:420
static int skip_1stop_8data_bits(GetBitContext *gb)
Definition: get_bits.h:854
int h263_long_vectors
use horrible H.263v1 long vector mode
Definition: mpegvideo.h:224
#define stride
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
Definition: mpegvideo.h:267
int h263_aic_dir
AIC direction: 0 = left, 1 = top.
Definition: mpegvideo.h:376
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
#define MB_TYPE_L0
Definition: mpegutils.h:67
int ff_h263_decode_mb(MpegEncContext *s, int16_t block[6][64])
Definition: ituh263dec.c:697
Predicted.
Definition: avutil.h:275
#define INTRA_MCBPC_VLC_BITS
Definition: h263.h:37
uint16_t pb_time
time distance between the last b and p,s,i frame
Definition: mpegvideo.h:393
const uint8_t ff_mvtab[33][2]
Definition: h263data.c:90