@revizly/sharp-libvips-dev 1.0.34 → 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.
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright(c) 2025 Meta Platforms, Inc. and affiliates.
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 https://www.aomedia.org/license/software-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
+ /*
13
+ * This file contains configuration macros that control which parts of code are used
14
+ * Macros could be fed via command line, so all macros here must check if they are
15
+ * already defined!
16
+ * All macros must have the following format:
17
+ * - all macros must be prefixed with CONFIG_
18
+ */
19
+
20
+ #ifndef EbConfigMacros_h
21
+ #define EbConfigMacros_h
22
+
23
+ // clang-format off
24
+
25
+ #ifndef RTC_BUILD
26
+ #define RTC_BUILD 0
27
+ #endif
28
+
29
+ #if RTC_BUILD
30
+ #define CONFIG_LOG_QUIET 1
31
+
32
+ #define CONFIG_ARM_NEON_IS_GUARANTEED 1
33
+ #define CONFIG_X86_AVX2_IS_GUARANTEED 0
34
+
35
+ #define CONFIG_ENABLE_QUANT_MATRIX 0
36
+ #define CONFIG_ENABLE_OBMC 0
37
+ #define CONFIG_ENABLE_FILM_GRAIN 0
38
+ #define CONFIG_ENABLE_HIGH_BIT_DEPTH 0
39
+ #endif
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
+
62
+ #ifndef CONFIG_LOG_QUIET
63
+ #define CONFIG_LOG_QUIET 0
64
+ #endif
65
+
66
+ #ifndef CONFIG_ENABLE_QUANT_MATRIX
67
+ #define CONFIG_ENABLE_QUANT_MATRIX 1
68
+ #endif
69
+
70
+ #ifndef CONFIG_ENABLE_OBMC
71
+ #define CONFIG_ENABLE_OBMC 1
72
+ #endif
73
+
74
+ #ifndef CONFIG_ENABLE_FILM_GRAIN
75
+ #define CONFIG_ENABLE_FILM_GRAIN 1
76
+ #endif
77
+
78
+ #ifndef CONFIG_ENABLE_HIGH_BIT_DEPTH
79
+ #define CONFIG_ENABLE_HIGH_BIT_DEPTH 1
80
+ #endif
81
+
82
+ // clang-format on
83
+
84
+ #endif // EbConfigMacros_h
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Copyright(c) 2020 Intel Corporation
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 https://www.aomedia.org/license/software-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
+ /*
13
+ * This file contains only debug macros that are used during the development
14
+ * and are supposed to be cleaned up every tag cycle
15
+ * all macros must have the following format:
16
+ * - adding a new feature should be prefixed by FTR_
17
+ * - tuning a feature should be prefixed by TUNE_
18
+ * - enabling a feature should be prefixed by EN_
19
+ * - disabling a feature should be prefixed by DIS_
20
+ * - bug fixes should be prefixed by FIX_
21
+ * - code refactors should be prefixed by RFCTR_
22
+ * - code cleanups should be prefixed by CLN_
23
+ * - optimizations should be prefixed by OPT_
24
+ * - all macros must have a coherent comment explaining what the MACRO is doing
25
+ * - #if 0 / #if 1 are not to be used
26
+ */
27
+
28
+ #ifndef EbDebugMacros_h
29
+ #define EbDebugMacros_h
30
+
31
+ // clang-format off
32
+
33
+ #ifdef __cplusplus
34
+ extern "C" {
35
+ #endif // __cplusplus
36
+
37
+ //FOR DEBUGGING - Do not remove
38
+ #define LOG_ENC_DONE 0 // log encoder job one
39
+ #define DEBUG_TPL 0 // Prints to debug TPL
40
+ #define DETAILED_FRAME_OUTPUT 0 // Prints detailed frame output from the library for debugging
41
+ #define DEBUG_BUFFERS 0 // Print process count and segments info
42
+ #define TUNE_CHROMA_SSIM 0 // Allows for Chroma and SSIM BDR-based Tuning
43
+ #define TUNE_CQP_CHROMA_SSIM 0 // Tune CQP qp scaling towards improved chroma and SSIM BDR
44
+
45
+ #define MIN_PIC_PARALLELIZATION 0 // Use the minimum amount of picture parallelization
46
+ #define SRM_REPORT 0 // Report SRM status
47
+ #define LAD_MG_PRINT 0 // Report LAD
48
+ #define RC_NO_R2R 0 // This is a debugging flag for RC and makes encoder to run with no R2R in RC mode
49
+ // Note that the speed might impacted significantly
50
+ #if !RC_NO_R2R
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
+ #endif
57
+ // Super-resolution debugging code
58
+ #define DEBUG_SCALING 0
59
+ #define DEBUG_TF 0
60
+ #define DEBUG_SUPERRES_RECODE 0
61
+ #define DEBUG_SUPERRES_ENERGY 0
62
+ #define DEBUG_RC_CAP_LOG 0 // Prints for RC cap
63
+
64
+ // Switch frame debugging code
65
+ #define DEBUG_SFRAME 0
66
+
67
+ // Variance Boost debugging code
68
+ #define DEBUG_VAR_BOOST 0
69
+ #define DEBUG_VAR_BOOST_QP 0
70
+ #define DEBUG_VAR_BOOST_STATS 0
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
+
78
+ // Quantization matrices
79
+ #define DEBUG_QM_LEVEL 0
80
+ #define DEBUG_STARTUP_MG_SIZE 0
81
+ #define DEBUG_SEGMENT_QP 0
82
+ #define DEBUG_ROI 0
83
+ #ifdef __cplusplus
84
+ }
85
+ #endif // __cplusplus
86
+
87
+ // clang-format on
88
+
89
+ #endif // EbDebugMacros_h
@@ -0,0 +1,428 @@
1
+ /*
2
+ * Copyright(c) 2019 Intel Corporation
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 https://www.aomedia.org/license/software-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 EbSvtAv1_h
13
+ #define EbSvtAv1_h
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif // __cplusplus
18
+
19
+ #include <stdbool.h>
20
+ #include <stdint.h>
21
+ #include "EbSvtAv1Formats.h"
22
+ #include "EbConfigMacros.h"
23
+ #include "EbDebugMacros.h"
24
+
25
+ struct SvtMetadataArray;
26
+
27
+ // API Version
28
+ #define SVT_AV1_VERSION_MAJOR 4
29
+ #define SVT_AV1_VERSION_MINOR 1
30
+ #define SVT_AV1_VERSION_PATCHLEVEL 0
31
+
32
+ #define SVT_AV1_CHECK_VERSION(major, minor, patch) \
33
+ (SVT_AV1_VERSION_MAJOR > (major) || (SVT_AV1_VERSION_MAJOR == (major) && SVT_AV1_VERSION_MINOR > (minor)) || \
34
+ (SVT_AV1_VERSION_MAJOR == (major) && SVT_AV1_VERSION_MINOR == (minor) && SVT_AV1_VERSION_PATCHLEVEL >= (patch)))
35
+
36
+ #if defined(_WIN32)
37
+ #define EB_HELPER_EXPORT __declspec(dllexport)
38
+ #define EB_HELPER_IMPORT __declspec(dllimport)
39
+ #elif defined(__GNUC__) && __GNUC__ >= 4
40
+ #define EB_HELPER_EXPORT __attribute__((visibility("default")))
41
+ #define EB_HELPER_IMPORT
42
+ #else
43
+ #define EB_HELPER_EXPORT
44
+ #define EB_HELPER_IMPORT
45
+ #endif
46
+
47
+ #if defined(EB_DLL)
48
+ #if defined(EB_BUILDING_SHARED_LIBS)
49
+ #define EB_API EB_HELPER_EXPORT
50
+ #else
51
+ #define EB_API EB_HELPER_IMPORT
52
+ #endif // if defined(EB_BUILDING_SHARED_LIBS)
53
+ #else
54
+ #define EB_API
55
+ #endif //if defined(EB_DLL)
56
+
57
+ #define EB_MAX_NUM_OPERATING_POINTS 32
58
+
59
+ #define MAX_TEMPORAL_LAYERS 6
60
+
61
+ #define EB_MAX_TEMPORAL_LAYERS MAX_TEMPORAL_LAYERS
62
+
63
+ /********************************
64
+ * Defines
65
+ ********************************/
66
+ #define EB_PICTURE uint32_t
67
+
68
+ typedef enum EbAv1PictureType {
69
+ EB_AV1_INTER_PICTURE = 0,
70
+ EB_AV1_ALT_REF_PICTURE = 1,
71
+ EB_AV1_INTRA_ONLY_PICTURE = 2,
72
+ EB_AV1_KEY_PICTURE = 3,
73
+ EB_AV1_NON_REF_PICTURE = 4,
74
+ EB_AV1_SHOW_EXISTING_PICTURE = 6,
75
+ EB_AV1_FW_KEY_PICTURE = 5,
76
+ EB_AV1_SWITCH_PICTURE = 7,
77
+ EB_AV1_INVALID_PICTURE = 0xFF
78
+ } EbAv1PictureType;
79
+
80
+ typedef struct EbBufferHeaderType {
81
+ // EbBufferHeaderType size
82
+ uint32_t size;
83
+
84
+ // picture (input or output) buffer
85
+ uint8_t* p_buffer;
86
+ uint32_t n_filled_len;
87
+ uint32_t n_alloc_len;
88
+
89
+ // pic private data
90
+ void* p_app_private;
91
+ void* wrapper_ptr;
92
+
93
+ // pic timing param
94
+ uint32_t n_tick_count;
95
+ int64_t dts;
96
+ int64_t pts;
97
+
98
+ // pic info
99
+ uint8_t temporal_layer_index;
100
+ uint32_t qp;
101
+ uint32_t avg_qp;
102
+ EbAv1PictureType pic_type;
103
+ uint64_t luma_sse;
104
+ uint64_t cr_sse;
105
+ uint64_t cb_sse;
106
+ // pic flags
107
+ uint32_t flags;
108
+
109
+ double luma_ssim;
110
+ double cr_ssim;
111
+ double cb_ssim;
112
+
113
+ struct SvtMetadataArray* metadata;
114
+ } EbBufferHeaderType;
115
+
116
+ typedef struct EbComponentType {
117
+ uint32_t size;
118
+ void* p_component_private;
119
+ void* p_application_private;
120
+ } EbComponentType;
121
+
122
+ typedef enum EbErrorType {
123
+ EB_ErrorNone = 0,
124
+ EB_DecUnsupportedBitstream = (int32_t)0x40001000,
125
+ EB_DecNoOutputPicture = (int32_t)0x40001004,
126
+ EB_DecDecodingError = (int32_t)0x40001008,
127
+ EB_Corrupt_Frame = (int32_t)0x4000100C,
128
+ EB_ErrorInsufficientResources = (int32_t)0x80001000,
129
+ EB_ErrorUndefined = (int32_t)0x80001001,
130
+ EB_ErrorInvalidComponent = (int32_t)0x80001004,
131
+ EB_ErrorBadParameter = (int32_t)0x80001005,
132
+ EB_ErrorDestroyThreadFailed = (int32_t)0x80002012,
133
+ EB_ErrorSemaphoreUnresponsive = (int32_t)0x80002021,
134
+ EB_ErrorDestroySemaphoreFailed = (int32_t)0x80002022,
135
+ EB_ErrorCreateMutexFailed = (int32_t)0x80002030,
136
+ EB_ErrorMutexUnresponsive = (int32_t)0x80002031,
137
+ EB_ErrorDestroyMutexFailed = (int32_t)0x80002032,
138
+ EB_NoErrorEmptyQueue = (int32_t)0x80002033,
139
+ EB_NoErrorFifoShutdown = (int32_t)0x80002034,
140
+ EB_ErrorMax = 0x7FFFFFFF
141
+ } EbErrorType;
142
+
143
+ /* AV1 bistream profile (seq_profile syntax element) */
144
+ typedef enum EbAv1SeqProfile { MAIN_PROFILE = 0, HIGH_PROFILE = 1, PROFESSIONAL_PROFILE = 2 } EbAv1SeqProfile;
145
+
146
+ // For 8-bit and 10-bit packed inputs and outputs, the luma, cb, and cr fields should be used
147
+ // for the three input picture planes. However, for 10-bit unpacked planes the
148
+ // lumaExt, cbExt, and crExt fields should be used hold the extra 2-bits of
149
+ // precision while the luma, cb, and cr fields hold the 8-bit data.
150
+ typedef struct EbSvtIOFormat //former EbSvtEncInput
151
+ {
152
+ // Hosts 8 bit or 16 bit input YUV420p / YUV420p10le
153
+ uint8_t* luma;
154
+ uint8_t* cb;
155
+ uint8_t* cr;
156
+ uint32_t y_stride;
157
+ uint32_t cr_stride;
158
+ uint32_t cb_stride;
159
+ } EbSvtIOFormat;
160
+
161
+ typedef struct EbOperatingParametersInfo {
162
+ /*!<Specifies the time interval between the arrival of the first bit in the
163
+ * smoothing buffer and the subsequent removal of the data that belongs to
164
+ * the first coded frame for operating point*/
165
+ uint32_t decoder_buffer_delay;
166
+
167
+ /*!<Specifies, in combination with decoder_buffer_delay[op] syntax element,
168
+ * the first bit arrival time of frames to be decoded to the smoothing
169
+ * buffer */
170
+ uint32_t encoder_buffer_delay;
171
+
172
+ /*!< Equal to 1 indicates that the smoothing buffer operates in low-delay
173
+ * mode for operating point*/
174
+ uint8_t low_delay_mode_flag;
175
+
176
+ } EbOperatingParametersInfo;
177
+
178
+ typedef struct EbAV1OperatingPoint {
179
+ uint32_t op_idc;
180
+ uint32_t seq_level_idx;
181
+ uint32_t seq_tier;
182
+
183
+ /*!< 1 -> Indicates that there is a decoder model associated with operating
184
+ point,
185
+ * 0 -> Indicates that there is not a decoder model associated with
186
+ operating point*/
187
+ uint8_t decoder_model_present_for_this_op;
188
+
189
+ /*!< Operating Parameters Information structure*/
190
+ EbOperatingParametersInfo operating_parameters_info;
191
+
192
+ uint32_t initial_display_delay_present_for_this_op;
193
+ uint32_t initial_display_delay;
194
+
195
+ } EbAv1OperatingPoint;
196
+
197
+ typedef struct EbColorConfig {
198
+ /*!< bit depth */
199
+ EbBitDepth bit_depth;
200
+
201
+ /*!< 1: Indicates that the video does not contain U and V color planes.
202
+ * 0: Indicates that the video contains Y, U, and V color planes. */
203
+ bool mono_chrome;
204
+ /*!< Specify the chroma subsampling format */
205
+ uint8_t subsampling_x;
206
+
207
+ /*!< Specify the chroma subsampling format */
208
+ uint8_t subsampling_y;
209
+ /*!< An integer that is defined by the "Color primaries" section of
210
+ * ISO/IEC 23091-4/ITU-T H.273 */
211
+ EbColorPrimaries color_primaries;
212
+
213
+ /*!< An integer that is defined by the "Transfer characteristics" section
214
+ * of ISO/IEC 23091-4/ITU-T H.273 */
215
+ EbTransferCharacteristics transfer_characteristics;
216
+
217
+ /*!< An integer that is defined by the "Matrix coefficients" section of
218
+ * ISO/IEC 23091-4/ITU-T H.273 */
219
+ EbMatrixCoefficients matrix_coefficients;
220
+
221
+ /*!< 0: shall be referred to as the studio swing representation
222
+ * 1: shall be referred to as the full swing representation */
223
+ EbColorRange color_range;
224
+
225
+ /*!< Specifies the sample position for subsampled streams */
226
+ EbChromaSamplePosition chroma_sample_position;
227
+
228
+ /*!< 1: Indicates that the U and V planes may have separate delta quantizer
229
+ * 0: Indicates that the U and V planes will share the same delta
230
+ quantizer value */
231
+ bool separate_uv_delta_q;
232
+ } EbColorConfig;
233
+
234
+ // structure to be allocated at the sample application and passed to the library
235
+ // on a per picture basis through the p_app_private field in the EbBufferHeaderType structure
236
+ // this structure and the data inside would be casted, validated, then copied at the
237
+ // svt_av1_enc_send_picture API call
238
+ typedef enum {
239
+ PRIVATE_DATA, // data to be passed through and written to the bitstream
240
+ //FILM_GRAIN_PARAM, // passing film grain parameters per picture
241
+ REF_FRAME_SCALING_EVENT, // reference frame scaling data per picture
242
+ ROI_MAP_EVENT, // ROI map data per picture
243
+ RES_CHANGE_EVENT, // resolution 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
247
+ PRIVATE_DATA_TYPES // end of private data types
248
+ } PrivDataType;
249
+
250
+ typedef struct EbPrivDataNode {
251
+ PrivDataType node_type;
252
+ void* data; // pointer to data structure e.g. EbRefFrameScale or AomFilmGrain
253
+ uint32_t size; // size of data being sent for the library to know how much to copy
254
+ struct EbPrivDataNode* next; // pointer to the next node, NULL if done.
255
+ } EbPrivDataNode;
256
+
257
+ typedef struct EbRefFrameScale {
258
+ uint8_t scale_mode; // scaling mode, support for RESIZE_NONE, RESIZE_FIXED and RESIZE_RANDOM
259
+ uint32_t scale_denom; // scaling denominator for non-key frame, from 8~16
260
+ uint32_t scale_kf_denom; // scaling denominator for key frame, from 8~16
261
+ } EbRefFrameScale;
262
+
263
+ typedef struct SvtAv1RoiMapEvt {
264
+ uint64_t start_picture_number;
265
+ uint8_t* b64_seg_map;
266
+ int16_t seg_qp[8]; // 8: MAX_SEGMENTS
267
+ int8_t max_seg_id;
268
+ struct SvtAv1RoiMapEvt* next;
269
+ } SvtAv1RoiMapEvt;
270
+
271
+ typedef struct SvtAv1RoiMap {
272
+ uint32_t evt_num;
273
+ SvtAv1RoiMapEvt* evt_list;
274
+ SvtAv1RoiMapEvt* cur_evt;
275
+ int16_t* qp_map;
276
+ char* buf;
277
+ } SvtAv1RoiMap;
278
+
279
+ typedef struct SvtAv1InputPicDef {
280
+ uint16_t input_luma_width; // input luma width aligned to 8, this is used during encoding
281
+ uint16_t input_luma_height; // input luma height aligned to 8, this is used during encoding
282
+ uint16_t input_pad_bottom;
283
+ uint16_t input_pad_right;
284
+ } SvtAv1InputPicDef;
285
+
286
+ typedef struct SvtAv1RateInfo {
287
+ // Sequence QP used in CRF/CQP algorithm. Over writes the sequence QP.
288
+ uint32_t seq_qp;
289
+ uint32_t target_bit_rate;
290
+ } SvtAv1RateInfo;
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
+
303
+ /*!\brief Structure containing film grain synthesis parameters for a frame
304
+ *
305
+ * This structure contains input parameters for film grain synthesis
306
+ */
307
+ typedef struct {
308
+ // Whether the decoder should apply film grain
309
+ int32_t apply_grain;
310
+
311
+ // Whether the decoder should update the film grain parameters from previous frame
312
+ int32_t update_parameters;
313
+
314
+ // 8 bit values indicating grain scaling points for the luma plane
315
+ int32_t scaling_points_y[14][2];
316
+ int32_t num_y_points; // value: 0..14
317
+
318
+ // 8 bit values indicating grain scaling points for the blue chroma plane
319
+ int32_t scaling_points_cb[10][2];
320
+ int32_t num_cb_points; // value: 0..10
321
+
322
+ // 8 bit values indicating grain scaling points for the red chroma plane
323
+ int32_t scaling_points_cr[10][2];
324
+ int32_t num_cr_points; // value: 0..10
325
+
326
+ // A value by which to shift scaling points, typically 8
327
+ int32_t scaling_shift; // values : 8..11
328
+
329
+ // Number of auto-regressive coefficients
330
+ int32_t ar_coeff_lag; // values: 0..3
331
+
332
+ // 8 bit values representing auto-regressive coefficients for each plane
333
+ int32_t ar_coeffs_y[24];
334
+ int32_t ar_coeffs_cb[25];
335
+ int32_t ar_coeffs_cr[25];
336
+
337
+ // Shift value: AR coeffs range
338
+ // 6: [-2, 2)
339
+ // 7: [-1, 1)
340
+ // 8: [-0.5, 0.5)
341
+ // 9: [-0.25, 0.25)
342
+ int32_t ar_coeff_shift; // values : 6..9
343
+
344
+ // A multiplier for the cb component used in derivation of the
345
+ // input index to the cb component scaling function.
346
+ int32_t cb_mult; // 8 bits
347
+ // A multiplier for the average luma component used in derivation of the input index to the cb
348
+ // component scaling function.
349
+ int32_t cb_luma_mult; // 8 bits
350
+ // An offset used in derivation of the input index to the cb component scaling function.
351
+ int32_t cb_offset; // 9 bits
352
+
353
+ // A multiplier for the cr component used in derivation of the
354
+ // input index to the cr component scaling function.
355
+ int32_t cr_mult; // 8 bits
356
+ // A multiplier for the average luma component used in derivation of the input index to the cr
357
+ // component scaling function.
358
+ int32_t cr_luma_mult; // 8 bits
359
+ // An offset used in derivation of the input index to the cr component scaling function.
360
+ int32_t cr_offset; // 9 bits
361
+
362
+ // Whether overlap between film grain blocks should be applied
363
+ int32_t overlap_flag;
364
+
365
+ // Whether to clip to studio range after film grain is generated
366
+ int32_t clip_to_restricted_range;
367
+
368
+ int32_t bit_depth; // video bit depth
369
+
370
+ // Whether to apply film grain to chroma planes based on the luma plane
371
+ int32_t chroma_scaling_from_luma;
372
+
373
+ // Specifies how much the random numbers should be scaled down during grain synthesis
374
+ int32_t grain_scale_shift;
375
+
376
+ // A random seed for the decoder to use for grain generation
377
+ uint16_t random_seed;
378
+
379
+ // Whether the encoder should ignore the ref frame map when coding film grain
380
+ int32_t ignore_ref;
381
+ } AomFilmGrain;
382
+
383
+ /**
384
+ CPU FLAGS
385
+ */
386
+ typedef uint64_t EbCpuFlags;
387
+ #ifdef ARCH_X86_64
388
+ #define EB_CPU_FLAGS_MMX (1 << 0)
389
+ #define EB_CPU_FLAGS_SSE (1 << 1)
390
+ #define EB_CPU_FLAGS_SSE2 (1 << 2)
391
+ #define EB_CPU_FLAGS_SSE3 (1 << 3)
392
+ #define EB_CPU_FLAGS_SSSE3 (1 << 4)
393
+ #define EB_CPU_FLAGS_SSE4_1 (1 << 5)
394
+ #define EB_CPU_FLAGS_SSE4_2 (1 << 6)
395
+ #define EB_CPU_FLAGS_AVX (1 << 7)
396
+ #define EB_CPU_FLAGS_AVX2 (1 << 8)
397
+ #define EB_CPU_FLAGS_AVX512F (1 << 9)
398
+ #define EB_CPU_FLAGS_AVX512CD (1 << 10)
399
+ #define EB_CPU_FLAGS_AVX512DQ (1 << 11)
400
+ #define EB_CPU_FLAGS_AVX512BW (1 << 14)
401
+ #define EB_CPU_FLAGS_AVX512VL (1 << 15)
402
+ // AVX512 extensions supported on Icelake and later (Zen 4 and later on AMD)
403
+ #define EB_CPU_FLAGS_AVX512ICL (1 << 16)
404
+ #elif defined(ARCH_AARCH64)
405
+ // Armv8.0-A mandatory Neon instructions.
406
+ #define EB_CPU_FLAGS_NEON (1 << 0)
407
+ // Armv8.0-A optional CRC32 instructions, mandatory from Armv8.1-A.
408
+ #define EB_CPU_FLAGS_ARM_CRC32 (1 << 1)
409
+ // Armv8.2-A optional Neon dot-product instructions, mandatory from Armv8.4-A.
410
+ #define EB_CPU_FLAGS_NEON_DOTPROD (1 << 2)
411
+ // Armv8.2-A optional Neon i8mm instructions, mandatory from Armv8.6-A.
412
+ #define EB_CPU_FLAGS_NEON_I8MM (1 << 3)
413
+ // Armv8.2-A optional SVE instructions, mandatory from Armv9.0-A.
414
+ #define EB_CPU_FLAGS_SVE (1 << 4)
415
+ // Armv9.0-A SVE2 instructions.
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)
419
+
420
+ #endif
421
+ #define EB_CPU_FLAGS_INVALID (1ULL << (sizeof(EbCpuFlags) * 8ULL - 1ULL))
422
+ #define EB_CPU_FLAGS_ALL ((EB_CPU_FLAGS_INVALID >> 1) - 1)
423
+
424
+ #ifdef __cplusplus
425
+ }
426
+ #endif // __cplusplus
427
+
428
+ #endif // EbSvtAv1_h