texturedsp.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Texture block module
  3. * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * Texture block (4x4) module
  24. *
  25. * References:
  26. * https://www.opengl.org/wiki/S3_Texture_Compression
  27. * https://www.opengl.org/wiki/Red_Green_Texture_Compression
  28. * https://msdn.microsoft.com/en-us/library/bb694531%28v=vs.85%29.aspx
  29. *
  30. * All functions return how much data has been written or read.
  31. *
  32. * Pixel input or output format is always AV_PIX_FMT_RGBA.
  33. */
  34. #ifndef AVCODEC_TEXTUREDSP_H
  35. #define AVCODEC_TEXTUREDSP_H
  36. #include <stddef.h>
  37. #include <stdint.h>
  38. #define TEXTURE_BLOCK_W 4
  39. #define TEXTURE_BLOCK_H 4
  40. typedef struct TextureDSPContext {
  41. int (*dxt1_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  42. int (*dxt1a_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  43. int (*dxt2_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  44. int (*dxt3_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  45. int (*dxt4_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  46. int (*dxt5_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  47. int (*dxt5y_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  48. int (*dxt5ys_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  49. int (*rgtc1s_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  50. int (*rgtc1u_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  51. int (*rgtc1u_gray_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  52. int (*rgtc1u_alpha_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  53. int (*rgtc2s_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  54. int (*rgtc2u_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  55. int (*dxn3dc_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
  56. } TextureDSPContext;
  57. void ff_texturedsp_init(TextureDSPContext *c);
  58. void ff_texturedspenc_init(TextureDSPContext *c);
  59. #endif /* AVCODEC_TEXTUREDSP_H */