ratecontrol.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*****************************************************************************
  2. * ratecontrol.h: ratecontrol
  3. *****************************************************************************
  4. * Copyright (C) 2003-2018 x264 project
  5. *
  6. * Authors: Loren Merritt <lorenm@u.washington.edu>
  7. * Laurent Aimar <fenrir@via.ecp.fr>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program 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
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  22. *
  23. * This program is also available under a commercial proprietary license.
  24. * For more information, contact us at licensing@x264.com.
  25. *****************************************************************************/
  26. #ifndef X264_ENCODER_RATECONTROL_H
  27. #define X264_ENCODER_RATECONTROL_H
  28. /* Completely arbitrary. Ratecontrol lowers relative quality at higher framerates
  29. * and the reverse at lower framerates; this serves as the center of the curve.
  30. * Halve all the values for frame-packed 3D to compensate for the "doubled"
  31. * framerate. */
  32. #define BASE_FRAME_DURATION (0.04f / ((h->param.i_frame_packing == 5)+1))
  33. /* Arbitrary limitations as a sanity check. */
  34. #define MAX_FRAME_DURATION (1.00f / ((h->param.i_frame_packing == 5)+1))
  35. #define MIN_FRAME_DURATION (0.01f / ((h->param.i_frame_packing == 5)+1))
  36. #define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION)
  37. #define x264_ratecontrol_new x264_template(ratecontrol_new)
  38. int x264_ratecontrol_new ( x264_t * );
  39. #define x264_ratecontrol_delete x264_template(ratecontrol_delete)
  40. void x264_ratecontrol_delete( x264_t * );
  41. #define x264_ratecontrol_init_reconfigurable x264_template(ratecontrol_init_reconfigurable)
  42. void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init );
  43. #define x264_encoder_reconfig_apply x264_template(encoder_reconfig_apply)
  44. int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param );
  45. #define x264_adaptive_quant_frame x264_template(adaptive_quant_frame)
  46. void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets );
  47. #define x264_macroblock_tree_read x264_template(macroblock_tree_read)
  48. int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );
  49. #define x264_reference_build_list_optimal x264_template(reference_build_list_optimal)
  50. int x264_reference_build_list_optimal( x264_t *h );
  51. #define x264_thread_sync_ratecontrol x264_template(thread_sync_ratecontrol)
  52. void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );
  53. #define x264_ratecontrol_zone_init x264_template(ratecontrol_zone_init)
  54. void x264_ratecontrol_zone_init( x264_t * );
  55. #define x264_ratecontrol_start x264_template(ratecontrol_start)
  56. void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );
  57. #define x264_ratecontrol_slice_type x264_template(ratecontrol_slice_type)
  58. int x264_ratecontrol_slice_type( x264_t *, int i_frame );
  59. #define x264_ratecontrol_set_weights x264_template(ratecontrol_set_weights)
  60. void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );
  61. #define x264_ratecontrol_mb x264_template(ratecontrol_mb)
  62. int x264_ratecontrol_mb( x264_t *, int bits );
  63. #define x264_ratecontrol_qp x264_template(ratecontrol_qp)
  64. int x264_ratecontrol_qp( x264_t * );
  65. #define x264_ratecontrol_mb_qp x264_template(ratecontrol_mb_qp)
  66. int x264_ratecontrol_mb_qp( x264_t *h );
  67. #define x264_ratecontrol_end x264_template(ratecontrol_end)
  68. int x264_ratecontrol_end( x264_t *, int bits, int *filler );
  69. #define x264_ratecontrol_summary x264_template(ratecontrol_summary)
  70. void x264_ratecontrol_summary( x264_t * );
  71. #define x264_rc_analyse_slice x264_template(rc_analyse_slice)
  72. int x264_rc_analyse_slice( x264_t *h );
  73. #define x264_threads_distribute_ratecontrol x264_template(threads_distribute_ratecontrol)
  74. void x264_threads_distribute_ratecontrol( x264_t *h );
  75. #define x264_threads_merge_ratecontrol x264_template(threads_merge_ratecontrol)
  76. void x264_threads_merge_ratecontrol( x264_t *h );
  77. #define x264_hrd_fullness x264_template(hrd_fullness)
  78. void x264_hrd_fullness( x264_t *h );
  79. #endif