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.

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