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.

67 lines
2.0KB

  1. /*
  2. * Vidvox Hap
  3. * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVCODEC_HAP_H
  22. #define AVCODEC_HAP_H
  23. #include <stdint.h>
  24. #include "libavutil/opt.h"
  25. #include "bytestream.h"
  26. #include "texturedsp.h"
  27. enum HapTextureFormat {
  28. HAP_FMT_RGBDXT1 = 0x0B,
  29. HAP_FMT_RGBADXT5 = 0x0E,
  30. HAP_FMT_YCOCGDXT5 = 0x0F,
  31. };
  32. enum HapCompressor {
  33. HAP_COMP_NONE = 0xA0,
  34. HAP_COMP_SNAPPY = 0xB0,
  35. HAP_COMP_COMPLEX = 0xC0,
  36. };
  37. typedef struct HapContext {
  38. AVClass *class;
  39. TextureDSPContext dxtc;
  40. GetByteContext gbc;
  41. int section_type; /* Header type */
  42. int tex_rat; /* Compression ratio */
  43. const uint8_t *tex_data; /* Compressed texture */
  44. uint8_t *tex_buf; /* Uncompressed texture */
  45. size_t tex_size; /* Size of the compressed texture */
  46. uint8_t *snappied; /* Buffer interacting with snappy */
  47. size_t max_snappy; /* Maximum compressed size for snappy buffer */
  48. int slice_count; /* Number of slices for threaded operations */
  49. /* Pointer to the selected compress or decompress function */
  50. int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  51. } HapContext;
  52. #endif /* AVCODEC_HAP_H */