@revizly/sharp-libvips-dev 1.0.35 → 1.0.36

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.
@@ -22,15 +22,43 @@
22
22
 
23
23
  // clang-format off
24
24
 
25
+ #ifndef RTC_BUILD
26
+ #define RTC_BUILD 0
27
+ #endif
28
+
25
29
  #if RTC_BUILD
26
30
  #define CONFIG_LOG_QUIET 1
27
31
 
32
+ #define CONFIG_ARM_NEON_IS_GUARANTEED 1
33
+ #define CONFIG_X86_AVX2_IS_GUARANTEED 0
34
+
28
35
  #define CONFIG_ENABLE_QUANT_MATRIX 0
29
36
  #define CONFIG_ENABLE_OBMC 0
30
37
  #define CONFIG_ENABLE_FILM_GRAIN 0
31
38
  #define CONFIG_ENABLE_HIGH_BIT_DEPTH 0
32
39
  #endif
33
40
 
41
+
42
+ // When set to 1, EB_CPU_FLAGS_NEON is unconditionally set for all ARCH_AARCH64
43
+ // builds, i.e. requiring Neon for library to work. This also allows linker to
44
+ // strip code for all C functions which are optimized with Neon SIMD and thus
45
+ // reduce final binary size.
46
+ // Neon is mandatory in Armv8.0-A (AArch64), which is our minimum Arm target,
47
+ // so it is guaranteed for deployment builds, however tests use C functions,
48
+ // and hence for development builds this must stay at 0.
49
+ #ifndef CONFIG_ARM_NEON_IS_GUARANTEED
50
+ #define CONFIG_ARM_NEON_IS_GUARANTEED 0
51
+ #endif
52
+
53
+ // Same for x86 builds and AVX2 as minimum required SIMD level.
54
+ // AVX2 was first released in 2013 on Haswell microarchitecture, all x86
55
+ // processors since support it.
56
+ // You can set it to 1 to reduce binary size if deployment platforms are
57
+ // guaranteed to be not older than Haswell.
58
+ #ifndef CONFIG_X86_AVX2_IS_GUARANTEED
59
+ #define CONFIG_X86_AVX2_IS_GUARANTEED 0
60
+ #endif
61
+
34
62
  #ifndef CONFIG_LOG_QUIET
35
63
  #define CONFIG_LOG_QUIET 0
36
64
  #endif
@@ -34,9 +34,7 @@
34
34
  extern "C" {
35
35
  #endif // __cplusplus
36
36
 
37
- #define FIX_TUNE_SSIM 1 // Fix SSIM mode
38
37
  //FOR DEBUGGING - Do not remove
39
- #define OPT_LD_LATENCY2 1 // Latency optimization for low delay - to keep the Macro for backwards testing until 3.0
40
38
  #define LOG_ENC_DONE 0 // log encoder job one
41
39
  #define DEBUG_TPL 0 // Prints to debug TPL
42
40
  #define DETAILED_FRAME_OUTPUT 0 // Prints detailed frame output from the library for debugging
@@ -50,9 +48,11 @@ extern "C" {
50
48
  #define RC_NO_R2R 0 // This is a debugging flag for RC and makes encoder to run with no R2R in RC mode
51
49
  // Note that the speed might impacted significantly
52
50
  #if !RC_NO_R2R
53
- #define FTR_KF_ON_FLY_SAMPLE 0 // Sample code to signal KF
54
- #define FTR_RES_ON_FLY_SAMPLE 0 // Sample functions to change the resolution on the fly
55
- #define FTR_RATE_ON_FLY_SAMPLE 0 // Sample functions to change bit rate
51
+ #define FTR_KF_ON_FLY_SAMPLE 0 // Sample code to signal KF
52
+ #define FTR_RES_ON_FLY_SAMPLE 0 // Sample functions to change the resolution on the fly
53
+ #define FTR_RATE_ON_FLY_SAMPLE 0 // Sample functions to change bit rate
54
+ #define FTR_FRAME_RATE_ON_FLY_SAMPLE 0 // Sample functions to change frame rate
55
+ #define FTR_PER_FRAME_QUALITY_SAMPLE 0 // Sample functions to compute PSNR per frame
56
56
  #endif
57
57
  // Super-resolution debugging code
58
58
  #define DEBUG_SCALING 0
@@ -64,11 +64,17 @@ extern "C" {
64
64
  // Switch frame debugging code
65
65
  #define DEBUG_SFRAME 0
66
66
 
67
- // Variance boost debugging code
67
+ // Variance Boost debugging code
68
68
  #define DEBUG_VAR_BOOST 0
69
69
  #define DEBUG_VAR_BOOST_QP 0
70
70
  #define DEBUG_VAR_BOOST_STATS 0
71
71
 
72
+ // Anti-alias aware screen content mode debugging code
73
+ #define DEBUG_AA_SCM 0
74
+
75
+ // QP scaling debugging code
76
+ #define DEBUG_QP_SCALING 0
77
+
72
78
  // Quantization matrices
73
79
  #define DEBUG_QM_LEVEL 0
74
80
  #define DEBUG_STARTUP_MG_SIZE 0
@@ -25,9 +25,9 @@ extern "C" {
25
25
  struct SvtMetadataArray;
26
26
 
27
27
  // API Version
28
- #define SVT_AV1_VERSION_MAJOR 3
28
+ #define SVT_AV1_VERSION_MAJOR 4
29
29
  #define SVT_AV1_VERSION_MINOR 1
30
- #define SVT_AV1_VERSION_PATCHLEVEL 2
30
+ #define SVT_AV1_VERSION_PATCHLEVEL 0
31
31
 
32
32
  #define SVT_AV1_CHECK_VERSION(major, minor, patch) \
33
33
  (SVT_AV1_VERSION_MAJOR > (major) || (SVT_AV1_VERSION_MAJOR == (major) && SVT_AV1_VERSION_MINOR > (minor)) || \
@@ -82,13 +82,13 @@ typedef struct EbBufferHeaderType {
82
82
  uint32_t size;
83
83
 
84
84
  // picture (input or output) buffer
85
- uint8_t *p_buffer;
85
+ uint8_t* p_buffer;
86
86
  uint32_t n_filled_len;
87
87
  uint32_t n_alloc_len;
88
88
 
89
89
  // pic private data
90
- void *p_app_private;
91
- void *wrapper_ptr;
90
+ void* p_app_private;
91
+ void* wrapper_ptr;
92
92
 
93
93
  // pic timing param
94
94
  uint32_t n_tick_count;
@@ -110,13 +110,13 @@ typedef struct EbBufferHeaderType {
110
110
  double cr_ssim;
111
111
  double cb_ssim;
112
112
 
113
- struct SvtMetadataArray *metadata;
113
+ struct SvtMetadataArray* metadata;
114
114
  } EbBufferHeaderType;
115
115
 
116
116
  typedef struct EbComponentType {
117
117
  uint32_t size;
118
- void *p_component_private;
119
- void *p_application_private;
118
+ void* p_component_private;
119
+ void* p_application_private;
120
120
  } EbComponentType;
121
121
 
122
122
  typedef enum EbErrorType {
@@ -150,9 +150,9 @@ typedef enum EbAv1SeqProfile { MAIN_PROFILE = 0, HIGH_PROFILE = 1, PROFESSIONAL_
150
150
  typedef struct EbSvtIOFormat //former EbSvtEncInput
151
151
  {
152
152
  // Hosts 8 bit or 16 bit input YUV420p / YUV420p10le
153
- uint8_t *luma;
154
- uint8_t *cb;
155
- uint8_t *cr;
153
+ uint8_t* luma;
154
+ uint8_t* cb;
155
+ uint8_t* cr;
156
156
  uint32_t y_stride;
157
157
  uint32_t cr_stride;
158
158
  uint32_t cb_stride;
@@ -231,29 +231,6 @@ typedef struct EbColorConfig {
231
231
  bool separate_uv_delta_q;
232
232
  } EbColorConfig;
233
233
 
234
- typedef struct EbTimingInfo {
235
- /*!< Timing info present flag */
236
- bool timing_info_present;
237
-
238
- /*!< Number of time units of a clock operating at the frequency time_scale
239
- * Hz that corresponds to one increment of a clock tick counter*/
240
- uint32_t num_units_in_display_tick;
241
-
242
- /*!< Number of time units that pass in one second*/
243
- uint32_t time_scale;
244
-
245
- /*!< Equal to 1 indicates that pictures should be displayed according to
246
- * their output order with the number of ticks between two consecutive
247
- * pictures specified by num_ticks_per_picture.*/
248
- uint8_t equal_picture_interval;
249
-
250
- /*!< Specifies the number of clock ticks corresponding to output time
251
- * between two consecutive pictures in the output order.
252
- * Range - [0 to (1 << 32) - 2]*/
253
- uint32_t num_ticks_per_picture;
254
-
255
- } EbTimingInfo;
256
-
257
234
  // structure to be allocated at the sample application and passed to the library
258
235
  // on a per picture basis through the p_app_private field in the EbBufferHeaderType structure
259
236
  // this structure and the data inside would be casted, validated, then copied at the
@@ -264,33 +241,39 @@ typedef enum {
264
241
  REF_FRAME_SCALING_EVENT, // reference frame scaling data per picture
265
242
  ROI_MAP_EVENT, // ROI map data per picture
266
243
  RES_CHANGE_EVENT, // resolution change data per picture (KF only)
267
- RATE_CHANGE_EVENT, // Rate change data per picture (KF only)
244
+ RATE_CHANGE_EVENT, // Rate change data per picture
245
+ FRAME_RATE_CHANGE_EVENT, // Frame rate change data per picture
246
+ COMPUTE_QUALITY_EVENT, // Compute quality per frame
268
247
  PRIVATE_DATA_TYPES // end of private data types
269
248
  } PrivDataType;
249
+
270
250
  typedef struct EbPrivDataNode {
271
251
  PrivDataType node_type;
272
- void *data; // pointer to data structure e.g. EbRefFrameScale or AomFilmGrain
252
+ void* data; // pointer to data structure e.g. EbRefFrameScale or AomFilmGrain
273
253
  uint32_t size; // size of data being sent for the library to know how much to copy
274
- struct EbPrivDataNode *next; // pointer to the next node, NULL if done.
254
+ struct EbPrivDataNode* next; // pointer to the next node, NULL if done.
275
255
  } EbPrivDataNode;
256
+
276
257
  typedef struct EbRefFrameScale {
277
258
  uint8_t scale_mode; // scaling mode, support for RESIZE_NONE, RESIZE_FIXED and RESIZE_RANDOM
278
259
  uint32_t scale_denom; // scaling denominator for non-key frame, from 8~16
279
260
  uint32_t scale_kf_denom; // scaling denominator for key frame, from 8~16
280
261
  } EbRefFrameScale;
262
+
281
263
  typedef struct SvtAv1RoiMapEvt {
282
264
  uint64_t start_picture_number;
283
- uint8_t *b64_seg_map;
265
+ uint8_t* b64_seg_map;
284
266
  int16_t seg_qp[8]; // 8: MAX_SEGMENTS
285
267
  int8_t max_seg_id;
286
- struct SvtAv1RoiMapEvt *next;
268
+ struct SvtAv1RoiMapEvt* next;
287
269
  } SvtAv1RoiMapEvt;
270
+
288
271
  typedef struct SvtAv1RoiMap {
289
272
  uint32_t evt_num;
290
- SvtAv1RoiMapEvt *evt_list;
291
- SvtAv1RoiMapEvt *cur_evt;
292
- int16_t *qp_map;
293
- char *buf;
273
+ SvtAv1RoiMapEvt* evt_list;
274
+ SvtAv1RoiMapEvt* cur_evt;
275
+ int16_t* qp_map;
276
+ char* buf;
294
277
  } SvtAv1RoiMap;
295
278
 
296
279
  typedef struct SvtAv1InputPicDef {
@@ -299,12 +282,24 @@ typedef struct SvtAv1InputPicDef {
299
282
  uint16_t input_pad_bottom;
300
283
  uint16_t input_pad_right;
301
284
  } SvtAv1InputPicDef;
285
+
302
286
  typedef struct SvtAv1RateInfo {
303
287
  // Sequence QP used in CRF/CQP algorithm. Over writes the sequence QP.
304
288
  uint32_t seq_qp;
305
289
  uint32_t target_bit_rate;
306
290
  } SvtAv1RateInfo;
307
291
 
292
+ typedef struct SvtAv1FrameRateInfo {
293
+ // Sequence frame rate which over writes the sequence frame rate.
294
+ uint32_t frame_rate_numerator;
295
+ uint32_t frame_rate_denominator;
296
+ } SvtAv1FrameRateInfo;
297
+
298
+ typedef struct SvtAv1ComputeQualityInfo {
299
+ bool compute_psnr;
300
+ bool compute_ssim;
301
+ } SvtAv1ComputeQualityInfo;
302
+
308
303
  /*!\brief Structure containing film grain synthesis parameters for a frame
309
304
  *
310
305
  * This structure contains input parameters for film grain synthesis
@@ -402,11 +397,6 @@ typedef uint64_t EbCpuFlags;
402
397
  #define EB_CPU_FLAGS_AVX512F (1 << 9)
403
398
  #define EB_CPU_FLAGS_AVX512CD (1 << 10)
404
399
  #define EB_CPU_FLAGS_AVX512DQ (1 << 11)
405
- #if !SVT_AV1_CHECK_VERSION(4, 0, 0)
406
- // Deprecated as they were never used.
407
- #define EB_CPU_FLAGS_AVX512ER (1 << 12)
408
- #define EB_CPU_FLAGS_AVX512PF (1 << 13)
409
- #endif
410
400
  #define EB_CPU_FLAGS_AVX512BW (1 << 14)
411
401
  #define EB_CPU_FLAGS_AVX512VL (1 << 15)
412
402
  // AVX512 extensions supported on Icelake and later (Zen 4 and later on AMD)
@@ -424,6 +414,8 @@ typedef uint64_t EbCpuFlags;
424
414
  #define EB_CPU_FLAGS_SVE (1 << 4)
425
415
  // Armv9.0-A SVE2 instructions.
426
416
  #define EB_CPU_FLAGS_SVE2 (1 << 5)
417
+ // sad_loop_kernel has special code for this core.
418
+ #define EB_CPU_FLAGS_NEOVERSE_V2 (1 << 6)
427
419
 
428
420
  #endif
429
421
  #define EB_CPU_FLAGS_INVALID (1ULL << (sizeof(EbCpuFlags) * 8ULL - 1ULL))
@@ -19,6 +19,7 @@ extern "C" {
19
19
  #include <stdint.h>
20
20
  #include "EbSvtAv1.h"
21
21
  #include <stdlib.h>
22
+ #include <stdarg.h>
22
23
  #include <stdio.h>
23
24
  #include <stdbool.h>
24
25
  /**
@@ -100,17 +101,6 @@ struct EbSvtAv1MasteringDisplayInfo {
100
101
  uint32_t min_luma;
101
102
  };
102
103
 
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
104
  // super-res modes
115
105
  typedef enum {
116
106
  SUPERRES_NONE, // No frame superres allowed.
@@ -139,6 +129,10 @@ typedef enum {
139
129
  RESIZE_MODES
140
130
  } RESIZE_MODE;
141
131
 
132
+ /* Indicates what prediction structure to use
133
+ */
134
+ typedef enum PredStructure { ALL_INTRA, LOW_DELAY, RANDOM_ACCESS, PRED_TOTAL_COUNT, PRED_INVALID = 0xFF } PredStructure;
135
+
142
136
  /** The SvtAv1IntraRefreshType is used to describe the intra refresh type.
143
137
  */
144
138
  typedef enum SvtAv1IntraRefreshType {
@@ -158,7 +152,7 @@ typedef enum {
158
152
  * This structure is able to hold a reference to any fixed size buffer.
159
153
  */
160
154
  typedef struct SvtAv1FixedBuf {
161
- void *buf; /**< Pointer to the data. Does NOT own the data! */
155
+ void* buf; /**< Pointer to the data. Does NOT own the data! */
162
156
  uint64_t sz; /**< Length of the buffer, in chars */
163
157
  } SvtAv1FixedBuf; /**< alias for struct aom_fixed_buf */
164
158
 
@@ -169,23 +163,14 @@ typedef enum EbSFrameMode {
169
163
  1, /**< The considered frame will be made into an S-Frame only if it is a base layer inter frame */
170
164
  SFRAME_NEAREST_BASE =
171
165
  2, /**< If the considered frame is not an altref frame, the next base layer inter frame will be made into an S-Frame */
166
+ SFRAME_FLEXIBLE_BASE =
167
+ 3, /**< If the considered frame is not an altref frame, modify the miniGOP layers to make the considered frame as an altref frame, then it will be made into an S-Frame */
168
+ SFRAME_DEC_POSI_BASE =
169
+ 4, /**< If the considered frame in decode order is not an altref frame, modify the mini-GOP structure to promote its previous frame to an altref frame, and set the next altref to an S-Frame */
172
170
  } EbSFrameMode;
173
171
 
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
172
  /* Indicates what rate control mode is used.
188
- * Currently, cqp is distinguised by setting enable_adaptive_quantization to 0
173
+ * Currently, cqp is distinguised by setting aq_mode to 0
189
174
  */
190
175
  typedef enum SvtAv1RcMode {
191
176
  SVT_AV1_RC_MODE_CQP_OR_CRF = 0, // constant quantization parameter/constant rate factor
@@ -206,11 +191,19 @@ typedef enum SvtAv1FrameUpdateType {
206
191
 
207
192
  typedef struct SvtAv1FrameScaleEvts {
208
193
  uint32_t evt_num;
209
- uint64_t *start_frame_nums;
210
- uint32_t *resize_kf_denoms;
211
- uint32_t *resize_denoms;
194
+ uint64_t* start_frame_nums;
195
+ uint32_t* resize_kf_denoms;
196
+ uint32_t* resize_denoms;
212
197
  } SvtAv1FrameScaleEvts;
213
198
 
199
+ typedef struct SvtAv1SFramePositions {
200
+ uint32_t sframe_num;
201
+ uint64_t* sframe_posis;
202
+ uint32_t sframe_qp_num;
203
+ uint8_t* sframe_qps;
204
+ int8_t* sframe_qp_offsets;
205
+ } SvtAv1SFramePositions;
206
+
214
207
  // Will contain the EbEncApi which will live in the EncHandle class
215
208
  // Only modifiable during config-time.
216
209
  typedef struct EbSvtAv1EncConfiguration {
@@ -267,7 +260,7 @@ typedef struct EbSvtAv1EncConfiguration {
267
260
  * Refer to PredStructure enum for valid values.
268
261
  *
269
262
  * Default is RANDOM_ACCESS. */
270
- uint8_t pred_structure;
263
+ PredStructure pred_structure;
271
264
 
272
265
  // Input Info
273
266
 
@@ -560,9 +553,12 @@ typedef struct EbSvtAv1EncConfiguration {
560
553
  /**
561
554
  * @brief Deblocking loop filter control
562
555
  *
563
- * Default is true.
556
+ * 0: disabled
557
+ * 1: enabled
558
+ * 2: more accurate (slower)
564
559
  */
565
- bool enable_dlf_flag;
560
+ uint8_t enable_dlf_flag;
561
+
566
562
  /* Film grain denoising the input picture
567
563
  * Flag to enable the denoising
568
564
  *
@@ -615,12 +611,6 @@ typedef struct EbSvtAv1EncConfiguration {
615
611
  * Default depends on rate control mode.*/
616
612
  uint32_t look_ahead_distance;
617
613
 
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
614
  /* recode_loop indicates the recode levels,
625
615
  * DISALLOW_RECODE = 0, No recode.
626
616
  * ALLOW_RECODE_KFMAXBW = 1, Allow recode for KF and exceeding maximum frame bandwidth.
@@ -637,11 +627,13 @@ typedef struct EbSvtAv1EncConfiguration {
637
627
  * Default is 0. */
638
628
  uint32_t screen_content_mode;
639
629
 
640
- /* Enable adaptive quantization within a frame using segmentation.
630
+ /* Adaptive quantization used within a frame.
641
631
  *
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;
632
+ * For rc_mode 0, setting this to:
633
+ * 0: use CQP mode
634
+ * 1: variance-based segmentation
635
+ * 2: CRF (per-frame QPs and per-SB delta-QPs derived using TPL) */
636
+ uint8_t aq_mode;
645
637
 
646
638
  /**
647
639
  * @brief Enable use of ALT-REF (temporally filtered) frames.
@@ -653,7 +645,7 @@ typedef struct EbSvtAv1EncConfiguration {
653
645
 
654
646
  bool enable_overlays;
655
647
  /**
656
- * @brief Tune for a particular metric; 0: VQ, 1: PSNR, 2: SSIM.
648
+ * @brief Tune for a particular metric; 0: VQ, 1: PSNR, 2: SSIM, 3: IQ (Image Quality), 4: MS-SSIM.
657
649
  *
658
650
  * Default is 1.
659
651
  */
@@ -681,31 +673,13 @@ typedef struct EbSvtAv1EncConfiguration {
681
673
  * values are from EbSFrameMode
682
674
  * SFRAME_STRICT_ARF: the considered frame will be made into an S-Frame only if it is an altref frame
683
675
  * SFRAME_NEAREST_ARF: if the considered frame is not an altref frame, the next altref frame will be made into an S-Frame
676
+ * SFRAME_FLEXIBLE_ARF: if the considered frame is not an altref frame, modify the mini-GOP structure to promote it to an altref frame
677
+ * SFRAME_DEC_POSI: if the considered frame in decode order is not an altref frame, modify the mini-GOP structure to promote its previous frame to an altref frame, and set the next altref to an S-Frame
684
678
  */
685
679
  EbSFrameMode sframe_mode;
686
680
 
687
681
  // End of individual tuning flags
688
682
 
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
683
  // Threads management
710
684
 
711
685
  /* The level of parallelism refers to how much parallelization the encoder will perform
@@ -716,22 +690,6 @@ typedef struct EbSvtAv1EncConfiguration {
716
690
  */
717
691
  uint32_t level_of_parallelism;
718
692
 
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
693
  /* CPU FLAGS to limit assembly instruction set used by encoder.
736
694
  * Default is EB_CPU_FLAGS_ALL. */
737
695
  EbCpuFlags use_cpu_flags;
@@ -875,14 +833,14 @@ typedef struct EbSvtAv1EncConfiguration {
875
833
  uint8_t tf_strength;
876
834
 
877
835
  /* Stores the optional film grain synthesis info */
878
- AomFilmGrain *fgs_table;
836
+ AomFilmGrain* fgs_table;
879
837
 
880
838
  /* New parameters can go in under this line. Also deduct the size of the parameter */
881
839
  /* from the padding array */
882
840
 
883
- /* Variance boost
884
- * false = disable variance boost
885
- * true = enable variance boost
841
+ /* Variance Boost
842
+ * false = disable Variance Boost
843
+ * true = enable Variance Boost
886
844
  * Default is false. */
887
845
  bool enable_variance_boost;
888
846
  /* @brief Selects the curve strength to boost low variance regions according to a fast-growing formula
@@ -894,7 +852,7 @@ typedef struct EbSvtAv1EncConfiguration {
894
852
  * 1: 1st octile
895
853
  * 4: 4th octile
896
854
  * 8: 8th octile
897
- * Default is 6 */
855
+ * Default is 5 */
898
856
  uint8_t variance_octile;
899
857
 
900
858
  /* @brief Bias towards decreased/increased sharpness in the deblocking loop filter & during rate distortion
@@ -951,10 +909,66 @@ typedef struct EbSvtAv1EncConfiguration {
951
909
  * Default is false.
952
910
  */
953
911
  bool rtc;
912
+
913
+ /* @brief compresses the QP hierarchical layer scale to improve temporal video consistency
914
+ * 0: no compression, original SVT-AV1 scaling
915
+ * 1-3: enable compression, the higher the number the stronger the compression
916
+ * (different frame quality fluctuation/mean quality tradeoffs)
917
+ * Default is 1
918
+ */
919
+ uint8_t qp_scale_compress_strength;
920
+
921
+ /* @brief Indicates where to insert an S-Frame, only available when sframe_mode is SFRAME_FLEXIBLE_ARF */
922
+ SvtAv1SFramePositions sframe_posi;
923
+
924
+ /* @brief Indicates QP of S-Frame(s) */
925
+ uint8_t sframe_qp;
926
+ /* @brief Indicates QP offset of S-Frame(s) */
927
+ int8_t sframe_qp_offset;
928
+
929
+ /**
930
+ * @brief Toggle default film grain blocksize behavior
931
+ * 0: use default blocksize behavior (32x32)
932
+ * 1: use adaptive blocksize based on resolution
933
+ * - 8x8 for <4k
934
+ * - 16x16 for 4k
935
+ * Default is 1
936
+ */
937
+ bool adaptive_film_grain;
938
+
939
+ /* @brief Limit transform sizes to the specified size
940
+ * 32: use transform sizes up to 32x32 pixels
941
+ * 64: use transform sizes up to 64x64 pixels
942
+ * Default is 64
943
+ * Note: Setting the max transform size to 32 can be useful under some circumstances (e.g. still image coding),
944
+ * as it's the largest transform where all coefficients can be coded into the bitstream.
945
+ * In AV1, the transform size of 64 drops the highest 32 AC coefficients by design, effectively zeroing them upon
946
+ * decoding, which can cause certain visual features to look blurry.
947
+ * Forcing smaller tx sizes (i.e. 16, 8, 4) doesn't hold an inherent visual quality advantage over 32, so those
948
+ * aren't exposed as options.
949
+ */
950
+ uint8_t max_tx_size;
951
+
952
+ /* @brief qindex offset for extended CRF support
953
+ * Value is internally determined by CRF parameter value, each quarter-step increment to the CRF adds 1 to the
954
+ * offset, with a maximum of 3 (i.e. three quarter-step increments) for fractional CRFs below 63, and up to
955
+ * 28 for the extended CRF range (63.25 to 70)
956
+ * Default is 0 if CRF is an integer
957
+ */
958
+ uint8_t extended_crf_qindex_offset;
959
+
960
+ /**
961
+ * @brief Strength of the internal RD metric to bias toward high-frequency error (helps with texture preservation and film grain retention)
962
+ * 0.00: disable AC bias
963
+ * 1.00: enable AC bias with a strength of 1.00
964
+ * Default is 0.00.
965
+ */
966
+ double ac_bias;
967
+
954
968
  // 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)
969
+ /* Add 128 Byte Padding to Struct to avoid changing the size of the public configuration struct */
970
+ uint8_t padding[128
971
+ - sizeof(PredStructure) + sizeof (uint8_t) // pred_strucutre type was changed from uint8_t to PredStructure
958
972
  ];
959
973
  // clang-format on
960
974
  } EbSvtAv1EncConfiguration;
@@ -963,7 +977,7 @@ typedef struct EbSvtAv1EncConfiguration {
963
977
  * Returns a string containing "v$tag-$commit_count-g$hash${dirty:+-dirty}"
964
978
  * @param[out] SVT_AV1_CVS_VERSION
965
979
  */
966
- EB_API const char *svt_av1_get_version(void);
980
+ EB_API const char* svt_av1_get_version(void);
967
981
 
968
982
  /**
969
983
  * Prints the version header and build information to the file
@@ -971,6 +985,47 @@ EB_API const char *svt_av1_get_version(void);
971
985
  */
972
986
  EB_API void svt_av1_print_version(void);
973
987
 
988
+ /**
989
+ * @brief Log levels
990
+ *
991
+ * Defines the severity levels for logging messages.
992
+ */
993
+ typedef enum {
994
+ SVT_AV1_LOG_ALL = -1, /**< Log all messages */
995
+ SVT_AV1_LOG_FATAL = 0, /**< Fatal errors */
996
+ SVT_AV1_LOG_ERROR = 1, /**< Errors */
997
+ SVT_AV1_LOG_WARN = 2, /**< Warnings */
998
+ SVT_AV1_LOG_INFO = 3, /**< Informational messages */
999
+ SVT_AV1_LOG_DEBUG = 4, /**< Debug messages */
1000
+ } SvtAv1LogLevel;
1001
+
1002
+ /**
1003
+ * @brief Log callback function signature
1004
+ *
1005
+ * Applications can register a callback to intercept log messages from the encoder.
1006
+ *
1007
+ * @param[in] level Severity level of the log message
1008
+ * @param[in] context Opaque user-provided context pointer (may be NULL)
1009
+ * @param[in] tag Optional log tag (may be NULL)
1010
+ * @param[in] fmt printf-style format string
1011
+ * @param[in] args Variable argument list corresponding to the format string
1012
+ */
1013
+ typedef void (*SvtAv1LogCallback)(void* context, SvtAv1LogLevel level, const char* tag, const char* fmt, va_list args);
1014
+
1015
+ /**
1016
+ * Register a callback for intercepting log messages.
1017
+ *
1018
+ * Applications can use this function to redirect log output to custom handlers. When a callback is registered, all log
1019
+ * messages will be dispatched to the callback instead of the default stderr/file output. This will affect all
1020
+ * instances and is a global setting. This should be called before svt_av1_enc_init_handle() as any calls to
1021
+ * svt_av1_enc_init_handle() will finalize logging.
1022
+ *
1023
+ * @param[in] callback Callback function pointer. Has no effect if NULL.
1024
+ * @param[in] context Opaque context pointer passed back to the callback. Typically application state or logging context.
1025
+ * Ignored if callback is NULL.
1026
+ */
1027
+ EB_API void svt_av1_set_log_callback(SvtAv1LogCallback callback, void* context);
1028
+
974
1029
  /* STEP 1: Call the library to construct a Component Handle.
975
1030
  *
976
1031
  * Parameter:
@@ -980,8 +1035,8 @@ EB_API void svt_av1_print_version(void);
980
1035
  * @ *config_ptr Pointer passed back to the client during callbacks, it will be
981
1036
  * loaded with default params from the library. */
982
1037
  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
1038
+ EbComponentType** p_handle,
1039
+ EbSvtAv1EncConfiguration* config_ptr); // config_ptr will be loaded with default params from the library
985
1040
 
986
1041
  /* STEP 2: Set all configuration parameters.
987
1042
  *
@@ -989,9 +1044,9 @@ EB_API EbErrorType svt_av1_enc_init_handle(
989
1044
  * @ *svt_enc_component Encoder handler.
990
1045
  * @ *pComponentParameterStructure Encoder and buffer configurations will be copied to the library. */
991
1046
  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
1047
+ EbComponentType* svt_enc_component,
1048
+ EbSvtAv1EncConfiguration*
1049
+ pComponentParameterStructure); // pComponentParameterStructure contents will be copied to the library
995
1050
 
996
1051
  /* OPTIONAL: Set a single configuration parameter.
997
1052
  *
@@ -999,35 +1054,35 @@ EB_API EbErrorType svt_av1_enc_set_parameter(
999
1054
  * @ *pComponentParameterStructure Encoder parameters structure.
1000
1055
  * @ *name Null terminated string containing the parameter name
1001
1056
  * @ *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);
1057
+ EB_API EbErrorType svt_av1_enc_parse_parameter(EbSvtAv1EncConfiguration* pComponentParameterStructure, const char* name,
1058
+ const char* value);
1004
1059
 
1005
1060
  /* STEP 3: Initialize encoder and allocates memory to necessary buffers.
1006
1061
  *
1007
1062
  * Parameter:
1008
1063
  * @ *svt_enc_component Encoder handler. */
1009
- EB_API EbErrorType svt_av1_enc_init(EbComponentType *svt_enc_component);
1064
+ EB_API EbErrorType svt_av1_enc_init(EbComponentType* svt_enc_component);
1010
1065
 
1011
1066
  /* OPTIONAL: Get stream headers at init time.
1012
1067
  *
1013
1068
  * Parameter:
1014
1069
  * @ *svt_enc_component Encoder handler.
1015
1070
  * @ **output_stream_ptr Output buffer. */
1016
- EB_API EbErrorType svt_av1_enc_stream_header(EbComponentType *svt_enc_component,
1017
- EbBufferHeaderType **output_stream_ptr);
1071
+ EB_API EbErrorType svt_av1_enc_stream_header(EbComponentType* svt_enc_component,
1072
+ EbBufferHeaderType** output_stream_ptr);
1018
1073
 
1019
1074
  /* OPTIONAL: Release stream headers at init time.
1020
1075
  *
1021
1076
  * Parameter:
1022
1077
  * @ *stream_header_ptr stream header buffer. */
1023
- EB_API EbErrorType svt_av1_enc_stream_header_release(EbBufferHeaderType *stream_header_ptr);
1078
+ EB_API EbErrorType svt_av1_enc_stream_header_release(EbBufferHeaderType* stream_header_ptr);
1024
1079
 
1025
1080
  /* STEP 4: Send the picture.
1026
1081
  *
1027
1082
  * Parameter:
1028
1083
  * @ *svt_enc_component Encoder handler.
1029
1084
  * @ *p_buffer Header pointer, picture buffer. */
1030
- EB_API EbErrorType svt_av1_enc_send_picture(EbComponentType *svt_enc_component, EbBufferHeaderType *p_buffer);
1085
+ EB_API EbErrorType svt_av1_enc_send_picture(EbComponentType* svt_enc_component, EbBufferHeaderType* p_buffer);
1031
1086
 
1032
1087
  /**
1033
1088
  * @brief Step 5: Receive packet.
@@ -1039,21 +1094,21 @@ EB_API EbErrorType svt_av1_enc_send_picture(EbComponentType *svt_enc_component,
1039
1094
  * @param pic_send_done Flag to signal that all input pictures have been sent. Should be either 0 or 1.
1040
1095
  * @return EB_API Either EB_ErrorMax for an encode error or EB_NoErrorEmptyQueue if there are no available packets.
1041
1096
  */
1042
- EB_API EbErrorType svt_av1_enc_get_packet(EbComponentType *svt_enc_component, EbBufferHeaderType **p_buffer,
1097
+ EB_API EbErrorType svt_av1_enc_get_packet(EbComponentType* svt_enc_component, EbBufferHeaderType** p_buffer,
1043
1098
  uint8_t pic_send_done);
1044
1099
 
1045
1100
  /* STEP 5-1: Release output buffer back into the pool.
1046
1101
  *
1047
1102
  * Parameter:
1048
1103
  * @ **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);
1104
+ EB_API void svt_av1_enc_release_out_buffer(EbBufferHeaderType** p_buffer);
1050
1105
 
1051
1106
  /* OPTIONAL: Fill buffer with reconstructed picture.
1052
1107
  *
1053
1108
  * Parameter:
1054
1109
  * @ *svt_enc_component Encoder handler.
1055
1110
  * @ *p_buffer Output buffer. */
1056
- EB_API EbErrorType svt_av1_get_recon(EbComponentType *svt_enc_component, EbBufferHeaderType *p_buffer);
1111
+ EB_API EbErrorType svt_av1_get_recon(EbComponentType* svt_enc_component, EbBufferHeaderType* p_buffer);
1057
1112
 
1058
1113
  /* OPTIONAL: get stream information
1059
1114
  *
@@ -1061,19 +1116,19 @@ EB_API EbErrorType svt_av1_get_recon(EbComponentType *svt_enc_component, EbBuffe
1061
1116
  * @ *svt_enc_component Encoder handler.
1062
1117
  * @ *stream_info_id SVT_AV1_STREAM_INFO_ID.
1063
1118
  * @ *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);
1119
+ EB_API EbErrorType svt_av1_enc_get_stream_info(EbComponentType* svt_enc_component, uint32_t stream_info_id, void* info);
1065
1120
 
1066
1121
  /* STEP 6: Deinitialize encoder library.
1067
1122
  *
1068
1123
  * Parameter:
1069
1124
  * @ *svt_enc_component Encoder handler. */
1070
- EB_API EbErrorType svt_av1_enc_deinit(EbComponentType *svt_enc_component);
1125
+ EB_API EbErrorType svt_av1_enc_deinit(EbComponentType* svt_enc_component);
1071
1126
 
1072
1127
  /* STEP 7: Deconstruct encoder handler.
1073
1128
  *
1074
1129
  * Parameter:
1075
1130
  * @ *svt_enc_component Encoder handler. */
1076
- EB_API EbErrorType svt_av1_enc_deinit_handle(EbComponentType *svt_enc_component);
1131
+ EB_API EbErrorType svt_av1_enc_deinit_handle(EbComponentType* svt_enc_component);
1077
1132
 
1078
1133
  #ifdef __cplusplus
1079
1134
  }
@@ -16,21 +16,15 @@
16
16
  extern "C" {
17
17
  #endif // __cplusplus
18
18
 
19
- #define CHECK_REPORT_ERROR(cond, app_callback_ptr, errorCode) \
20
- { \
21
- if (!(cond)) { \
22
- (app_callback_ptr)->error_handler(((app_callback_ptr)->handle), (errorCode)); \
23
- while (1) \
24
- ; \
25
- } \
19
+ #define CHECK_REPORT_ERROR(cond, app_callback_ptr, errorCode) \
20
+ if (!(cond)) { \
21
+ (app_callback_ptr)->error_handler(((app_callback_ptr)->handle), (errorCode)); \
22
+ while (1) {} \
26
23
  }
27
- #define CHECK_REPORT_ERROR_NC(app_callback_ptr, errorCode) \
28
- { \
29
- { \
30
- (app_callback_ptr)->error_handler(((app_callback_ptr)->handle), (errorCode)); \
31
- while (1) \
32
- ; \
33
- } \
24
+ #define CHECK_REPORT_ERROR_NC(app_callback_ptr, errorCode) \
25
+ { \
26
+ (app_callback_ptr)->error_handler(((app_callback_ptr)->handle), (errorCode)); \
27
+ while (1) {} \
34
28
  }
35
29
 
36
30
  typedef enum ENCODER_ERROR_CODES {
@@ -102,7 +102,6 @@ typedef enum EbBitDepth {
102
102
  EB_EIGHT_BIT = 8,
103
103
  EB_TEN_BIT = 10,
104
104
  EB_TWELVE_BIT = 12,
105
- EB_FOURTEEN_BIT = 14, // Not supported
106
105
  EB_SIXTEEN_BIT = 16, // Not supported
107
106
  EB_THIRTYTWO_BIT = 32, // Not supported
108
107
  } EbBitDepth;
@@ -36,14 +36,14 @@ typedef enum EbAv1MetadataType {
36
36
  /*!\brief Metadata payload. */
37
37
  typedef struct SvtMetadata {
38
38
  uint32_t type; /**< Metadata type */
39
- uint8_t *payload; /**< Metadata payload data */
39
+ uint8_t* payload; /**< Metadata payload data */
40
40
  size_t sz; /**< Metadata payload size */
41
41
  } SvtMetadataT;
42
42
 
43
43
  /*!\brief Array of aom_metadata structs for an image. */
44
44
  typedef struct SvtMetadataArray {
45
45
  size_t sz; /* Number of metadata structs in the list */
46
- SvtMetadataT **metadata_array; /* Array of metadata structs */
46
+ SvtMetadataT** metadata_array; /* Array of metadata structs */
47
47
  } SvtMetadataArrayT;
48
48
 
49
49
  /*!\brief Frame size struct in metadata. */
@@ -70,7 +70,7 @@ typedef struct SvtMetadataFrameSize {
70
70
  * \return Returns the newly allocated SvtMetadataT struct. If data is NULL,
71
71
  * sz is 0, or memory allocation fails, it returns NULL.
72
72
  */
73
- EB_API SvtMetadataT *svt_metadata_alloc(const uint32_t type, const uint8_t *data, const size_t sz);
73
+ EB_API SvtMetadataT* svt_metadata_alloc(const uint32_t type, const uint8_t* data, const size_t sz);
74
74
 
75
75
  /*!\brief Free metadata struct.
76
76
  *
@@ -78,7 +78,7 @@ EB_API SvtMetadataT *svt_metadata_alloc(const uint32_t type, const uint8_t *data
78
78
  *
79
79
  * \param[in] ptr Metadata struct pointer
80
80
  */
81
- EB_API void svt_metadata_free(void *ptr);
81
+ EB_API void svt_metadata_free(void* ptr);
82
82
 
83
83
  /*!\brief Alloc memory for SvtMetadataArrayT struct.
84
84
  *
@@ -89,7 +89,7 @@ EB_API void svt_metadata_free(void *ptr);
89
89
  *
90
90
  * \param[in] sz Size of internal metadata list buffer
91
91
  */
92
- EB_API SvtMetadataArrayT *svt_metadata_array_alloc(const size_t sz);
92
+ EB_API SvtMetadataArrayT* svt_metadata_array_alloc(const size_t sz);
93
93
 
94
94
  /*!\brief Free metadata array struct.
95
95
  *
@@ -97,7 +97,7 @@ EB_API SvtMetadataArrayT *svt_metadata_array_alloc(const size_t sz);
97
97
  *
98
98
  * \param[in] arr Metadata array struct pointer
99
99
  */
100
- EB_API void svt_metadata_array_free(void *arr);
100
+ EB_API void svt_metadata_array_free(void* arr);
101
101
 
102
102
  /*!\brief Add metadata to image.
103
103
  *
@@ -113,7 +113,7 @@ EB_API void svt_metadata_array_free(void *arr);
113
113
  * \return Returns 0 on success. If buffer or data is NULL, sz is 0, or memory
114
114
  * allocation fails, it returns -1.
115
115
  */
116
- EB_API int svt_add_metadata(struct EbBufferHeaderType *buffer, const uint32_t type, const uint8_t *data,
116
+ EB_API int svt_add_metadata(struct EbBufferHeaderType* buffer, const uint32_t type, const uint8_t* data,
117
117
  const size_t sz);
118
118
 
119
119
  /*!\brief Return metadata size.
@@ -123,7 +123,7 @@ EB_API int svt_add_metadata(struct EbBufferHeaderType *buffer, const uint32_t ty
123
123
  * \param[in] metadata Metadata array struct pointer
124
124
  * \param[in] type Metadata type descriptor
125
125
  */
126
- EB_API size_t svt_metadata_size(SvtMetadataArrayT *metadata, const EbAv1MetadataType type);
126
+ EB_API size_t svt_metadata_size(SvtMetadataArrayT* metadata, const EbAv1MetadataType type);
127
127
 
128
128
  /*!\brief Parse string into EbSvtAv1MasteringDisplayInfo struct.
129
129
  *
@@ -135,7 +135,7 @@ EB_API size_t svt_metadata_size(SvtMetadataArrayT *metadata, const EbAv1Metadata
135
135
  *
136
136
  * \return Returns 1 on success. 0 on failure.
137
137
  */
138
- EB_API int svt_aom_parse_mastering_display(struct EbSvtAv1MasteringDisplayInfo *mdi, const char *md_str);
138
+ EB_API int svt_aom_parse_mastering_display(struct EbSvtAv1MasteringDisplayInfo* mdi, const char* md_str);
139
139
 
140
140
  /*!\brief Parse string into EbContentLightLevel struct.
141
141
  *
@@ -147,7 +147,7 @@ EB_API int svt_aom_parse_mastering_display(struct EbSvtAv1MasteringDisplayInfo *
147
147
  *
148
148
  * \return Returns 1 on success. 0 on failure.
149
149
  */
150
- EB_API int svt_aom_parse_content_light_level(struct EbContentLightLevel *cll, const char *cll_str);
150
+ EB_API int svt_aom_parse_content_light_level(struct EbContentLightLevel* cll, const char* cll_str);
151
151
 
152
152
  #ifdef __cplusplus
153
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revizly/sharp-libvips-dev",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "Header files and C++ sources for libvips and dependencies required when compiling sharp from source",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://sharp.pixelplumbing.com",