roqvideo.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2003 Mike Melanson
  3. * Copyright (C) 2003 Dr. Tim Ferguson
  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_ROQVIDEO_H
  22. #define AVCODEC_ROQVIDEO_H
  23. #include "libavutil/lfg.h"
  24. #include "avcodec.h"
  25. #include "bytestream.h"
  26. typedef struct roq_cell {
  27. unsigned char y[4];
  28. unsigned char u, v;
  29. } roq_cell;
  30. typedef struct roq_qcell {
  31. int idx[4];
  32. } roq_qcell;
  33. typedef struct motion_vect {
  34. int d[2];
  35. } motion_vect;
  36. struct RoqTempData;
  37. typedef struct RoqContext {
  38. const AVClass *class;
  39. AVCodecContext *avctx;
  40. AVFrame *last_frame;
  41. AVFrame *current_frame;
  42. int first_frame;
  43. roq_cell cb2x2[256];
  44. roq_qcell cb4x4[256];
  45. GetByteContext gb;
  46. int width, height;
  47. /* Encoder only data */
  48. AVLFG randctx;
  49. uint64_t lambda;
  50. motion_vect *this_motion4;
  51. motion_vect *last_motion4;
  52. motion_vect *this_motion8;
  53. motion_vect *last_motion8;
  54. unsigned int framesSinceKeyframe;
  55. const AVFrame *frame_to_enc;
  56. uint8_t *out_buf;
  57. struct RoqTempData *tmpData;
  58. int quake3_compat; // Quake 3 compatibility option
  59. } RoqContext;
  60. #define RoQ_INFO 0x1001
  61. #define RoQ_QUAD_CODEBOOK 0x1002
  62. #define RoQ_QUAD_VQ 0x1011
  63. #define RoQ_SOUND_MONO 0x1020
  64. #define RoQ_SOUND_STEREO 0x1021
  65. #define RoQ_ID_MOT 0x00
  66. #define RoQ_ID_FCC 0x01
  67. #define RoQ_ID_SLD 0x02
  68. #define RoQ_ID_CCC 0x03
  69. void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell);
  70. void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell);
  71. void ff_apply_motion_4x4(RoqContext *ri, int x, int y, int deltax, int deltay);
  72. void ff_apply_motion_8x8(RoqContext *ri, int x, int y, int deltax, int deltay);
  73. #endif /* AVCODEC_ROQVIDEO_H */