intrax8.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_INTRAX8_H
  19. #define AVCODEC_INTRAX8_H
  20. #include "blockdsp.h"
  21. #include "get_bits.h"
  22. #include "idctdsp.h"
  23. #include "intrax8dsp.h"
  24. #include "wmv2dsp.h"
  25. #include "mpegpicture.h"
  26. typedef struct IntraX8Context {
  27. VLC *j_ac_vlc[4]; // they point to the static j_mb_vlc
  28. VLC *j_orient_vlc;
  29. VLC *j_dc_vlc[3];
  30. int use_quant_matrix;
  31. // set by ff_intrax8_common_init
  32. uint8_t *prediction_table; // 2 * (mb_w * 2)
  33. ScanTable scantable[3];
  34. WMV2DSPContext wdsp;
  35. uint8_t idct_permutation[64];
  36. AVCodecContext *avctx;
  37. int *block_last_index; ///< last nonzero coefficient in block
  38. int16_t (*block)[64];
  39. // set by the caller codec
  40. IntraX8DSPContext dsp;
  41. IDCTDSPContext idsp;
  42. BlockDSPContext bdsp;
  43. int quant;
  44. int dquant;
  45. int qsum;
  46. int loopfilter;
  47. AVFrame *frame;
  48. GetBitContext *gb;
  49. // calculated per frame
  50. int quant_dc_chroma;
  51. int divide_quant_dc_luma;
  52. int divide_quant_dc_chroma;
  53. uint8_t *dest[3];
  54. uint8_t scratchpad[42]; // size of the block is fixed (8x8 plus padding)
  55. // changed per block
  56. int edges;
  57. int flat_dc;
  58. int predicted_dc;
  59. int raw_orient;
  60. int chroma_orient;
  61. int orient;
  62. int est_run;
  63. // block props
  64. int mb_x, mb_y;
  65. int mb_width, mb_height;
  66. } IntraX8Context;
  67. /**
  68. * Initialize IntraX8 frame decoder.
  69. * @param avctx pointer to AVCodecContext
  70. * @param w pointer to IntraX8Context
  71. * @param idsp pointer to IDCTDSPContext
  72. * @param block pointer to block array
  73. * @param block_last_index pointer to index array
  74. * @param mb_width macroblock width
  75. * @param mb_height macroblock height
  76. * @return 0 on success, a negative AVERROR value on error
  77. */
  78. int ff_intrax8_common_init(AVCodecContext *avctx,
  79. IntraX8Context *w, IDCTDSPContext *idsp,
  80. int16_t (*block)[64],
  81. int block_last_index[12],
  82. int mb_width, int mb_height);
  83. /**
  84. * Destroy IntraX8 frame structure.
  85. * @param w pointer to IntraX8Context
  86. */
  87. void ff_intrax8_common_end(IntraX8Context *w);
  88. /**
  89. * Decode single IntraX8 frame.
  90. * lowres decoding is theoretically impossible.
  91. * @param w pointer to IntraX8Context
  92. * @param pict the output Picture containing an AVFrame
  93. * @param gb open bitstream reader
  94. * @param mb_x pointer to the x coordinate of the current macroblock
  95. * @param mb_y pointer to the y coordinate of the current macroblock
  96. * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
  97. * @param quant_offset offset away from zero
  98. * @param loopfilter enable filter after decoding a block
  99. */
  100. int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict,
  101. GetBitContext *gb, int *mb_x, int *mb_y,
  102. int quant, int halfpq,
  103. int loopfilter, int lowdelay);
  104. #endif /* AVCODEC_INTRAX8_H */