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.

99 lines
2.5KB

  1. /*
  2. * Common Ut Video header
  3. * Copyright (c) 2011 Konstantin Shishkov
  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_UTVIDEO_H
  22. #define AVCODEC_UTVIDEO_H
  23. /**
  24. * @file
  25. * Common Ut Video header
  26. */
  27. #include "libavutil/common.h"
  28. #include "avcodec.h"
  29. #include "bswapdsp.h"
  30. #include "huffyuvdsp.h"
  31. #include "huffyuvencdsp.h"
  32. enum {
  33. PRED_NONE = 0,
  34. PRED_LEFT,
  35. PRED_GRADIENT,
  36. PRED_MEDIAN,
  37. };
  38. enum {
  39. COMP_NONE = 0,
  40. COMP_HUFF,
  41. };
  42. /*
  43. * "Original format" markers.
  44. * Based on values gotten from the official VFW encoder.
  45. * They are not used during decoding, but they do have
  46. * an informative role on seeing what was input
  47. * to the encoder.
  48. */
  49. enum {
  50. UTVIDEO_RGB = MKTAG(0x00, 0x00, 0x01, 0x18),
  51. UTVIDEO_RGBA = MKTAG(0x00, 0x00, 0x02, 0x18),
  52. UTVIDEO_420 = MKTAG('Y', 'V', '1', '2'),
  53. UTVIDEO_422 = MKTAG('Y', 'U', 'Y', '2'),
  54. };
  55. /* Mapping of libavcodec prediction modes to Ut Video's */
  56. extern const int ff_ut_pred_order[5];
  57. /* Order of RGB(A) planes in Ut Video */
  58. extern const int ff_ut_rgb_order[4];
  59. typedef struct UtvideoContext {
  60. const AVClass *class;
  61. AVCodecContext *avctx;
  62. BswapDSPContext bdsp;
  63. HuffYUVDSPContext hdspdec;
  64. HuffYUVEncDSPContext hdsp;
  65. uint32_t frame_info_size, flags, frame_info;
  66. int planes;
  67. int slices;
  68. int compression;
  69. int interlaced;
  70. int frame_pred;
  71. int pro;
  72. ptrdiff_t slice_stride;
  73. uint8_t *slice_bits, *slice_buffer[4];
  74. int slice_bits_size;
  75. } UtvideoContext;
  76. typedef struct HuffEntry {
  77. uint16_t sym;
  78. uint8_t len;
  79. uint32_t code;
  80. } HuffEntry;
  81. /* Compare huffman tree nodes */
  82. int ff_ut_huff_cmp_len(const void *a, const void *b);
  83. int ff_ut10_huff_cmp_len(const void *a, const void *b);
  84. #endif /* AVCODEC_UTVIDEO_H */