jtypes.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #pragma warning (disable : 4200)
  3. #pragma pack(1)
  4. typedef struct tag_JFIFHeader {
  5. BYTE SOI[2];
  6. BYTE APP0[2];
  7. WORD Length;
  8. BYTE Identifier[5];
  9. BYTE Version[2];
  10. BYTE Units;
  11. WORD XDensity;
  12. WORD YDensity;
  13. BYTE XThumbnail;
  14. BYTE YThumbnail;
  15. } JFIFHEAD;
  16. typedef struct tag_JFIFExtension {
  17. BYTE APP0[2];
  18. WORD Length;
  19. } JFIFEXTENSION;
  20. //
  21. // HUFFCODE and HUFFTABLE store the data needed to decode huffman encoded data.
  22. //
  23. typedef struct tagHUFFCODE {
  24. DWORD dwBits;
  25. DWORD dwMask;
  26. char value;
  27. char numbits;
  28. } HUFFCODE;
  29. typedef struct tagHUFFMAN_TABLE {
  30. int size;
  31. int first9bit;
  32. short quick_lookup[256];
  33. HUFFCODE code[];
  34. } HUFFTABLE;
  35. //
  36. // a bitstream is basically just a structure containing information needed to extract variable numbers of bits
  37. //
  38. typedef struct tagBITSTREAM {
  39. DWORD dwBits; // holds from 24--32 of the latest bits. bit 31 (the MSB) is always the next bit to extract
  40. BYTE *p; // *p is always the next 8 bits that will go into dwBits
  41. int nEmpty; // holds the number of bits at the bottom of dwBits that are not being currently used. when
  42. // this value reaches 8, we need to grab another byte (8 bits) from *p and increment p.
  43. } BITSTREAM;
  44. typedef struct tagCOMP {
  45. BYTE id;
  46. BYTE samp_factor;
  47. BYTE table;
  48. } COMP;
  49. typedef struct tagFRAME {
  50. BYTE prec;
  51. WORD wHeight;
  52. WORD wWidth;
  53. BYTE nComps;
  54. COMP comp[];
  55. } FRAME;
  56. typedef signed short COEF;
  57. typedef COEF MATRIX[8][8];
  58. #ifndef FREE
  59. #define FREE(x) { if (x) { free(x); (x)=NULL; } }
  60. #endif