hqx.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Canopus HQX decoder
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg 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. * FFmpeg 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 FFmpeg; 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 "get_bits.h"
  26. #include "hqxdsp.h"
  27. enum HQXACMode {
  28. HQX_AC_Q0 = 0,
  29. HQX_AC_Q8,
  30. HQX_AC_Q16,
  31. HQX_AC_Q32,
  32. HQX_AC_Q64,
  33. HQX_AC_Q128,
  34. NUM_HQX_AC
  35. };
  36. typedef struct HQXLUT {
  37. int16_t lev;
  38. uint8_t run;
  39. int8_t bits;
  40. } HQXLUT;
  41. typedef struct HQXAC {
  42. int lut_bits, extra_bits;
  43. const HQXLUT *lut;
  44. } HQXAC;
  45. struct HQXContext;
  46. typedef int (*mb_decode_func)(struct HQXContext *ctx,
  47. int slice_no, int x, int y);
  48. typedef struct HQXSlice {
  49. GetBitContext gb;
  50. DECLARE_ALIGNED(16, int16_t, block)[16][64];
  51. } HQXSlice;
  52. typedef struct HQXContext {
  53. HQXDSPContext hqxdsp;
  54. HQXSlice slice[16];
  55. AVFrame *pic;
  56. mb_decode_func decode_func;
  57. int format, dcb, width, height;
  58. int interlaced;
  59. uint8_t *src;
  60. unsigned int data_size;
  61. uint32_t slice_off[17];
  62. VLC cbp_vlc;
  63. VLC dc_vlc[3];
  64. } HQXContext;
  65. #define HQX_DC_VLC_BITS 9
  66. extern const HQXAC ff_hqx_ac[NUM_HQX_AC];
  67. int ff_hqx_init_vlcs(HQXContext *ctx);
  68. #endif /* AVCODEC_HQX_H */