ac.hpp
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:5k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. /* $Id: ac.hpp,v 1.2 2001/04/19 18:32:09 wmay Exp $ */
  2. /****************************************************************************/
  3. /*   MPEG4 Visual Texture Coding (VTC) Mode Software                        */
  4. /*                                                                          */
  5. /*   This software was jointly developed by the following participants:     */
  6. /*                                                                          */
  7. /*   Single-quant,  multi-quant and flow control                            */
  8. /*   are provided by  Sarnoff Corporation                                   */
  9. /*     Iraj Sodagar   (iraj@sarnoff.com)                                    */
  10. /*     Hung-Ju Lee    (hjlee@sarnoff.com)                                   */
  11. /*     Paul Hatrack   (hatrack@sarnoff.com)                                 */
  12. /*     Shipeng Li     (shipeng@sarnoff.com)                                 */
  13. /*     Bing-Bing Chai (bchai@sarnoff.com)                                   */
  14. /*     B.S. Srinivas  (bsrinivas@sarnoff.com)                               */
  15. /*                                                                          */
  16. /*   Bi-level is provided by Texas Instruments                              */
  17. /*     Jie Liang      (liang@ti.com)                                        */
  18. /*                                                                          */
  19. /*   Shape Coding is provided by  OKI Electric Industry Co., Ltd.           */
  20. /*     Zhixiong Wu    (sgo@hlabs.oki.co.jp)                                 */
  21. /*     Yoshihiro Ueda (yueda@hlabs.oki.co.jp)                               */
  22. /*     Toshifumi Kanamaru (kanamaru@hlabs.oki.co.jp)                        */
  23. /*                                                                          */
  24. /*   OKI, Sharp, Sarnoff, TI and Microsoft contributed to bitstream         */
  25. /*   exchange and bug fixing.                                               */
  26. /*                                                                          */
  27. /*                                                                          */
  28. /* In the course of development of the MPEG-4 standard, this software       */
  29. /* module is an implementation of a part of one or more MPEG-4 tools as     */
  30. /* specified by the MPEG-4 standard.                                        */
  31. /*                                                                          */
  32. /* The copyright of this software belongs to ISO/IEC. ISO/IEC gives use     */
  33. /* of the MPEG-4 standard free license to use this  software module or      */
  34. /* modifications thereof for hardware or software products claiming         */
  35. /* conformance to the MPEG-4 standard.                                      */
  36. /*                                                                          */
  37. /* Those intending to use this software module in hardware or software      */
  38. /* products are advised that use may infringe existing  patents. The        */
  39. /* original developers of this software module and their companies, the     */
  40. /* subsequent editors and their companies, and ISO/IEC have no liability    */
  41. /* and ISO/IEC have no liability for use of this software module or         */
  42. /* modification thereof in an implementation.                               */
  43. /*                                                                          */
  44. /* Permission is granted to MPEG members to use, copy, modify,              */
  45. /* and distribute the software modules ( or portions thereof )              */
  46. /* for standardization activity within ISO/IEC JTC1/SC29/WG11.              */
  47. /*                                                                          */
  48. /* Copyright 1995, 1996, 1997, 1998 ISO/IEC                                 */
  49. /****************************************************************************/
  50. /************************************************************/
  51. /*     Sarnoff Very Low Bit Rate Still Image Coder          */
  52. /*     Copyright 1995, 1996, 1997, 1998 Sarnoff Corporation */
  53. /************************************************************/
  54. /************************************************************/
  55. /*  Filename: ac.h                                          */
  56. /*                                                          */
  57. /*  Descriptions:                                           */
  58. /*    This is the header file of ac.c containing arithmetic */
  59. /*    coding routines.                                      */
  60. /*                                                          */
  61. /************************************************************/
  62. #ifndef AC_HEADER
  63. #define AC_HEADER
  64. //#include <stdio.h>
  65. #include "basic.hpp"
  66. #define MAX_BUFFER 1024
  67. typedef struct {
  68.   FILE *fp;
  69.   long low;
  70.   long high;
  71.   long followBits;
  72.   Int buffer;
  73.   Int bitsLeft;
  74.   long bitCount;
  75.   UChar *bitstream;
  76.   long  bitstreamLength;
  77. } ac_encoder;
  78. typedef struct {
  79.   FILE *fp;
  80.   long value;
  81.   long low;
  82.   long high;
  83.   Int buffer;
  84.   Int bitsLeft;
  85.   UChar *bitstream;
  86.   long bitCount;
  87.   long  bitstream_ptr;
  88.   Int  dc_band;
  89. } ac_decoder;
  90. typedef struct {
  91.   Int nsym;   /* the number of symbols in the symbol set to be encoded */
  92.   Int adapt;  /* 0 => non-adaptive, !0 => adaptive */
  93.   Int inc;
  94.   /* for zeroth and mixed order models only */
  95.   UShort *freq;
  96.   UShort *cfreq;
  97.   UShort Max_frequency;
  98. } ac_model;
  99. #endif