You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
1.9KB

  1. /*
  2. * Canopus HQX decoder
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav 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 GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_HQX_H
  21. #define AVCODEC_HQX_H
  22. #include <stdint.h>
  23. #include "libavutil/frame.h"
  24. #include "libavutil/mem.h"
  25. #include "bitstream.h"
  26. #include "hqxdsp.h"
  27. #include "vlc.h"
  28. enum HQXACMode {
  29. HQX_AC_Q0 = 0,
  30. HQX_AC_Q8,
  31. HQX_AC_Q16,
  32. HQX_AC_Q32,
  33. HQX_AC_Q64,
  34. HQX_AC_Q128,
  35. NUM_HQX_AC
  36. };
  37. typedef struct HQXLUT {
  38. int16_t lev;
  39. uint8_t run;
  40. int8_t bits;
  41. } HQXLUT;
  42. typedef struct HQXAC {
  43. int lut_bits, extra_bits;
  44. const HQXLUT *lut;
  45. } HQXAC;
  46. struct HQXContext;
  47. typedef int (*mb_decode_func)(struct HQXContext *ctx,
  48. int slice_no, int x, int y);
  49. typedef struct HQXSlice {
  50. BitstreamContext bc;
  51. DECLARE_ALIGNED(16, int16_t, block)[16][64];
  52. } HQXSlice;
  53. typedef struct HQXContext {
  54. HQXDSPContext hqxdsp;
  55. HQXSlice slice[16];
  56. AVFrame *pic;
  57. mb_decode_func decode_func;
  58. int format, dcb, width, height;
  59. int interlaced;
  60. uint8_t *src;
  61. unsigned int data_size;
  62. uint32_t slice_off[17];
  63. VLC cbp_vlc;
  64. VLC dc_vlc[3];
  65. } HQXContext;
  66. #define HQX_DC_VLC_BITS 9
  67. extern const HQXAC ff_hqx_ac[NUM_HQX_AC];
  68. int ff_hqx_init_vlcs(HQXContext *ctx);
  69. #endif /* AVCODEC_HQX_H */