utvideo.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Common Ut Video header
  3. * Copyright (c) 2011 Konstantin Shishkov
  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. #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 "utvideodsp.h"
  31. #include "lossless_videodsp.h"
  32. #include "lossless_videoencdsp.h"
  33. enum {
  34. PRED_NONE = 0,
  35. PRED_LEFT,
  36. PRED_GRADIENT,
  37. PRED_MEDIAN,
  38. };
  39. enum {
  40. COMP_NONE = 0,
  41. COMP_HUFF,
  42. };
  43. /*
  44. * "Original format" markers.
  45. * Based on values gotten from the official VFW encoder.
  46. * They are not used during decoding, but they do have
  47. * an informative role on seeing what was input
  48. * to the encoder.
  49. */
  50. enum {
  51. UTVIDEO_RGB = MKTAG(0x00, 0x00, 0x01, 0x18),
  52. UTVIDEO_RGBA = MKTAG(0x00, 0x00, 0x02, 0x18),
  53. UTVIDEO_420 = MKTAG('Y', 'V', '1', '2'),
  54. UTVIDEO_422 = MKTAG('Y', 'U', 'Y', '2'),
  55. UTVIDEO_444 = MKTAG('Y', 'V', '2', '4'),
  56. };
  57. /* Mapping of libavcodec prediction modes to Ut Video's */
  58. extern const int ff_ut_pred_order[5];
  59. typedef struct UtvideoContext {
  60. const AVClass *class;
  61. AVCodecContext *avctx;
  62. UTVideoDSPContext utdsp;
  63. BswapDSPContext bdsp;
  64. LLVidDSPContext llviddsp;
  65. LLVidEncDSPContext llvidencdsp;
  66. uint32_t frame_info_size, flags, frame_info, offset;
  67. int planes;
  68. int slices;
  69. int compression;
  70. int interlaced;
  71. int frame_pred;
  72. int pro;
  73. int pack;
  74. ptrdiff_t slice_stride;
  75. uint8_t *slice_bits, *slice_buffer[4];
  76. int slice_bits_size;
  77. const uint8_t *packed_stream[4][256];
  78. size_t packed_stream_size[4][256];
  79. const uint8_t *control_stream[4][256];
  80. size_t control_stream_size[4][256];
  81. } UtvideoContext;
  82. typedef struct HuffEntry {
  83. uint16_t sym;
  84. uint8_t len;
  85. uint32_t code;
  86. } HuffEntry;
  87. /* Compare huffman tree nodes */
  88. int ff_ut_huff_cmp_len(const void *a, const void *b);
  89. int ff_ut10_huff_cmp_len(const void *a, const void *b);
  90. #endif /* AVCODEC_UTVIDEO_H */