@img/sharp-libvips-dev-wasm32 1.3.0-rc.1 → 1.3.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +23 -23
  2. package/include/aom/aom_codec.h +1 -1
  3. package/include/aom/aom_decoder.h +4 -0
  4. package/include/aom/aom_encoder.h +19 -8
  5. package/include/aom/aom_ext_ratectrl.h +664 -0
  6. package/include/aom/aom_image.h +93 -30
  7. package/include/aom/aom_tpl.h +99 -0
  8. package/include/aom/aomcx.h +89 -16
  9. package/include/aom/aomdx.h +12 -0
  10. package/include/expat.h +15 -3
  11. package/include/expat_config.h +6 -6
  12. package/include/expat_external.h +4 -4
  13. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  14. package/include/glib-2.0/gio/gfileattribute.h +1 -1
  15. package/include/glib-2.0/gio/gfileinfo.h +5 -0
  16. package/include/glib-2.0/gio/gicon.h +1 -1
  17. package/include/glib-2.0/gio/gio-autocleanups.h +0 -1
  18. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  19. package/include/glib-2.0/gio/gio.h +2 -0
  20. package/include/glib-2.0/gio/gioenums.h +66 -44
  21. package/include/glib-2.0/gio/gioenumtypes.h +2 -0
  22. package/include/glib-2.0/gio/giptosmessage.h +46 -0
  23. package/include/glib-2.0/gio/gipv6tclassmessage.h +46 -0
  24. package/include/glib-2.0/gio/gresolver.h +1 -1
  25. package/include/glib-2.0/gio/gsettings.h +1 -1
  26. package/include/glib-2.0/gio/gsocketcontrolmessage.h +2 -0
  27. package/include/glib-2.0/glib/gatomic.h +26 -2
  28. package/include/glib-2.0/glib/gfileutils.h +2 -2
  29. package/include/glib-2.0/glib/ghook.h +3 -1
  30. package/include/glib-2.0/glib/giochannel.h +1 -1
  31. package/include/glib-2.0/glib/gkeyfile.h +1 -1
  32. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  33. package/include/glib-2.0/glib/gmacros.h +32 -0
  34. package/include/glib-2.0/glib/gmain.h +4 -0
  35. package/include/glib-2.0/glib/gmarkup.h +18 -1
  36. package/include/glib-2.0/glib/gmem.h +4 -4
  37. package/include/glib-2.0/glib/gmessages.h +7 -9
  38. package/include/glib-2.0/glib/gnode.h +1 -1
  39. package/include/glib-2.0/glib/goption.h +1 -1
  40. package/include/glib-2.0/glib/gsequence.h +2 -2
  41. package/include/glib-2.0/glib/gslice.h +12 -4
  42. package/include/glib-2.0/glib/gspawn.h +1 -1
  43. package/include/glib-2.0/glib/gstrfuncs.h +191 -1
  44. package/include/glib-2.0/glib/gtestutils.h +6 -3
  45. package/include/glib-2.0/glib/gtimer.h +1 -0
  46. package/include/glib-2.0/glib/guri.h +3 -3
  47. package/include/glib-2.0/glib/gutils.h +10 -1
  48. package/include/glib-2.0/glib/gvarianttype.h +16 -16
  49. package/include/glib-2.0/glib/gversionmacros.h +22 -0
  50. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  51. package/include/glib-2.0/gmodule.h +1 -1
  52. package/include/glib-2.0/gobject/gbinding.h +1 -1
  53. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  54. package/include/glib-2.0/gobject/gobject.h +1 -1
  55. package/include/glib-2.0/gobject/gparam.h +1 -1
  56. package/include/glib-2.0/gobject/gsignal.h +8 -8
  57. package/include/glib-2.0/gobject/gtype.h +17 -17
  58. package/include/hwy/aligned_allocator.h +44 -2
  59. package/include/hwy/auto_tune.h +22 -6
  60. package/include/hwy/base.h +60 -90
  61. package/include/hwy/bit_set.h +410 -0
  62. package/include/hwy/cache_control.h +3 -2
  63. package/include/hwy/detect_compiler_arch.h +134 -14
  64. package/include/hwy/detect_targets.h +82 -36
  65. package/include/hwy/highway.h +15 -0
  66. package/include/hwy/nanobenchmark.h +12 -3
  67. package/include/hwy/ops/arm_neon-inl.h +96 -25
  68. package/include/hwy/ops/arm_sve-inl.h +250 -95
  69. package/include/hwy/ops/emu128-inl.h +12 -7
  70. package/include/hwy/ops/generic_ops-inl.h +271 -131
  71. package/include/hwy/ops/loongarch_lasx-inl.h +31 -9
  72. package/include/hwy/ops/loongarch_lsx-inl.h +33 -12
  73. package/include/hwy/ops/ppc_vsx-inl.h +99 -19
  74. package/include/hwy/ops/rvv-inl.h +239 -130
  75. package/include/hwy/ops/scalar-inl.h +22 -7
  76. package/include/hwy/ops/set_macros-inl.h +163 -107
  77. package/include/hwy/ops/wasm_128-inl.h +13 -22
  78. package/include/hwy/ops/x86_128-inl.h +223 -120
  79. package/include/hwy/ops/x86_256-inl.h +70 -134
  80. package/include/hwy/ops/x86_512-inl.h +130 -134
  81. package/include/hwy/print-inl.h +2 -0
  82. package/include/hwy/profiler.h +355 -264
  83. package/include/hwy/robust_statistics.h +3 -1
  84. package/include/hwy/timer.h +44 -0
  85. package/include/lcms2.h +35 -5
  86. package/include/lcms2_plugin.h +1 -1
  87. package/include/libexif/exif-utils.h +1 -1
  88. package/include/libheif/heif.h +2 -0
  89. package/include/libheif/heif_aux_images.h +2 -2
  90. package/include/libheif/heif_brands.h +16 -4
  91. package/include/libheif/heif_color.h +147 -25
  92. package/include/libheif/heif_components.h +264 -0
  93. package/include/libheif/heif_context.h +18 -4
  94. package/include/libheif/heif_cxx.h +20 -18
  95. package/include/libheif/heif_decoding.h +63 -9
  96. package/include/libheif/heif_encoding.h +46 -12
  97. package/include/libheif/heif_error.h +15 -6
  98. package/include/libheif/heif_export.h +48 -0
  99. package/include/libheif/heif_image.h +94 -32
  100. package/include/libheif/heif_image_handle.h +54 -3
  101. package/include/libheif/heif_items.h +25 -2
  102. package/include/libheif/heif_library.h +13 -18
  103. package/include/libheif/heif_metadata.h +5 -2
  104. package/include/libheif/heif_omaf.h +104 -0
  105. package/include/libheif/heif_plugin.h +80 -13
  106. package/include/libheif/heif_properties.h +259 -5
  107. package/include/libheif/heif_regions.h +5 -3
  108. package/include/libheif/heif_security.h +24 -2
  109. package/include/libheif/heif_sequences.h +163 -14
  110. package/include/libheif/heif_text.h +161 -0
  111. package/include/libheif/heif_tiling.h +2 -2
  112. package/include/libheif/heif_uncompressed.h +29 -5
  113. package/include/libheif/heif_version.h +2 -2
  114. package/include/libpng16/png.h +637 -488
  115. package/include/libpng16/pngconf.h +2 -2
  116. package/include/libpng16/pnglibconf.h +2 -2
  117. package/include/png.h +637 -488
  118. package/include/pngconf.h +2 -2
  119. package/include/pnglibconf.h +2 -2
  120. package/include/resvg.h +3 -3
  121. package/include/tiffconf.h +9 -10
  122. package/include/tiffio.h +10 -9
  123. package/include/tiffvers.h +1 -1
  124. package/include/ultrahdr_api.h +5 -11
  125. package/include/vips/colour.h +2 -2
  126. package/include/vips/memory.h +1 -1
  127. package/include/vips/version.h +4 -4
  128. package/include/zlib.h +3 -3
  129. package/lib/glib-2.0/include/glibconfig.h +1 -3
  130. package/lib/libaom.a +0 -0
  131. package/lib/libcgif.a +0 -0
  132. package/lib/libexif.a +0 -0
  133. package/lib/libexif.la +1 -1
  134. package/lib/libexpat.a +0 -0
  135. package/lib/libexpat.la +2 -2
  136. package/lib/libffi.a +0 -0
  137. package/lib/libgio-2.0.a +0 -0
  138. package/lib/libglib-2.0.a +0 -0
  139. package/lib/libgmodule-2.0.a +0 -0
  140. package/lib/libgobject-2.0.a +0 -0
  141. package/lib/libgthread-2.0.a +0 -0
  142. package/lib/libheif.a +0 -0
  143. package/lib/libhwy.a +0 -0
  144. package/lib/libimagequant.a +0 -0
  145. package/lib/libjpeg.a +0 -0
  146. package/lib/liblcms2.a +0 -0
  147. package/lib/libpng.a +0 -0
  148. package/lib/libpng.la +2 -2
  149. package/lib/libpng16.a +0 -0
  150. package/lib/libpng16.la +2 -2
  151. package/lib/libresvg.a +0 -0
  152. package/lib/libsharpyuv.a +0 -0
  153. package/lib/libtiff.a +0 -0
  154. package/lib/libuhdr.a +0 -0
  155. package/lib/libvips-cpp.a +0 -0
  156. package/lib/libvips.a +0 -0
  157. package/lib/libwebp.a +0 -0
  158. package/lib/libwebpdecoder.a +0 -0
  159. package/lib/libwebpdemux.a +0 -0
  160. package/lib/libwebpmux.a +0 -0
  161. package/lib/libz.a +0 -0
  162. package/lib/pkgconfig/aom.pc +2 -2
  163. package/lib/pkgconfig/cgif.pc +1 -1
  164. package/lib/pkgconfig/expat.pc +1 -1
  165. package/lib/pkgconfig/gio-2.0.pc +1 -1
  166. package/lib/pkgconfig/glib-2.0.pc +1 -1
  167. package/lib/pkgconfig/gmodule-2.0.pc +1 -1
  168. package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
  169. package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
  170. package/lib/pkgconfig/gobject-2.0.pc +1 -1
  171. package/lib/pkgconfig/gthread-2.0.pc +1 -1
  172. package/lib/pkgconfig/lcms2.pc +1 -1
  173. package/lib/pkgconfig/libexif.pc +1 -1
  174. package/lib/pkgconfig/libheif.pc +1 -1
  175. package/lib/pkgconfig/libhwy.pc +3 -4
  176. package/lib/pkgconfig/libpng.pc +1 -1
  177. package/lib/pkgconfig/libpng16.pc +1 -1
  178. package/lib/pkgconfig/libsharpyuv.pc +1 -1
  179. package/lib/pkgconfig/libtiff-4.pc +2 -2
  180. package/lib/pkgconfig/libwebp.pc +1 -1
  181. package/lib/pkgconfig/libwebpdecoder.pc +11 -0
  182. package/lib/pkgconfig/libwebpmux.pc +1 -1
  183. package/lib/pkgconfig/vips-cpp.pc +1 -1
  184. package/lib/pkgconfig/vips.pc +1 -1
  185. package/package.json +1 -1
  186. package/versions.json +15 -15
  187. package/lib/libsharpyuv.la +0 -41
  188. package/lib/libtiff.la +0 -41
  189. package/lib/libwebp.la +0 -41
  190. package/lib/libwebpdemux.la +0 -41
  191. package/lib/libwebpmux.la +0 -41
@@ -0,0 +1,664 @@
1
+ /*
2
+ * Copyright (c) 2025, Alliance for Open Media. All rights reserved.
3
+ *
4
+ * This source code is subject to the terms of the BSD 2 Clause License and
5
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6
+ * was not distributed with this source code in the LICENSE file, you can
7
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8
+ * Media Patent License 1.0 was not distributed with this source code in the
9
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10
+ */
11
+
12
+ /*!\file
13
+ * \brief Defines structs and callbacks needed for external rate control.
14
+ *
15
+ * \attention Experimental. Not part of the stable API.
16
+ */
17
+ #ifndef AOM_AOM_AOM_EXT_RATECTRL_H_
18
+ #define AOM_AOM_AOM_EXT_RATECTRL_H_
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ #include "aom/aom_integer.h"
25
+ #include "aom/aom_tpl.h"
26
+
27
+ /*!\brief Current ABI version number
28
+ *
29
+ * \internal
30
+ * If this file is altered in any way that changes the ABI, this value
31
+ * must be bumped. Examples include, but are not limited to, changing
32
+ * types, removing or reassigning enums, adding/removing/rearranging
33
+ * fields to structures.
34
+ */
35
+ #define AOM_EXT_RATECTRL_ABI_VERSION (2 + AOM_TPL_ABI_VERSION)
36
+
37
+ /*!\brief Corresponds to MAX_STATIC_GF_GROUP_LENGTH defined in ratectrl.h
38
+ */
39
+ #define AOM_RC_MAX_STATIC_GF_GROUP_LENGTH 250
40
+
41
+ /*!\brief Max number of ref frames returned by the external RC.
42
+ *
43
+ * Corresponds to REF_FRAMES defined in enums.h.
44
+ */
45
+ #define AOM_RC_MAX_REF_FRAMES 8
46
+
47
+ /*!\brief Max layer depth.
48
+ *
49
+ * Corresponds to MAX_ARF_LAYERS defined in ratectrl.h.
50
+ */
51
+ #define AOM_RC_MAX_ARF_LAYERS 6
52
+
53
+ /*!\brief The type of the external rate control.
54
+ *
55
+ * This controls what encoder parameters are determined by the external rate
56
+ * control.
57
+ */
58
+ typedef enum aom_rc_type {
59
+ /*!
60
+ * The external rate control doesn't determine anything.
61
+ * This mode is used as baseline.
62
+ */
63
+ AOM_RC_NONE = 0,
64
+ /*!
65
+ * The external rate control model determines the quantization parameter (QP)
66
+ * for each frame.
67
+ */
68
+ AOM_RC_QP = 1 << 0,
69
+ /*!
70
+ * The external rate control model determines the group of picture (GOP) of
71
+ * the video sequence.
72
+ */
73
+ AOM_RC_GOP = 1 << 1,
74
+ /*!
75
+ * The external rate control model determines the rate-distortion multiplier
76
+ * (rdmult) for the current frame.
77
+ */
78
+ AOM_RC_RDMULT = 1 << 2,
79
+ /*!
80
+ * The external rate control model determines both QP and GOP.
81
+ */
82
+ AOM_RC_GOP_QP = AOM_RC_QP | AOM_RC_GOP,
83
+ /*!
84
+ * The external rate control model determines the QP, GOP and the rdmult.
85
+ */
86
+ AOM_RC_GOP_QP_RDMULT = AOM_RC_QP | AOM_RC_GOP | AOM_RC_RDMULT
87
+ } aom_rc_type_t;
88
+
89
+ /*!\brief The rate control mode for the external rate control model.
90
+ */
91
+ typedef enum aom_ext_rc_mode {
92
+ AOM_RC_QMODE = 0,
93
+ AOM_RC_VBR = 1,
94
+ AOM_RC_CQ = 2,
95
+ } aom_ext_rc_mode_t;
96
+
97
+ /*!\brief Corresponds to FRAME_UPDATE_TYPE defined in ratectrl.h.
98
+ */
99
+ typedef enum aom_rc_frame_update_type {
100
+ AOM_RC_INVALID_UPDATE_TYPE = -1,
101
+ AOM_RC_KF_UPDATE = 0,
102
+ AOM_RC_LF_UPDATE = 1,
103
+ AOM_RC_GF_UPDATE = 2,
104
+ AOM_RC_ARF_UPDATE = 3,
105
+ AOM_RC_OVERLAY_UPDATE = 4,
106
+ AOM_RC_INTNL_OVERLAY_UPDATE = 5, // Internal Overlay Frame
107
+ AOM_RC_INTNL_ARF_UPDATE = 6, // Internal Altref Frame
108
+ } aom_rc_frame_update_type_t;
109
+
110
+ /*!\brief Name for the ref frames returned by the external RC.
111
+ *
112
+ * Corresponds to the ref frames defined in enums.h.
113
+ */
114
+ typedef enum aom_rc_ref_name {
115
+ AOM_RC_INVALID_REF_FRAME = -1,
116
+ AOM_RC_INTRA_FRAME,
117
+ AOM_RC_LAST_FRAME,
118
+ AOM_RC_LAST2_FRAME,
119
+ AOM_RC_LAST3_FRAME,
120
+ AOM_RC_GOLDEN_FRAME,
121
+ AOM_RC_BWDREF_FRAME,
122
+ AOM_RC_ALTREF2_FRAME,
123
+ AOM_RC_ALTREF_FRAME,
124
+ } aom_rc_ref_name_t;
125
+
126
+ /*!\brief Abstract rate control model handler
127
+ *
128
+ * The encoder will receive the model handler from
129
+ * aom_rc_funcs_t::create_model().
130
+ */
131
+ typedef void *aom_rc_model_t;
132
+
133
+ /*!\brief A reserved value for the q index.
134
+ * If the external rate control model returns this value,
135
+ * the encoder will use the default q selected by libaom's rate control
136
+ * system.
137
+ */
138
+ #define AOM_DEFAULT_Q -1
139
+
140
+ /*!\brief A reserved value for the rdmult.
141
+ * If the external rate control model returns this value,
142
+ * the encoder will use the default rdmult selected by libaom's rate control
143
+ * system.
144
+ */
145
+ #define AOM_DEFAULT_RDMULT -1
146
+
147
+ /*!\brief Superblock quantization parameters
148
+ * Store the superblock quantiztaion parameters
149
+ */
150
+ typedef struct aom_sb_parameters {
151
+ int q_index; /**< Quantizer step index [0..255]*/
152
+ int rdmult; /**< Superblock level Lagrangian multiplier*/
153
+ } aom_sb_params;
154
+
155
+ /*!\brief Encode frame decision made by the external rate control model
156
+ *
157
+ * The encoder will receive the decision from the external rate control model
158
+ * through aom_rc_funcs_t::get_encodeframe_decision().
159
+ */
160
+ typedef struct aom_rc_encodeframe_decision {
161
+ int q_index; /**< Required: Quantizer step index [0..255]*/
162
+ int rdmult; /**< Required: Frame level Lagrangian multiplier*/
163
+ // Whether per-superblock delta Q should be used.
164
+ // The rate control model should set the value pointed to by this member
165
+ // to 1 if per-superblock delta-Q is used for this frame, or 0 otherwise.
166
+ // This is a pointer to the flag in cpi->ext_ratectrl.
167
+ int *use_delta_q;
168
+ /*!
169
+ * Optional: Superblock quantization parameters
170
+ * It is zero initialized by default. It will be set for key and ARF frames
171
+ * but not leaf frames.
172
+ */
173
+ aom_sb_params *sb_params_list;
174
+ } aom_rc_encodeframe_decision_t;
175
+
176
+ /*!\brief Information for the frame to be encoded.
177
+ *
178
+ * The encoder will send the information to external rate control model through
179
+ * aom_rc_funcs_t::get_encodeframe_decision().
180
+ *
181
+ */
182
+ typedef struct aom_rc_encodeframe_info {
183
+ /*!
184
+ * 0: Key frame
185
+ * 1: Inter frame
186
+ * 2: Alternate reference frame
187
+ * 3: Overlay frame
188
+ * 4: Golden frame
189
+ */
190
+ int frame_type;
191
+ int show_index; /**< display index, starts from zero*/
192
+ int coding_index; /**< coding index, starts from zero*/
193
+ /*!
194
+ * index of the current frame in this group of picture, starts from zero.
195
+ */
196
+ int gop_index;
197
+ int ref_frame_coding_indexes[AOM_RC_MAX_REF_FRAMES]; /**< reference frames'
198
+ coding indices*/
199
+ /*!
200
+ * The validity of the three reference frames.
201
+ * 0: Invalid
202
+ * 1: Valid
203
+ */
204
+ int ref_frame_valid_list[AOM_RC_MAX_REF_FRAMES];
205
+ /*!
206
+ * The length of the current GOP.
207
+ */
208
+ int gop_size;
209
+ /*!
210
+ * Whether the current GOP uses an alt ref.
211
+ */
212
+ int use_alt_ref;
213
+ } aom_rc_encodeframe_info_t;
214
+
215
+ /*!\brief Frame coding result
216
+ *
217
+ * The encoder will send the result to the external rate control model through
218
+ * aom_rc_funcs_t::update_encodeframe_result().
219
+ */
220
+ typedef struct aom_rc_encodeframe_result {
221
+ int64_t bit_count; /**< number of bits spent on coding the frame*/
222
+ int actual_encoding_qindex; /**< the actual qindex used to encode the frame*/
223
+ } aom_rc_encodeframe_result_t;
224
+
225
+ /*!\brief Status returned by rate control callback functions.
226
+ */
227
+ typedef enum aom_rc_status {
228
+ AOM_RC_OK = 0,
229
+ AOM_RC_ERROR = 1,
230
+ } aom_rc_status_t;
231
+
232
+ /*!\brief First pass frame stats
233
+ * This is a mirror of FIRSTPASS_STATS in firstpass.h
234
+ */
235
+ typedef struct aom_rc_frame_stats {
236
+ /*!
237
+ * Frame number in display order, if stats are for a single frame.
238
+ * No real meaning for a collection of frames.
239
+ */
240
+ double frame;
241
+ /*!
242
+ * Weight assigned to this frame (or total weight for the collection of
243
+ * frames) currently based on intra factor and brightness factor. This is used
244
+ * to distribute bits betweeen easier and harder frames.
245
+ */
246
+ double weight;
247
+ /*!
248
+ * Intra prediction error.
249
+ */
250
+ double intra_error;
251
+ /*!
252
+ * Average wavelet energy computed using Discrete Wavelet Transform (DWT).
253
+ */
254
+ double frame_avg_wavelet_energy;
255
+ /*!
256
+ * Best of intra pred error and inter pred error using last frame as ref.
257
+ */
258
+ double coded_error;
259
+ /*!
260
+ * Best of intra pred error and inter pred error using golden frame as ref.
261
+ */
262
+ double sr_coded_error;
263
+ /*!
264
+ * Percentage of blocks with inter pred error < intra pred error.
265
+ */
266
+ double pcnt_inter;
267
+ /*!
268
+ * Percentage of blocks using (inter prediction and) non-zero motion vectors.
269
+ */
270
+ double pcnt_motion;
271
+ /*!
272
+ * Percentage of blocks where golden frame was better than last or intra:
273
+ * inter pred error using golden frame < inter pred error using last frame and
274
+ * inter pred error using golden frame < intra pred error
275
+ */
276
+ double pcnt_second_ref;
277
+ /*!
278
+ * Percentage of blocks where intra and inter prediction errors were very
279
+ * close. Note that this is a 'weighted count', that is, the so blocks may be
280
+ * weighted by how close the two errors were.
281
+ */
282
+ double pcnt_neutral;
283
+ /*!
284
+ * Percentage of blocks that have almost no intra error residual
285
+ * (i.e. are in effect completely flat and untextured in the intra
286
+ * domain). In natural videos this is uncommon, but it is much more
287
+ * common in animations, graphics and screen content, so may be used
288
+ * as a signal to detect these types of content.
289
+ */
290
+ double intra_skip_pct;
291
+ /*!
292
+ * Image mask rows top and bottom.
293
+ */
294
+ double inactive_zone_rows;
295
+ /*!
296
+ * Image mask columns at left and right edges.
297
+ */
298
+ double inactive_zone_cols;
299
+ /*!
300
+ * Average of row motion vectors.
301
+ */
302
+ double MVr;
303
+ /*!
304
+ * Mean of absolute value of row motion vectors.
305
+ */
306
+ double mvr_abs;
307
+ /*!
308
+ * Mean of column motion vectors.
309
+ */
310
+ double MVc;
311
+ /*!
312
+ * Mean of absolute value of column motion vectors.
313
+ */
314
+ double mvc_abs;
315
+ /*!
316
+ * Variance of row motion vectors.
317
+ */
318
+ double MVrv;
319
+ /*!
320
+ * Variance of column motion vectors.
321
+ */
322
+ double MVcv;
323
+ /*!
324
+ * Value in range [-1,1] indicating fraction of row and column motion vectors
325
+ * that point inwards (negative MV value) or outwards (positive MV value).
326
+ * For example, value of 1 indicates, all row/column MVs are inwards.
327
+ */
328
+ double mv_in_out_count;
329
+ /*!
330
+ * Count of unique non-zero motion vectors.
331
+ */
332
+ double new_mv_count;
333
+ /*!
334
+ * Duration of the frame / collection of frames.
335
+ */
336
+ double duration;
337
+ /*!
338
+ * 1.0 if stats are for a single frame, OR
339
+ * Number of frames in this collection for which the stats are accumulated.
340
+ */
341
+ double count;
342
+ /*!
343
+ * standard deviation for (0, 0) motion prediction error
344
+ */
345
+ double raw_error_stdev;
346
+ /*!
347
+ * Whether the frame contains a flash
348
+ */
349
+ int64_t is_flash;
350
+ /*!
351
+ * Estimated noise variance
352
+ */
353
+ double noise_var;
354
+ /*!
355
+ * Correlation coefficient with the previous frame
356
+ */
357
+ double cor_coeff;
358
+ /*!
359
+ * log of intra_error
360
+ */
361
+ double log_intra_error;
362
+ /*!
363
+ * log of coded_error
364
+ */
365
+ double log_coded_error;
366
+ } aom_rc_frame_stats_t;
367
+
368
+ /*!\brief Collection of first pass frame stats
369
+ */
370
+ typedef struct aom_rc_firstpass_stats {
371
+ /*!
372
+ * Pointer to first pass frame stats.
373
+ * The pointed array of aom_rc_frame_stats_t should have length equal to
374
+ * number of show frames in the video.
375
+ */
376
+ aom_rc_frame_stats_t *frame_stats;
377
+ /*!
378
+ * Number of show frames in the video.
379
+ */
380
+ int num_frames;
381
+ } aom_rc_firstpass_stats_t;
382
+
383
+ /*!\brief Encode config sent to external rate control model
384
+ */
385
+ typedef struct aom_rc_config {
386
+ int frame_width; /**< frame width */
387
+ int frame_height; /**< frame height */
388
+ int show_frame_count; /**< number of visible frames in the video */
389
+ int max_gf_interval; /**< max GOP size in number of show frames */
390
+ int min_gf_interval; /**< min GOP size in number of show frames */
391
+ /*!
392
+ * Target bitrate in kilobytes per second
393
+ */
394
+ int target_bitrate_kbps;
395
+ int frame_rate_num; /**< numerator of frame rate */
396
+ int frame_rate_den; /**< denominator of frame rate */
397
+ /*!
398
+ * The following fields are only for external rate control models that support
399
+ * different rate control modes.
400
+ */
401
+ aom_ext_rc_mode_t rc_mode; /**< Q mode or VBR mode */
402
+ int overshoot_percent; /**< for VBR mode only */
403
+ int undershoot_percent; /**< for VBR mode only */
404
+ int min_base_q_index; /**< for VBR mode only */
405
+ int max_base_q_index; /**< for VBR mode only */
406
+ int base_qp; /**< base QP for leaf frames, 0-255 */
407
+ int superblock_size; /**< 64 or 128 */
408
+ } aom_rc_config_t;
409
+
410
+ /*!\brief Control what ref frame to use and its index.
411
+ */
412
+ typedef struct aom_rc_ref_frame {
413
+ /*!
414
+ * Ref frame index.
415
+ */
416
+ int index[AOM_RC_MAX_REF_FRAMES];
417
+ /*!
418
+ * Ref frame name.
419
+ */
420
+ aom_rc_ref_name_t name[AOM_RC_MAX_REF_FRAMES];
421
+ } aom_rc_ref_frame_t;
422
+
423
+ /*!\brief A single reference frame.
424
+ */
425
+ typedef struct aom_rc_single_ref_frame {
426
+ int index; /**< Ref frame index. */
427
+ aom_rc_ref_name_t name; /**< Ref frame name. */
428
+ } aom_rc_single_ref_frame_t;
429
+
430
+ /*!\brief A single frame in the GOP.
431
+ */
432
+ typedef struct aom_rc_gop_frame {
433
+ // Basic info
434
+ int order_idx; /**< Index in display order within a GOP, starting at 0. */
435
+ int coding_idx; /**< Index in coding order within a GOP, starting at 0. */
436
+ int display_idx; /**< The number of displayed frames preceding this frame in a
437
+ GOP. */
438
+ int order_hint; /**< Index in display order since a key frame. */
439
+ int global_order_idx; /**< Index in display order in the whole video chunk. */
440
+ int global_coding_idx; /**< Index in coding order in the whole video chunk. */
441
+ int is_key_frame; /**< Whether this frame is a key frame. */
442
+ aom_rc_frame_update_type_t update_type; /**< The type of frame. */
443
+
444
+ // Reference frame info
445
+ /**
446
+ * For an overlay or show_existing frame: index of primary reference frame;
447
+ * otherwise -1.
448
+ */
449
+ int colocated_ref_idx;
450
+ /**
451
+ * The reference index that this frame should be updated to. -1 when this
452
+ * frame will not serve as a reference frame.
453
+ */
454
+ int update_ref_idx;
455
+ /**
456
+ * Additional bits to set in refresh_frame_flags, to allow extra frames to be
457
+ * evicted from the DPB. -1 for not set.
458
+ */
459
+ int extra_refresh_frame_flags;
460
+ /**
461
+ * Candidate reference frames which may be used for coding the current frame.
462
+ */
463
+ aom_rc_ref_frame_t ref_frame_list;
464
+ int layer_depth; /**< Layer depth in the GOP structure. */
465
+ /**
466
+ * Primary reference frame (used to update current frame's initial probability
467
+ * model).
468
+ */
469
+ aom_rc_single_ref_frame_t primary_ref_frame;
470
+ } aom_rc_gop_frame_t;
471
+
472
+ /*!\brief The decision made by the external rate control model to set the
473
+ * group of picture. This struct represents a list of GOPs.
474
+ */
475
+ typedef struct aom_rc_gop_decision {
476
+ int show_frame_count; /**< Number of visible frames in this GOP. */
477
+ int order_hint_offset; /**< Order hint offset for this GOP. */
478
+ int global_order_idx_offset; /**< Global order index offset for this GOP. */
479
+ int global_coding_idx_offset; /**< Global coding index offset for this GOP. */
480
+ int is_scene_cut; /**< Whether this GOP starts with a scene cut. */
481
+ /**
482
+ * The adjustment ratio, based on which the base QP index of this GOP will be
483
+ * adjusted from RateControlParam::base_q_index.
484
+ */
485
+ double base_q_ratio;
486
+ aom_rc_gop_frame_t *gop_frame_list; /**< List of frames in this GOP. */
487
+ int gop_frame_count;
488
+ } aom_rc_gop_decision_t;
489
+
490
+ /*!\brief The decision made by the external rate control model to set the
491
+ * key frame location and the show frame count in the key frame group
492
+ */
493
+ typedef struct aom_rc_key_frame_decision {
494
+ int key_frame_show_index; /**< This key frame's show index in the video */
495
+ int key_frame_group_size; /**< Show frame count of this key frame group */
496
+ } aom_rc_key_frame_decision_t;
497
+
498
+ /*!\brief Create an external rate control model callback prototype
499
+ *
500
+ * This callback is invoked by the encoder to create an external rate control
501
+ * model.
502
+ *
503
+ * \param[in] priv Callback's private data
504
+ * \param[in] ratectrl_config Pointer to aom_rc_config_t
505
+ * \param[out] rate_ctrl_model_ptr Pointer to aom_rc_model_t
506
+ */
507
+ typedef aom_rc_status_t (*aom_rc_create_model_cb_fn_t)(
508
+ void *priv, const aom_rc_config_t *ratectrl_config,
509
+ aom_rc_model_t *rate_ctrl_model_ptr);
510
+
511
+ /*!\brief Send first pass stats to the external rate control model callback
512
+ * prototype
513
+ *
514
+ * This callback is invoked by the encoder to send first pass stats to the
515
+ * external rate control model.
516
+ *
517
+ * \param[in] rate_ctrl_model rate control model
518
+ * \param[in] first_pass_stats first pass stats
519
+ */
520
+ typedef aom_rc_status_t (*aom_rc_send_firstpass_stats_cb_fn_t)(
521
+ aom_rc_model_t rate_ctrl_model,
522
+ const aom_rc_firstpass_stats_t *first_pass_stats);
523
+
524
+ /*!\brief Send TPL stats for the current GOP to the external rate control model
525
+ * callback prototype
526
+ *
527
+ * This callback is invoked by the encoder to send TPL stats for the GOP to the
528
+ * external rate control model.
529
+ *
530
+ * \param[in] rate_ctrl_model rate control model
531
+ * \param[in] tpl_gop_stats TPL stats for current GOP
532
+ */
533
+ typedef aom_rc_status_t (*aom_rc_send_tpl_gop_stats_cb_fn_t)(
534
+ aom_rc_model_t rate_ctrl_model, const AomTplGopStats *extrc_tpl_gop_stats);
535
+
536
+ /*!\brief Receive encode frame decision callback prototype
537
+ *
538
+ * This callback is invoked by the encoder to receive encode frame decision from
539
+ * the external rate control model.
540
+ *
541
+ * \param[in] rate_ctrl_model rate control model
542
+ * \param[in] frame_gop_index index of the frame in current gop
543
+ * \param[out] frame_decision encode decision of the coding frame
544
+ */
545
+ typedef aom_rc_status_t (*aom_rc_get_encodeframe_decision_cb_fn_t)(
546
+ aom_rc_model_t rate_ctrl_model, const int frame_gop_index,
547
+ aom_rc_encodeframe_decision_t *frame_decision);
548
+
549
+ /*!\brief Update encode frame result callback prototype
550
+ *
551
+ * This callback is invoked by the encoder to update encode frame result to the
552
+ * external rate control model.
553
+ *
554
+ * \param[in] rate_ctrl_model rate control model
555
+ * \param[out] encode_frame_result encode result of the coding frame
556
+ */
557
+ typedef aom_rc_status_t (*aom_rc_update_encodeframe_result_cb_fn_t)(
558
+ aom_rc_model_t rate_ctrl_model,
559
+ const aom_rc_encodeframe_result_t *encode_frame_result);
560
+
561
+ /*!\brief Get the key frame decision from the external rate control model.
562
+ *
563
+ * This callback is invoked by the encoder to get key frame decision from
564
+ * the external rate control model.
565
+ *
566
+ * \param[in] rate_ctrl_model rate control model
567
+ * \param[out] key_frame_decision key frame decision from the model
568
+ */
569
+ typedef aom_rc_status_t (*aom_rc_get_key_frame_decision_cb_fn_t)(
570
+ aom_rc_model_t rate_ctrl_model,
571
+ aom_rc_key_frame_decision_t *key_frame_decision);
572
+
573
+ /*!\brief Get the GOP structure from the external rate control model.
574
+ *
575
+ * This callback is invoked by the encoder to get GOP decisions from
576
+ * the external rate control model.
577
+ *
578
+ * \param[in] rate_ctrl_model rate control model
579
+ * \param[out] gop_decision GOP decision from the model
580
+ */
581
+ typedef aom_rc_status_t (*aom_rc_get_gop_decision_cb_fn_t)(
582
+ aom_rc_model_t rate_ctrl_model, aom_rc_gop_decision_t *gop_decision);
583
+
584
+ /*!\brief Get the frame rdmult from the external rate control model.
585
+ *
586
+ * This callback is invoked by the encoder to get rdmult from
587
+ * the external rate control model.
588
+ *
589
+ * \param[in] rate_ctrl_model rate control model
590
+ * \param[in] frame_info information collected from the encoder
591
+ * \param[out] rdmult frame rate-distortion multiplier from the model
592
+ */
593
+ typedef aom_rc_status_t (*aom_rc_get_frame_rdmult_cb_fn_t)(
594
+ aom_rc_model_t rate_ctrl_model, const aom_rc_encodeframe_info_t *frame_info,
595
+ int *rdmult);
596
+
597
+ /*!\brief Delete the external rate control model callback prototype
598
+ *
599
+ * This callback is invoked by the encoder to delete the external rate control
600
+ * model.
601
+ *
602
+ * \param[in] rate_ctrl_model rate control model
603
+ */
604
+ typedef aom_rc_status_t (*aom_rc_delete_model_cb_fn_t)(
605
+ aom_rc_model_t rate_ctrl_model);
606
+
607
+ /*!\brief Callback function set for external rate control.
608
+ *
609
+ * The user can enable external rate control by registering
610
+ * a set of callback functions with the codec control flag
611
+ * #AOME_SET_EXTERNAL_RATE_CONTROL.
612
+ */
613
+ typedef struct aom_rc_funcs {
614
+ /*!
615
+ * The rate control type of this API.
616
+ */
617
+ aom_rc_type_t rc_type;
618
+ /*!
619
+ * Create an external rate control model.
620
+ */
621
+ aom_rc_create_model_cb_fn_t create_model;
622
+ /*!
623
+ * Send first pass stats to the external rate control model.
624
+ */
625
+ aom_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats;
626
+ /*!
627
+ * Send TPL stats for current GOP to the external rate control model.
628
+ */
629
+ aom_rc_send_tpl_gop_stats_cb_fn_t send_tpl_gop_stats;
630
+ /*!
631
+ * Get encodeframe decision from the external rate control model.
632
+ */
633
+ aom_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision;
634
+ /*!
635
+ * Update encodeframe result to the external rate control model.
636
+ */
637
+ aom_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result;
638
+ /*!
639
+ * Get key frame decision from the external rate control model.
640
+ */
641
+ aom_rc_get_key_frame_decision_cb_fn_t get_key_frame_decision;
642
+ /*!
643
+ * Get GOP decisions from the external rate control model.
644
+ */
645
+ aom_rc_get_gop_decision_cb_fn_t get_gop_decision;
646
+ /*!
647
+ * Get rdmult for the frame from the external rate control model.
648
+ */
649
+ aom_rc_get_frame_rdmult_cb_fn_t get_frame_rdmult;
650
+ /*!
651
+ * Delete the external rate control model.
652
+ */
653
+ aom_rc_delete_model_cb_fn_t delete_model;
654
+ /*!
655
+ * Private data for the external rate control model.
656
+ */
657
+ void *priv;
658
+ } aom_rc_funcs_t;
659
+
660
+ #ifdef __cplusplus
661
+ } // extern "C"
662
+ #endif
663
+
664
+ #endif // AOM_AOM_AOM_EXT_RATECTRL_H_