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.

109 lines
2.3KB

  1. /*
  2. * Copyright (c) 2015 Kieran Kunhya
  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_CFHD_H
  21. #define AVCODEC_CFHD_H
  22. #include <stdint.h>
  23. #include "avcodec.h"
  24. #include "bitstream.h"
  25. #define VLC_BITS 9
  26. #define SUBBAND_COUNT 10
  27. typedef struct CFHD_RL_VLC_ELEM {
  28. int16_t level;
  29. int8_t len;
  30. uint16_t run;
  31. } CFHD_RL_VLC_ELEM;
  32. #define DWT_LEVELS 3
  33. typedef struct SubBand {
  34. int level;
  35. int orientation;
  36. ptrdiff_t stride;
  37. int a_width;
  38. int width;
  39. int a_height;
  40. int height;
  41. int pshift;
  42. int quant;
  43. uint8_t *ibuf;
  44. } SubBand;
  45. typedef struct Plane {
  46. int width;
  47. int height;
  48. ptrdiff_t stride;
  49. int16_t *idwt_buf;
  50. int16_t *idwt_tmp;
  51. /* TODO: merge this into SubBand structure */
  52. int16_t *subband[SUBBAND_COUNT];
  53. int16_t *l_h[8];
  54. SubBand band[DWT_LEVELS][4];
  55. } Plane;
  56. typedef struct CFHDContext {
  57. AVCodecContext *avctx;
  58. CFHD_RL_VLC_ELEM table_9_rl_vlc[2088];
  59. VLC vlc_9;
  60. CFHD_RL_VLC_ELEM table_18_rl_vlc[4572];
  61. VLC vlc_18;
  62. BitstreamContext bc;
  63. int coded_width;
  64. int coded_height;
  65. int cropped_height;
  66. enum AVPixelFormat coded_format;
  67. int a_width;
  68. int a_height;
  69. int a_format;
  70. int bpc; // bits per channel/component
  71. int channel_cnt;
  72. int subband_cnt;
  73. int channel_num;
  74. uint8_t lowpass_precision;
  75. uint16_t quantisation;
  76. int wavelet_depth;
  77. int pshift;
  78. int codebook;
  79. int subband_num;
  80. int level;
  81. int subband_num_actual;
  82. uint8_t prescale_shift[3];
  83. Plane plane[4];
  84. } CFHDContext;
  85. int ff_cfhd_init_vlcs(CFHDContext *s);
  86. #endif /* AVCODEC_CFHD_H */