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.

114 lines
3.5KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; 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 "mpegpicture.h"
  25. typedef struct IntraX8Context {
  26. VLC *j_ac_vlc[4]; // they point to the static j_mb_vlc
  27. VLC *j_orient_vlc;
  28. VLC *j_dc_vlc[3];
  29. int use_quant_matrix;
  30. // set by ff_intrax8_common_init
  31. uint8_t *prediction_table; // 2 * (mb_w * 2)
  32. ScanTable scantable[3];
  33. AVCodecContext *avctx;
  34. int *block_last_index; ///< last nonzero coefficient in block
  35. int16_t (*block)[64];
  36. // set by the caller codec
  37. IntraX8DSPContext dsp;
  38. IDCTDSPContext idsp;
  39. BlockDSPContext bdsp;
  40. int quant;
  41. int dquant;
  42. int qsum;
  43. int loopfilter;
  44. AVFrame *frame;
  45. GetBitContext *gb;
  46. // calculated per frame
  47. int quant_dc_chroma;
  48. int divide_quant_dc_luma;
  49. int divide_quant_dc_chroma;
  50. uint8_t *dest[3];
  51. uint8_t scratchpad[42]; // size of the block is fixed (8x8 plus padding)
  52. // changed per block
  53. int edges;
  54. int flat_dc;
  55. int predicted_dc;
  56. int raw_orient;
  57. int chroma_orient;
  58. int orient;
  59. int est_run;
  60. // block props
  61. int mb_x, mb_y;
  62. int mb_width, mb_height;
  63. } IntraX8Context;
  64. /**
  65. * Initialize IntraX8 frame decoder.
  66. * @param avctx pointer to AVCodecContext
  67. * @param w pointer to IntraX8Context
  68. * @param idsp pointer to IDCTDSPContext
  69. * @param block pointer to block array
  70. * @param block_last_index pointer to index array
  71. * @param mb_width macroblock width
  72. * @param mb_height macroblock height
  73. * @return 0 on success, a negative AVERROR value on error
  74. */
  75. int ff_intrax8_common_init(AVCodecContext *avctx,
  76. IntraX8Context *w, IDCTDSPContext *idsp,
  77. int16_t (*block)[64],
  78. int block_last_index[12],
  79. int mb_width, int mb_height);
  80. /**
  81. * Destroy IntraX8 frame structure.
  82. * @param w pointer to IntraX8Context
  83. */
  84. void ff_intrax8_common_end(IntraX8Context *w);
  85. /**
  86. * Decode single IntraX8 frame.
  87. * @param w pointer to IntraX8Context
  88. * @param pict the output Picture containing an AVFrame
  89. * @param gb open bitstream reader
  90. * @param mb_x pointer to the x coordinate of the current macroblock
  91. * @param mb_y pointer to the y coordinate of the current macroblock
  92. * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
  93. * @param quant_offset offset away from zero
  94. * @param loopfilter enable filter after decoding a block
  95. */
  96. int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict,
  97. GetBitContext *gb, int *mb_x, int *mb_y,
  98. int quant, int halfpq,
  99. int loopfilter, int lowdelay);
  100. #endif /* AVCODEC_INTRAX8_H */