home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / graphics / display / mpega / src / bitstream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-20  |  2.6 KB  |  105 lines

  1. /*------------------------------------------------------------------------------
  2.  
  3.     File    :    BitStream.h
  4.  
  5.     Author  :    Stéphane TAVENARD
  6.  
  7.     $VER:   BitStream.h  1.0  (23/06/1995)
  8.  
  9.     (C) Copyright 1995-1995 Stéphane TAVENARD
  10.     All Rights Reserved
  11.  
  12.     #Rev|   Date   |              Comment
  13.     ----|----------|--------------------------------------------------------
  14.     0    |12/04/1995| Initial revision                      ST
  15.     1    |03/06/1995| First release (no more C code)                       ST
  16.     2    |23/06/1995| Aminet release                      ST
  17.  
  18.     ------------------------------------------------------------------------
  19.  
  20.     C Defintion of BitStream files handling
  21.  
  22. ------------------------------------------------------------------------------*/
  23.  
  24. #ifndef BITSTREAM_H
  25. #define BITSTREAM_H
  26.  
  27. #include <dos/dos.h>
  28.  
  29. typedef struct {
  30.    BPTR file_ptr;
  31.    int mode;
  32.    int buffer_size;
  33.    char *buffer;
  34.    int current_bit_index;
  35.    int remaining_bits;
  36.    unsigned long bitstream_size;
  37.    int end_of_stream;
  38. } BITSTREAM;
  39.  
  40. #define BSTR_MAX_BITS          32
  41.  
  42. #define BSTR_MODE_READ    0
  43. #define BSTR_MODE_WRITE 1
  44.  
  45. #ifndef ASM
  46. #ifdef __SASC
  47. #define ASM_A0 register __a0
  48. #define ASM_A1 register __a1
  49. #define ASM_A2 register __a2
  50. #define ASM_A3 register __a3
  51. #define ASM_A4 register __a4
  52. #define ASM_A5 register __a5
  53. #define ASM_A6 register __a6
  54. #define ASM_D0 register __d0
  55. #define ASM_D1 register __d1
  56. #define ASM_D2 register __d2
  57. #define ASM_D3 register __d3
  58. #define ASM_D4 register __d4
  59. #define ASM_D5 register __d5
  60. #define ASM_D6 register __d6
  61. #define ASM_D7 register __d7
  62. #define ASM __asm
  63. #else
  64. #define ASM_A0 __A0
  65. #define ASM_A1 __A1
  66. #define ASM_A2 __A2
  67. #define ASM_A3 __A3
  68. #define ASM_A4 __A4
  69. #define ASM_A5 __A5
  70. #define ASM_A6 __A6
  71. #define ASM_D0 __D0
  72. #define ASM_D1 __D1
  73. #define ASM_D2 __D2
  74. #define ASM_D3 __D3
  75. #define ASM_D4 __D4
  76. #define ASM_D5 __D5
  77. #define ASM_D6 __D6
  78. #define ASM_D7 __D7
  79. #define ASM
  80. #endif
  81. #endif
  82.  
  83. void BSTR_close( ASM_A0 BITSTREAM *bitstream );
  84. BITSTREAM *BSTR_open( ASM_A0 char *filename,
  85.               ASM_D0 unsigned int buffer_size,
  86.               ASM_D1 int mode );
  87.  
  88. int BSTR_rewind( ASM_A0 BITSTREAM *bitstream );
  89. int BSTR_end( ASM_A0 BITSTREAM *bitstream );
  90. unsigned int BSTR_seek_tell( ASM_A0 BITSTREAM *bitstream );
  91.  
  92. unsigned int ASM BSTR_read_bit( ASM_A0 BITSTREAM *bitstream );
  93. unsigned int ASM BSTR_read_bits( ASM_A0 BITSTREAM *bitstream,
  94.                  ASM_D1 unsigned int bit_count );
  95. int ASM BSTR_read_signed_bits( ASM_A0 BITSTREAM *bitstream,
  96.                    ASM_D1 unsigned int bit_count );
  97. unsigned int ASM BSTR_skip_bits( ASM_A0 BITSTREAM *bitstream,
  98.                  ASM_D1 unsigned int bit_count );
  99.  
  100. int ASM BSTR_seek_sync( ASM_A0 BITSTREAM *bitstream,
  101.             ASM_D0 unsigned int sync_value,
  102.             ASM_D1 unsigned int sync_length );
  103.  
  104. #endif
  105.