w9968cf_decoder.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /***************************************************************************
  2. * Video decoder for the W996[87]CF driver for Linux. *
  3. * *
  4. * Copyright (C) 2003 2004 by Luca Risolia <luca.risolia@studio.unibo.it> *
  5. * *
  6. * This program is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 2 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program 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 *
  14. * GNU General Public License for more details. *
  15. * *
  16. * You should have received a copy of the GNU General Public License *
  17. * along with this program; if not, write to the Free Software *
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
  19. ***************************************************************************/
  20. #ifndef _W9968CF_DECODER_H_
  21. #define _W9968CF_DECODER_H_
  22. /* Comment/uncomment this for high/low quality of compressed video */
  23. #define W9968CF_DEC_FAST_LOWQUALITY_VIDEO
  24. #ifdef W9968CF_DEC_FAST_LOWQUALITY_VIDEO
  25. static const unsigned char Y_QUANTABLE[64] = {
  26. 16, 11, 10, 16, 24, 40, 51, 61,
  27. 12, 12, 14, 19, 26, 58, 60, 55,
  28. 14, 13, 16, 24, 40, 57, 69, 56,
  29. 14, 17, 22, 29, 51, 87, 80, 62,
  30. 18, 22, 37, 56, 68, 109, 103, 77,
  31. 24, 35, 55, 64, 81, 104, 113, 92,
  32. 49, 64, 78, 87, 103, 121, 120, 101,
  33. 72, 92, 95, 98, 112, 100, 103, 99
  34. };
  35. static const unsigned char UV_QUANTABLE[64] = {
  36. 17, 18, 24, 47, 99, 99, 99, 99,
  37. 18, 21, 26, 66, 99, 99, 99, 99,
  38. 24, 26, 56, 99, 99, 99, 99, 99,
  39. 47, 66, 99, 99, 99, 99, 99, 99,
  40. 99, 99, 99, 99, 99, 99, 99, 99,
  41. 99, 99, 99, 99, 99, 99, 99, 99,
  42. 99, 99, 99, 99, 99, 99, 99, 99,
  43. 99, 99, 99, 99, 99, 99, 99, 99
  44. };
  45. #else
  46. static const unsigned char Y_QUANTABLE[64] = {
  47. 8, 5, 5, 8, 12, 20, 25, 30,
  48. 6, 6, 7, 9, 13, 29, 30, 27,
  49. 7, 6, 8, 12, 20, 28, 34, 28,
  50. 7, 8, 11, 14, 25, 43, 40, 31,
  51. 9, 11, 18, 28, 34, 54, 51, 38,
  52. 12, 17, 27, 32, 40, 52, 56, 46,
  53. 24, 32, 39, 43, 51, 60, 60, 50,
  54. 36, 46, 47, 49, 56, 50, 51, 49
  55. };
  56. static const unsigned char UV_QUANTABLE[64] = {
  57. 8, 9, 12, 23, 49, 49, 49, 49,
  58. 9, 10, 13, 33, 49, 49, 49, 49,
  59. 12, 13, 28, 49, 49, 49, 49, 49,
  60. 23, 33, 49, 49, 49, 49, 49, 49,
  61. 49, 49, 49, 49, 49, 49, 49, 49,
  62. 49, 49, 49, 49, 49, 49, 49, 49,
  63. 49, 49, 49, 49, 49, 49, 49, 49,
  64. 49, 49, 49, 49, 49, 49, 49, 49
  65. };
  66. #endif
  67. #define W9968CF_DEC_ERR_CORRUPTED_DATA -1
  68. #define W9968CF_DEC_ERR_BUF_OVERFLOW -2
  69. #define W9968CF_DEC_ERR_NO_SOI -3
  70. #define W9968CF_DEC_ERR_NO_SOF0 -4
  71. #define W9968CF_DEC_ERR_NO_SOS -5
  72. #define W9968CF_DEC_ERR_NO_EOI -6
  73. extern void w9968cf_init_decoder(void);
  74. extern int w9968cf_check_headers(const unsigned char* Pin,
  75. const unsigned long BUF_SIZE);
  76. extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE,
  77. const unsigned W, const unsigned H, char* Pout);
  78. #endif /* _W9968CF_DECODER_H_ */