huffman.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * libmad - MPEG audio decoder library
  3. * Copyright (C) 2000-2004 Underbit Technologies, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. * $Id: huffman.h,v 1.11 2004/01/23 09:41:32 rob Exp $
  20. */
  21. # ifndef LIBMAD_HUFFMAN_H
  22. # define LIBMAD_HUFFMAN_H
  23. union huffquad {
  24. struct {
  25. unsigned short final : 1;
  26. unsigned short bits : 3;
  27. unsigned short offset : 12;
  28. } ptr;
  29. struct {
  30. unsigned short final : 1;
  31. unsigned short hlen : 3;
  32. unsigned short v : 1;
  33. unsigned short w : 1;
  34. unsigned short x : 1;
  35. unsigned short y : 1;
  36. } value;
  37. unsigned short final : 1;
  38. };
  39. union huffpair {
  40. struct {
  41. unsigned short final : 1;
  42. unsigned short bits : 3;
  43. unsigned short offset : 12;
  44. } ptr;
  45. struct {
  46. unsigned short final : 1;
  47. unsigned short hlen : 3;
  48. unsigned short x : 4;
  49. unsigned short y : 4;
  50. } value;
  51. unsigned short final : 1;
  52. };
  53. struct hufftable {
  54. union huffpair const *table;
  55. unsigned short linbits;
  56. unsigned short startbits;
  57. };
  58. extern union huffquad const *const mad_huff_quad_table[2];
  59. extern struct hufftable const mad_huff_pair_table[32];
  60. # endif