@revizly/sharp-libvips-dev 1.0.33 → 1.0.35

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 (56) hide show
  1. package/include/fontconfig/fcfreetype.h +14 -0
  2. package/include/fontconfig/fcprivate.h +8 -1
  3. package/include/fontconfig/fontconfig.h +52 -16
  4. package/include/glib-2.0/gio/gdbusconnection.h +2 -8
  5. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  6. package/include/glib-2.0/gio/gioenums.h +5 -4
  7. package/include/glib-2.0/girepository/gi-visibility.h +34 -0
  8. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  9. package/include/glib-2.0/glib/gmacros.h +3 -3
  10. package/include/glib-2.0/glib/gmarkup.h +10 -0
  11. package/include/glib-2.0/glib/gmem.h +4 -4
  12. package/include/glib-2.0/glib/gmessages.h +6 -8
  13. package/include/glib-2.0/glib/gsequence.h +2 -2
  14. package/include/glib-2.0/glib/gstrfuncs.h +190 -0
  15. package/include/glib-2.0/glib/gutils.h +9 -0
  16. package/include/glib-2.0/glib/gversionmacros.h +9 -0
  17. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  18. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  19. package/include/glib-2.0/gobject/gsignal.h +5 -5
  20. package/include/glib-2.0/gobject/gtype.h +14 -14
  21. package/include/harfbuzz/hb-script-list.h +0 -1
  22. package/include/harfbuzz/hb-version.h +2 -2
  23. package/include/libde265/de265-version.h +2 -2
  24. package/include/libde265/de265.h +35 -9
  25. package/include/libheif/heif.h +2 -0
  26. package/include/libheif/heif_color.h +127 -11
  27. package/include/libheif/heif_components.h +264 -0
  28. package/include/libheif/heif_context.h +2 -1
  29. package/include/libheif/heif_cxx.h +10 -10
  30. package/include/libheif/heif_decoding.h +44 -7
  31. package/include/libheif/heif_encoding.h +15 -9
  32. package/include/libheif/heif_error.h +9 -2
  33. package/include/libheif/heif_export.h +48 -0
  34. package/include/libheif/heif_image.h +81 -66
  35. package/include/libheif/heif_image_handle.h +2 -2
  36. package/include/libheif/heif_items.h +1 -1
  37. package/include/libheif/heif_library.h +8 -16
  38. package/include/libheif/heif_omaf.h +104 -0
  39. package/include/libheif/heif_plugin.h +16 -9
  40. package/include/libheif/heif_properties.h +250 -12
  41. package/include/libheif/heif_security.h +16 -4
  42. package/include/libheif/heif_sequences.h +74 -2
  43. package/include/libheif/heif_tiling.h +2 -2
  44. package/include/libheif/heif_uncompressed.h +44 -332
  45. package/include/libheif/heif_version.h +2 -2
  46. package/include/librsvg-2.0/librsvg/rsvg-version.h +2 -2
  47. package/include/svt-av1/EbConfigMacros.h +56 -0
  48. package/include/svt-av1/EbDebugMacros.h +83 -0
  49. package/include/svt-av1/EbSvtAv1.h +436 -0
  50. package/include/svt-av1/EbSvtAv1Enc.h +1082 -0
  51. package/include/svt-av1/EbSvtAv1ErrorCodes.h +67 -0
  52. package/include/svt-av1/EbSvtAv1Formats.h +126 -0
  53. package/include/svt-av1/EbSvtAv1Metadata.h +156 -0
  54. package/package.json +2 -2
  55. package/versions.json +8 -8
  56. package/include/libheif/heif_uncompressed_types.h +0 -143
@@ -0,0 +1,1082 @@
1
+ /*
2
+ * Copyright(c) 2019 Intel Corporation
3
+ *
4
+ * This source code is subject to the terms of the BSD 3-Clause Clear License and
5
+ * the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear License
6
+ * was not distributed with this source code in the LICENSE file, you can
7
+ * obtain it at https://www.aomedia.org/license. 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 https://www.aomedia.org/license/patent-license.
10
+ */
11
+
12
+ #ifndef EbSvtAv1Enc_h
13
+ #define EbSvtAv1Enc_h
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif // __cplusplus
18
+
19
+ #include <stdint.h>
20
+ #include "EbSvtAv1.h"
21
+ #include <stdlib.h>
22
+ #include <stdio.h>
23
+ #include <stdbool.h>
24
+ /**
25
+ * @brief SVT-AV1 encoder ABI version
26
+ *
27
+ * Should be increased by 1 everytime a public struct in the encoder
28
+ * has been modified, and reset anytime the major API version has
29
+ * been changed. Used to keep track if a field has been added or not.
30
+ */
31
+ #define SVT_AV1_ENC_ABI_VERSION 0
32
+ #define HIERARCHICAL_LEVELS_AUTO ((uint32_t)(~0))
33
+ #define MAX_HIERARCHICAL_LEVEL 6
34
+ #define REF_LIST_MAX_DEPTH 4
35
+ /*!\brief Decorator indicating that given struct/union/enum is packed */
36
+ #ifndef ATTRIBUTE_PACKED
37
+ #if defined(__GNUC__) && __GNUC__
38
+ #define ATTRIBUTE_PACKED __attribute__((packed))
39
+ #else
40
+ #define ATTRIBUTE_PACKED
41
+ #endif
42
+ #endif /* ATTRIBUTE_PACKED */
43
+ typedef enum ATTRIBUTE_PACKED {
44
+ ENC_MR = -1, //Research mode with higher quality than M0
45
+ ENC_M0 = 0,
46
+ ENC_M1 = 1,
47
+ ENC_M2 = 2,
48
+ ENC_M3 = 3,
49
+ ENC_M4 = 4,
50
+ ENC_M5 = 5,
51
+ ENC_M6 = 6,
52
+ ENC_M7 = 7,
53
+ ENC_M8 = 8,
54
+ ENC_M9 = 9,
55
+ ENC_M10 = 10,
56
+ ENC_M11 = 11,
57
+ ENC_M12 = 12,
58
+ ENC_M13 = 13,
59
+ MAX_ENC_PRESET = ENC_M13
60
+ } EncMode;
61
+
62
+ #define DEFAULT -1
63
+
64
+ #define EB_BUFFERFLAG_EOS 0x00000001 // signals the last packet of the stream
65
+ #define EB_BUFFERFLAG_SHOW_EXT 0x00000002 // signals that the packet contains a show existing frame at the end
66
+ #define EB_BUFFERFLAG_HAS_TD 0x00000004 // signals that the packet contains a TD
67
+ #define EB_BUFFERFLAG_IS_ALT_REF 0x00000008 // signals that the packet contains an ALT_REF frame
68
+ #define EB_BUFFERFLAG_ERROR_MASK \
69
+ 0xFFFFFFF0 // mask for signalling error assuming top flags fit in 4 bits. To be changed, if more flags are added.
70
+
71
+ /*
72
+ * Struct for storing content light level information
73
+ * Values are stored in BE format
74
+ * Refer to the AV1 specification 6.7.3 for more details
75
+ */
76
+ struct EbContentLightLevel {
77
+ uint16_t max_cll;
78
+ uint16_t max_fall;
79
+ };
80
+
81
+ /*
82
+ * Struct for storing x and y chroma points, values are stored in BE format
83
+ */
84
+ struct EbSvtAv1ChromaPoints {
85
+ uint16_t x;
86
+ uint16_t y;
87
+ };
88
+
89
+ /*
90
+ * Struct for storing mastering-display information
91
+ * values are stored in BE format
92
+ * Refer to the AV1 specification 6.7.4 for more details
93
+ */
94
+ struct EbSvtAv1MasteringDisplayInfo {
95
+ struct EbSvtAv1ChromaPoints r;
96
+ struct EbSvtAv1ChromaPoints g;
97
+ struct EbSvtAv1ChromaPoints b;
98
+ struct EbSvtAv1ChromaPoints white_point;
99
+ uint32_t max_luma;
100
+ uint32_t min_luma;
101
+ };
102
+
103
+ /************************************************
104
+ * Prediction Structure Config Entry
105
+ * Contains the basic reference lists and
106
+ * configurations for each Prediction Structure
107
+ * Config Entry.
108
+ ************************************************/
109
+ typedef struct PredictionStructureConfigEntry {
110
+ uint32_t temporal_layer_index;
111
+ uint32_t decode_order;
112
+ } PredictionStructureConfigEntry;
113
+
114
+ // super-res modes
115
+ typedef enum {
116
+ SUPERRES_NONE, // No frame superres allowed.
117
+ SUPERRES_FIXED, // All frames are coded at the specified scale, and super-resolved.
118
+ SUPERRES_RANDOM, // All frames are coded at a random scale, and super-resolved.
119
+ SUPERRES_QTHRESH, // Superres scale for a frame is determined based on q_index.
120
+ SUPERRES_AUTO, // Automatically select superres for appropriate frames.
121
+ SUPERRES_MODES
122
+ } SUPERRES_MODE;
123
+
124
+ // super-res auto search type
125
+ typedef enum {
126
+ SUPERRES_AUTO_ALL, // Tries all possible superres ratios
127
+ SUPERRES_AUTO_DUAL, // Tries no superres and q-based superres ratios
128
+ SUPERRES_AUTO_SOLO, // Only apply the q-based superres ratio
129
+ SUPERRES_AUTO_SEARCH_TYPES
130
+ } SUPERRES_AUTO_SEARCH_TYPE;
131
+
132
+ // reference scaling modes
133
+ typedef enum {
134
+ RESIZE_NONE, // No frame resize allowed.
135
+ RESIZE_FIXED, // All frames are coded at the specified scale.
136
+ RESIZE_RANDOM, // All frames are coded at a random scale.
137
+ RESIZE_DYNAMIC, // Resize scale for a frame in dynamic.
138
+ RESIZE_RANDOM_ACCESS, // Resize scale frame by event in random access
139
+ RESIZE_MODES
140
+ } RESIZE_MODE;
141
+
142
+ /** The SvtAv1IntraRefreshType is used to describe the intra refresh type.
143
+ */
144
+ typedef enum SvtAv1IntraRefreshType {
145
+ SVT_AV1_FWDKF_REFRESH = 1,
146
+ SVT_AV1_KF_REFRESH = 2,
147
+ } SvtAv1IntraRefreshType;
148
+
149
+ typedef enum {
150
+ SVT_AV1_STREAM_INFO_START = 1,
151
+ SVT_AV1_STREAM_INFO_FIRST_PASS_STATS_OUT = SVT_AV1_STREAM_INFO_START,
152
+
153
+ SVT_AV1_STREAM_INFO_END,
154
+ } SVT_AV1_STREAM_INFO_ID;
155
+
156
+ /*!\brief Generic fixed size buffer structure
157
+ *
158
+ * This structure is able to hold a reference to any fixed size buffer.
159
+ */
160
+ typedef struct SvtAv1FixedBuf {
161
+ void *buf; /**< Pointer to the data. Does NOT own the data! */
162
+ uint64_t sz; /**< Length of the buffer, in chars */
163
+ } SvtAv1FixedBuf; /**< alias for struct aom_fixed_buf */
164
+
165
+ /** Indicates how an S-Frame should be inserted.
166
+ */
167
+ typedef enum EbSFrameMode {
168
+ SFRAME_STRICT_BASE =
169
+ 1, /**< The considered frame will be made into an S-Frame only if it is a base layer inter frame */
170
+ SFRAME_NEAREST_BASE =
171
+ 2, /**< If the considered frame is not an altref frame, the next base layer inter frame will be made into an S-Frame */
172
+ } EbSFrameMode;
173
+
174
+ #if !SVT_AV1_CHECK_VERSION(4, 0, 0) // to be deprecated in v4.0
175
+ /* Do not use the values in SvtAv1PredStructure. Use PredStructure (in definitions.h) instead.
176
+ * SvtAv1PredStructure will be deprecated in v4.0.
177
+ */
178
+ typedef enum SvtAv1PredStructure {
179
+ SVT_AV1_PRED_LOW_DELAY_P = 0, // No longer active
180
+ SVT_AV1_PRED_LOW_DELAY_B = 1,
181
+ SVT_AV1_PRED_RANDOM_ACCESS = 2,
182
+ SVT_AV1_PRED_TOTAL_COUNT = 3,
183
+ SVT_AV1_PRED_INVALID = 0xFF,
184
+ } SvtAv1PredStructure;
185
+ #endif
186
+
187
+ /* Indicates what rate control mode is used.
188
+ * Currently, cqp is distinguised by setting enable_adaptive_quantization to 0
189
+ */
190
+ typedef enum SvtAv1RcMode {
191
+ SVT_AV1_RC_MODE_CQP_OR_CRF = 0, // constant quantization parameter/constant rate factor
192
+ SVT_AV1_RC_MODE_VBR = 1, // variable bit rate
193
+ SVT_AV1_RC_MODE_CBR = 2, // constant bit rate
194
+ } SvtAv1RcMode;
195
+
196
+ typedef enum SvtAv1FrameUpdateType {
197
+ SVT_AV1_KF_UPDATE,
198
+ SVT_AV1_LF_UPDATE,
199
+ SVT_AV1_GF_UPDATE,
200
+ SVT_AV1_ARF_UPDATE,
201
+ SVT_AV1_OVERLAY_UPDATE,
202
+ SVT_AV1_INTNL_OVERLAY_UPDATE, // Internal Overlay Frame
203
+ SVT_AV1_INTNL_ARF_UPDATE, // Internal Altref Frame
204
+ SVT_AV1_FRAME_UPDATE_TYPES
205
+ } SvtAv1FrameUpdateType;
206
+
207
+ typedef struct SvtAv1FrameScaleEvts {
208
+ uint32_t evt_num;
209
+ uint64_t *start_frame_nums;
210
+ uint32_t *resize_kf_denoms;
211
+ uint32_t *resize_denoms;
212
+ } SvtAv1FrameScaleEvts;
213
+
214
+ // Will contain the EbEncApi which will live in the EncHandle class
215
+ // Only modifiable during config-time.
216
+ typedef struct EbSvtAv1EncConfiguration {
217
+ /**
218
+ * @brief Encoder preset used.
219
+ * -2 and -1 are for debug purposes and should not be used.
220
+ * 0 is the highest quality mode but is the slowest,
221
+ * 13 is the fastest mode but is not as high quality.
222
+ *
223
+ * Min value is -2.
224
+ * Max value is 13.
225
+ * Default is 12.
226
+ */
227
+ int8_t enc_mode;
228
+
229
+ // GOP Structure
230
+
231
+ /* The intra period defines the interval of frames after which you insert an
232
+ * Intra refresh. It is strongly recommended to set the value to multiple of
233
+ * 2^(hierarchical_levels), subtracting one if using open GOP (intra_refresh_type == 1).
234
+ * For instance, to get a 5-second GOP (default being >=5 seconds)
235
+ * with hierarchical_levels = 3 and open GOP you could use 319, 279, 159
236
+ * for 60, 50, or 30 respectively.
237
+ *
238
+ * -1 = no intra update.
239
+ * -2 = auto.
240
+ *
241
+ * Default is -2. */
242
+ int32_t intra_period_length;
243
+
244
+ /* Random access.
245
+ *
246
+ * 1 = CRA, open GOP.
247
+ * 2 = IDR, closed GOP.
248
+ *
249
+ * Default is 1. */
250
+ SvtAv1IntraRefreshType intra_refresh_type;
251
+ /* Number of hierarchical layers used to construct GOP.
252
+ * Minigop size = 2^HierarchicalLevels.
253
+ *
254
+ * Default is auto */
255
+ uint32_t hierarchical_levels;
256
+ /* Prediction structure used to construct GOP. There are two main structures
257
+ * supported, which are: Low Delay and Random Access.
258
+ *
259
+ * In Low Delay structure, pictures within a mini GOP refer to the previously
260
+ * encoded pictures in display order. In other words, pictures with display
261
+ * order N can only be referenced by pictures with display order greater than
262
+ * N, and it can only refer pictures with picture order lower than N.
263
+ *
264
+ * In Random Access structure, the B/b pictures can refer to reference pictures
265
+ * from both directions (past and future).
266
+ *
267
+ * Refer to PredStructure enum for valid values.
268
+ *
269
+ * Default is RANDOM_ACCESS. */
270
+ uint8_t pred_structure;
271
+
272
+ // Input Info
273
+
274
+ /**
275
+ * @brief Frame width in pixels.
276
+ *
277
+ * Min is 64.
278
+ * Max is 16384.
279
+ * Default is 0.
280
+ */
281
+ uint32_t source_width;
282
+
283
+ /**
284
+ * @brief Frame height in pixels
285
+ *
286
+ * Min is 64.
287
+ * Max is 8704.
288
+ * Default is 0.
289
+ */
290
+ uint32_t source_height;
291
+
292
+ /* Specifies the maximum frame width/height for the frames represented by the sequence header
293
+ * (max_frame_width_minus_1 and max_frame_height_minus_1, spec 5.5.1).
294
+ * Actual frame height could be equal to or less than this value. E.g. Use this value to indicate
295
+ * the maximum height between renditions when switch frame feature is on.
296
+ */
297
+ uint32_t forced_max_frame_width;
298
+ uint32_t forced_max_frame_height;
299
+ /* Frame rate numerator. When zero, the encoder will use -fps if
300
+ * FrameRateDenominator is also zero, otherwise an error is returned.
301
+ *
302
+ * Default is 0. */
303
+ uint32_t frame_rate_numerator;
304
+ /* Frame rate denominator. When zero, the encoder will use -fps if
305
+ * FrameRateNumerator is also zero, otherwise an error is returned.
306
+ *
307
+ * Default is 0. */
308
+ uint32_t frame_rate_denominator;
309
+ /* Specifies the bit depth of input video.
310
+ *
311
+ * 8 = 8 bit.
312
+ * 10 = 10 bit.
313
+ *
314
+ * Default is 8. */
315
+ uint32_t encoder_bit_depth;
316
+
317
+ /**
318
+ * @brief Encoder color format.
319
+ * Only YUV420 is supported for now.
320
+ *
321
+ * Min is YUV400.
322
+ * Max is YUV444.
323
+ * Default is YUV420.
324
+ */
325
+ EbColorFormat encoder_color_format;
326
+ /**
327
+ * @brief Bitstream profile to use.
328
+ * 0: main, 1: high, 2: professional.
329
+ *
330
+ * Min is MAIN_PROFILE.
331
+ * Max is PROFESSIONAL_PROFILE.
332
+ * Default is MAIN_PROFILE.
333
+ */
334
+ EbAv1SeqProfile profile;
335
+ /* Constraints for bitstream in terms of max bitrate and max buffer size.
336
+ *
337
+ * 0 = Main, for most applications.
338
+ * 1 = High, for demanding applications.
339
+ *
340
+ * Default is 0. */
341
+ uint32_t tier;
342
+ /**
343
+ * @brief Bitstream level.
344
+ * 0: autodetect from bitstream, 20: level 2.0, 63: level 6.3, only levels 2.0-6.3 are properly defined.
345
+ * The levels are defined at https://aomediacodec.github.io/av1-spec/av1-spec.pdf
346
+ * under "A.3. Levels".
347
+ *
348
+ * Min is 0.
349
+ * Max is 73.
350
+ * Default is 0.
351
+ */
352
+ uint32_t level;
353
+ /* Color primaries
354
+ * values are from EbColorPrimaries
355
+ Default is 2 (CP_UNSPECIFIED). */
356
+ EbColorPrimaries color_primaries;
357
+ /* Transfer characteristics
358
+ * values are from EbTransferCharacteristics
359
+ Default is 2 (TC_UNSPECIFIED). */
360
+ EbTransferCharacteristics transfer_characteristics;
361
+ /* Matrix coefficients
362
+ * values are from EbMatrixCoefficients
363
+ Default is 2 (MC_UNSPECIFIED). */
364
+ EbMatrixCoefficients matrix_coefficients;
365
+ /* Color range
366
+ * values are from EbColorRange
367
+ * 0: studio swing.
368
+ * 1: full swing.
369
+ Default is 0. */
370
+ EbColorRange color_range;
371
+ /* Mastering display metadata
372
+ * values are from set using svt_aom_parse_mastering_display()
373
+ */
374
+ struct EbSvtAv1MasteringDisplayInfo mastering_display;
375
+ /* Content light level
376
+ * values are from set using svt_aom_parse_content_light_level()
377
+ */
378
+ struct EbContentLightLevel content_light_level;
379
+
380
+ /* Chroma sample position
381
+ * Values as per 6.4.2 of the specification:
382
+ * EB_CSP_UNKNOWN: default
383
+ * EB_CSP_VERTICAL: value 0 from H.273 AKA "left"
384
+ * EB_CSP_COLOCATED: value 2 from H.273 AKA "top left"
385
+ */
386
+ EbChromaSamplePosition chroma_sample_position;
387
+
388
+ // End input info
389
+
390
+ /* Rate control mode.
391
+ *
392
+ * Refer to the SvtAv1RcMode enum for valid values
393
+ * Default is 0. */
394
+ uint8_t rate_control_mode;
395
+ // Rate control tuning
396
+
397
+ // Quantization
398
+ /* Initial quantization parameter for the Intra pictures used under constant
399
+ * qp rate control mode.
400
+ *
401
+ * Default is 50. */
402
+ uint32_t qp;
403
+
404
+ /* force qp values for every picture that are passed in the header pointer
405
+ *
406
+ * Default is 0.*/
407
+ bool use_qp_file;
408
+ /* Target bitrate in bits/second, only applicable when rate control mode is
409
+ * set to 1 (VBR) or 2 (CBR).
410
+ *
411
+ * Default is 2000513. */
412
+ uint32_t target_bit_rate;
413
+ /* maximum bitrate in bits/second, only apllicable when rate control mode is
414
+ * set to 0.
415
+ *
416
+ * Default is 0. */
417
+ uint32_t max_bit_rate;
418
+ /* Maxium QP value
419
+ * Default is 63. */
420
+ uint32_t max_qp_allowed;
421
+ /* Minimum QP value
422
+ * Default is auto. */
423
+ uint32_t min_qp_allowed;
424
+ /**
425
+ * @brief Variable Bit Rate Minimum Section Percentage
426
+ *
427
+ * Indicates the minimum bitrate to be used for a single GOP as a percentage
428
+ * of the target bitrate.
429
+ *
430
+ * Min is 0.
431
+ * Max is 100.
432
+ * Default is 0.
433
+ */
434
+ uint32_t vbr_min_section_pct;
435
+
436
+ /**
437
+ * @brief Variable Bit Rate Maximum Section Percentage
438
+ *
439
+ * Indicates the maximum bitrate to be used for a single GOP as a percentage
440
+ * of the target bitrate.
441
+ *
442
+ * Min is 0.
443
+ * Max is 10000.
444
+ * Default is 2000.
445
+ */
446
+ uint32_t vbr_max_section_pct;
447
+
448
+ /**
449
+ * @brief UnderShoot Percentage
450
+ *
451
+ * Only applicable for VBR and CBR.
452
+ *
453
+ * Indicates the tolerance of the VBR algorithm to undershoot and is used
454
+ * as a trigger threshold for more agressive adaptation of Quantization.
455
+ *
456
+ * Min is 0.
457
+ * Max is 100.
458
+ * Default is 25 for CBR and 50 for VBR.
459
+ */
460
+ uint32_t under_shoot_pct;
461
+
462
+ /**
463
+ * @brief OverShoot Percentage
464
+ *
465
+ * Only applicable for VBR and CBR
466
+ *
467
+ * Indicates the tolerance of the VBR algorithm to overshoot and is used as
468
+ * a trigger threshold for more agressive adaptation of Quantization.
469
+ *
470
+ * Min is 0.
471
+ * Max is 100.
472
+ * Default is 25.
473
+ */
474
+ uint32_t over_shoot_pct;
475
+
476
+ /**
477
+ * @brief MaxBitRate OverShoot Percentage
478
+ *
479
+ * Only applicable for Capped CRF.
480
+ *
481
+ * Indicates the tolerance of the Capped CRF algorithm to overshoot
482
+ * and is used as a trigger threshold for more agressive adaptation of
483
+ * Quantization.
484
+ *
485
+ * Min is 0.
486
+ * Max is 100.
487
+ * Default is 50.
488
+ */
489
+ uint32_t mbr_over_shoot_pct;
490
+
491
+ /**
492
+ * @brief Starting Buffer Level in MilliSeconds
493
+ *
494
+ * Only applicable for CBR.
495
+ *
496
+ * Indicates the amount of data that will be buffered by the decoding
497
+ * application prior to beginning playback, and is expressed in units of
498
+ * time. Must be less than maximum_buffer_size_ms.
499
+ *
500
+ * Min is 20.
501
+ * Max is 10000.
502
+ * Default is 600.
503
+ */
504
+ int64_t starting_buffer_level_ms;
505
+
506
+ /**
507
+ * @brief Optimal Buffer Level in MilliSeconds
508
+ *
509
+ * Only applicable for CBR.
510
+ *
511
+ * indicates the amount of data that the encoder should try to maintain in the
512
+ * decoder's buffer, and is expressed in units of time. Must be less than
513
+ * maximum_buffer_size_ms.
514
+ *
515
+ * Min is 20.
516
+ * Max is 10000.
517
+ * Default is 600.
518
+ */
519
+ int64_t optimal_buffer_level_ms;
520
+
521
+ /**
522
+ * @brief Maximum Buffer Size in MilliSeconds
523
+ *
524
+ * Only applicable for CBR.
525
+ *
526
+ * indicates the maximum amount of data that may be buffered by the
527
+ * decoding application, and is expressed in units of time.
528
+ *
529
+ * Min is 20.
530
+ * Max is 10000.
531
+ * Default is 1000.
532
+ */
533
+ int64_t maximum_buffer_size_ms;
534
+
535
+ // input / output buffer to be used for multi-pass encoding
536
+ SvtAv1FixedBuf rc_stats_buffer;
537
+ int pass;
538
+
539
+ // End rate control tuning
540
+
541
+ // Individual tuning flags
542
+ /* use fixed qp offset for every picture based on temporal layer index
543
+ * 0: off (use the auto mode QP)
544
+ * 1: on (the offset is applied on top of the user QP)
545
+ * 2: on (the offset is applied on top of the auto mode QP)
546
+ *
547
+ * Default is 0.*/
548
+ uint8_t use_fixed_qindex_offsets;
549
+ int32_t qindex_offsets[EB_MAX_TEMPORAL_LAYERS];
550
+ int32_t key_frame_chroma_qindex_offset;
551
+ int32_t key_frame_qindex_offset;
552
+ int32_t chroma_qindex_offsets[EB_MAX_TEMPORAL_LAYERS];
553
+
554
+ int32_t luma_y_dc_qindex_offset;
555
+ int32_t chroma_u_dc_qindex_offset;
556
+ int32_t chroma_u_ac_qindex_offset;
557
+ int32_t chroma_v_dc_qindex_offset;
558
+ int32_t chroma_v_ac_qindex_offset;
559
+
560
+ /**
561
+ * @brief Deblocking loop filter control
562
+ *
563
+ * Default is true.
564
+ */
565
+ bool enable_dlf_flag;
566
+ /* Film grain denoising the input picture
567
+ * Flag to enable the denoising
568
+ *
569
+ * Default is 0. */
570
+ uint32_t film_grain_denoise_strength;
571
+
572
+ /**
573
+ * @brief Determines how much denoising is used.
574
+ * Only applicable when film grain is ON.
575
+ *
576
+ * 0 is no denoising
577
+ * 1 is full denoising
578
+ *
579
+ * Default is 0. */
580
+ uint8_t film_grain_denoise_apply;
581
+
582
+ /* CDEF Level
583
+ *
584
+ * Default is -1. */
585
+ int cdef_level;
586
+
587
+ /* Restoration filtering
588
+ * enable/disable
589
+ * set Self-Guided (sg) mode
590
+ * set Wiener (wn) mode
591
+ *
592
+ * Default is -1. */
593
+ int enable_restoration_filtering;
594
+
595
+ /* motion field motion vector
596
+ *
597
+ * Default is -1. */
598
+ int enable_mfmv;
599
+
600
+ /* Flag to enable the scene change detection algorithm.
601
+ *
602
+ * Default is 1. */
603
+ uint32_t scene_change_detection;
604
+
605
+ /* Log 2 Tile Rows and columns . 0 means no tiling,1 means that we split the dimension
606
+ * into 2
607
+ * Default is 0. */
608
+ int32_t tile_columns;
609
+ int32_t tile_rows;
610
+
611
+ /* When RateControlMode is set to 1 it's best to set this parameter to be
612
+ * equal to the Intra period value (such is the default set by the encoder).
613
+ * When CQP is chosen, then a (2 * minigopsize +1) look ahead is recommended.
614
+ *
615
+ * Default depends on rate control mode.*/
616
+ uint32_t look_ahead_distance;
617
+
618
+ /* Enable TPL in look ahead
619
+ * 0 = disable TPL in look ahead
620
+ * 1 = enable TPL in look ahead
621
+ * Default is 0 */
622
+ uint8_t enable_tpl_la;
623
+
624
+ /* recode_loop indicates the recode levels,
625
+ * DISALLOW_RECODE = 0, No recode.
626
+ * ALLOW_RECODE_KFMAXBW = 1, Allow recode for KF and exceeding maximum frame bandwidth.
627
+ * ALLOW_RECODE_KFARFGF = 2, Allow recode only for KF/ARF/GF frames.
628
+ * ALLOW_RECODE = 3, Allow recode for all frames based on bitrate constraints.
629
+ * ALLOW_RECODE_DEFAULT = 4, Default setting, ALLOW_RECODE_KFARFGF for M0~5 and
630
+ * ALLOW_RECODE_KFMAXBW for M6~8.
631
+ * default is 4
632
+ */
633
+ uint32_t recode_loop;
634
+
635
+ /* Flag to signal the content being a screen sharing content type
636
+ *
637
+ * Default is 0. */
638
+ uint32_t screen_content_mode;
639
+
640
+ /* Enable adaptive quantization within a frame using segmentation.
641
+ *
642
+ * For rate control mode 0, setting this to 0 will use CQP mode, else CRF mode will be used.
643
+ * Default is 2. */
644
+ uint8_t enable_adaptive_quantization;
645
+
646
+ /**
647
+ * @brief Enable use of ALT-REF (temporally filtered) frames.
648
+ * 0 = off
649
+ * 1 = on
650
+ * 2 = adaptive
651
+ * Default is 1. */
652
+ uint8_t enable_tf;
653
+
654
+ bool enable_overlays;
655
+ /**
656
+ * @brief Tune for a particular metric; 0: VQ, 1: PSNR, 2: SSIM.
657
+ *
658
+ * Default is 1.
659
+ */
660
+ uint8_t tune;
661
+
662
+ // super-resolution parameters
663
+ uint8_t superres_mode;
664
+ uint8_t superres_denom;
665
+ uint8_t superres_kf_denom;
666
+ uint8_t superres_qthres;
667
+ uint8_t superres_kf_qthres;
668
+ uint8_t superres_auto_search_type;
669
+ /* Decoder-speed-targeted encoder optimization level (produce bitstreams that can be decoded faster).
670
+ * 0: No decoder-targeted speed optimization
671
+ * 1: Level 1 of decoder-targeted speed optimizations (faster decoder-speed than level 0)
672
+ * 2: Level 2 of decoder-targeted speed optimizations (faster decoder-speed than level 1)
673
+ */
674
+ uint8_t fast_decode;
675
+ /* S-Frame interval (frames)
676
+ * 0: S-Frame off
677
+ * >0: S-Frame on and indicates the number of frames after which a frame may be coded as an S-Frame
678
+ */
679
+ int32_t sframe_dist;
680
+ /* Indicates how an S-Frame should be inserted
681
+ * values are from EbSFrameMode
682
+ * SFRAME_STRICT_ARF: the considered frame will be made into an S-Frame only if it is an altref frame
683
+ * SFRAME_NEAREST_ARF: if the considered frame is not an altref frame, the next altref frame will be made into an S-Frame
684
+ */
685
+ EbSFrameMode sframe_mode;
686
+
687
+ // End of individual tuning flags
688
+
689
+ // Application Specific parameters
690
+
691
+ /**
692
+ * @brief API signal for the library to know the channel ID (used for pinning to cores).
693
+ *
694
+ * Min value is 0.
695
+ * Max value is 0xFFFFFFFF.
696
+ * Default is 0.
697
+ */
698
+ uint32_t channel_id;
699
+
700
+ /**
701
+ * @brief API signal for the library to know the active number of channels being encoded simultaneously.
702
+ *
703
+ * Min value is 1.
704
+ * Max value is 0xFFFFFFFF.
705
+ * Default is 1.
706
+ */
707
+ uint32_t active_channel_count;
708
+
709
+ // Threads management
710
+
711
+ /* The level of parallelism refers to how much parallelization the encoder will perform
712
+ * by setting the number of threads and pictures that can be handled simultaneously. If
713
+ * the value is 0, a deafult level will be chosen based on the number of cores on the
714
+ * machine. Levels 1-6 are supported. Beyond that, higher inputs
715
+ * will map to the highest level.
716
+ */
717
+ uint32_t level_of_parallelism;
718
+
719
+ /* Pin the execution of threads to the first N logical processors.
720
+ * 0: unpinned
721
+ * N: Pin threads to socket's first N processors
722
+ * default 0 */
723
+ uint32_t pin_threads;
724
+
725
+ /* Target socket to run on. For dual socket systems, this can specify which
726
+ * socket the encoder runs on.
727
+ *
728
+ * -1 = Both Sockets.
729
+ * 0 = Socket 0.
730
+ * 1 = Socket 1.
731
+ *
732
+ * Default is -1. */
733
+ int32_t target_socket;
734
+
735
+ /* CPU FLAGS to limit assembly instruction set used by encoder.
736
+ * Default is EB_CPU_FLAGS_ALL. */
737
+ EbCpuFlags use_cpu_flags;
738
+
739
+ // Debug tools
740
+ /* Instruct the library to calculate the recon to source for PSNR calculation
741
+ *
742
+ * Default is 0.*/
743
+ uint32_t stat_report;
744
+
745
+ /**
746
+ * @brief API Signal to output reconstructed yuv used for debug purposes.
747
+ * Using this will affect the speed of encoder.
748
+ *
749
+ * Default is false.
750
+ */
751
+ bool recon_enabled;
752
+ // 1.0.0: Any additional fields shall go after here
753
+
754
+ /**
755
+ * @brief Signal that force-key-frames is enabled.
756
+ *
757
+ */
758
+ bool force_key_frames;
759
+
760
+ /**
761
+ * @brief Signal to the library to treat intra_period_length as seconds and
762
+ * multiply by fps_num/fps_den.
763
+ */
764
+ bool multiply_keyint;
765
+ // reference scaling parameters
766
+ /**
767
+ * @brief Reference scaling mode
768
+ * the available modes are defined in RESIZE_MODE
769
+ */
770
+ uint8_t resize_mode;
771
+ /**
772
+ * @brief Resize denominator
773
+ * this value can be from 8 to 16, means downscaling to 8/8-8/16 of original
774
+ * resolution in both width and height
775
+ */
776
+ uint8_t resize_denom;
777
+ /**
778
+ * @brief Resize denominator of key frames
779
+ * this value can be from 8 to 16, means downscaling to 8/8-8/16 of original
780
+ * resolution in both width and height
781
+ */
782
+ uint8_t resize_kf_denom;
783
+ /**
784
+ * @brief Signal to the library to enable quantisation matrices
785
+ *
786
+ * Default is false.
787
+ */
788
+ bool enable_qm;
789
+
790
+ /**
791
+ * @brief Min quant matrix flatness. Applicable when enable_qm is true.
792
+ * Min value is 0.
793
+ * Max value is 15.
794
+ * Default is 8.
795
+ */
796
+ uint8_t min_qm_level;
797
+ /**
798
+ * @brief Max quant matrix flatness. Applicable when enable_qm is true.
799
+ * Min value is 0.
800
+ * Max value is 15.
801
+ * Default is 15.
802
+ */
803
+ uint8_t max_qm_level;
804
+
805
+ /**
806
+ * @brief gop_constraint_rc
807
+ *
808
+ * Currently, only applicable for VBR and when GoP size is greater than 119 frames.
809
+ *
810
+ * When enabled, the rate control matches the target rate for each GoP.
811
+ *
812
+ * 0: off
813
+ * 1: on
814
+ * Default is 0.
815
+ */
816
+ bool gop_constraint_rc;
817
+ /**
818
+ * @brief scale factors for lambda value for different frame update types
819
+ * factor >> 7 (/ 128) is the actual value in float
820
+ */
821
+ int32_t lambda_scale_factors[SVT_AV1_FRAME_UPDATE_TYPES];
822
+
823
+ /* Dynamic gop
824
+ *
825
+ * 0 = disable Dynamic GoP
826
+ * 1 = enable Dynamic GoP
827
+ * Default is 1. */
828
+ bool enable_dg;
829
+ /**
830
+ * @brief startup_mg_size
831
+ *
832
+ * When enabled, a MG with specified size will be inserted after the key frame.
833
+ * The MG size is determined by 2^startup_mg_size.
834
+ *
835
+ * 0: off
836
+ * 2: set hierarchical levels to 2 (MG size 4)
837
+ * 3: set hierarchical levels to 3 (MG size 8)
838
+ * 4: set hierarchical levels to 4 (MG size 16)
839
+ * Default is 0.
840
+ */
841
+ uint8_t startup_mg_size;
842
+
843
+ /**
844
+ * @brief startup_qp_offset
845
+ *
846
+ * When enabled, an offset will be added to the input-qp of the startup GOP prior to the picture-qp derivation
847
+ *
848
+ * Min value is -63.
849
+ * Max value is 63.
850
+ * Default is 0.
851
+ */
852
+ int8_t startup_qp_offset;
853
+ /* @brief reference scaling events for random access mode (resize-mode = 4)
854
+ *
855
+ * evt_num: total count of events
856
+ * start_frame_nums: array of scaling start frame numbers
857
+ * resize_kf_denoms: array of scaling denominators of key-frame
858
+ * resize_denoms: array of scaling denominators of non-key-frame
859
+ */
860
+ SvtAv1FrameScaleEvts frame_scale_evts;
861
+
862
+ /* ROI map
863
+ *
864
+ * 0 = disable ROI
865
+ * 1 = enable ROI
866
+ * Default is 0. */
867
+ bool enable_roi_map;
868
+
869
+ /* Manually adjust temporal filtering strength
870
+ * 10 + (4 - 0) = 14 (8x weaker)
871
+ * 10 + (4 - 1) = 13 (4x weaker, PSY default)
872
+ * 10 + (4 - 2) = 12 (2x weaker)
873
+ * 10 + (4 - 3) = 11 (mainline default)
874
+ * 10 + (4 - 4) = 10 (2x stronger) */
875
+ uint8_t tf_strength;
876
+
877
+ /* Stores the optional film grain synthesis info */
878
+ AomFilmGrain *fgs_table;
879
+
880
+ /* New parameters can go in under this line. Also deduct the size of the parameter */
881
+ /* from the padding array */
882
+
883
+ /* Variance boost
884
+ * false = disable variance boost
885
+ * true = enable variance boost
886
+ * Default is false. */
887
+ bool enable_variance_boost;
888
+ /* @brief Selects the curve strength to boost low variance regions according to a fast-growing formula
889
+ * Default is 2 */
890
+ uint8_t variance_boost_strength;
891
+
892
+ /* @brief Picks a set of eight 8x8 variance values per superblock to determine boost
893
+ * Lower values enable detecting more blocks that need boosting, at the expense of more possible false positives (overall bitrate increase)
894
+ * 1: 1st octile
895
+ * 4: 4th octile
896
+ * 8: 8th octile
897
+ * Default is 6 */
898
+ uint8_t variance_octile;
899
+
900
+ /* @brief Bias towards decreased/increased sharpness in the deblocking loop filter & during rate distortion
901
+ * Minimum value is -7 (less sharp).
902
+ * Maximum value is 7 (more sharp).
903
+ * Default is 0 (medium sharpness). */
904
+ int8_t sharpness;
905
+
906
+ /* @brief Enable the user to configure which curve variance boost uses.
907
+ * Curve 1 emphasizes boosting low-medium contrast regions at a modest bitrate increase over the default curve
908
+ * 0: default curve
909
+ * 1: low-medium contrast boost curve
910
+ * 2: still picture curve, tuned for SSIMULACRA2 performance on the CID22 Validation Set
911
+ * Default is 0. */
912
+ uint8_t variance_boost_curve;
913
+
914
+ /* @brief Frame-level luminance-based QP bias to improve quality in low luma scenarios
915
+ * Works by adjusting frame-level QP based on average luminance across a frame
916
+ * 0: Disable luminance-based QP bias
917
+ * 1-100: Enable frame-level luminance-based QP bias. Higher values strengthen the bias
918
+ * Default is 0 (disabled). */
919
+ uint8_t luminance_qp_bias;
920
+
921
+ /* @brief Signal to the library to enable losless coding
922
+ *
923
+ * Default is false.
924
+ */
925
+ bool lossless;
926
+
927
+ /* @brief Signal to the library to enable still-picture coding
928
+ *
929
+ * Default is false.
930
+ */
931
+ bool avif;
932
+
933
+ /**
934
+ * @brief Min chroma quant matrix flatness. Applicable when enable_qm is true.
935
+ * Min value is 0.
936
+ * Max value is 15.
937
+ * Default is 8.
938
+ */
939
+ uint8_t min_chroma_qm_level;
940
+
941
+ /**
942
+ * @brief Max chroma quant matrix flatness. Applicable when enable_qm is true.
943
+ * Min value is 0.
944
+ * Max value is 15.
945
+ * Default is 15.
946
+ */
947
+ uint8_t max_chroma_qm_level;
948
+
949
+ /* @brief Signal to the library to enable real-time coding
950
+ *
951
+ * Default is false.
952
+ */
953
+ bool rtc;
954
+ // clang-format off
955
+ /*Add 128 Byte Padding to Struct to avoid changing the size of the public configuration struct*/
956
+ uint8_t padding[128 - (sizeof(uint8_t) * 2)
957
+ - sizeof(bool)
958
+ ];
959
+ // clang-format on
960
+ } EbSvtAv1EncConfiguration;
961
+
962
+ /**
963
+ * Returns a string containing "v$tag-$commit_count-g$hash${dirty:+-dirty}"
964
+ * @param[out] SVT_AV1_CVS_VERSION
965
+ */
966
+ EB_API const char *svt_av1_get_version(void);
967
+
968
+ /**
969
+ * Prints the version header and build information to the file
970
+ * specified by the SVT_LOG_FILE environment variable or stderr
971
+ */
972
+ EB_API void svt_av1_print_version(void);
973
+
974
+ /* STEP 1: Call the library to construct a Component Handle.
975
+ *
976
+ * Parameter:
977
+ * @ **p_handle Handle to be called in the future for manipulating the
978
+ * component.
979
+ * @ *p_app_data Callback data.
980
+ * @ *config_ptr Pointer passed back to the client during callbacks, it will be
981
+ * loaded with default params from the library. */
982
+ EB_API EbErrorType svt_av1_enc_init_handle(
983
+ EbComponentType **p_handle,
984
+ EbSvtAv1EncConfiguration *config_ptr); // config_ptr will be loaded with default params from the library
985
+
986
+ /* STEP 2: Set all configuration parameters.
987
+ *
988
+ * Parameter:
989
+ * @ *svt_enc_component Encoder handler.
990
+ * @ *pComponentParameterStructure Encoder and buffer configurations will be copied to the library. */
991
+ EB_API EbErrorType svt_av1_enc_set_parameter(
992
+ EbComponentType *svt_enc_component,
993
+ EbSvtAv1EncConfiguration
994
+ *pComponentParameterStructure); // pComponentParameterStructure contents will be copied to the library
995
+
996
+ /* OPTIONAL: Set a single configuration parameter.
997
+ *
998
+ * Parameter:
999
+ * @ *pComponentParameterStructure Encoder parameters structure.
1000
+ * @ *name Null terminated string containing the parameter name
1001
+ * @ *value Null terminated string containing the parameter value */
1002
+ EB_API EbErrorType svt_av1_enc_parse_parameter(EbSvtAv1EncConfiguration *pComponentParameterStructure, const char *name,
1003
+ const char *value);
1004
+
1005
+ /* STEP 3: Initialize encoder and allocates memory to necessary buffers.
1006
+ *
1007
+ * Parameter:
1008
+ * @ *svt_enc_component Encoder handler. */
1009
+ EB_API EbErrorType svt_av1_enc_init(EbComponentType *svt_enc_component);
1010
+
1011
+ /* OPTIONAL: Get stream headers at init time.
1012
+ *
1013
+ * Parameter:
1014
+ * @ *svt_enc_component Encoder handler.
1015
+ * @ **output_stream_ptr Output buffer. */
1016
+ EB_API EbErrorType svt_av1_enc_stream_header(EbComponentType *svt_enc_component,
1017
+ EbBufferHeaderType **output_stream_ptr);
1018
+
1019
+ /* OPTIONAL: Release stream headers at init time.
1020
+ *
1021
+ * Parameter:
1022
+ * @ *stream_header_ptr stream header buffer. */
1023
+ EB_API EbErrorType svt_av1_enc_stream_header_release(EbBufferHeaderType *stream_header_ptr);
1024
+
1025
+ /* STEP 4: Send the picture.
1026
+ *
1027
+ * Parameter:
1028
+ * @ *svt_enc_component Encoder handler.
1029
+ * @ *p_buffer Header pointer, picture buffer. */
1030
+ EB_API EbErrorType svt_av1_enc_send_picture(EbComponentType *svt_enc_component, EbBufferHeaderType *p_buffer);
1031
+
1032
+ /**
1033
+ * @brief Step 5: Receive packet.
1034
+ * This function will become blocking if either pic_send_done is set to 1 or if we are in low-delay (pred-struct=1).
1035
+ * Otherwise, this function is non-blocking and will return EB_NoErrorEmptyQueue if there are no packets available.
1036
+ *
1037
+ * @param svt_enc_component The encoder handler
1038
+ * @param p_buffer Header pointer to return packet with
1039
+ * @param pic_send_done Flag to signal that all input pictures have been sent. Should be either 0 or 1.
1040
+ * @return EB_API Either EB_ErrorMax for an encode error or EB_NoErrorEmptyQueue if there are no available packets.
1041
+ */
1042
+ EB_API EbErrorType svt_av1_enc_get_packet(EbComponentType *svt_enc_component, EbBufferHeaderType **p_buffer,
1043
+ uint8_t pic_send_done);
1044
+
1045
+ /* STEP 5-1: Release output buffer back into the pool.
1046
+ *
1047
+ * Parameter:
1048
+ * @ **p_buffer Header pointer that contains the output packet to be released. */
1049
+ EB_API void svt_av1_enc_release_out_buffer(EbBufferHeaderType **p_buffer);
1050
+
1051
+ /* OPTIONAL: Fill buffer with reconstructed picture.
1052
+ *
1053
+ * Parameter:
1054
+ * @ *svt_enc_component Encoder handler.
1055
+ * @ *p_buffer Output buffer. */
1056
+ EB_API EbErrorType svt_av1_get_recon(EbComponentType *svt_enc_component, EbBufferHeaderType *p_buffer);
1057
+
1058
+ /* OPTIONAL: get stream information
1059
+ *
1060
+ * Parameter:
1061
+ * @ *svt_enc_component Encoder handler.
1062
+ * @ *stream_info_id SVT_AV1_STREAM_INFO_ID.
1063
+ * @ *info output, the type depends on id */
1064
+ EB_API EbErrorType svt_av1_enc_get_stream_info(EbComponentType *svt_enc_component, uint32_t stream_info_id, void *info);
1065
+
1066
+ /* STEP 6: Deinitialize encoder library.
1067
+ *
1068
+ * Parameter:
1069
+ * @ *svt_enc_component Encoder handler. */
1070
+ EB_API EbErrorType svt_av1_enc_deinit(EbComponentType *svt_enc_component);
1071
+
1072
+ /* STEP 7: Deconstruct encoder handler.
1073
+ *
1074
+ * Parameter:
1075
+ * @ *svt_enc_component Encoder handler. */
1076
+ EB_API EbErrorType svt_av1_enc_deinit_handle(EbComponentType *svt_enc_component);
1077
+
1078
+ #ifdef __cplusplus
1079
+ }
1080
+ #endif // __cplusplus
1081
+
1082
+ #endif // EbSvtAv1Enc_h