dnxhdenc.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * VC3/DNxHD encoder structure definitions and prototypes
  3. * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
  4. *
  5. * VC-3 encoder funded by the British Broadcasting Corporation
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVCODEC_DNXHDENC_H
  24. #define AVCODEC_DNXHDENC_H
  25. #include <stdint.h>
  26. #include "config.h"
  27. #include "mpegvideo.h"
  28. #include "dnxhddata.h"
  29. typedef struct RCCMPEntry {
  30. uint16_t mb;
  31. int value;
  32. } RCCMPEntry;
  33. typedef struct RCEntry {
  34. int ssd;
  35. int bits;
  36. } RCEntry;
  37. typedef struct DNXHDEncContext {
  38. AVClass *class;
  39. BlockDSPContext bdsp;
  40. MpegEncContext m; ///< Used for quantization dsp functions
  41. int cid;
  42. int profile;
  43. int bit_depth;
  44. int is_444;
  45. const CIDEntry *cid_table;
  46. uint8_t *msip; ///< Macroblock Scan Indexes Payload
  47. uint32_t *slice_size;
  48. uint32_t *slice_offs;
  49. struct DNXHDEncContext *thread[MAX_THREADS];
  50. // Because our samples are either 8 or 16 bits for 8-bit and 10-bit
  51. // encoding respectively, these refer either to bytes or to two-byte words.
  52. unsigned dct_y_offset;
  53. unsigned dct_uv_offset;
  54. unsigned block_width_l2;
  55. int frame_size;
  56. int coding_unit_size;
  57. int data_offset;
  58. int interlaced;
  59. int cur_field;
  60. int nitris_compat;
  61. unsigned min_padding;
  62. int intra_quant_bias;
  63. DECLARE_ALIGNED(32, int16_t, blocks)[12][64];
  64. DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[512]; // has to hold 16x16 uint16 when depth=10
  65. DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][512]; // has to hold 16x16 uint16_t when depth=10
  66. int (*qmatrix_c) [64];
  67. int (*qmatrix_l) [64];
  68. uint16_t (*qmatrix_l16)[2][64];
  69. uint16_t (*qmatrix_c16)[2][64];
  70. unsigned frame_bits;
  71. uint8_t *src[3];
  72. uint32_t *orig_vlc_codes;
  73. uint8_t *orig_vlc_bits;
  74. uint32_t *vlc_codes;
  75. uint8_t *vlc_bits;
  76. uint16_t *run_codes;
  77. uint8_t *run_bits;
  78. /** Rate control */
  79. unsigned slice_bits;
  80. unsigned qscale;
  81. unsigned lambda;
  82. uint16_t *mb_bits;
  83. uint8_t *mb_qscale;
  84. RCCMPEntry *mb_cmp;
  85. RCCMPEntry *mb_cmp_tmp;
  86. RCEntry *mb_rc;
  87. void (*get_pixels_8x4_sym)(int16_t *av_restrict /* align 16 */ block,
  88. const uint8_t *pixels, ptrdiff_t line_size);
  89. } DNXHDEncContext;
  90. void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx);
  91. #endif /* AVCODEC_DNXHDENC_H */