h263dec.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * H.263 decoder internal header
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_H263DEC_H
  21. #define AVCODEC_H263DEC_H
  22. #include "get_bits.h"
  23. #include "mpegvideo.h"
  24. #include "vlc.h"
  25. #include "libavutil/mem_internal.h"
  26. // The defines below define the number of bits that are read at once for
  27. // reading vlc values. Changing these may improve speed and data cache needs
  28. // be aware though that decreasing them may need the number of stages that is
  29. // passed to get_vlc* to be increased.
  30. #define H263_MV_VLC_BITS 9
  31. #define INTRA_MCBPC_VLC_BITS 6
  32. #define INTER_MCBPC_VLC_BITS 7
  33. #define CBPY_VLC_BITS 6
  34. #define TEX_VLC_BITS 9
  35. extern VLCElem ff_h263_intra_MCBPC_vlc[];
  36. extern VLCElem ff_h263_inter_MCBPC_vlc[];
  37. extern VLCElem ff_h263_cbpy_vlc[];
  38. extern VLCElem ff_h263_mv_vlc[];
  39. typedef struct H263DecContext {
  40. MPVContext c;
  41. GetBitContext gb;
  42. int mb_num_left; ///< number of MBs left in this video packet (for partitioned slices only)
  43. int picture_number;
  44. int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved)
  45. /* motion compensation */
  46. int h263_long_vectors; ///< use horrible H.263v1 long vector mode
  47. /* FLV specific */
  48. int flv; ///< use flv H.263 header
  49. /* H.263 specific */
  50. int ehc_mode;
  51. int gob_index;
  52. /* H.263+ specific */
  53. int custom_pcf;
  54. int umvplus; ///< == H.263+ && unrestricted_mv
  55. int h263_slice_structured;
  56. int alt_inter_vlc; ///< alternative inter vlc
  57. int loop_filter;
  58. int modified_quant;
  59. /* MPEG-4 specific */
  60. int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4
  61. int skipped_last_frame;
  62. int divx_packed; ///< divx specific, used to workaround (many) bugs in divx5
  63. int data_partitioning; ///< data partitioning flag from header
  64. int partitioned_frame; ///< is current frame partitioned
  65. /* MSMPEG4 specific */
  66. int slice_height; ///< in macroblocks
  67. /* MPEG-4 (Studio Profile), MSMPEG4 and RV10 specific */
  68. int last_dc[3]; ///< last DC values, used by MPEG4, MSMPEG4V1, RV10
  69. /* RV10 specific */
  70. int rv10_version; ///< RV10 version: 0 or 3
  71. int rv10_first_dc_coded[3];
  72. int (*decode_header)(struct H263DecContext *const h);
  73. #define FRAME_SKIPPED 100 ///< Frame is not coded
  74. int (*decode_mb)(struct H263DecContext *h);
  75. #define SLICE_OK 0
  76. #define SLICE_ERROR -1
  77. #define SLICE_END -2 ///<end marker found
  78. #define SLICE_NOEND -3 ///<no end marker or error found but mb count exceeded
  79. GetBitContext last_resync_gb; ///< used to search for the next resync marker
  80. DECLARE_ALIGNED_32(int16_t, block)[6][64];
  81. } H263DecContext;
  82. int ff_h263_decode_motion(H263DecContext *const h, int pred, int f_code);
  83. int ff_h263_decode_init(AVCodecContext *avctx);
  84. int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *frame,
  85. int *got_frame, AVPacket *avpkt);
  86. void ff_h263_decode_init_vlc(void);
  87. int ff_h263_decode_picture_header(H263DecContext *const h);
  88. int ff_h263_decode_gob_header(H263DecContext *const h);
  89. int ff_h263_decode_mba(H263DecContext *const h);
  90. /**
  91. * Print picture info if FF_DEBUG_PICT_INFO is set.
  92. */
  93. void ff_h263_show_pict_info(H263DecContext *const h, int h263_plus);
  94. int ff_intel_h263_decode_picture_header(H263DecContext *const h);
  95. int ff_h263_decode_mb(H263DecContext *const h);
  96. int ff_h263_resync(H263DecContext *const h);
  97. #endif