paredeyes commited on
Commit
0440930
·
verified ·
1 Parent(s): 56dc64d

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. ffmpeg/include/libavutil/hwcontext_vulkan.h +382 -0
  2. ffmpeg/include/libavutil/iamf.h +694 -0
  3. ffmpeg/include/libavutil/imgutils.h +377 -0
  4. ffmpeg/include/libavutil/intfloat.h +77 -0
  5. ffmpeg/include/libavutil/intreadwrite.h +677 -0
  6. ffmpeg/include/libavutil/lfg.h +81 -0
  7. ffmpeg/include/libavutil/log.h +416 -0
  8. ffmpeg/include/libavutil/lzo.h +66 -0
  9. ffmpeg/include/libavutil/macros.h +80 -0
  10. ffmpeg/include/libavutil/mastering_display_metadata.h +137 -0
  11. ffmpeg/include/libavutil/spherical.h +243 -0
  12. ffmpeg/include/libavutil/stereo3d.h +325 -0
  13. ffmpeg/include/libavutil/tea.h +71 -0
  14. ffmpeg/include/libavutil/threadmessage.h +115 -0
  15. ffmpeg/include/libavutil/time.h +56 -0
  16. ffmpeg/include/libavutil/timecode.h +199 -0
  17. ffmpeg/include/libavutil/timestamp.h +85 -0
  18. ffmpeg/include/libavutil/tree.h +137 -0
  19. ffmpeg/include/libavutil/twofish.h +70 -0
  20. ffmpeg/include/libavutil/tx.h +210 -0
  21. ffmpeg/include/libavutil/uuid.h +146 -0
  22. ffmpeg/include/libavutil/version.h +126 -0
  23. ffmpeg/include/libavutil/video_enc_params.h +171 -0
  24. ffmpeg/include/libavutil/video_hint.h +107 -0
  25. ffmpeg/include/libavutil/xtea.h +94 -0
  26. ffmpeg/include/libpostproc/postprocess.h +107 -0
  27. ffmpeg/include/libpostproc/version.h +46 -0
  28. ffmpeg/include/libpostproc/version_major.h +31 -0
  29. ffmpeg/include/libswresample/swresample.h +587 -0
  30. ffmpeg/include/libswresample/version.h +46 -0
  31. ffmpeg/include/libswresample/version_major.h +31 -0
  32. ffmpeg/include/libswscale/swscale.h +683 -0
  33. ffmpeg/include/libswscale/version.h +44 -0
  34. ffmpeg/include/libswscale/version_major.h +35 -0
  35. ffmpeg/lib/pkgconfig/libavcodec.pc +13 -0
  36. ffmpeg/lib/pkgconfig/libavdevice.pc +13 -0
  37. ffmpeg/lib/pkgconfig/libavfilter.pc +13 -0
  38. ffmpeg/lib/pkgconfig/libavformat.pc +13 -0
  39. ffmpeg/lib/pkgconfig/libavutil.pc +13 -0
  40. ffmpeg/lib/pkgconfig/libpostproc.pc +13 -0
  41. ffmpeg/lib/pkgconfig/libswresample.pc +13 -0
  42. ffmpeg/lib/pkgconfig/libswscale.pc +13 -0
  43. mingw/bin/addr2line.exe +0 -0
  44. mingw/bin/ar.exe +0 -0
  45. mingw/bin/c++.exe +0 -0
  46. mingw/bin/c++filt.exe +0 -0
  47. mingw/bin/cpp.exe +0 -0
  48. mingw/bin/dllwrap.exe +0 -0
  49. mingw/bin/elfedit.exe +0 -0
  50. mingw/bin/g++.exe +0 -0
ffmpeg/include/libavutil/hwcontext_vulkan.h ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_HWCONTEXT_VULKAN_H
20
+ #define AVUTIL_HWCONTEXT_VULKAN_H
21
+
22
+ #if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
23
+ #define VK_USE_PLATFORM_WIN32_KHR
24
+ #endif
25
+ #include <vulkan/vulkan.h>
26
+
27
+ #include "pixfmt.h"
28
+ #include "frame.h"
29
+ #include "hwcontext.h"
30
+
31
+ typedef struct AVVkFrame AVVkFrame;
32
+
33
+ typedef struct AVVulkanDeviceQueueFamily {
34
+ /* Queue family index */
35
+ int idx;
36
+ /* Number of queues in the queue family in use */
37
+ int num;
38
+ /* Queue family capabilities. Must be non-zero.
39
+ * Flags may be removed to indicate the queue family may not be used
40
+ * for a given purpose. */
41
+ VkQueueFlagBits flags;
42
+ /* Vulkan implementations are allowed to list multiple video queues
43
+ * which differ in what they can encode or decode. */
44
+ VkVideoCodecOperationFlagBitsKHR video_caps;
45
+ } AVVulkanDeviceQueueFamily;
46
+
47
+ /**
48
+ * @file
49
+ * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
50
+ *
51
+ * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
52
+ * with the data pointer set to an AVVkFrame.
53
+ */
54
+
55
+ /**
56
+ * Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
57
+ * All of these can be set before init to change what the context uses
58
+ */
59
+ typedef struct AVVulkanDeviceContext {
60
+ /**
61
+ * Custom memory allocator, else NULL
62
+ */
63
+ const VkAllocationCallbacks *alloc;
64
+
65
+ /**
66
+ * Pointer to a vkGetInstanceProcAddr loading function.
67
+ * If unset, will dynamically load and use libvulkan.
68
+ */
69
+ PFN_vkGetInstanceProcAddr get_proc_addr;
70
+
71
+ /**
72
+ * Vulkan instance. Must be at least version 1.3.
73
+ */
74
+ VkInstance inst;
75
+
76
+ /**
77
+ * Physical device
78
+ */
79
+ VkPhysicalDevice phys_dev;
80
+
81
+ /**
82
+ * Active device
83
+ */
84
+ VkDevice act_dev;
85
+
86
+ /**
87
+ * This structure should be set to the set of features that present and enabled
88
+ * during device creation. When a device is created by FFmpeg, it will default to
89
+ * enabling all that are present of the shaderImageGatherExtended,
90
+ * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features.
91
+ */
92
+ VkPhysicalDeviceFeatures2 device_features;
93
+
94
+ /**
95
+ * Enabled instance extensions.
96
+ * If supplying your own device context, set this to an array of strings, with
97
+ * each entry containing the specified Vulkan extension string to enable.
98
+ * Duplicates are possible and accepted.
99
+ * If no extensions are enabled, set these fields to NULL, and 0 respectively.
100
+ */
101
+ const char * const *enabled_inst_extensions;
102
+ int nb_enabled_inst_extensions;
103
+
104
+ /**
105
+ * Enabled device extensions. By default, VK_KHR_external_memory_fd,
106
+ * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier,
107
+ * VK_KHR_external_semaphore_fd and VK_EXT_external_memory_host are enabled if found.
108
+ * If supplying your own device context, these fields takes the same format as
109
+ * the above fields, with the same conditions that duplicates are possible
110
+ * and accepted, and that NULL and 0 respectively means no extensions are enabled.
111
+ */
112
+ const char * const *enabled_dev_extensions;
113
+ int nb_enabled_dev_extensions;
114
+
115
+ #if FF_API_VULKAN_FIXED_QUEUES
116
+ /**
117
+ * Queue family index for graphics operations, and the number of queues
118
+ * enabled for it. If unavaiable, will be set to -1. Not required.
119
+ * av_hwdevice_create() will attempt to find a dedicated queue for each
120
+ * queue family, or pick the one with the least unrelated flags set.
121
+ * Queue indices here may overlap if a queue has to share capabilities.
122
+ */
123
+ attribute_deprecated
124
+ int queue_family_index;
125
+ attribute_deprecated
126
+ int nb_graphics_queues;
127
+
128
+ /**
129
+ * Queue family index for transfer operations and the number of queues
130
+ * enabled. Required.
131
+ */
132
+ attribute_deprecated
133
+ int queue_family_tx_index;
134
+ attribute_deprecated
135
+ int nb_tx_queues;
136
+
137
+ /**
138
+ * Queue family index for compute operations and the number of queues
139
+ * enabled. Required.
140
+ */
141
+ attribute_deprecated
142
+ int queue_family_comp_index;
143
+ attribute_deprecated
144
+ int nb_comp_queues;
145
+
146
+ /**
147
+ * Queue family index for video encode ops, and the amount of queues enabled.
148
+ * If the device doesn't support such, queue_family_encode_index will be -1.
149
+ * Not required.
150
+ */
151
+ attribute_deprecated
152
+ int queue_family_encode_index;
153
+ attribute_deprecated
154
+ int nb_encode_queues;
155
+
156
+ /**
157
+ * Queue family index for video decode ops, and the amount of queues enabled.
158
+ * If the device doesn't support such, queue_family_decode_index will be -1.
159
+ * Not required.
160
+ */
161
+ attribute_deprecated
162
+ int queue_family_decode_index;
163
+ attribute_deprecated
164
+ int nb_decode_queues;
165
+ #endif
166
+
167
+ /**
168
+ * Locks a queue, preventing other threads from submitting any command
169
+ * buffers to this queue.
170
+ * If set to NULL, will be set to lavu-internal functions that utilize a
171
+ * mutex.
172
+ */
173
+ void (*lock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
174
+
175
+ /**
176
+ * Similar to lock_queue(), unlocks a queue. Must only be called after locking.
177
+ */
178
+ void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index);
179
+
180
+ /**
181
+ * Queue families used. Must be preferentially ordered. List may contain
182
+ * duplicates.
183
+ *
184
+ * For compatibility reasons, all the enabled queue families listed above
185
+ * (queue_family_(tx/comp/encode/decode)_index) must also be included in
186
+ * this list until they're removed after deprecation.
187
+ */
188
+ AVVulkanDeviceQueueFamily qf[64];
189
+ int nb_qf;
190
+ } AVVulkanDeviceContext;
191
+
192
+ /**
193
+ * Defines the behaviour of frame allocation.
194
+ */
195
+ typedef enum AVVkFrameFlags {
196
+ /* Unless this flag is set, autodetected flags will be OR'd based on the
197
+ * device and tiling during av_hwframe_ctx_init(). */
198
+ AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
199
+
200
+ #if FF_API_VULKAN_CONTIGUOUS_MEMORY
201
+ /* DEPRECATED: does nothing. Replaced by multiplane images. */
202
+ AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1),
203
+ #endif
204
+
205
+ /* Disables multiplane images.
206
+ * This is required to export/import images from CUDA. */
207
+ AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE = (1ULL << 2),
208
+ } AVVkFrameFlags;
209
+
210
+ /**
211
+ * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
212
+ */
213
+ typedef struct AVVulkanFramesContext {
214
+ /**
215
+ * Controls the tiling of allocated frames.
216
+ * If left as VK_IMAGE_TILING_OPTIMAL (0), will use optimal tiling.
217
+ * Can be set to VK_IMAGE_TILING_LINEAR to force linear images,
218
+ * or VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT to force DMABUF-backed
219
+ * images.
220
+ * @note Imported frames from other APIs ignore this.
221
+ */
222
+ VkImageTiling tiling;
223
+
224
+ /**
225
+ * Defines extra usage of output frames. If non-zero, all flags MUST be
226
+ * supported by the VkFormat. Otherwise, will use supported flags amongst:
227
+ * - VK_IMAGE_USAGE_SAMPLED_BIT
228
+ * - VK_IMAGE_USAGE_STORAGE_BIT
229
+ * - VK_IMAGE_USAGE_TRANSFER_SRC_BIT
230
+ * - VK_IMAGE_USAGE_TRANSFER_DST_BIT
231
+ */
232
+ VkImageUsageFlagBits usage;
233
+
234
+ /**
235
+ * Extension data for image creation.
236
+ * If DRM tiling is used, a VkImageDrmFormatModifierListCreateInfoEXT structure
237
+ * can be added to specify the exact modifier to use.
238
+ *
239
+ * Additional structures may be added at av_hwframe_ctx_init() time,
240
+ * which will be freed automatically on uninit(), so users must only free
241
+ * any structures they've allocated themselves.
242
+ */
243
+ void *create_pnext;
244
+
245
+ /**
246
+ * Extension data for memory allocation. Must have as many entries as
247
+ * the number of planes of the sw_format.
248
+ * This will be chained to VkExportMemoryAllocateInfo, which is used
249
+ * to make all pool images exportable to other APIs if the necessary
250
+ * extensions are present in enabled_dev_extensions.
251
+ */
252
+ void *alloc_pnext[AV_NUM_DATA_POINTERS];
253
+
254
+ /**
255
+ * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set,
256
+ * autodetected flags will be OR'd based on the device and tiling during
257
+ * av_hwframe_ctx_init().
258
+ */
259
+ AVVkFrameFlags flags;
260
+
261
+ /**
262
+ * Flags to set during image creation. If unset, defaults to
263
+ * VK_IMAGE_CREATE_ALIAS_BIT.
264
+ */
265
+ VkImageCreateFlags img_flags;
266
+
267
+ /**
268
+ * Vulkan format for each image. MUST be compatible with the pixel format.
269
+ * If unset, will be automatically set.
270
+ * There are at most two compatible formats for a frame - a multiplane
271
+ * format, and a single-plane multi-image format.
272
+ */
273
+ VkFormat format[AV_NUM_DATA_POINTERS];
274
+
275
+ /**
276
+ * Number of layers each image will have.
277
+ */
278
+ int nb_layers;
279
+
280
+ /**
281
+ * Locks a frame, preventing other threads from changing frame properties.
282
+ * Users SHOULD only ever lock just before command submission in order
283
+ * to get accurate frame properties, and unlock immediately after command
284
+ * submission without waiting for it to finish.
285
+ *
286
+ * If unset, will be set to lavu-internal functions that utilize a mutex.
287
+ */
288
+ void (*lock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
289
+
290
+ /**
291
+ * Similar to lock_frame(), unlocks a frame. Must only be called after locking.
292
+ */
293
+ void (*unlock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf);
294
+ } AVVulkanFramesContext;
295
+
296
+ /*
297
+ * Frame structure.
298
+ *
299
+ * @note the size of this structure is not part of the ABI, to allocate
300
+ * you must use @av_vk_frame_alloc().
301
+ */
302
+ struct AVVkFrame {
303
+ /**
304
+ * Vulkan images to which the memory is bound to.
305
+ * May be one for multiplane formats, or multiple.
306
+ */
307
+ VkImage img[AV_NUM_DATA_POINTERS];
308
+
309
+ /**
310
+ * Tiling for the frame.
311
+ */
312
+ VkImageTiling tiling;
313
+
314
+ /**
315
+ * Memory backing the images. Either one, or as many as there are planes
316
+ * in the sw_format.
317
+ * In case of having multiple VkImages, but one memory, the offset field
318
+ * will indicate the bound offset for each image.
319
+ */
320
+ VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
321
+ size_t size[AV_NUM_DATA_POINTERS];
322
+
323
+ /**
324
+ * OR'd flags for all memory allocated
325
+ */
326
+ VkMemoryPropertyFlagBits flags;
327
+
328
+ /**
329
+ * Updated after every barrier. One per VkImage.
330
+ */
331
+ VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
332
+ VkImageLayout layout[AV_NUM_DATA_POINTERS];
333
+
334
+ /**
335
+ * Synchronization timeline semaphores, one for each VkImage.
336
+ * Must not be freed manually. Must be waited on at every submission using
337
+ * the value in sem_value, and must be signalled at every submission,
338
+ * using an incremented value.
339
+ */
340
+ VkSemaphore sem[AV_NUM_DATA_POINTERS];
341
+
342
+ /**
343
+ * Up to date semaphore value at which each image becomes accessible.
344
+ * One per VkImage.
345
+ * Clients must wait on this value when submitting a command queue,
346
+ * and increment it when signalling.
347
+ */
348
+ uint64_t sem_value[AV_NUM_DATA_POINTERS];
349
+
350
+ /**
351
+ * Internal data.
352
+ */
353
+ struct AVVkFrameInternal *internal;
354
+
355
+ /**
356
+ * Describes the binding offset of each image to the VkDeviceMemory.
357
+ * One per VkImage.
358
+ */
359
+ ptrdiff_t offset[AV_NUM_DATA_POINTERS];
360
+
361
+ /**
362
+ * Queue family of the images. Must be VK_QUEUE_FAMILY_IGNORED if
363
+ * the image was allocated with the CONCURRENT concurrency option.
364
+ * One per VkImage.
365
+ */
366
+ uint32_t queue_family[AV_NUM_DATA_POINTERS];
367
+ };
368
+
369
+ /**
370
+ * Allocates a single AVVkFrame and initializes everything as 0.
371
+ * @note Must be freed via av_free()
372
+ */
373
+ AVVkFrame *av_vk_frame_alloc(void);
374
+
375
+ /**
376
+ * Returns the optimal per-plane Vulkan format for a given sw_format,
377
+ * one for each plane.
378
+ * Returns NULL on unsupported formats.
379
+ */
380
+ const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p);
381
+
382
+ #endif /* AVUTIL_HWCONTEXT_VULKAN_H */
ffmpeg/include/libavutil/iamf.h ADDED
@@ -0,0 +1,694 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Immersive Audio Model and Formats helper functions and defines
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_IAMF_H
22
+ #define AVUTIL_IAMF_H
23
+
24
+ /**
25
+ * @file
26
+ * Immersive Audio Model and Formats API header
27
+ * @see <a href="https://aomediacodec.github.io/iamf/">Immersive Audio Model and Formats</a>
28
+ */
29
+
30
+ #include <stdint.h>
31
+ #include <stddef.h>
32
+
33
+ #include "attributes.h"
34
+ #include "avassert.h"
35
+ #include "channel_layout.h"
36
+ #include "dict.h"
37
+ #include "rational.h"
38
+
39
+ /**
40
+ * @defgroup lavu_iamf Immersive Audio Model and Formats
41
+ * @ingroup lavu_audio
42
+ *
43
+ * Immersive Audio Model and Formats related functions and defines
44
+ *
45
+ * @defgroup lavu_iamf_params Parameter Definition
46
+ * @ingroup lavu_iamf
47
+ * @{
48
+ * Parameters as defined in section 3.6.1 and 3.8 of IAMF.
49
+ * @}
50
+ *
51
+ * @defgroup lavu_iamf_audio Audio Element
52
+ * @ingroup lavu_iamf
53
+ * @{
54
+ * Audio Elements as defined in section 3.6 of IAMF.
55
+ * @}
56
+ *
57
+ * @defgroup lavu_iamf_mix Mix Presentation
58
+ * @ingroup lavu_iamf
59
+ * @{
60
+ * Mix Presentations as defined in section 3.7 of IAMF.
61
+ * @}
62
+ *
63
+ * @addtogroup lavu_iamf_params
64
+ * @{
65
+ */
66
+ enum AVIAMFAnimationType {
67
+ AV_IAMF_ANIMATION_TYPE_STEP,
68
+ AV_IAMF_ANIMATION_TYPE_LINEAR,
69
+ AV_IAMF_ANIMATION_TYPE_BEZIER,
70
+ };
71
+
72
+ /**
73
+ * Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
74
+ *
75
+ * @note This struct's size is not a part of the public ABI.
76
+ */
77
+ typedef struct AVIAMFMixGain {
78
+ const AVClass *av_class;
79
+
80
+ /**
81
+ * Duration for the given subblock, in units of
82
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
83
+ * It must not be 0.
84
+ */
85
+ unsigned int subblock_duration;
86
+ /**
87
+ * The type of animation applied to the parameter values.
88
+ */
89
+ enum AVIAMFAnimationType animation_type;
90
+ /**
91
+ * Parameter value that is applied at the start of the subblock.
92
+ * Applies to all defined Animation Types.
93
+ *
94
+ * Valid range of values is -128.0 to 128.0
95
+ */
96
+ AVRational start_point_value;
97
+ /**
98
+ * Parameter value that is applied at the end of the subblock.
99
+ * Applies only to AV_IAMF_ANIMATION_TYPE_LINEAR and
100
+ * AV_IAMF_ANIMATION_TYPE_BEZIER Animation Types.
101
+ *
102
+ * Valid range of values is -128.0 to 128.0
103
+ */
104
+ AVRational end_point_value;
105
+ /**
106
+ * Parameter value of the middle control point of a quadratic Bezier
107
+ * curve, i.e., its y-axis value.
108
+ * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
109
+ *
110
+ * Valid range of values is -128.0 to 128.0
111
+ */
112
+ AVRational control_point_value;
113
+ /**
114
+ * Parameter value of the time of the middle control point of a
115
+ * quadratic Bezier curve, i.e., its x-axis value.
116
+ * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
117
+ *
118
+ * Valid range of values is 0.0 to 1.0
119
+ */
120
+ AVRational control_point_relative_time;
121
+ } AVIAMFMixGain;
122
+
123
+ /**
124
+ * Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
125
+ *
126
+ * @note This struct's size is not a part of the public ABI.
127
+ */
128
+ typedef struct AVIAMFDemixingInfo {
129
+ const AVClass *av_class;
130
+
131
+ /**
132
+ * Duration for the given subblock, in units of
133
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
134
+ * It must not be 0.
135
+ */
136
+ unsigned int subblock_duration;
137
+ /**
138
+ * Pre-defined combination of demixing parameters.
139
+ */
140
+ unsigned int dmixp_mode;
141
+ } AVIAMFDemixingInfo;
142
+
143
+ /**
144
+ * Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
145
+ *
146
+ * @note This struct's size is not a part of the public ABI.
147
+ */
148
+ typedef struct AVIAMFReconGain {
149
+ const AVClass *av_class;
150
+
151
+ /**
152
+ * Duration for the given subblock, in units of
153
+ * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
154
+ * It must not be 0.
155
+ */
156
+ unsigned int subblock_duration;
157
+
158
+ /**
159
+ * Array of gain values to be applied to each channel for each layer
160
+ * defined in the Audio Element referencing the parent Parameter Definition.
161
+ * Values for layers where the AV_IAMF_LAYER_FLAG_RECON_GAIN flag is not set
162
+ * are undefined.
163
+ *
164
+ * Channel order is: FL, C, FR, SL, SR, TFL, TFR, BL, BR, TBL, TBR, LFE
165
+ */
166
+ uint8_t recon_gain[6][12];
167
+ } AVIAMFReconGain;
168
+
169
+ enum AVIAMFParamDefinitionType {
170
+ /**
171
+ * Subblocks are of struct type AVIAMFMixGain
172
+ */
173
+ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN,
174
+ /**
175
+ * Subblocks are of struct type AVIAMFDemixingInfo
176
+ */
177
+ AV_IAMF_PARAMETER_DEFINITION_DEMIXING,
178
+ /**
179
+ * Subblocks are of struct type AVIAMFReconGain
180
+ */
181
+ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN,
182
+ };
183
+
184
+ /**
185
+ * Parameters as defined in section 3.6.1 of IAMF.
186
+ *
187
+ * The struct is allocated by av_iamf_param_definition_alloc() along with an
188
+ * array of subblocks, its type depending on the value of type.
189
+ * This array is placed subblocks_offset bytes after the start of this struct.
190
+ *
191
+ * @note This struct's size is not a part of the public ABI.
192
+ */
193
+ typedef struct AVIAMFParamDefinition {
194
+ const AVClass *av_class;
195
+
196
+ /**
197
+ * Offset in bytes from the start of this struct, at which the subblocks
198
+ * array is located.
199
+ */
200
+ size_t subblocks_offset;
201
+ /**
202
+ * Size in bytes of each element in the subblocks array.
203
+ */
204
+ size_t subblock_size;
205
+ /**
206
+ * Number of subblocks in the array.
207
+ */
208
+ unsigned int nb_subblocks;
209
+
210
+ /**
211
+ * Parameters type. Determines the type of the subblock elements.
212
+ */
213
+ enum AVIAMFParamDefinitionType type;
214
+
215
+ /**
216
+ * Identifier for the paremeter substream.
217
+ */
218
+ unsigned int parameter_id;
219
+ /**
220
+ * Sample rate for the paremeter substream. It must not be 0.
221
+ */
222
+ unsigned int parameter_rate;
223
+
224
+ /**
225
+ * The accumulated duration of all blocks in this parameter definition,
226
+ * in units of 1 / @ref parameter_rate.
227
+ *
228
+ * May be 0, in which case all duration values should be specified in
229
+ * another parameter definition referencing the same parameter_id.
230
+ */
231
+ unsigned int duration;
232
+ /**
233
+ * The duration of every subblock in the case where all subblocks, with
234
+ * the optional exception of the last subblock, have equal durations.
235
+ *
236
+ * Must be 0 if subblocks have different durations.
237
+ */
238
+ unsigned int constant_subblock_duration;
239
+ } AVIAMFParamDefinition;
240
+
241
+ const AVClass *av_iamf_param_definition_get_class(void);
242
+
243
+ /**
244
+ * Allocates memory for AVIAMFParamDefinition, plus an array of {@code nb_subblocks}
245
+ * amount of subblocks of the given type and initializes the variables. Can be
246
+ * freed with a normal av_free() call.
247
+ *
248
+ * @param size if non-NULL, the size in bytes of the resulting data array is written here.
249
+ */
250
+ AVIAMFParamDefinition *av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type,
251
+ unsigned int nb_subblocks, size_t *size);
252
+
253
+ /**
254
+ * Get the subblock at the specified {@code idx}. Must be between 0 and nb_subblocks - 1.
255
+ *
256
+ * The @ref AVIAMFParamDefinition.type "param definition type" defines
257
+ * the struct type of the returned pointer.
258
+ */
259
+ static av_always_inline void*
260
+ av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
261
+ {
262
+ av_assert0(idx < par->nb_subblocks);
263
+ return (void *)((uint8_t *)par + par->subblocks_offset + idx * par->subblock_size);
264
+ }
265
+
266
+ /**
267
+ * @}
268
+ * @addtogroup lavu_iamf_audio
269
+ * @{
270
+ */
271
+
272
+ enum AVIAMFAmbisonicsMode {
273
+ AV_IAMF_AMBISONICS_MODE_MONO,
274
+ AV_IAMF_AMBISONICS_MODE_PROJECTION,
275
+ };
276
+
277
+ /**
278
+ * Recon gain information for the layer is present in AVIAMFReconGain
279
+ */
280
+ #define AV_IAMF_LAYER_FLAG_RECON_GAIN (1 << 0)
281
+
282
+ /**
283
+ * A layer defining a Channel Layout in the Audio Element.
284
+ *
285
+ * When @ref AVIAMFAudioElement.audio_element_type "the parent's Audio Element type"
286
+ * is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, this corresponds to an Scalable Channel
287
+ * Layout layer as defined in section 3.6.2 of IAMF.
288
+ * For AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, it is an Ambisonics channel
289
+ * layout as defined in section 3.6.3 of IAMF.
290
+ *
291
+ * @note The struct should be allocated with av_iamf_audio_element_add_layer()
292
+ * and its size is not a part of the public ABI.
293
+ */
294
+ typedef struct AVIAMFLayer {
295
+ const AVClass *av_class;
296
+
297
+ AVChannelLayout ch_layout;
298
+
299
+ /**
300
+ * A bitmask which may contain a combination of AV_IAMF_LAYER_FLAG_* flags.
301
+ */
302
+ unsigned int flags;
303
+ /**
304
+ * Output gain channel flags as defined in section 3.6.2 of IAMF.
305
+ *
306
+ * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
307
+ * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
308
+ * must be 0 otherwise.
309
+ */
310
+ unsigned int output_gain_flags;
311
+ /**
312
+ * Output gain as defined in section 3.6.2 of IAMF.
313
+ *
314
+ * Must be 0 if @ref output_gain_flags is 0.
315
+ */
316
+ AVRational output_gain;
317
+ /**
318
+ * Ambisonics mode as defined in section 3.6.3 of IAMF.
319
+ *
320
+ * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
321
+ * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE.
322
+ *
323
+ * If AV_IAMF_AMBISONICS_MODE_MONO, channel_mapping is defined implicitly
324
+ * (Ambisonic Order) or explicitly (Custom Order with ambi channels) in
325
+ * @ref ch_layout.
326
+ * If AV_IAMF_AMBISONICS_MODE_PROJECTION, @ref demixing_matrix must be set.
327
+ */
328
+ enum AVIAMFAmbisonicsMode ambisonics_mode;
329
+
330
+ /**
331
+ * Demixing matrix as defined in section 3.6.3 of IAMF.
332
+ *
333
+ * The length of the array is ch_layout.nb_channels multiplied by the sum of
334
+ * the amount of streams in the group plus the amount of streams in the group
335
+ * that are stereo.
336
+ *
337
+ * May be set only if @ref ambisonics_mode == AV_IAMF_AMBISONICS_MODE_PROJECTION,
338
+ * must be NULL otherwise.
339
+ */
340
+ AVRational *demixing_matrix;
341
+ } AVIAMFLayer;
342
+
343
+
344
+ enum AVIAMFAudioElementType {
345
+ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
346
+ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE,
347
+ };
348
+
349
+ /**
350
+ * Information on how to combine one or more audio streams, as defined in
351
+ * section 3.6 of IAMF.
352
+ *
353
+ * @note The struct should be allocated with av_iamf_audio_element_alloc()
354
+ * and its size is not a part of the public ABI.
355
+ */
356
+ typedef struct AVIAMFAudioElement {
357
+ const AVClass *av_class;
358
+
359
+ AVIAMFLayer **layers;
360
+ /**
361
+ * Number of layers, or channel groups, in the Audio Element.
362
+ * There may be 6 layers at most, and for @ref audio_element_type
363
+ * AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, there may be exactly 1.
364
+ *
365
+ * Set by av_iamf_audio_element_add_layer(), must not be
366
+ * modified by any other code.
367
+ */
368
+ unsigned int nb_layers;
369
+
370
+ /**
371
+ * Demixing information used to reconstruct a scalable channel audio
372
+ * representation.
373
+ * The @ref AVIAMFParamDefinition.type "type" must be
374
+ * AV_IAMF_PARAMETER_DEFINITION_DEMIXING.
375
+ */
376
+ AVIAMFParamDefinition *demixing_info;
377
+ /**
378
+ * Recon gain information used to reconstruct a scalable channel audio
379
+ * representation.
380
+ * The @ref AVIAMFParamDefinition.type "type" must be
381
+ * AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN.
382
+ */
383
+ AVIAMFParamDefinition *recon_gain_info;
384
+
385
+ /**
386
+ * Audio element type as defined in section 3.6 of IAMF.
387
+ */
388
+ enum AVIAMFAudioElementType audio_element_type;
389
+
390
+ /**
391
+ * Default weight value as defined in section 3.6 of IAMF.
392
+ */
393
+ unsigned int default_w;
394
+ } AVIAMFAudioElement;
395
+
396
+ const AVClass *av_iamf_audio_element_get_class(void);
397
+
398
+ /**
399
+ * Allocates a AVIAMFAudioElement, and initializes its fields with default values.
400
+ * No layers are allocated. Must be freed with av_iamf_audio_element_free().
401
+ *
402
+ * @see av_iamf_audio_element_add_layer()
403
+ */
404
+ AVIAMFAudioElement *av_iamf_audio_element_alloc(void);
405
+
406
+ /**
407
+ * Allocate a layer and add it to a given AVIAMFAudioElement.
408
+ * It is freed by av_iamf_audio_element_free() alongside the rest of the parent
409
+ * AVIAMFAudioElement.
410
+ *
411
+ * @return a pointer to the allocated layer.
412
+ */
413
+ AVIAMFLayer *av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element);
414
+
415
+ /**
416
+ * Free an AVIAMFAudioElement and all its contents.
417
+ *
418
+ * @param audio_element pointer to pointer to an allocated AVIAMFAudioElement.
419
+ * upon return, *audio_element will be set to NULL.
420
+ */
421
+ void av_iamf_audio_element_free(AVIAMFAudioElement **audio_element);
422
+
423
+ /**
424
+ * @}
425
+ * @addtogroup lavu_iamf_mix
426
+ * @{
427
+ */
428
+
429
+ enum AVIAMFHeadphonesMode {
430
+ /**
431
+ * The referenced Audio Element shall be rendered to stereo loudspeakers.
432
+ */
433
+ AV_IAMF_HEADPHONES_MODE_STEREO,
434
+ /**
435
+ * The referenced Audio Element shall be rendered with a binaural renderer.
436
+ */
437
+ AV_IAMF_HEADPHONES_MODE_BINAURAL,
438
+ };
439
+
440
+ /**
441
+ * Submix element as defined in section 3.7 of IAMF.
442
+ *
443
+ * @note The struct should be allocated with av_iamf_submix_add_element()
444
+ * and its size is not a part of the public ABI.
445
+ */
446
+ typedef struct AVIAMFSubmixElement {
447
+ const AVClass *av_class;
448
+
449
+ /**
450
+ * The id of the Audio Element this submix element references.
451
+ */
452
+ unsigned int audio_element_id;
453
+
454
+ /**
455
+ * Information required required for applying any processing to the
456
+ * referenced and rendered Audio Element before being summed with other
457
+ * processed Audio Elements.
458
+ * The @ref AVIAMFParamDefinition.type "type" must be
459
+ * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
460
+ */
461
+ AVIAMFParamDefinition *element_mix_config;
462
+
463
+ /**
464
+ * Default mix gain value to apply when there are no AVIAMFParamDefinition
465
+ * with @ref element_mix_config "element_mix_config's"
466
+ * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
467
+ * given audio frame.
468
+ */
469
+ AVRational default_mix_gain;
470
+
471
+ /**
472
+ * A value that indicates whether the referenced channel-based Audio Element
473
+ * shall be rendered to stereo loudspeakers or spatialized with a binaural
474
+ * renderer when played back on headphones.
475
+ * If the Audio Element is not of @ref AVIAMFAudioElement.audio_element_type
476
+ * "type" AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, then this field is undefined.
477
+ */
478
+ enum AVIAMFHeadphonesMode headphones_rendering_mode;
479
+
480
+ /**
481
+ * A dictionary of strings describing the submix in different languages.
482
+ * Must have the same amount of entries as
483
+ * @ref AVIAMFMixPresentation.annotations "the mix's annotations", stored
484
+ * in the same order, and with the same key strings.
485
+ *
486
+ * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47 that
487
+ * specifies the language for the string stored in
488
+ * @ref AVDictionaryEntry.value "value".
489
+ */
490
+ AVDictionary *annotations;
491
+ } AVIAMFSubmixElement;
492
+
493
+ enum AVIAMFSubmixLayoutType {
494
+ /**
495
+ * The layout follows the loudspeaker sound system convention of ITU-2051-3.
496
+ * @ref AVIAMFSubmixLayout.sound_system must be set.
497
+ */
498
+ AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS = 2,
499
+ /**
500
+ * The layout is binaural.
501
+ *
502
+ * @note @ref AVIAMFSubmixLayout.sound_system may be set to
503
+ * AV_CHANNEL_LAYOUT_BINAURAL to simplify API usage, but it's not mandatory.
504
+ */
505
+ AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL = 3,
506
+ };
507
+
508
+ /**
509
+ * Submix layout as defined in section 3.7.6 of IAMF.
510
+ *
511
+ * @note The struct should be allocated with av_iamf_submix_add_layout()
512
+ * and its size is not a part of the public ABI.
513
+ */
514
+ typedef struct AVIAMFSubmixLayout {
515
+ const AVClass *av_class;
516
+
517
+ enum AVIAMFSubmixLayoutType layout_type;
518
+
519
+ /**
520
+ * Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus
521
+ * 7.1.2ch, 3.1.2ch, and binaural.
522
+ * If layout_type is not AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS or
523
+ * AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL, this field is undefined.
524
+ */
525
+ AVChannelLayout sound_system;
526
+ /**
527
+ * The program integrated loudness information, as defined in
528
+ * ITU-1770-4.
529
+ */
530
+ AVRational integrated_loudness;
531
+ /**
532
+ * The digital (sampled) peak value of the audio signal, as defined
533
+ * in ITU-1770-4.
534
+ */
535
+ AVRational digital_peak;
536
+ /**
537
+ * The true peak of the audio signal, as defined in ITU-1770-4.
538
+ */
539
+ AVRational true_peak;
540
+ /**
541
+ * The Dialogue loudness information, as defined in ITU-1770-4.
542
+ */
543
+ AVRational dialogue_anchored_loudness;
544
+ /**
545
+ * The Album loudness information, as defined in ITU-1770-4.
546
+ */
547
+ AVRational album_anchored_loudness;
548
+ } AVIAMFSubmixLayout;
549
+
550
+ /**
551
+ * Submix layout as defined in section 3.7 of IAMF.
552
+ *
553
+ * @note The struct should be allocated with av_iamf_mix_presentation_add_submix()
554
+ * and its size is not a part of the public ABI.
555
+ */
556
+ typedef struct AVIAMFSubmix {
557
+ const AVClass *av_class;
558
+
559
+ /**
560
+ * Array of submix elements.
561
+ *
562
+ * Set by av_iamf_submix_add_element(), must not be modified by any
563
+ * other code.
564
+ */
565
+ AVIAMFSubmixElement **elements;
566
+ /**
567
+ * Number of elements in the submix.
568
+ *
569
+ * Set by av_iamf_submix_add_element(), must not be modified by any
570
+ * other code.
571
+ */
572
+ unsigned int nb_elements;
573
+
574
+ /**
575
+ * Array of submix layouts.
576
+ *
577
+ * Set by av_iamf_submix_add_layout(), must not be modified by any
578
+ * other code.
579
+ */
580
+ AVIAMFSubmixLayout **layouts;
581
+ /**
582
+ * Number of layouts in the submix.
583
+ *
584
+ * Set by av_iamf_submix_add_layout(), must not be modified by any
585
+ * other code.
586
+ */
587
+ unsigned int nb_layouts;
588
+
589
+ /**
590
+ * Information required for post-processing the mixed audio signal to
591
+ * generate the audio signal for playback.
592
+ * The @ref AVIAMFParamDefinition.type "type" must be
593
+ * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
594
+ */
595
+ AVIAMFParamDefinition *output_mix_config;
596
+
597
+ /**
598
+ * Default mix gain value to apply when there are no AVIAMFParamDefinition
599
+ * with @ref output_mix_config "output_mix_config's"
600
+ * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
601
+ * given audio frame.
602
+ */
603
+ AVRational default_mix_gain;
604
+ } AVIAMFSubmix;
605
+
606
+ /**
607
+ * Information on how to render and mix one or more AVIAMFAudioElement to generate
608
+ * the final audio output, as defined in section 3.7 of IAMF.
609
+ *
610
+ * @note The struct should be allocated with av_iamf_mix_presentation_alloc()
611
+ * and its size is not a part of the public ABI.
612
+ */
613
+ typedef struct AVIAMFMixPresentation {
614
+ const AVClass *av_class;
615
+
616
+ /**
617
+ * Array of submixes.
618
+ *
619
+ * Set by av_iamf_mix_presentation_add_submix(), must not be modified
620
+ * by any other code.
621
+ */
622
+ AVIAMFSubmix **submixes;
623
+ /**
624
+ * Number of submixes in the presentation.
625
+ *
626
+ * Set by av_iamf_mix_presentation_add_submix(), must not be modified
627
+ * by any other code.
628
+ */
629
+ unsigned int nb_submixes;
630
+
631
+ /**
632
+ * A dictionary of strings describing the mix in different languages.
633
+ * Must have the same amount of entries as every
634
+ * @ref AVIAMFSubmixElement.annotations "Submix element annotations",
635
+ * stored in the same order, and with the same key strings.
636
+ *
637
+ * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47
638
+ * that specifies the language for the string stored in
639
+ * @ref AVDictionaryEntry.value "value".
640
+ */
641
+ AVDictionary *annotations;
642
+ } AVIAMFMixPresentation;
643
+
644
+ const AVClass *av_iamf_mix_presentation_get_class(void);
645
+
646
+ /**
647
+ * Allocates a AVIAMFMixPresentation, and initializes its fields with default
648
+ * values. No submixes are allocated.
649
+ * Must be freed with av_iamf_mix_presentation_free().
650
+ *
651
+ * @see av_iamf_mix_presentation_add_submix()
652
+ */
653
+ AVIAMFMixPresentation *av_iamf_mix_presentation_alloc(void);
654
+
655
+ /**
656
+ * Allocate a submix and add it to a given AVIAMFMixPresentation.
657
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
658
+ * parent AVIAMFMixPresentation.
659
+ *
660
+ * @return a pointer to the allocated submix.
661
+ */
662
+ AVIAMFSubmix *av_iamf_mix_presentation_add_submix(AVIAMFMixPresentation *mix_presentation);
663
+
664
+ /**
665
+ * Allocate a submix element and add it to a given AVIAMFSubmix.
666
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
667
+ * parent AVIAMFSubmix.
668
+ *
669
+ * @return a pointer to the allocated submix.
670
+ */
671
+ AVIAMFSubmixElement *av_iamf_submix_add_element(AVIAMFSubmix *submix);
672
+
673
+ /**
674
+ * Allocate a submix layout and add it to a given AVIAMFSubmix.
675
+ * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
676
+ * parent AVIAMFSubmix.
677
+ *
678
+ * @return a pointer to the allocated submix.
679
+ */
680
+ AVIAMFSubmixLayout *av_iamf_submix_add_layout(AVIAMFSubmix *submix);
681
+
682
+ /**
683
+ * Free an AVIAMFMixPresentation and all its contents.
684
+ *
685
+ * @param mix_presentation pointer to pointer to an allocated AVIAMFMixPresentation.
686
+ * upon return, *mix_presentation will be set to NULL.
687
+ */
688
+ void av_iamf_mix_presentation_free(AVIAMFMixPresentation **mix_presentation);
689
+
690
+ /**
691
+ * @}
692
+ */
693
+
694
+ #endif /* AVUTIL_IAMF_H */
ffmpeg/include/libavutil/imgutils.h ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_IMGUTILS_H
20
+ #define AVUTIL_IMGUTILS_H
21
+
22
+ /**
23
+ * @file
24
+ * misc image utilities
25
+ *
26
+ * @addtogroup lavu_picture
27
+ * @{
28
+ */
29
+
30
+ #include <stddef.h>
31
+ #include <stdint.h>
32
+ #include "pixdesc.h"
33
+ #include "pixfmt.h"
34
+ #include "rational.h"
35
+
36
+ /**
37
+ * Compute the max pixel step for each plane of an image with a
38
+ * format described by pixdesc.
39
+ *
40
+ * The pixel step is the distance in bytes between the first byte of
41
+ * the group of bytes which describe a pixel component and the first
42
+ * byte of the successive group in the same plane for the same
43
+ * component.
44
+ *
45
+ * @param max_pixsteps an array which is filled with the max pixel step
46
+ * for each plane. Since a plane may contain different pixel
47
+ * components, the computed max_pixsteps[plane] is relative to the
48
+ * component in the plane with the max pixel step.
49
+ * @param max_pixstep_comps an array which is filled with the component
50
+ * for each plane which has the max pixel step. May be NULL.
51
+ * @param pixdesc the AVPixFmtDescriptor for the image, describing its format
52
+ */
53
+ void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
54
+ const AVPixFmtDescriptor *pixdesc);
55
+
56
+ /**
57
+ * Compute the size of an image line with format pix_fmt and width
58
+ * width for the plane plane.
59
+ *
60
+ * @return the computed size in bytes
61
+ */
62
+ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
63
+
64
+ /**
65
+ * Fill plane linesizes for an image with pixel format pix_fmt and
66
+ * width width.
67
+ *
68
+ * @param linesizes array to be filled with the linesize for each plane
69
+ * @param pix_fmt the AVPixelFormat of the image
70
+ * @param width width of the image in pixels
71
+ * @return >= 0 in case of success, a negative error code otherwise
72
+ */
73
+ int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width);
74
+
75
+ /**
76
+ * Fill plane sizes for an image with pixel format pix_fmt and height height.
77
+ *
78
+ * @param size the array to be filled with the size of each image plane
79
+ * @param pix_fmt the AVPixelFormat of the image
80
+ * @param height height of the image in pixels
81
+ * @param linesizes the array containing the linesize for each
82
+ * plane, should be filled by av_image_fill_linesizes()
83
+ * @return >= 0 in case of success, a negative error code otherwise
84
+ *
85
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
86
+ * int for av_image_fill_linesizes().
87
+ */
88
+ int av_image_fill_plane_sizes(size_t size[4], enum AVPixelFormat pix_fmt,
89
+ int height, const ptrdiff_t linesizes[4]);
90
+
91
+ /**
92
+ * Fill plane data pointers for an image with pixel format pix_fmt and
93
+ * height height.
94
+ *
95
+ * @param data pointers array to be filled with the pointer for each image plane
96
+ * @param pix_fmt the AVPixelFormat of the image
97
+ * @param height height of the image in pixels
98
+ * @param ptr the pointer to a buffer which will contain the image
99
+ * @param linesizes the array containing the linesize for each
100
+ * plane, should be filled by av_image_fill_linesizes()
101
+ * @return the size in bytes required for the image buffer, a negative
102
+ * error code in case of failure
103
+ */
104
+ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height,
105
+ uint8_t *ptr, const int linesizes[4]);
106
+
107
+ /**
108
+ * Allocate an image with size w and h and pixel format pix_fmt, and
109
+ * fill pointers and linesizes accordingly.
110
+ * The allocated image buffer has to be freed by using
111
+ * av_freep(&pointers[0]).
112
+ *
113
+ * @param pointers array to be filled with the pointer for each image plane
114
+ * @param linesizes the array filled with the linesize for each plane
115
+ * @param w width of the image in pixels
116
+ * @param h height of the image in pixels
117
+ * @param pix_fmt the AVPixelFormat of the image
118
+ * @param align the value to use for buffer size alignment
119
+ * @return the size in bytes required for the image buffer, a negative
120
+ * error code in case of failure
121
+ */
122
+ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
123
+ int w, int h, enum AVPixelFormat pix_fmt, int align);
124
+
125
+ /**
126
+ * Copy image plane from src to dst.
127
+ * That is, copy "height" number of lines of "bytewidth" bytes each.
128
+ * The first byte of each successive line is separated by *_linesize
129
+ * bytes.
130
+ *
131
+ * bytewidth must be contained by both absolute values of dst_linesize
132
+ * and src_linesize, otherwise the function behavior is undefined.
133
+ *
134
+ * @param dst destination plane to copy to
135
+ * @param dst_linesize linesize for the image plane in dst
136
+ * @param src source plane to copy from
137
+ * @param src_linesize linesize for the image plane in src
138
+ * @param height height (number of lines) of the plane
139
+ */
140
+ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
141
+ const uint8_t *src, int src_linesize,
142
+ int bytewidth, int height);
143
+
144
+ /**
145
+ * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
146
+ * available, this function will use special functionality for reading from such
147
+ * memory, which may result in greatly improved performance compared to plain
148
+ * av_image_copy_plane().
149
+ *
150
+ * bytewidth must be contained by both absolute values of dst_linesize
151
+ * and src_linesize, otherwise the function behavior is undefined.
152
+ *
153
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
154
+ * int for av_image_copy_plane().
155
+ * @note On x86, the linesizes currently need to be aligned to the cacheline
156
+ * size (i.e. 64) to get improved performance.
157
+ */
158
+ void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
159
+ const uint8_t *src, ptrdiff_t src_linesize,
160
+ ptrdiff_t bytewidth, int height);
161
+
162
+ /**
163
+ * Copy image in src_data to dst_data.
164
+ *
165
+ * @param dst_data destination image data buffer to copy to
166
+ * @param dst_linesizes linesizes for the image in dst_data
167
+ * @param src_data source image data buffer to copy from
168
+ * @param src_linesizes linesizes for the image in src_data
169
+ * @param pix_fmt the AVPixelFormat of the image
170
+ * @param width width of the image in pixels
171
+ * @param height height of the image in pixels
172
+ */
173
+ void av_image_copy(uint8_t * const dst_data[4], const int dst_linesizes[4],
174
+ const uint8_t * const src_data[4], const int src_linesizes[4],
175
+ enum AVPixelFormat pix_fmt, int width, int height);
176
+
177
+ /**
178
+ * Wrapper around av_image_copy() to workaround the limitation
179
+ * that the conversion from uint8_t * const * to const uint8_t * const *
180
+ * is not performed automatically in C.
181
+ * @see av_image_copy()
182
+ */
183
+ static inline
184
+ void av_image_copy2(uint8_t * const dst_data[4], const int dst_linesizes[4],
185
+ uint8_t * const src_data[4], const int src_linesizes[4],
186
+ enum AVPixelFormat pix_fmt, int width, int height)
187
+ {
188
+ av_image_copy(dst_data, dst_linesizes,
189
+ (const uint8_t * const *)src_data, src_linesizes,
190
+ pix_fmt, width, height);
191
+ }
192
+
193
+ /**
194
+ * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
195
+ * available, this function will use special functionality for reading from such
196
+ * memory, which may result in greatly improved performance compared to plain
197
+ * av_image_copy().
198
+ *
199
+ * The data pointers and the linesizes must be aligned to the maximum required
200
+ * by the CPU architecture.
201
+ *
202
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
203
+ * int for av_image_copy().
204
+ * @note On x86, the linesizes currently need to be aligned to the cacheline
205
+ * size (i.e. 64) to get improved performance.
206
+ */
207
+ void av_image_copy_uc_from(uint8_t * const dst_data[4], const ptrdiff_t dst_linesizes[4],
208
+ const uint8_t * const src_data[4], const ptrdiff_t src_linesizes[4],
209
+ enum AVPixelFormat pix_fmt, int width, int height);
210
+
211
+ /**
212
+ * Setup the data pointers and linesizes based on the specified image
213
+ * parameters and the provided array.
214
+ *
215
+ * The fields of the given image are filled in by using the src
216
+ * address which points to the image data buffer. Depending on the
217
+ * specified pixel format, one or multiple image data pointers and
218
+ * line sizes will be set. If a planar format is specified, several
219
+ * pointers will be set pointing to the different picture planes and
220
+ * the line sizes of the different planes will be stored in the
221
+ * lines_sizes array. Call with src == NULL to get the required
222
+ * size for the src buffer.
223
+ *
224
+ * To allocate the buffer and fill in the dst_data and dst_linesize in
225
+ * one call, use av_image_alloc().
226
+ *
227
+ * @param dst_data data pointers to be filled in
228
+ * @param dst_linesize linesizes for the image in dst_data to be filled in
229
+ * @param src buffer which will contain or contains the actual image data, can be NULL
230
+ * @param pix_fmt the pixel format of the image
231
+ * @param width the width of the image in pixels
232
+ * @param height the height of the image in pixels
233
+ * @param align the value used in src for linesize alignment
234
+ * @return the size in bytes required for src, a negative error code
235
+ * in case of failure
236
+ */
237
+ int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
238
+ const uint8_t *src,
239
+ enum AVPixelFormat pix_fmt, int width, int height, int align);
240
+
241
+ /**
242
+ * Return the size in bytes of the amount of data required to store an
243
+ * image with the given parameters.
244
+ *
245
+ * @param pix_fmt the pixel format of the image
246
+ * @param width the width of the image in pixels
247
+ * @param height the height of the image in pixels
248
+ * @param align the assumed linesize alignment
249
+ * @return the buffer size in bytes, a negative error code in case of failure
250
+ */
251
+ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align);
252
+
253
+ /**
254
+ * Copy image data from an image into a buffer.
255
+ *
256
+ * av_image_get_buffer_size() can be used to compute the required size
257
+ * for the buffer to fill.
258
+ *
259
+ * @param dst a buffer into which picture data will be copied
260
+ * @param dst_size the size in bytes of dst
261
+ * @param src_data pointers containing the source image data
262
+ * @param src_linesize linesizes for the image in src_data
263
+ * @param pix_fmt the pixel format of the source image
264
+ * @param width the width of the source image in pixels
265
+ * @param height the height of the source image in pixels
266
+ * @param align the assumed linesize alignment for dst
267
+ * @return the number of bytes written to dst, or a negative value
268
+ * (error code) on error
269
+ */
270
+ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
271
+ const uint8_t * const src_data[4], const int src_linesize[4],
272
+ enum AVPixelFormat pix_fmt, int width, int height, int align);
273
+
274
+ /**
275
+ * Check if the given dimension of an image is valid, meaning that all
276
+ * bytes of the image can be addressed with a signed int.
277
+ *
278
+ * @param w the width of the picture
279
+ * @param h the height of the picture
280
+ * @param log_offset the offset to sum to the log level for logging with log_ctx
281
+ * @param log_ctx the parent logging context, it may be NULL
282
+ * @return >= 0 if valid, a negative error code otherwise
283
+ */
284
+ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
285
+
286
+ /**
287
+ * Check if the given dimension of an image is valid, meaning that all
288
+ * bytes of a plane of an image with the specified pix_fmt can be addressed
289
+ * with a signed int.
290
+ *
291
+ * @param w the width of the picture
292
+ * @param h the height of the picture
293
+ * @param max_pixels the maximum number of pixels the user wants to accept
294
+ * @param pix_fmt the pixel format, can be AV_PIX_FMT_NONE if unknown.
295
+ * @param log_offset the offset to sum to the log level for logging with log_ctx
296
+ * @param log_ctx the parent logging context, it may be NULL
297
+ * @return >= 0 if valid, a negative error code otherwise
298
+ */
299
+ int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx);
300
+
301
+ /**
302
+ * Check if the given sample aspect ratio of an image is valid.
303
+ *
304
+ * It is considered invalid if the denominator is 0 or if applying the ratio
305
+ * to the image size would make the smaller dimension less than 1. If the
306
+ * sar numerator is 0, it is considered unknown and will return as valid.
307
+ *
308
+ * @param w width of the image
309
+ * @param h height of the image
310
+ * @param sar sample aspect ratio of the image
311
+ * @return 0 if valid, a negative AVERROR code otherwise
312
+ */
313
+ int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar);
314
+
315
+ /**
316
+ * Overwrite the image data with black. This is suitable for filling a
317
+ * sub-rectangle of an image, meaning the padding between the right most pixel
318
+ * and the left most pixel on the next line will not be overwritten. For some
319
+ * formats, the image size might be rounded up due to inherent alignment.
320
+ *
321
+ * If the pixel format has alpha, the alpha is cleared to opaque.
322
+ *
323
+ * This can return an error if the pixel format is not supported. Normally, all
324
+ * non-hwaccel pixel formats should be supported.
325
+ *
326
+ * Passing NULL for dst_data is allowed. Then the function returns whether the
327
+ * operation would have succeeded. (It can return an error if the pix_fmt is
328
+ * not supported.)
329
+ *
330
+ * @param dst_data data pointers to destination image
331
+ * @param dst_linesize linesizes for the destination image
332
+ * @param pix_fmt the pixel format of the image
333
+ * @param range the color range of the image (important for colorspaces such as YUV)
334
+ * @param width the width of the image in pixels
335
+ * @param height the height of the image in pixels
336
+ * @return 0 if the image data was cleared, a negative AVERROR code otherwise
337
+ */
338
+ int av_image_fill_black(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
339
+ enum AVPixelFormat pix_fmt, enum AVColorRange range,
340
+ int width, int height);
341
+
342
+ /**
343
+ * Overwrite the image data with a color. This is suitable for filling a
344
+ * sub-rectangle of an image, meaning the padding between the right most pixel
345
+ * and the left most pixel on the next line will not be overwritten. For some
346
+ * formats, the image size might be rounded up due to inherent alignment.
347
+ *
348
+ * If the pixel format has alpha, it is also replaced. Color component values
349
+ * are interpreted as native integers (or intfloats) regardless of actual pixel
350
+ * format endianness.
351
+ *
352
+ * This can return an error if the pixel format is not supported. Normally, all
353
+ * non-hwaccel pixel formats should be supported.
354
+ *
355
+ * Passing NULL for dst_data is allowed. Then the function returns whether the
356
+ * operation would have succeeded. (It can return an error if the pix_fmt is
357
+ * not supported.)
358
+ *
359
+ * @param dst_data data pointers to destination image
360
+ * @param dst_linesize linesizes for the destination image
361
+ * @param pix_fmt the pixel format of the image
362
+ * @param color the color components to be used for the fill
363
+ * @param width the width of the image in pixels
364
+ * @param height the height of the image in pixels
365
+ * @param flags currently unused
366
+ * @return 0 if the image data was filled, a negative AVERROR code otherwise
367
+ */
368
+ int av_image_fill_color(uint8_t * const dst_data[4], const ptrdiff_t dst_linesize[4],
369
+ enum AVPixelFormat pix_fmt, const uint32_t color[4],
370
+ int width, int height, int flags);
371
+
372
+ /**
373
+ * @}
374
+ */
375
+
376
+
377
+ #endif /* AVUTIL_IMGUTILS_H */
ffmpeg/include/libavutil/intfloat.h ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2011 Mans Rullgard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_INTFLOAT_H
22
+ #define AVUTIL_INTFLOAT_H
23
+
24
+ #include <stdint.h>
25
+ #include "attributes.h"
26
+
27
+ union av_intfloat32 {
28
+ uint32_t i;
29
+ float f;
30
+ };
31
+
32
+ union av_intfloat64 {
33
+ uint64_t i;
34
+ double f;
35
+ };
36
+
37
+ /**
38
+ * Reinterpret a 32-bit integer as a float.
39
+ */
40
+ static av_always_inline float av_int2float(uint32_t i)
41
+ {
42
+ union av_intfloat32 v;
43
+ v.i = i;
44
+ return v.f;
45
+ }
46
+
47
+ /**
48
+ * Reinterpret a float as a 32-bit integer.
49
+ */
50
+ static av_always_inline uint32_t av_float2int(float f)
51
+ {
52
+ union av_intfloat32 v;
53
+ v.f = f;
54
+ return v.i;
55
+ }
56
+
57
+ /**
58
+ * Reinterpret a 64-bit integer as a double.
59
+ */
60
+ static av_always_inline double av_int2double(uint64_t i)
61
+ {
62
+ union av_intfloat64 v;
63
+ v.i = i;
64
+ return v.f;
65
+ }
66
+
67
+ /**
68
+ * Reinterpret a double as a 64-bit integer.
69
+ */
70
+ static av_always_inline uint64_t av_double2int(double f)
71
+ {
72
+ union av_intfloat64 v;
73
+ v.f = f;
74
+ return v.i;
75
+ }
76
+
77
+ #endif /* AVUTIL_INTFLOAT_H */
ffmpeg/include/libavutil/intreadwrite.h ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_INTREADWRITE_H
20
+ #define AVUTIL_INTREADWRITE_H
21
+
22
+ #include <stdint.h>
23
+ #include "libavutil/avconfig.h"
24
+ #include "attributes.h"
25
+ #include "bswap.h"
26
+
27
+ typedef union {
28
+ uint64_t u64;
29
+ uint32_t u32[2];
30
+ uint16_t u16[4];
31
+ uint8_t u8 [8];
32
+ double f64;
33
+ float f32[2];
34
+ } av_alias av_alias64;
35
+
36
+ typedef union {
37
+ uint32_t u32;
38
+ uint16_t u16[2];
39
+ uint8_t u8 [4];
40
+ float f32;
41
+ } av_alias av_alias32;
42
+
43
+ typedef union {
44
+ uint16_t u16;
45
+ uint8_t u8 [2];
46
+ } av_alias av_alias16;
47
+
48
+ /*
49
+ * Arch-specific headers can provide any combination of
50
+ * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
51
+ * Preprocessor symbols must be defined, even if these are implemented
52
+ * as inline functions.
53
+ *
54
+ * R/W means read/write, B/L/N means big/little/native endianness.
55
+ * The following macros require aligned access, compared to their
56
+ * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A.
57
+ * Incorrect usage may range from abysmal performance to crash
58
+ * depending on the platform.
59
+ *
60
+ * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U.
61
+ */
62
+
63
+ #ifdef HAVE_AV_CONFIG_H
64
+
65
+ #include "config.h"
66
+
67
+ #if ARCH_AARCH64
68
+ # include "aarch64/intreadwrite.h"
69
+ #elif ARCH_MIPS
70
+ # include "mips/intreadwrite.h"
71
+ #elif ARCH_PPC
72
+ # include "ppc/intreadwrite.h"
73
+ #elif ARCH_X86
74
+ # include "x86/intreadwrite.h"
75
+ #endif
76
+
77
+ #endif /* HAVE_AV_CONFIG_H */
78
+
79
+ /*
80
+ * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
81
+ */
82
+
83
+ #if AV_HAVE_BIGENDIAN
84
+
85
+ # if defined(AV_RN16) && !defined(AV_RB16)
86
+ # define AV_RB16(p) AV_RN16(p)
87
+ # elif !defined(AV_RN16) && defined(AV_RB16)
88
+ # define AV_RN16(p) AV_RB16(p)
89
+ # endif
90
+
91
+ # if defined(AV_WN16) && !defined(AV_WB16)
92
+ # define AV_WB16(p, v) AV_WN16(p, v)
93
+ # elif !defined(AV_WN16) && defined(AV_WB16)
94
+ # define AV_WN16(p, v) AV_WB16(p, v)
95
+ # endif
96
+
97
+ # if defined(AV_RN24) && !defined(AV_RB24)
98
+ # define AV_RB24(p) AV_RN24(p)
99
+ # elif !defined(AV_RN24) && defined(AV_RB24)
100
+ # define AV_RN24(p) AV_RB24(p)
101
+ # endif
102
+
103
+ # if defined(AV_WN24) && !defined(AV_WB24)
104
+ # define AV_WB24(p, v) AV_WN24(p, v)
105
+ # elif !defined(AV_WN24) && defined(AV_WB24)
106
+ # define AV_WN24(p, v) AV_WB24(p, v)
107
+ # endif
108
+
109
+ # if defined(AV_RN32) && !defined(AV_RB32)
110
+ # define AV_RB32(p) AV_RN32(p)
111
+ # elif !defined(AV_RN32) && defined(AV_RB32)
112
+ # define AV_RN32(p) AV_RB32(p)
113
+ # endif
114
+
115
+ # if defined(AV_WN32) && !defined(AV_WB32)
116
+ # define AV_WB32(p, v) AV_WN32(p, v)
117
+ # elif !defined(AV_WN32) && defined(AV_WB32)
118
+ # define AV_WN32(p, v) AV_WB32(p, v)
119
+ # endif
120
+
121
+ # if defined(AV_RN48) && !defined(AV_RB48)
122
+ # define AV_RB48(p) AV_RN48(p)
123
+ # elif !defined(AV_RN48) && defined(AV_RB48)
124
+ # define AV_RN48(p) AV_RB48(p)
125
+ # endif
126
+
127
+ # if defined(AV_WN48) && !defined(AV_WB48)
128
+ # define AV_WB48(p, v) AV_WN48(p, v)
129
+ # elif !defined(AV_WN48) && defined(AV_WB48)
130
+ # define AV_WN48(p, v) AV_WB48(p, v)
131
+ # endif
132
+
133
+ # if defined(AV_RN64) && !defined(AV_RB64)
134
+ # define AV_RB64(p) AV_RN64(p)
135
+ # elif !defined(AV_RN64) && defined(AV_RB64)
136
+ # define AV_RN64(p) AV_RB64(p)
137
+ # endif
138
+
139
+ # if defined(AV_WN64) && !defined(AV_WB64)
140
+ # define AV_WB64(p, v) AV_WN64(p, v)
141
+ # elif !defined(AV_WN64) && defined(AV_WB64)
142
+ # define AV_WN64(p, v) AV_WB64(p, v)
143
+ # endif
144
+
145
+ #else /* AV_HAVE_BIGENDIAN */
146
+
147
+ # if defined(AV_RN16) && !defined(AV_RL16)
148
+ # define AV_RL16(p) AV_RN16(p)
149
+ # elif !defined(AV_RN16) && defined(AV_RL16)
150
+ # define AV_RN16(p) AV_RL16(p)
151
+ # endif
152
+
153
+ # if defined(AV_WN16) && !defined(AV_WL16)
154
+ # define AV_WL16(p, v) AV_WN16(p, v)
155
+ # elif !defined(AV_WN16) && defined(AV_WL16)
156
+ # define AV_WN16(p, v) AV_WL16(p, v)
157
+ # endif
158
+
159
+ # if defined(AV_RN24) && !defined(AV_RL24)
160
+ # define AV_RL24(p) AV_RN24(p)
161
+ # elif !defined(AV_RN24) && defined(AV_RL24)
162
+ # define AV_RN24(p) AV_RL24(p)
163
+ # endif
164
+
165
+ # if defined(AV_WN24) && !defined(AV_WL24)
166
+ # define AV_WL24(p, v) AV_WN24(p, v)
167
+ # elif !defined(AV_WN24) && defined(AV_WL24)
168
+ # define AV_WN24(p, v) AV_WL24(p, v)
169
+ # endif
170
+
171
+ # if defined(AV_RN32) && !defined(AV_RL32)
172
+ # define AV_RL32(p) AV_RN32(p)
173
+ # elif !defined(AV_RN32) && defined(AV_RL32)
174
+ # define AV_RN32(p) AV_RL32(p)
175
+ # endif
176
+
177
+ # if defined(AV_WN32) && !defined(AV_WL32)
178
+ # define AV_WL32(p, v) AV_WN32(p, v)
179
+ # elif !defined(AV_WN32) && defined(AV_WL32)
180
+ # define AV_WN32(p, v) AV_WL32(p, v)
181
+ # endif
182
+
183
+ # if defined(AV_RN48) && !defined(AV_RL48)
184
+ # define AV_RL48(p) AV_RN48(p)
185
+ # elif !defined(AV_RN48) && defined(AV_RL48)
186
+ # define AV_RN48(p) AV_RL48(p)
187
+ # endif
188
+
189
+ # if defined(AV_WN48) && !defined(AV_WL48)
190
+ # define AV_WL48(p, v) AV_WN48(p, v)
191
+ # elif !defined(AV_WN48) && defined(AV_WL48)
192
+ # define AV_WN48(p, v) AV_WL48(p, v)
193
+ # endif
194
+
195
+ # if defined(AV_RN64) && !defined(AV_RL64)
196
+ # define AV_RL64(p) AV_RN64(p)
197
+ # elif !defined(AV_RN64) && defined(AV_RL64)
198
+ # define AV_RN64(p) AV_RL64(p)
199
+ # endif
200
+
201
+ # if defined(AV_WN64) && !defined(AV_WL64)
202
+ # define AV_WL64(p, v) AV_WN64(p, v)
203
+ # elif !defined(AV_WN64) && defined(AV_WL64)
204
+ # define AV_WN64(p, v) AV_WL64(p, v)
205
+ # endif
206
+
207
+ #endif /* !AV_HAVE_BIGENDIAN */
208
+
209
+ /*
210
+ * Define AV_[RW]N helper macros to simplify definitions not provided
211
+ * by per-arch headers.
212
+ */
213
+
214
+ #if defined(__GNUC__) || defined(__clang__)
215
+
216
+ union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
217
+ union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
218
+ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
219
+
220
+ # define AV_RN(s, p) (((const union unaligned_##s *) (p))->l)
221
+ # define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v))
222
+
223
+ #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_X64) || defined(_M_ARM64)) && AV_HAVE_FAST_UNALIGNED
224
+
225
+ # define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
226
+ # define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
227
+
228
+ #elif AV_HAVE_FAST_UNALIGNED
229
+
230
+ # define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
231
+ # define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v))
232
+
233
+ #else
234
+
235
+ #ifndef AV_RB16
236
+ # define AV_RB16(x) \
237
+ ((((const uint8_t*)(x))[0] << 8) | \
238
+ ((const uint8_t*)(x))[1])
239
+ #endif
240
+ #ifndef AV_WB16
241
+ # define AV_WB16(p, val) do { \
242
+ uint16_t d = (val); \
243
+ ((uint8_t*)(p))[1] = (d); \
244
+ ((uint8_t*)(p))[0] = (d)>>8; \
245
+ } while(0)
246
+ #endif
247
+
248
+ #ifndef AV_RL16
249
+ # define AV_RL16(x) \
250
+ ((((const uint8_t*)(x))[1] << 8) | \
251
+ ((const uint8_t*)(x))[0])
252
+ #endif
253
+ #ifndef AV_WL16
254
+ # define AV_WL16(p, val) do { \
255
+ uint16_t d = (val); \
256
+ ((uint8_t*)(p))[0] = (d); \
257
+ ((uint8_t*)(p))[1] = (d)>>8; \
258
+ } while(0)
259
+ #endif
260
+
261
+ #ifndef AV_RB32
262
+ # define AV_RB32(x) \
263
+ (((uint32_t)((const uint8_t*)(x))[0] << 24) | \
264
+ (((const uint8_t*)(x))[1] << 16) | \
265
+ (((const uint8_t*)(x))[2] << 8) | \
266
+ ((const uint8_t*)(x))[3])
267
+ #endif
268
+ #ifndef AV_WB32
269
+ # define AV_WB32(p, val) do { \
270
+ uint32_t d = (val); \
271
+ ((uint8_t*)(p))[3] = (d); \
272
+ ((uint8_t*)(p))[2] = (d)>>8; \
273
+ ((uint8_t*)(p))[1] = (d)>>16; \
274
+ ((uint8_t*)(p))[0] = (d)>>24; \
275
+ } while(0)
276
+ #endif
277
+
278
+ #ifndef AV_RL32
279
+ # define AV_RL32(x) \
280
+ (((uint32_t)((const uint8_t*)(x))[3] << 24) | \
281
+ (((const uint8_t*)(x))[2] << 16) | \
282
+ (((const uint8_t*)(x))[1] << 8) | \
283
+ ((const uint8_t*)(x))[0])
284
+ #endif
285
+ #ifndef AV_WL32
286
+ # define AV_WL32(p, val) do { \
287
+ uint32_t d = (val); \
288
+ ((uint8_t*)(p))[0] = (d); \
289
+ ((uint8_t*)(p))[1] = (d)>>8; \
290
+ ((uint8_t*)(p))[2] = (d)>>16; \
291
+ ((uint8_t*)(p))[3] = (d)>>24; \
292
+ } while(0)
293
+ #endif
294
+
295
+ #ifndef AV_RB64
296
+ # define AV_RB64(x) \
297
+ (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
298
+ ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
299
+ ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
300
+ ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
301
+ ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
302
+ ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
303
+ ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
304
+ (uint64_t)((const uint8_t*)(x))[7])
305
+ #endif
306
+ #ifndef AV_WB64
307
+ # define AV_WB64(p, val) do { \
308
+ uint64_t d = (val); \
309
+ ((uint8_t*)(p))[7] = (d); \
310
+ ((uint8_t*)(p))[6] = (d)>>8; \
311
+ ((uint8_t*)(p))[5] = (d)>>16; \
312
+ ((uint8_t*)(p))[4] = (d)>>24; \
313
+ ((uint8_t*)(p))[3] = (d)>>32; \
314
+ ((uint8_t*)(p))[2] = (d)>>40; \
315
+ ((uint8_t*)(p))[1] = (d)>>48; \
316
+ ((uint8_t*)(p))[0] = (d)>>56; \
317
+ } while(0)
318
+ #endif
319
+
320
+ #ifndef AV_RL64
321
+ # define AV_RL64(x) \
322
+ (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
323
+ ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
324
+ ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
325
+ ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
326
+ ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
327
+ ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
328
+ ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
329
+ (uint64_t)((const uint8_t*)(x))[0])
330
+ #endif
331
+ #ifndef AV_WL64
332
+ # define AV_WL64(p, val) do { \
333
+ uint64_t d = (val); \
334
+ ((uint8_t*)(p))[0] = (d); \
335
+ ((uint8_t*)(p))[1] = (d)>>8; \
336
+ ((uint8_t*)(p))[2] = (d)>>16; \
337
+ ((uint8_t*)(p))[3] = (d)>>24; \
338
+ ((uint8_t*)(p))[4] = (d)>>32; \
339
+ ((uint8_t*)(p))[5] = (d)>>40; \
340
+ ((uint8_t*)(p))[6] = (d)>>48; \
341
+ ((uint8_t*)(p))[7] = (d)>>56; \
342
+ } while(0)
343
+ #endif
344
+
345
+ #if AV_HAVE_BIGENDIAN
346
+ # define AV_RN(s, p) AV_RB##s(p)
347
+ # define AV_WN(s, p, v) AV_WB##s(p, v)
348
+ #else
349
+ # define AV_RN(s, p) AV_RL##s(p)
350
+ # define AV_WN(s, p, v) AV_WL##s(p, v)
351
+ #endif
352
+
353
+ #endif /* HAVE_FAST_UNALIGNED */
354
+
355
+ #ifndef AV_RN16
356
+ # define AV_RN16(p) AV_RN(16, p)
357
+ #endif
358
+
359
+ #ifndef AV_RN32
360
+ # define AV_RN32(p) AV_RN(32, p)
361
+ #endif
362
+
363
+ #ifndef AV_RN64
364
+ # define AV_RN64(p) AV_RN(64, p)
365
+ #endif
366
+
367
+ #ifndef AV_WN16
368
+ # define AV_WN16(p, v) AV_WN(16, p, v)
369
+ #endif
370
+
371
+ #ifndef AV_WN32
372
+ # define AV_WN32(p, v) AV_WN(32, p, v)
373
+ #endif
374
+
375
+ #ifndef AV_WN64
376
+ # define AV_WN64(p, v) AV_WN(64, p, v)
377
+ #endif
378
+
379
+ #if AV_HAVE_BIGENDIAN
380
+ # define AV_RB(s, p) AV_RN##s(p)
381
+ # define AV_WB(s, p, v) AV_WN##s(p, v)
382
+ # define AV_RL(s, p) av_bswap##s(AV_RN##s(p))
383
+ # define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v))
384
+ #else
385
+ # define AV_RB(s, p) av_bswap##s(AV_RN##s(p))
386
+ # define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v))
387
+ # define AV_RL(s, p) AV_RN##s(p)
388
+ # define AV_WL(s, p, v) AV_WN##s(p, v)
389
+ #endif
390
+
391
+ #define AV_RB8(x) (((const uint8_t*)(x))[0])
392
+ #define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
393
+
394
+ #define AV_RL8(x) AV_RB8(x)
395
+ #define AV_WL8(p, d) AV_WB8(p, d)
396
+
397
+ #ifndef AV_RB16
398
+ # define AV_RB16(p) AV_RB(16, p)
399
+ #endif
400
+ #ifndef AV_WB16
401
+ # define AV_WB16(p, v) AV_WB(16, p, v)
402
+ #endif
403
+
404
+ #ifndef AV_RL16
405
+ # define AV_RL16(p) AV_RL(16, p)
406
+ #endif
407
+ #ifndef AV_WL16
408
+ # define AV_WL16(p, v) AV_WL(16, p, v)
409
+ #endif
410
+
411
+ #ifndef AV_RB32
412
+ # define AV_RB32(p) AV_RB(32, p)
413
+ #endif
414
+ #ifndef AV_WB32
415
+ # define AV_WB32(p, v) AV_WB(32, p, v)
416
+ #endif
417
+
418
+ #ifndef AV_RL32
419
+ # define AV_RL32(p) AV_RL(32, p)
420
+ #endif
421
+ #ifndef AV_WL32
422
+ # define AV_WL32(p, v) AV_WL(32, p, v)
423
+ #endif
424
+
425
+ #ifndef AV_RB64
426
+ # define AV_RB64(p) AV_RB(64, p)
427
+ #endif
428
+ #ifndef AV_WB64
429
+ # define AV_WB64(p, v) AV_WB(64, p, v)
430
+ #endif
431
+
432
+ #ifndef AV_RL64
433
+ # define AV_RL64(p) AV_RL(64, p)
434
+ #endif
435
+ #ifndef AV_WL64
436
+ # define AV_WL64(p, v) AV_WL(64, p, v)
437
+ #endif
438
+
439
+ #ifndef AV_RB24
440
+ # define AV_RB24(x) \
441
+ ((((const uint8_t*)(x))[0] << 16) | \
442
+ (((const uint8_t*)(x))[1] << 8) | \
443
+ ((const uint8_t*)(x))[2])
444
+ #endif
445
+ #ifndef AV_WB24
446
+ # define AV_WB24(p, d) do { \
447
+ ((uint8_t*)(p))[2] = (d); \
448
+ ((uint8_t*)(p))[1] = (d)>>8; \
449
+ ((uint8_t*)(p))[0] = (d)>>16; \
450
+ } while(0)
451
+ #endif
452
+
453
+ #ifndef AV_RL24
454
+ # define AV_RL24(x) \
455
+ ((((const uint8_t*)(x))[2] << 16) | \
456
+ (((const uint8_t*)(x))[1] << 8) | \
457
+ ((const uint8_t*)(x))[0])
458
+ #endif
459
+ #ifndef AV_WL24
460
+ # define AV_WL24(p, d) do { \
461
+ ((uint8_t*)(p))[0] = (d); \
462
+ ((uint8_t*)(p))[1] = (d)>>8; \
463
+ ((uint8_t*)(p))[2] = (d)>>16; \
464
+ } while(0)
465
+ #endif
466
+
467
+ #ifndef AV_RB48
468
+ # define AV_RB48(x) \
469
+ (((uint64_t)((const uint8_t*)(x))[0] << 40) | \
470
+ ((uint64_t)((const uint8_t*)(x))[1] << 32) | \
471
+ ((uint64_t)((const uint8_t*)(x))[2] << 24) | \
472
+ ((uint64_t)((const uint8_t*)(x))[3] << 16) | \
473
+ ((uint64_t)((const uint8_t*)(x))[4] << 8) | \
474
+ (uint64_t)((const uint8_t*)(x))[5])
475
+ #endif
476
+ #ifndef AV_WB48
477
+ # define AV_WB48(p, darg) do { \
478
+ uint64_t d = (darg); \
479
+ ((uint8_t*)(p))[5] = (d); \
480
+ ((uint8_t*)(p))[4] = (d)>>8; \
481
+ ((uint8_t*)(p))[3] = (d)>>16; \
482
+ ((uint8_t*)(p))[2] = (d)>>24; \
483
+ ((uint8_t*)(p))[1] = (d)>>32; \
484
+ ((uint8_t*)(p))[0] = (d)>>40; \
485
+ } while(0)
486
+ #endif
487
+
488
+ #ifndef AV_RL48
489
+ # define AV_RL48(x) \
490
+ (((uint64_t)((const uint8_t*)(x))[5] << 40) | \
491
+ ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
492
+ ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
493
+ ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
494
+ ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
495
+ (uint64_t)((const uint8_t*)(x))[0])
496
+ #endif
497
+ #ifndef AV_WL48
498
+ # define AV_WL48(p, darg) do { \
499
+ uint64_t d = (darg); \
500
+ ((uint8_t*)(p))[0] = (d); \
501
+ ((uint8_t*)(p))[1] = (d)>>8; \
502
+ ((uint8_t*)(p))[2] = (d)>>16; \
503
+ ((uint8_t*)(p))[3] = (d)>>24; \
504
+ ((uint8_t*)(p))[4] = (d)>>32; \
505
+ ((uint8_t*)(p))[5] = (d)>>40; \
506
+ } while(0)
507
+ #endif
508
+
509
+ /*
510
+ * The AV_[RW]NA macros access naturally aligned data
511
+ * in a type-safe way.
512
+ */
513
+
514
+ #define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s)
515
+ #define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v))
516
+
517
+ #ifndef AV_RN16A
518
+ # define AV_RN16A(p) AV_RNA(16, p)
519
+ #endif
520
+
521
+ #ifndef AV_RN32A
522
+ # define AV_RN32A(p) AV_RNA(32, p)
523
+ #endif
524
+
525
+ #ifndef AV_RN64A
526
+ # define AV_RN64A(p) AV_RNA(64, p)
527
+ #endif
528
+
529
+ #ifndef AV_WN16A
530
+ # define AV_WN16A(p, v) AV_WNA(16, p, v)
531
+ #endif
532
+
533
+ #ifndef AV_WN32A
534
+ # define AV_WN32A(p, v) AV_WNA(32, p, v)
535
+ #endif
536
+
537
+ #ifndef AV_WN64A
538
+ # define AV_WN64A(p, v) AV_WNA(64, p, v)
539
+ #endif
540
+
541
+ #if AV_HAVE_BIGENDIAN
542
+ # define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
543
+ # define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
544
+ # define AV_RBA(s, p) AV_RN##s##A(p)
545
+ # define AV_WBA(s, p, v) AV_WN##s##A(p, v)
546
+ #else
547
+ # define AV_RLA(s, p) AV_RN##s##A(p)
548
+ # define AV_WLA(s, p, v) AV_WN##s##A(p, v)
549
+ # define AV_RBA(s, p) av_bswap##s(AV_RN##s##A(p))
550
+ # define AV_WBA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
551
+ #endif
552
+
553
+ #ifndef AV_RL16A
554
+ # define AV_RL16A(p) AV_RLA(16, p)
555
+ #endif
556
+ #ifndef AV_WL16A
557
+ # define AV_WL16A(p, v) AV_WLA(16, p, v)
558
+ #endif
559
+
560
+ #ifndef AV_RB16A
561
+ # define AV_RB16A(p) AV_RBA(16, p)
562
+ #endif
563
+ #ifndef AV_WB16A
564
+ # define AV_WB16A(p, v) AV_WBA(16, p, v)
565
+ #endif
566
+
567
+ #ifndef AV_RL32A
568
+ # define AV_RL32A(p) AV_RLA(32, p)
569
+ #endif
570
+ #ifndef AV_WL32A
571
+ # define AV_WL32A(p, v) AV_WLA(32, p, v)
572
+ #endif
573
+
574
+ #ifndef AV_RB32A
575
+ # define AV_RB32A(p) AV_RBA(32, p)
576
+ #endif
577
+ #ifndef AV_WB32A
578
+ # define AV_WB32A(p, v) AV_WBA(32, p, v)
579
+ #endif
580
+
581
+ #ifndef AV_RL64A
582
+ # define AV_RL64A(p) AV_RLA(64, p)
583
+ #endif
584
+ #ifndef AV_WL64A
585
+ # define AV_WL64A(p, v) AV_WLA(64, p, v)
586
+ #endif
587
+
588
+ #ifndef AV_RB64A
589
+ # define AV_RB64A(p) AV_RBA(64, p)
590
+ #endif
591
+ #ifndef AV_WB64A
592
+ # define AV_WB64A(p, v) AV_WBA(64, p, v)
593
+ #endif
594
+
595
+ /*
596
+ * The AV_COPYxxU macros are suitable for copying data to/from unaligned
597
+ * memory locations.
598
+ */
599
+
600
+ #define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s));
601
+
602
+ #ifndef AV_COPY16U
603
+ # define AV_COPY16U(d, s) AV_COPYU(16, d, s)
604
+ #endif
605
+
606
+ #ifndef AV_COPY32U
607
+ # define AV_COPY32U(d, s) AV_COPYU(32, d, s)
608
+ #endif
609
+
610
+ #ifndef AV_COPY64U
611
+ # define AV_COPY64U(d, s) AV_COPYU(64, d, s)
612
+ #endif
613
+
614
+ #ifndef AV_COPY128U
615
+ # define AV_COPY128U(d, s) \
616
+ do { \
617
+ AV_COPY64U(d, s); \
618
+ AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \
619
+ } while(0)
620
+ #endif
621
+
622
+ /* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
623
+ * naturally aligned.
624
+ */
625
+
626
+ #define AV_COPY(n, d, s) \
627
+ (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n)
628
+
629
+ #ifndef AV_COPY16
630
+ # define AV_COPY16(d, s) AV_COPY(16, d, s)
631
+ #endif
632
+
633
+ #ifndef AV_COPY32
634
+ # define AV_COPY32(d, s) AV_COPY(32, d, s)
635
+ #endif
636
+
637
+ #ifndef AV_COPY64
638
+ # define AV_COPY64(d, s) AV_COPY(64, d, s)
639
+ #endif
640
+
641
+ #ifndef AV_COPY128
642
+ # define AV_COPY128(d, s) \
643
+ do { \
644
+ AV_COPY64(d, s); \
645
+ AV_COPY64((char*)(d)+8, (char*)(s)+8); \
646
+ } while(0)
647
+ #endif
648
+
649
+ #define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b))
650
+
651
+ #ifndef AV_SWAP64
652
+ # define AV_SWAP64(a, b) AV_SWAP(64, a, b)
653
+ #endif
654
+
655
+ #define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0)
656
+
657
+ #ifndef AV_ZERO16
658
+ # define AV_ZERO16(d) AV_ZERO(16, d)
659
+ #endif
660
+
661
+ #ifndef AV_ZERO32
662
+ # define AV_ZERO32(d) AV_ZERO(32, d)
663
+ #endif
664
+
665
+ #ifndef AV_ZERO64
666
+ # define AV_ZERO64(d) AV_ZERO(64, d)
667
+ #endif
668
+
669
+ #ifndef AV_ZERO128
670
+ # define AV_ZERO128(d) \
671
+ do { \
672
+ AV_ZERO64(d); \
673
+ AV_ZERO64((char*)(d)+8); \
674
+ } while(0)
675
+ #endif
676
+
677
+ #endif /* AVUTIL_INTREADWRITE_H */
ffmpeg/include/libavutil/lfg.h ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Lagged Fibonacci PRNG
3
+ * Copyright (c) 2008 Michael Niedermayer
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_LFG_H
23
+ #define AVUTIL_LFG_H
24
+
25
+ #include <stdint.h>
26
+
27
+ /**
28
+ * Context structure for the Lagged Fibonacci PRNG.
29
+ * The exact layout, types and content of this struct may change and should
30
+ * not be accessed directly. Only its `sizeof()` is guaranteed to stay the same
31
+ * to allow easy instanciation.
32
+ */
33
+ typedef struct AVLFG {
34
+ unsigned int state[64];
35
+ int index;
36
+ } AVLFG;
37
+
38
+ void av_lfg_init(AVLFG *c, unsigned int seed);
39
+
40
+ /**
41
+ * Seed the state of the ALFG using binary data.
42
+ *
43
+ * @return 0 on success, negative value (AVERROR) on failure.
44
+ */
45
+ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
46
+
47
+ /**
48
+ * Get the next random unsigned 32-bit number using an ALFG.
49
+ *
50
+ * Please also consider a simple LCG like state= state*1664525+1013904223,
51
+ * it may be good enough and faster for your specific use case.
52
+ */
53
+ static inline unsigned int av_lfg_get(AVLFG *c){
54
+ unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
55
+ c->index += 1U;
56
+ return a;
57
+ }
58
+
59
+ /**
60
+ * Get the next random unsigned 32-bit number using a MLFG.
61
+ *
62
+ * Please also consider av_lfg_get() above, it is faster.
63
+ */
64
+ static inline unsigned int av_mlfg_get(AVLFG *c){
65
+ unsigned int a= c->state[(c->index-55) & 63];
66
+ unsigned int b= c->state[(c->index-24) & 63];
67
+ a = c->state[c->index & 63] = 2*a*b+a+b;
68
+ c->index += 1U;
69
+ return a;
70
+ }
71
+
72
+ /**
73
+ * Get the next two numbers generated by a Box-Muller Gaussian
74
+ * generator using the random numbers issued by lfg.
75
+ *
76
+ * @param lfg pointer to the contex structure
77
+ * @param out array where the two generated numbers are placed
78
+ */
79
+ void av_bmg_get(AVLFG *lfg, double out[2]);
80
+
81
+ #endif /* AVUTIL_LFG_H */
ffmpeg/include/libavutil/log.h ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_LOG_H
22
+ #define AVUTIL_LOG_H
23
+
24
+ #include <stdarg.h>
25
+ #include "attributes.h"
26
+ #include "version.h"
27
+
28
+ typedef enum {
29
+ AV_CLASS_CATEGORY_NA = 0,
30
+ AV_CLASS_CATEGORY_INPUT,
31
+ AV_CLASS_CATEGORY_OUTPUT,
32
+ AV_CLASS_CATEGORY_MUXER,
33
+ AV_CLASS_CATEGORY_DEMUXER,
34
+ AV_CLASS_CATEGORY_ENCODER,
35
+ AV_CLASS_CATEGORY_DECODER,
36
+ AV_CLASS_CATEGORY_FILTER,
37
+ AV_CLASS_CATEGORY_BITSTREAM_FILTER,
38
+ AV_CLASS_CATEGORY_SWSCALER,
39
+ AV_CLASS_CATEGORY_SWRESAMPLER,
40
+ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
41
+ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
42
+ AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
43
+ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
44
+ AV_CLASS_CATEGORY_DEVICE_OUTPUT,
45
+ AV_CLASS_CATEGORY_DEVICE_INPUT,
46
+ AV_CLASS_CATEGORY_NB ///< not part of ABI/API
47
+ }AVClassCategory;
48
+
49
+ enum AVClassStateFlags {
50
+ /**
51
+ * Object initialization has finished and it is now in the 'runtime' stage.
52
+ * This affects e.g. what options can be set on the object (only
53
+ * AV_OPT_FLAG_RUNTIME_PARAM options can be set on initialized objects).
54
+ */
55
+ AV_CLASS_STATE_INITIALIZED = (1 << 0),
56
+ };
57
+
58
+ #define AV_IS_INPUT_DEVICE(category) \
59
+ (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
60
+ ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
61
+ ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
62
+
63
+ #define AV_IS_OUTPUT_DEVICE(category) \
64
+ (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
65
+ ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
66
+ ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
67
+
68
+ struct AVOptionRanges;
69
+
70
+ /**
71
+ * Describe the class of an AVClass context structure. That is an
72
+ * arbitrary struct of which the first field is a pointer to an
73
+ * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
74
+ */
75
+ typedef struct AVClass {
76
+ /**
77
+ * The name of the class; usually it is the same name as the
78
+ * context structure type to which the AVClass is associated.
79
+ */
80
+ const char* class_name;
81
+
82
+ /**
83
+ * A pointer to a function which returns the name of a context
84
+ * instance ctx associated with the class.
85
+ */
86
+ const char* (*item_name)(void* ctx);
87
+
88
+ /**
89
+ * An array of options for the structure or NULL.
90
+ * When non-NULL, the array must be terminated by an option with a NULL
91
+ * name.
92
+ *
93
+ * @see av_set_default_options()
94
+ */
95
+ const struct AVOption *option;
96
+
97
+ /**
98
+ * LIBAVUTIL_VERSION with which this structure was created.
99
+ * This is used to allow fields to be added to AVClass without requiring
100
+ * major version bumps everywhere.
101
+ */
102
+
103
+ int version;
104
+
105
+ /**
106
+ * Offset in the structure where the log level offset is stored. The log
107
+ * level offset is an int added to the log level for logging with this
108
+ * object as the context.
109
+ *
110
+ * 0 means there is no such variable.
111
+ */
112
+ int log_level_offset_offset;
113
+
114
+ /**
115
+ * Offset in the structure where a pointer to the parent context for
116
+ * logging is stored. For example a decoder could pass its AVCodecContext
117
+ * to eval as such a parent context, which an ::av_log() implementation
118
+ * could then leverage to display the parent context.
119
+ *
120
+ * When the pointer is NULL, or this offset is zero, the object is assumed
121
+ * to have no parent.
122
+ */
123
+ int parent_log_context_offset;
124
+
125
+ /**
126
+ * Category used for visualization (like color).
127
+ *
128
+ * Only used when ::get_category() is NULL. Use this field when all
129
+ * instances of this class have the same category, use ::get_category()
130
+ * otherwise.
131
+ */
132
+ AVClassCategory category;
133
+
134
+ /**
135
+ * Callback to return the instance category. Use this callback when
136
+ * different instances of this class may have different categories,
137
+ * ::category otherwise.
138
+ */
139
+ AVClassCategory (*get_category)(void* ctx);
140
+
141
+ /**
142
+ * Callback to return the supported/allowed ranges.
143
+ */
144
+ int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
145
+
146
+ /**
147
+ * Return next AVOptions-enabled child or NULL
148
+ */
149
+ void* (*child_next)(void *obj, void *prev);
150
+
151
+ /**
152
+ * Iterate over the AVClasses corresponding to potential AVOptions-enabled
153
+ * children.
154
+ *
155
+ * @param iter pointer to opaque iteration state. The caller must initialize
156
+ * *iter to NULL before the first call.
157
+ * @return AVClass for the next AVOptions-enabled child or NULL if there are
158
+ * no more such children.
159
+ *
160
+ * @note The difference between ::child_next() and ::child_class_iterate()
161
+ * is that ::child_next() iterates over _actual_ children of an
162
+ * _existing_ object instance, while ::child_class_iterate() iterates
163
+ * over the classes of all _potential_ children of any possible
164
+ * instance of this class.
165
+ */
166
+ const struct AVClass* (*child_class_iterate)(void **iter);
167
+
168
+ /**
169
+ * When non-zero, offset in the object to an unsigned int holding object
170
+ * state flags, a combination of AVClassStateFlags values. The flags are
171
+ * updated by the object to signal its state to the generic code.
172
+ *
173
+ * Added in version 59.41.100.
174
+ */
175
+ int state_flags_offset;
176
+ } AVClass;
177
+
178
+ /**
179
+ * @addtogroup lavu_log
180
+ *
181
+ * @{
182
+ *
183
+ * @defgroup lavu_log_constants Logging Constants
184
+ *
185
+ * @{
186
+ */
187
+
188
+ /**
189
+ * Print no output.
190
+ */
191
+ #define AV_LOG_QUIET -8
192
+
193
+ /**
194
+ * Something went really wrong and we will crash now.
195
+ */
196
+ #define AV_LOG_PANIC 0
197
+
198
+ /**
199
+ * Something went wrong and recovery is not possible.
200
+ * For example, no header was found for a format which depends
201
+ * on headers or an illegal combination of parameters is used.
202
+ */
203
+ #define AV_LOG_FATAL 8
204
+
205
+ /**
206
+ * Something went wrong and cannot losslessly be recovered.
207
+ * However, not all future data is affected.
208
+ */
209
+ #define AV_LOG_ERROR 16
210
+
211
+ /**
212
+ * Something somehow does not look correct. This may or may not
213
+ * lead to problems. An example would be the use of '-vstrict -2'.
214
+ */
215
+ #define AV_LOG_WARNING 24
216
+
217
+ /**
218
+ * Standard information.
219
+ */
220
+ #define AV_LOG_INFO 32
221
+
222
+ /**
223
+ * Detailed information.
224
+ */
225
+ #define AV_LOG_VERBOSE 40
226
+
227
+ /**
228
+ * Stuff which is only useful for libav* developers.
229
+ */
230
+ #define AV_LOG_DEBUG 48
231
+
232
+ /**
233
+ * Extremely verbose debugging, useful for libav* development.
234
+ */
235
+ #define AV_LOG_TRACE 56
236
+
237
+ #define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
238
+
239
+ /**
240
+ * @}
241
+ */
242
+
243
+ /**
244
+ * Sets additional colors for extended debugging sessions.
245
+ * @code
246
+ av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
247
+ @endcode
248
+ * Requires 256color terminal support. Uses outside debugging is not
249
+ * recommended.
250
+ */
251
+ #define AV_LOG_C(x) ((x) << 8)
252
+
253
+ /**
254
+ * Send the specified message to the log if the level is less than or equal
255
+ * to the current av_log_level. By default, all logging messages are sent to
256
+ * stderr. This behavior can be altered by setting a different logging callback
257
+ * function.
258
+ * @see av_log_set_callback
259
+ *
260
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
261
+ * pointer to an AVClass struct or NULL if general log.
262
+ * @param level The importance level of the message expressed using a @ref
263
+ * lavu_log_constants "Logging Constant".
264
+ * @param fmt The format string (printf-compatible) that specifies how
265
+ * subsequent arguments are converted to output.
266
+ */
267
+ void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
268
+
269
+ /**
270
+ * Send the specified message to the log once with the initial_level and then with
271
+ * the subsequent_level. By default, all logging messages are sent to
272
+ * stderr. This behavior can be altered by setting a different logging callback
273
+ * function.
274
+ * @see av_log
275
+ *
276
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
277
+ * pointer to an AVClass struct or NULL if general log.
278
+ * @param initial_level importance level of the message expressed using a @ref
279
+ * lavu_log_constants "Logging Constant" for the first occurance.
280
+ * @param subsequent_level importance level of the message expressed using a @ref
281
+ * lavu_log_constants "Logging Constant" after the first occurance.
282
+ * @param fmt The format string (printf-compatible) that specifies how
283
+ * subsequent arguments are converted to output.
284
+ * @param state a variable to keep trak of if a message has already been printed
285
+ * this must be initialized to 0 before the first use. The same state
286
+ * must not be accessed by 2 Threads simultaneously.
287
+ */
288
+ void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...) av_printf_format(5, 6);
289
+
290
+
291
+ /**
292
+ * Send the specified message to the log if the level is less than or equal
293
+ * to the current av_log_level. By default, all logging messages are sent to
294
+ * stderr. This behavior can be altered by setting a different logging callback
295
+ * function.
296
+ * @see av_log_set_callback
297
+ *
298
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
299
+ * pointer to an AVClass struct.
300
+ * @param level The importance level of the message expressed using a @ref
301
+ * lavu_log_constants "Logging Constant".
302
+ * @param fmt The format string (printf-compatible) that specifies how
303
+ * subsequent arguments are converted to output.
304
+ * @param vl The arguments referenced by the format string.
305
+ */
306
+ void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
307
+
308
+ /**
309
+ * Get the current log level
310
+ *
311
+ * @see lavu_log_constants
312
+ *
313
+ * @return Current log level
314
+ */
315
+ int av_log_get_level(void);
316
+
317
+ /**
318
+ * Set the log level
319
+ *
320
+ * @see lavu_log_constants
321
+ *
322
+ * @param level Logging level
323
+ */
324
+ void av_log_set_level(int level);
325
+
326
+ /**
327
+ * Set the logging callback
328
+ *
329
+ * @note The callback must be thread safe, even if the application does not use
330
+ * threads itself as some codecs are multithreaded.
331
+ *
332
+ * @see av_log_default_callback
333
+ *
334
+ * @param callback A logging function with a compatible signature.
335
+ */
336
+ void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
337
+
338
+ /**
339
+ * Default logging callback
340
+ *
341
+ * It prints the message to stderr, optionally colorizing it.
342
+ *
343
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
344
+ * pointer to an AVClass struct.
345
+ * @param level The importance level of the message expressed using a @ref
346
+ * lavu_log_constants "Logging Constant".
347
+ * @param fmt The format string (printf-compatible) that specifies how
348
+ * subsequent arguments are converted to output.
349
+ * @param vl The arguments referenced by the format string.
350
+ */
351
+ void av_log_default_callback(void *avcl, int level, const char *fmt,
352
+ va_list vl);
353
+
354
+ /**
355
+ * Return the context name
356
+ *
357
+ * @param ctx The AVClass context
358
+ *
359
+ * @return The AVClass class_name
360
+ */
361
+ const char* av_default_item_name(void* ctx);
362
+ AVClassCategory av_default_get_category(void *ptr);
363
+
364
+ /**
365
+ * Format a line of log the same way as the default callback.
366
+ * @param line buffer to receive the formatted line
367
+ * @param line_size size of the buffer
368
+ * @param print_prefix used to store whether the prefix must be printed;
369
+ * must point to a persistent integer initially set to 1
370
+ */
371
+ void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
372
+ char *line, int line_size, int *print_prefix);
373
+
374
+ /**
375
+ * Format a line of log the same way as the default callback.
376
+ * @param line buffer to receive the formatted line;
377
+ * may be NULL if line_size is 0
378
+ * @param line_size size of the buffer; at most line_size-1 characters will
379
+ * be written to the buffer, plus one null terminator
380
+ * @param print_prefix used to store whether the prefix must be printed;
381
+ * must point to a persistent integer initially set to 1
382
+ * @return Returns a negative value if an error occurred, otherwise returns
383
+ * the number of characters that would have been written for a
384
+ * sufficiently large buffer, not including the terminating null
385
+ * character. If the return value is not less than line_size, it means
386
+ * that the log message was truncated to fit the buffer.
387
+ */
388
+ int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
389
+ char *line, int line_size, int *print_prefix);
390
+
391
+ /**
392
+ * Skip repeated messages, this requires the user app to use av_log() instead of
393
+ * (f)printf as the 2 would otherwise interfere and lead to
394
+ * "Last message repeated x times" messages below (f)printf messages with some
395
+ * bad luck.
396
+ * Also to receive the last, "last repeated" line if any, the user app must
397
+ * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
398
+ */
399
+ #define AV_LOG_SKIP_REPEATED 1
400
+
401
+ /**
402
+ * Include the log severity in messages originating from codecs.
403
+ *
404
+ * Results in messages such as:
405
+ * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
406
+ */
407
+ #define AV_LOG_PRINT_LEVEL 2
408
+
409
+ void av_log_set_flags(int arg);
410
+ int av_log_get_flags(void);
411
+
412
+ /**
413
+ * @}
414
+ */
415
+
416
+ #endif /* AVUTIL_LOG_H */
ffmpeg/include/libavutil/lzo.h ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * LZO 1x decompression
3
+ * copyright (c) 2006 Reimar Doeffinger
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_LZO_H
23
+ #define AVUTIL_LZO_H
24
+
25
+ /**
26
+ * @defgroup lavu_lzo LZO
27
+ * @ingroup lavu_crypto
28
+ *
29
+ * @{
30
+ */
31
+
32
+ #include <stdint.h>
33
+
34
+ /** @name Error flags returned by av_lzo1x_decode
35
+ * @{ */
36
+ /// end of the input buffer reached before decoding finished
37
+ #define AV_LZO_INPUT_DEPLETED 1
38
+ /// decoded data did not fit into output buffer
39
+ #define AV_LZO_OUTPUT_FULL 2
40
+ /// a reference to previously decoded data was wrong
41
+ #define AV_LZO_INVALID_BACKPTR 4
42
+ /// a non-specific error in the compressed bitstream
43
+ #define AV_LZO_ERROR 8
44
+ /** @} */
45
+
46
+ #define AV_LZO_INPUT_PADDING 8
47
+ #define AV_LZO_OUTPUT_PADDING 12
48
+
49
+ /**
50
+ * @brief Decodes LZO 1x compressed data.
51
+ * @param out output buffer
52
+ * @param outlen size of output buffer, number of bytes left are returned here
53
+ * @param in input buffer
54
+ * @param inlen size of input buffer, number of bytes left are returned here
55
+ * @return 0 on success, otherwise a combination of the error flags above
56
+ *
57
+ * Make sure all buffers are appropriately padded, in must provide
58
+ * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
59
+ */
60
+ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
61
+
62
+ /**
63
+ * @}
64
+ */
65
+
66
+ #endif /* AVUTIL_LZO_H */
ffmpeg/include/libavutil/macros.h ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ /**
20
+ * @file
21
+ * @ingroup lavu
22
+ * Utility Preprocessor macros
23
+ */
24
+
25
+ #ifndef AVUTIL_MACROS_H
26
+ #define AVUTIL_MACROS_H
27
+
28
+ #include "libavutil/avconfig.h"
29
+
30
+ #if AV_HAVE_BIGENDIAN
31
+ # define AV_NE(be, le) (be)
32
+ #else
33
+ # define AV_NE(be, le) (le)
34
+ #endif
35
+
36
+ /**
37
+ * Comparator.
38
+ * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
39
+ * if x == y. This is useful for instance in a qsort comparator callback.
40
+ * Furthermore, compilers are able to optimize this to branchless code, and
41
+ * there is no risk of overflow with signed types.
42
+ * As with many macros, this evaluates its argument multiple times, it thus
43
+ * must not have a side-effect.
44
+ */
45
+ #define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
46
+
47
+ #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
48
+ #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
49
+ #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
50
+ #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
51
+
52
+ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
53
+ #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
54
+
55
+ #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
56
+ #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
57
+
58
+ /**
59
+ * @addtogroup preproc_misc Preprocessor String Macros
60
+ *
61
+ * String manipulation macros
62
+ *
63
+ * @{
64
+ */
65
+
66
+ #define AV_STRINGIFY(s) AV_TOSTRING(s)
67
+ #define AV_TOSTRING(s) #s
68
+
69
+ #define AV_GLUE(a, b) a ## b
70
+ #define AV_JOIN(a, b) AV_GLUE(a, b)
71
+
72
+ /**
73
+ * @}
74
+ */
75
+
76
+ #define AV_PRAGMA(s) _Pragma(#s)
77
+
78
+ #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
79
+
80
+ #endif /* AVUTIL_MACROS_H */
ffmpeg/include/libavutil/mastering_display_metadata.h ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2016 Neil Birkbeck <neil.birkbeck@gmail.com>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H
22
+ #define AVUTIL_MASTERING_DISPLAY_METADATA_H
23
+
24
+ #include "frame.h"
25
+ #include "rational.h"
26
+
27
+
28
+ /**
29
+ * Mastering display metadata capable of representing the color volume of
30
+ * the display used to master the content (SMPTE 2086:2014).
31
+ *
32
+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
33
+ * appropriate type.
34
+ *
35
+ * @note The struct should be allocated with av_mastering_display_metadata_alloc()
36
+ * and its size is not a part of the public ABI.
37
+ */
38
+ typedef struct AVMasteringDisplayMetadata {
39
+ /**
40
+ * CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
41
+ */
42
+ AVRational display_primaries[3][2];
43
+
44
+ /**
45
+ * CIE 1931 xy chromaticity coords of white point.
46
+ */
47
+ AVRational white_point[2];
48
+
49
+ /**
50
+ * Min luminance of mastering display (cd/m^2).
51
+ */
52
+ AVRational min_luminance;
53
+
54
+ /**
55
+ * Max luminance of mastering display (cd/m^2).
56
+ */
57
+ AVRational max_luminance;
58
+
59
+ /**
60
+ * Flag indicating whether the display primaries (and white point) are set.
61
+ */
62
+ int has_primaries;
63
+
64
+ /**
65
+ * Flag indicating whether the luminance (min_ and max_) have been set.
66
+ */
67
+ int has_luminance;
68
+
69
+ } AVMasteringDisplayMetadata;
70
+
71
+ /**
72
+ * Allocate an AVMasteringDisplayMetadata structure and set its fields to
73
+ * default values. The resulting struct can be freed using av_freep().
74
+ *
75
+ * @return An AVMasteringDisplayMetadata filled with default values or NULL
76
+ * on failure.
77
+ */
78
+ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
79
+
80
+ /**
81
+ * Allocate an AVMasteringDisplayMetadata structure and set its fields to
82
+ * default values. The resulting struct can be freed using av_freep().
83
+ *
84
+ * @return An AVMasteringDisplayMetadata filled with default values or NULL
85
+ * on failure.
86
+ */
87
+ AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc_size(size_t *size);
88
+
89
+ /**
90
+ * Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
91
+ *
92
+ * @param frame The frame which side data is added to.
93
+ *
94
+ * @return The AVMasteringDisplayMetadata structure to be filled by caller.
95
+ */
96
+ AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
97
+
98
+ /**
99
+ * Content light level needed by to transmit HDR over HDMI (CTA-861.3).
100
+ *
101
+ * To be used as payload of a AVFrameSideData or AVPacketSideData with the
102
+ * appropriate type.
103
+ *
104
+ * @note The struct should be allocated with av_content_light_metadata_alloc()
105
+ * and its size is not a part of the public ABI.
106
+ */
107
+ typedef struct AVContentLightMetadata {
108
+ /**
109
+ * Max content light level (cd/m^2).
110
+ */
111
+ unsigned MaxCLL;
112
+
113
+ /**
114
+ * Max average light level per frame (cd/m^2).
115
+ */
116
+ unsigned MaxFALL;
117
+ } AVContentLightMetadata;
118
+
119
+ /**
120
+ * Allocate an AVContentLightMetadata structure and set its fields to
121
+ * default values. The resulting struct can be freed using av_freep().
122
+ *
123
+ * @return An AVContentLightMetadata filled with default values or NULL
124
+ * on failure.
125
+ */
126
+ AVContentLightMetadata *av_content_light_metadata_alloc(size_t *size);
127
+
128
+ /**
129
+ * Allocate a complete AVContentLightMetadata and add it to the frame.
130
+ *
131
+ * @param frame The frame which side data is added to.
132
+ *
133
+ * @return The AVContentLightMetadata structure to be filled by caller.
134
+ */
135
+ AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame);
136
+
137
+ #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */
ffmpeg/include/libavutil/spherical.h ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2016 Vittorio Giovara <vittorio.giovara@gmail.com>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * @ingroup lavu_video_spherical
24
+ * Spherical video
25
+ */
26
+
27
+ #ifndef AVUTIL_SPHERICAL_H
28
+ #define AVUTIL_SPHERICAL_H
29
+
30
+ #include <stddef.h>
31
+ #include <stdint.h>
32
+
33
+ /**
34
+ * @defgroup lavu_video_spherical Spherical video mapping
35
+ * @ingroup lavu_video
36
+ *
37
+ * A spherical video file contains surfaces that need to be mapped onto a
38
+ * sphere. Depending on how the frame was converted, a different distortion
39
+ * transformation or surface recomposition function needs to be applied before
40
+ * the video should be mapped and displayed.
41
+ * @{
42
+ */
43
+
44
+ /**
45
+ * Projection of the video surface(s) on a sphere.
46
+ */
47
+ enum AVSphericalProjection {
48
+ /**
49
+ * Video represents a sphere mapped on a flat surface using
50
+ * equirectangular projection.
51
+ */
52
+ AV_SPHERICAL_EQUIRECTANGULAR,
53
+
54
+ /**
55
+ * Video frame is split into 6 faces of a cube, and arranged on a
56
+ * 3x2 layout. Faces are oriented upwards for the front, left, right,
57
+ * and back faces. The up face is oriented so the top of the face is
58
+ * forwards and the down face is oriented so the top of the face is
59
+ * to the back.
60
+ */
61
+ AV_SPHERICAL_CUBEMAP,
62
+
63
+ /**
64
+ * Video represents a portion of a sphere mapped on a flat surface
65
+ * using equirectangular projection. The @ref bounding fields indicate
66
+ * the position of the current video in a larger surface.
67
+ */
68
+ AV_SPHERICAL_EQUIRECTANGULAR_TILE,
69
+
70
+ /**
71
+ * Video frame displays as a 180 degree equirectangular projection.
72
+ */
73
+ AV_SPHERICAL_HALF_EQUIRECTANGULAR,
74
+
75
+ /**
76
+ * Video frame displays on a flat, rectangular 2D surface.
77
+ */
78
+ AV_SPHERICAL_RECTILINEAR,
79
+
80
+ /**
81
+ * Fisheye projection (Apple).
82
+ * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
83
+ */
84
+ AV_SPHERICAL_FISHEYE,
85
+ };
86
+
87
+ /**
88
+ * This structure describes how to handle spherical videos, outlining
89
+ * information about projection, initial layout, and any other view modifier.
90
+ *
91
+ * @note The struct must be allocated with av_spherical_alloc() and
92
+ * its size is not a part of the public ABI.
93
+ */
94
+ typedef struct AVSphericalMapping {
95
+ /**
96
+ * Projection type.
97
+ */
98
+ enum AVSphericalProjection projection;
99
+
100
+ /**
101
+ * @name Initial orientation
102
+ * @{
103
+ * There fields describe additional rotations applied to the sphere after
104
+ * the video frame is mapped onto it. The sphere is rotated around the
105
+ * viewer, who remains stationary. The order of transformation is always
106
+ * yaw, followed by pitch, and finally by roll.
107
+ *
108
+ * The coordinate system matches the one defined in OpenGL, where the
109
+ * forward vector (z) is coming out of screen, and it is equivalent to
110
+ * a rotation matrix of R = r_y(yaw) * r_x(pitch) * r_z(roll).
111
+ *
112
+ * A positive yaw rotates the portion of the sphere in front of the viewer
113
+ * toward their right. A positive pitch rotates the portion of the sphere
114
+ * in front of the viewer upwards. A positive roll tilts the portion of
115
+ * the sphere in front of the viewer to the viewer's right.
116
+ *
117
+ * These values are exported as 16.16 fixed point.
118
+ *
119
+ * See this equirectangular projection as example:
120
+ *
121
+ * @code{.unparsed}
122
+ * Yaw
123
+ * -180 0 180
124
+ * 90 +-------------+-------------+ 180
125
+ * | | | up
126
+ * P | | | y| forward
127
+ * i | ^ | | /z
128
+ * t 0 +-------------X-------------+ 0 Roll | /
129
+ * c | | | | /
130
+ * h | | | 0|/_____right
131
+ * | | | x
132
+ * -90 +-------------+-------------+ -180
133
+ *
134
+ * X - the default camera center
135
+ * ^ - the default up vector
136
+ * @endcode
137
+ */
138
+ int32_t yaw; ///< Rotation around the up vector [-180, 180].
139
+ int32_t pitch; ///< Rotation around the right vector [-90, 90].
140
+ int32_t roll; ///< Rotation around the forward vector [-180, 180].
141
+ /**
142
+ * @}
143
+ */
144
+
145
+ /**
146
+ * @name Bounding rectangle
147
+ * @anchor bounding
148
+ * @{
149
+ * These fields indicate the location of the current tile, and where
150
+ * it should be mapped relative to the original surface. They are
151
+ * exported as 0.32 fixed point, and can be converted to classic
152
+ * pixel values with av_spherical_bounds().
153
+ *
154
+ * @code{.unparsed}
155
+ * +----------------+----------+
156
+ * | |bound_top |
157
+ * | +--------+ |
158
+ * | bound_left |tile | |
159
+ * +<---------->| |<--->+bound_right
160
+ * | +--------+ |
161
+ * | | |
162
+ * | bound_bottom| |
163
+ * +----------------+----------+
164
+ * @endcode
165
+ *
166
+ * If needed, the original video surface dimensions can be derived
167
+ * by adding the current stream or frame size to the related bounds,
168
+ * like in the following example:
169
+ *
170
+ * @code{c}
171
+ * original_width = tile->width + bound_left + bound_right;
172
+ * original_height = tile->height + bound_top + bound_bottom;
173
+ * @endcode
174
+ *
175
+ * @note These values are valid only for the tiled equirectangular
176
+ * projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
177
+ * and should be ignored in all other cases.
178
+ */
179
+ uint32_t bound_left; ///< Distance from the left edge
180
+ uint32_t bound_top; ///< Distance from the top edge
181
+ uint32_t bound_right; ///< Distance from the right edge
182
+ uint32_t bound_bottom; ///< Distance from the bottom edge
183
+ /**
184
+ * @}
185
+ */
186
+
187
+ /**
188
+ * Number of pixels to pad from the edge of each cube face.
189
+ *
190
+ * @note This value is valid for only for the cubemap projection type
191
+ * (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
192
+ * cases.
193
+ */
194
+ uint32_t padding;
195
+ } AVSphericalMapping;
196
+
197
+ /**
198
+ * Allocate a AVSphericalVideo structure and initialize its fields to default
199
+ * values.
200
+ *
201
+ * @return the newly allocated struct or NULL on failure
202
+ */
203
+ AVSphericalMapping *av_spherical_alloc(size_t *size);
204
+
205
+ /**
206
+ * Convert the @ref bounding fields from an AVSphericalVideo
207
+ * from 0.32 fixed point to pixels.
208
+ *
209
+ * @param map The AVSphericalVideo map to read bound values from.
210
+ * @param width Width of the current frame or stream.
211
+ * @param height Height of the current frame or stream.
212
+ * @param left Pixels from the left edge.
213
+ * @param top Pixels from the top edge.
214
+ * @param right Pixels from the right edge.
215
+ * @param bottom Pixels from the bottom edge.
216
+ */
217
+ void av_spherical_tile_bounds(const AVSphericalMapping *map,
218
+ size_t width, size_t height,
219
+ size_t *left, size_t *top,
220
+ size_t *right, size_t *bottom);
221
+
222
+ /**
223
+ * Provide a human-readable name of a given AVSphericalProjection.
224
+ *
225
+ * @param projection The input AVSphericalProjection.
226
+ *
227
+ * @return The name of the AVSphericalProjection, or "unknown".
228
+ */
229
+ const char *av_spherical_projection_name(enum AVSphericalProjection projection);
230
+
231
+ /**
232
+ * Get the AVSphericalProjection form a human-readable name.
233
+ *
234
+ * @param name The input string.
235
+ *
236
+ * @return The AVSphericalProjection value, or -1 if not found.
237
+ */
238
+ int av_spherical_from_name(const char *name);
239
+ /**
240
+ * @}
241
+ */
242
+
243
+ #endif /* AVUTIL_SPHERICAL_H */
ffmpeg/include/libavutil/stereo3d.h ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * @ingroup lavu_video_stereo3d
24
+ * Stereoscopic video
25
+ */
26
+
27
+ #ifndef AVUTIL_STEREO3D_H
28
+ #define AVUTIL_STEREO3D_H
29
+
30
+ #include <stdint.h>
31
+
32
+ #include "frame.h"
33
+
34
+ /**
35
+ * @defgroup lavu_video_stereo3d Stereo3D types and functions
36
+ * @ingroup lavu_video
37
+ *
38
+ * A stereoscopic video file consists in multiple views embedded in a single
39
+ * frame, usually describing two views of a scene. This file describes all
40
+ * possible codec-independent view arrangements.
41
+ *
42
+ * @{
43
+ */
44
+
45
+ /**
46
+ * List of possible 3D Types
47
+ */
48
+ enum AVStereo3DType {
49
+ /**
50
+ * Video is not stereoscopic (and metadata has to be there).
51
+ */
52
+ AV_STEREO3D_2D,
53
+
54
+ /**
55
+ * Views are next to each other.
56
+ *
57
+ * @code{.unparsed}
58
+ * LLLLRRRR
59
+ * LLLLRRRR
60
+ * LLLLRRRR
61
+ * ...
62
+ * @endcode
63
+ */
64
+ AV_STEREO3D_SIDEBYSIDE,
65
+
66
+ /**
67
+ * Views are on top of each other.
68
+ *
69
+ * @code{.unparsed}
70
+ * LLLLLLLL
71
+ * LLLLLLLL
72
+ * RRRRRRRR
73
+ * RRRRRRRR
74
+ * @endcode
75
+ */
76
+ AV_STEREO3D_TOPBOTTOM,
77
+
78
+ /**
79
+ * Views are alternated temporally.
80
+ *
81
+ * @code{.unparsed}
82
+ * frame0 frame1 frame2 ...
83
+ * LLLLLLLL RRRRRRRR LLLLLLLL
84
+ * LLLLLLLL RRRRRRRR LLLLLLLL
85
+ * LLLLLLLL RRRRRRRR LLLLLLLL
86
+ * ... ... ...
87
+ * @endcode
88
+ */
89
+ AV_STEREO3D_FRAMESEQUENCE,
90
+
91
+ /**
92
+ * Views are packed in a checkerboard-like structure per pixel.
93
+ *
94
+ * @code{.unparsed}
95
+ * LRLRLRLR
96
+ * RLRLRLRL
97
+ * LRLRLRLR
98
+ * ...
99
+ * @endcode
100
+ */
101
+ AV_STEREO3D_CHECKERBOARD,
102
+
103
+ /**
104
+ * Views are next to each other, but when upscaling
105
+ * apply a checkerboard pattern.
106
+ *
107
+ * @code{.unparsed}
108
+ * LLLLRRRR L L L L R R R R
109
+ * LLLLRRRR => L L L L R R R R
110
+ * LLLLRRRR L L L L R R R R
111
+ * LLLLRRRR L L L L R R R R
112
+ * @endcode
113
+ */
114
+ AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
115
+
116
+ /**
117
+ * Views are packed per line, as if interlaced.
118
+ *
119
+ * @code{.unparsed}
120
+ * LLLLLLLL
121
+ * RRRRRRRR
122
+ * LLLLLLLL
123
+ * ...
124
+ * @endcode
125
+ */
126
+ AV_STEREO3D_LINES,
127
+
128
+ /**
129
+ * Views are packed per column.
130
+ *
131
+ * @code{.unparsed}
132
+ * LRLRLRLR
133
+ * LRLRLRLR
134
+ * LRLRLRLR
135
+ * ...
136
+ * @endcode
137
+ */
138
+ AV_STEREO3D_COLUMNS,
139
+
140
+ /**
141
+ * Video is stereoscopic but the packing is unspecified.
142
+ */
143
+ AV_STEREO3D_UNSPEC,
144
+ };
145
+
146
+ /**
147
+ * List of possible view types.
148
+ */
149
+ enum AVStereo3DView {
150
+ /**
151
+ * Frame contains two packed views.
152
+ */
153
+ AV_STEREO3D_VIEW_PACKED,
154
+
155
+ /**
156
+ * Frame contains only the left view.
157
+ */
158
+ AV_STEREO3D_VIEW_LEFT,
159
+
160
+ /**
161
+ * Frame contains only the right view.
162
+ */
163
+ AV_STEREO3D_VIEW_RIGHT,
164
+
165
+ /**
166
+ * Content is unspecified.
167
+ */
168
+ AV_STEREO3D_VIEW_UNSPEC,
169
+ };
170
+
171
+ /**
172
+ * List of possible primary eyes.
173
+ */
174
+ enum AVStereo3DPrimaryEye {
175
+ /**
176
+ * Neither eye.
177
+ */
178
+ AV_PRIMARY_EYE_NONE,
179
+
180
+ /**
181
+ * Left eye.
182
+ */
183
+ AV_PRIMARY_EYE_LEFT,
184
+
185
+ /**
186
+ * Right eye
187
+ */
188
+ AV_PRIMARY_EYE_RIGHT,
189
+ };
190
+
191
+ /**
192
+ * Inverted views, Right/Bottom represents the left view.
193
+ */
194
+ #define AV_STEREO3D_FLAG_INVERT (1 << 0)
195
+
196
+ /**
197
+ * Stereo 3D type: this structure describes how two videos are packed
198
+ * within a single video surface, with additional information as needed.
199
+ *
200
+ * @note The struct must be allocated with av_stereo3d_alloc() and
201
+ * its size is not a part of the public ABI.
202
+ */
203
+ typedef struct AVStereo3D {
204
+ /**
205
+ * How views are packed within the video.
206
+ */
207
+ enum AVStereo3DType type;
208
+
209
+ /**
210
+ * Additional information about the frame packing.
211
+ */
212
+ int flags;
213
+
214
+ /**
215
+ * Determines which views are packed.
216
+ */
217
+ enum AVStereo3DView view;
218
+
219
+ /**
220
+ * Which eye is the primary eye when rendering in 2D.
221
+ */
222
+ enum AVStereo3DPrimaryEye primary_eye;
223
+
224
+ /**
225
+ * The distance between the centres of the lenses of the camera system,
226
+ * in micrometers. Zero if unset.
227
+ */
228
+ uint32_t baseline;
229
+
230
+ /**
231
+ * Relative shift of the left and right images, which changes the zero parallax plane.
232
+ * Range is -1.0 to 1.0. Zero if unset.
233
+ */
234
+ AVRational horizontal_disparity_adjustment;
235
+
236
+ /**
237
+ * Horizontal field of view, in degrees. Zero if unset.
238
+ */
239
+ AVRational horizontal_field_of_view;
240
+ } AVStereo3D;
241
+
242
+ /**
243
+ * Allocate an AVStereo3D structure and set its fields to default values.
244
+ * The resulting struct can be freed using av_freep().
245
+ *
246
+ * @return An AVStereo3D filled with default values or NULL on failure.
247
+ */
248
+ AVStereo3D *av_stereo3d_alloc(void);
249
+
250
+ /**
251
+ * Allocate an AVStereo3D structure and set its fields to default values.
252
+ * The resulting struct can be freed using av_freep().
253
+ *
254
+ * @return An AVStereo3D filled with default values or NULL on failure.
255
+ */
256
+ AVStereo3D *av_stereo3d_alloc_size(size_t *size);
257
+
258
+ /**
259
+ * Allocate a complete AVFrameSideData and add it to the frame.
260
+ *
261
+ * @param frame The frame which side data is added to.
262
+ *
263
+ * @return The AVStereo3D structure to be filled by caller.
264
+ */
265
+ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
266
+
267
+ /**
268
+ * Provide a human-readable name of a given stereo3d type.
269
+ *
270
+ * @param type The input stereo3d type value.
271
+ *
272
+ * @return The name of the stereo3d value, or "unknown".
273
+ */
274
+ const char *av_stereo3d_type_name(unsigned int type);
275
+
276
+ /**
277
+ * Get the AVStereo3DType form a human-readable name.
278
+ *
279
+ * @param name The input string.
280
+ *
281
+ * @return The AVStereo3DType value, or -1 if not found.
282
+ */
283
+ int av_stereo3d_from_name(const char *name);
284
+
285
+ /**
286
+ * Provide a human-readable name of a given stereo3d view.
287
+ *
288
+ * @param type The input stereo3d view value.
289
+ *
290
+ * @return The name of the stereo3d view value, or "unknown".
291
+ */
292
+ const char *av_stereo3d_view_name(unsigned int view);
293
+
294
+ /**
295
+ * Get the AVStereo3DView form a human-readable name.
296
+ *
297
+ * @param name The input string.
298
+ *
299
+ * @return The AVStereo3DView value, or -1 if not found.
300
+ */
301
+ int av_stereo3d_view_from_name(const char *name);
302
+
303
+ /**
304
+ * Provide a human-readable name of a given stereo3d primary eye.
305
+ *
306
+ * @param type The input stereo3d primary eye value.
307
+ *
308
+ * @return The name of the stereo3d primary eye value, or "unknown".
309
+ */
310
+ const char *av_stereo3d_primary_eye_name(unsigned int eye);
311
+
312
+ /**
313
+ * Get the AVStereo3DPrimaryEye form a human-readable name.
314
+ *
315
+ * @param name The input string.
316
+ *
317
+ * @return The AVStereo3DPrimaryEye value, or -1 if not found.
318
+ */
319
+ int av_stereo3d_primary_eye_from_name(const char *name);
320
+
321
+ /**
322
+ * @}
323
+ */
324
+
325
+ #endif /* AVUTIL_STEREO3D_H */
ffmpeg/include/libavutil/tea.h ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * A 32-bit implementation of the TEA algorithm
3
+ * Copyright (c) 2015 Vesselin Bontchev
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_TEA_H
23
+ #define AVUTIL_TEA_H
24
+
25
+ #include <stdint.h>
26
+
27
+ /**
28
+ * @file
29
+ * @brief Public header for libavutil TEA algorithm
30
+ * @defgroup lavu_tea TEA
31
+ * @ingroup lavu_crypto
32
+ * @{
33
+ */
34
+
35
+ extern const int av_tea_size;
36
+
37
+ struct AVTEA;
38
+
39
+ /**
40
+ * Allocate an AVTEA context
41
+ * To free the struct: av_free(ptr)
42
+ */
43
+ struct AVTEA *av_tea_alloc(void);
44
+
45
+ /**
46
+ * Initialize an AVTEA context.
47
+ *
48
+ * @param ctx an AVTEA context
49
+ * @param key a key of 16 bytes used for encryption/decryption
50
+ * @param rounds the number of rounds in TEA (64 is the "standard")
51
+ */
52
+ void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds);
53
+
54
+ /**
55
+ * Encrypt or decrypt a buffer using a previously initialized context.
56
+ *
57
+ * @param ctx an AVTEA context
58
+ * @param dst destination array, can be equal to src
59
+ * @param src source array, can be equal to dst
60
+ * @param count number of 8 byte blocks
61
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
62
+ * @param decrypt 0 for encryption, 1 for decryption
63
+ */
64
+ void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src,
65
+ int count, uint8_t *iv, int decrypt);
66
+
67
+ /**
68
+ * @}
69
+ */
70
+
71
+ #endif /* AVUTIL_TEA_H */
ffmpeg/include/libavutil/threadmessage.h ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public License
6
+ * as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public License
15
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_THREADMESSAGE_H
20
+ #define AVUTIL_THREADMESSAGE_H
21
+
22
+ typedef struct AVThreadMessageQueue AVThreadMessageQueue;
23
+
24
+ typedef enum AVThreadMessageFlags {
25
+
26
+ /**
27
+ * Perform non-blocking operation.
28
+ * If this flag is set, send and recv operations are non-blocking and
29
+ * return AVERROR(EAGAIN) immediately if they can not proceed.
30
+ */
31
+ AV_THREAD_MESSAGE_NONBLOCK = 1,
32
+
33
+ } AVThreadMessageFlags;
34
+
35
+ /**
36
+ * Allocate a new message queue.
37
+ *
38
+ * @param mq pointer to the message queue
39
+ * @param nelem maximum number of elements in the queue
40
+ * @param elsize size of each element in the queue
41
+ * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if
42
+ * lavu was built without thread support
43
+ */
44
+ int av_thread_message_queue_alloc(AVThreadMessageQueue **mq,
45
+ unsigned nelem,
46
+ unsigned elsize);
47
+
48
+ /**
49
+ * Free a message queue.
50
+ *
51
+ * The message queue must no longer be in use by another thread.
52
+ */
53
+ void av_thread_message_queue_free(AVThreadMessageQueue **mq);
54
+
55
+ /**
56
+ * Send a message on the queue.
57
+ */
58
+ int av_thread_message_queue_send(AVThreadMessageQueue *mq,
59
+ void *msg,
60
+ unsigned flags);
61
+
62
+ /**
63
+ * Receive a message from the queue.
64
+ */
65
+ int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
66
+ void *msg,
67
+ unsigned flags);
68
+
69
+ /**
70
+ * Set the sending error code.
71
+ *
72
+ * If the error code is set to non-zero, av_thread_message_queue_send() will
73
+ * return it immediately. Conventional values, such as AVERROR_EOF or
74
+ * AVERROR(EAGAIN), can be used to cause the sending thread to stop or
75
+ * suspend its operation.
76
+ */
77
+ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
78
+ int err);
79
+
80
+ /**
81
+ * Set the receiving error code.
82
+ *
83
+ * If the error code is set to non-zero, av_thread_message_queue_recv() will
84
+ * return it immediately when there are no longer available messages.
85
+ * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
86
+ * to cause the receiving thread to stop or suspend its operation.
87
+ */
88
+ void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
89
+ int err);
90
+
91
+ /**
92
+ * Set the optional free message callback function which will be called if an
93
+ * operation is removing messages from the queue.
94
+ */
95
+ void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq,
96
+ void (*free_func)(void *msg));
97
+
98
+ /**
99
+ * Return the current number of messages in the queue.
100
+ *
101
+ * @return the current number of messages or AVERROR(ENOSYS) if lavu was built
102
+ * without thread support
103
+ */
104
+ int av_thread_message_queue_nb_elems(AVThreadMessageQueue *mq);
105
+
106
+ /**
107
+ * Flush the message queue
108
+ *
109
+ * This function is mostly equivalent to reading and free-ing every message
110
+ * except that it will be done in a single operation (no lock/unlock between
111
+ * reads).
112
+ */
113
+ void av_thread_message_flush(AVThreadMessageQueue *mq);
114
+
115
+ #endif /* AVUTIL_THREADMESSAGE_H */
ffmpeg/include/libavutil/time.h ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2000-2003 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_TIME_H
22
+ #define AVUTIL_TIME_H
23
+
24
+ #include <stdint.h>
25
+
26
+ /**
27
+ * Get the current time in microseconds.
28
+ */
29
+ int64_t av_gettime(void);
30
+
31
+ /**
32
+ * Get the current time in microseconds since some unspecified starting point.
33
+ * On platforms that support it, the time comes from a monotonic clock
34
+ * This property makes this time source ideal for measuring relative time.
35
+ * The returned values may not be monotonic on platforms where a monotonic
36
+ * clock is not available.
37
+ */
38
+ int64_t av_gettime_relative(void);
39
+
40
+ /**
41
+ * Indicates with a boolean result if the av_gettime_relative() time source
42
+ * is monotonic.
43
+ */
44
+ int av_gettime_relative_is_monotonic(void);
45
+
46
+ /**
47
+ * Sleep for a period of time. Although the duration is expressed in
48
+ * microseconds, the actual delay may be rounded to the precision of the
49
+ * system timer.
50
+ *
51
+ * @param usec Number of microseconds to sleep.
52
+ * @return zero on success or (negative) error code.
53
+ */
54
+ int av_usleep(unsigned usec);
55
+
56
+ #endif /* AVUTIL_TIME_H */
ffmpeg/include/libavutil/timecode.h ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier <baptiste.coudurier@gmail.com>
3
+ * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch <clement.boesch@smartjog.com>
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ /**
23
+ * @file
24
+ * Timecode helpers header
25
+ */
26
+
27
+ #ifndef AVUTIL_TIMECODE_H
28
+ #define AVUTIL_TIMECODE_H
29
+
30
+ #include <stdint.h>
31
+ #include "rational.h"
32
+
33
+ #define AV_TIMECODE_STR_SIZE 23
34
+
35
+ enum AVTimecodeFlag {
36
+ AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame
37
+ AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours
38
+ AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed
39
+ };
40
+
41
+ typedef struct {
42
+ int start; ///< timecode frame start (first base frame number)
43
+ uint32_t flags; ///< flags such as drop frame, +24 hours support, ...
44
+ AVRational rate; ///< frame rate in rational form
45
+ unsigned fps; ///< frame per second; must be consistent with the rate field
46
+ } AVTimecode;
47
+
48
+ /**
49
+ * Adjust frame number for NTSC drop frame time code.
50
+ *
51
+ * @param framenum frame number to adjust
52
+ * @param fps frame per second, multiples of 30
53
+ * @return adjusted frame number
54
+ * @warning adjustment is only valid for multiples of NTSC 29.97
55
+ */
56
+ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
57
+
58
+ /**
59
+ * Convert frame number to SMPTE 12M binary representation.
60
+ *
61
+ * @param tc timecode data correctly initialized
62
+ * @param framenum frame number
63
+ * @return the SMPTE binary representation
64
+ *
65
+ * See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)"
66
+ * the format description as follows:
67
+ * bits 0-5: hours, in BCD(6bits)
68
+ * bits 6: BGF1
69
+ * bits 7: BGF2 (NTSC) or FIELD (PAL)
70
+ * bits 8-14: minutes, in BCD(7bits)
71
+ * bits 15: BGF0 (NTSC) or BGF2 (PAL)
72
+ * bits 16-22: seconds, in BCD(7bits)
73
+ * bits 23: FIELD (NTSC) or BGF0 (PAL)
74
+ * bits 24-29: frames, in BCD(6bits)
75
+ * bits 30: drop frame flag (0: non drop, 1: drop)
76
+ * bits 31: color frame flag (0: unsync mode, 1: sync mode)
77
+ * @note BCD numbers (6 or 7 bits): 4 or 5 lower bits for units, 2 higher bits for tens.
78
+ * @note Frame number adjustment is automatically done in case of drop timecode,
79
+ * you do NOT have to call av_timecode_adjust_ntsc_framenum2().
80
+ * @note The frame number is relative to tc->start.
81
+ * @note Color frame (CF) and binary group flags (BGF) bits are set to zero.
82
+ */
83
+ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum);
84
+
85
+ /**
86
+ * Convert sei info to SMPTE 12M binary representation.
87
+ *
88
+ * @param rate frame rate in rational form
89
+ * @param drop drop flag
90
+ * @param hh hour
91
+ * @param mm minute
92
+ * @param ss second
93
+ * @param ff frame number
94
+ * @return the SMPTE binary representation
95
+ */
96
+ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff);
97
+
98
+ /**
99
+ * Load timecode string in buf.
100
+ *
101
+ * @param tc timecode data correctly initialized
102
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
103
+ * @param framenum frame number
104
+ * @return the buf parameter
105
+ *
106
+ * @note Timecode representation can be a negative timecode and have more than
107
+ * 24 hours, but will only be honored if the flags are correctly set.
108
+ * @note The frame number is relative to tc->start.
109
+ */
110
+ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum);
111
+
112
+ /**
113
+ * Get the timecode string from the SMPTE timecode format.
114
+ *
115
+ * In contrast to av_timecode_make_smpte_tc_string this function supports 50/60
116
+ * fps timecodes by using the field bit.
117
+ *
118
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
119
+ * @param rate frame rate of the timecode
120
+ * @param tcsmpte the 32-bit SMPTE timecode
121
+ * @param prevent_df prevent the use of a drop flag when it is known the DF bit
122
+ * is arbitrary
123
+ * @param skip_field prevent the use of a field flag when it is known the field
124
+ * bit is arbitrary (e.g. because it is used as PC flag)
125
+ * @return the buf parameter
126
+ */
127
+ char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field);
128
+
129
+ /**
130
+ * Get the timecode string from the SMPTE timecode format.
131
+ *
132
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
133
+ * @param tcsmpte the 32-bit SMPTE timecode
134
+ * @param prevent_df prevent the use of a drop flag when it is known the DF bit
135
+ * is arbitrary
136
+ * @return the buf parameter
137
+ */
138
+ char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df);
139
+
140
+ /**
141
+ * Get the timecode string from the 25-bit timecode format (MPEG GOP format).
142
+ *
143
+ * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
144
+ * @param tc25bit the 25-bits timecode
145
+ * @return the buf parameter
146
+ */
147
+ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
148
+
149
+ /**
150
+ * Init a timecode struct with the passed parameters.
151
+ *
152
+ * @param tc pointer to an allocated AVTimecode
153
+ * @param rate frame rate in rational form
154
+ * @param flags miscellaneous flags such as drop frame, +24 hours, ...
155
+ * (see AVTimecodeFlag)
156
+ * @param frame_start the first frame number
157
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
158
+ * is a pointer to an AVClass struct (used for av_log)
159
+ * @return 0 on success, AVERROR otherwise
160
+ */
161
+ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
162
+
163
+ /**
164
+ * Init a timecode struct from the passed timecode components.
165
+ *
166
+ * @param tc pointer to an allocated AVTimecode
167
+ * @param rate frame rate in rational form
168
+ * @param flags miscellaneous flags such as drop frame, +24 hours, ...
169
+ * (see AVTimecodeFlag)
170
+ * @param hh hours
171
+ * @param mm minutes
172
+ * @param ss seconds
173
+ * @param ff frames
174
+ * @param log_ctx a pointer to an arbitrary struct of which the first field
175
+ * is a pointer to an AVClass struct (used for av_log)
176
+ * @return 0 on success, AVERROR otherwise
177
+ */
178
+ int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx);
179
+
180
+ /**
181
+ * Parse timecode representation (hh:mm:ss[:;.]ff).
182
+ *
183
+ * @param tc pointer to an allocated AVTimecode
184
+ * @param rate frame rate in rational form
185
+ * @param str timecode string which will determine the frame start
186
+ * @param log_ctx a pointer to an arbitrary struct of which the first field is a
187
+ * pointer to an AVClass struct (used for av_log).
188
+ * @return 0 on success, AVERROR otherwise
189
+ */
190
+ int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx);
191
+
192
+ /**
193
+ * Check if the timecode feature is available for the given frame rate
194
+ *
195
+ * @return 0 if supported, <0 otherwise
196
+ */
197
+ int av_timecode_check_frame_rate(AVRational rate);
198
+
199
+ #endif /* AVUTIL_TIMECODE_H */
ffmpeg/include/libavutil/timestamp.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ /**
20
+ * @file
21
+ * timestamp utils, mostly useful for debugging/logging purposes
22
+ */
23
+
24
+ #ifndef AVUTIL_TIMESTAMP_H
25
+ #define AVUTIL_TIMESTAMP_H
26
+
27
+ #include "avutil.h"
28
+
29
+ #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
30
+ #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
31
+ #endif
32
+
33
+ #define AV_TS_MAX_STRING_SIZE 32
34
+
35
+ /**
36
+ * Fill the provided buffer with a string containing a timestamp
37
+ * representation.
38
+ *
39
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
40
+ * @param ts the timestamp to represent
41
+ * @return the buffer in input
42
+ */
43
+ static inline char *av_ts_make_string(char *buf, int64_t ts)
44
+ {
45
+ if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
46
+ else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts);
47
+ return buf;
48
+ }
49
+
50
+ /**
51
+ * Convenience macro, the return value should be used only directly in
52
+ * function arguments but never stand-alone.
53
+ */
54
+ #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts)
55
+
56
+ /**
57
+ * Fill the provided buffer with a string containing a timestamp time
58
+ * representation.
59
+ *
60
+ * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE
61
+ * @param ts the timestamp to represent
62
+ * @param tb the timebase of the timestamp
63
+ * @return the buffer in input
64
+ */
65
+ char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb);
66
+
67
+ /**
68
+ * Fill the provided buffer with a string containing a timestamp
69
+ * representation.
70
+ *
71
+ * @see av_ts_make_time_string2
72
+ */
73
+ static inline char *av_ts_make_time_string(char *buf, int64_t ts,
74
+ const AVRational *tb)
75
+ {
76
+ return av_ts_make_time_string2(buf, ts, *tb);
77
+ }
78
+
79
+ /**
80
+ * Convenience macro, the return value should be used only directly in
81
+ * function arguments but never stand-alone.
82
+ */
83
+ #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb)
84
+
85
+ #endif /* AVUTIL_TIMESTAMP_H */
ffmpeg/include/libavutil/tree.h ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * A tree container.
24
+ * @author Michael Niedermayer <michaelni@gmx.at>
25
+ */
26
+
27
+ #ifndef AVUTIL_TREE_H
28
+ #define AVUTIL_TREE_H
29
+
30
+ #include "attributes.h"
31
+
32
+ /**
33
+ * @addtogroup lavu_tree AVTree
34
+ * @ingroup lavu_data
35
+ *
36
+ * Low-complexity tree container
37
+ *
38
+ * Insertion, removal, finding equal, largest which is smaller than and
39
+ * smallest which is larger than, all have O(log n) worst-case complexity.
40
+ * @{
41
+ */
42
+
43
+
44
+ struct AVTreeNode;
45
+ extern const int av_tree_node_size;
46
+
47
+ /**
48
+ * Allocate an AVTreeNode.
49
+ */
50
+ struct AVTreeNode *av_tree_node_alloc(void);
51
+
52
+ /**
53
+ * Find an element.
54
+ * @param root a pointer to the root node of the tree
55
+ * @param next If next is not NULL, then next[0] will contain the previous
56
+ * element and next[1] the next element. If either does not exist,
57
+ * then the corresponding entry in next is unchanged.
58
+ * @param cmp compare function used to compare elements in the tree,
59
+ * API identical to that of Standard C's qsort
60
+ * It is guaranteed that the first and only the first argument to cmp()
61
+ * will be the key parameter to av_tree_find(), thus it could if the
62
+ * user wants, be a different type (like an opaque context).
63
+ * @return An element with cmp(key, elem) == 0 or NULL if no such element
64
+ * exists in the tree.
65
+ */
66
+ void *av_tree_find(const struct AVTreeNode *root, void *key,
67
+ int (*cmp)(const void *key, const void *b), void *next[2]);
68
+
69
+ /**
70
+ * Insert or remove an element.
71
+ *
72
+ * If *next is NULL, then the supplied element will be removed if it exists.
73
+ * If *next is non-NULL, then the supplied element will be inserted, unless
74
+ * it already exists in the tree.
75
+ *
76
+ * @param rootp A pointer to a pointer to the root node of the tree; note that
77
+ * the root node can change during insertions, this is required
78
+ * to keep the tree balanced.
79
+ * @param key pointer to the element key to insert in the tree
80
+ * @param next Used to allocate and free AVTreeNodes. For insertion the user
81
+ * must set it to an allocated and zeroed object of at least
82
+ * av_tree_node_size bytes size. av_tree_insert() will set it to
83
+ * NULL if it has been consumed.
84
+ * For deleting elements *next is set to NULL by the user and
85
+ * av_tree_insert() will set it to the AVTreeNode which was
86
+ * used for the removed element.
87
+ * This allows the use of flat arrays, which have
88
+ * lower overhead compared to many malloced elements.
89
+ * You might want to define a function like:
90
+ * @code
91
+ * void *tree_insert(struct AVTreeNode **rootp, void *key,
92
+ * int (*cmp)(void *key, const void *b),
93
+ * AVTreeNode **next)
94
+ * {
95
+ * if (!*next)
96
+ * *next = av_mallocz(av_tree_node_size);
97
+ * return av_tree_insert(rootp, key, cmp, next);
98
+ * }
99
+ * void *tree_remove(struct AVTreeNode **rootp, void *key,
100
+ * int (*cmp)(void *key, const void *b, AVTreeNode **next))
101
+ * {
102
+ * av_freep(next);
103
+ * return av_tree_insert(rootp, key, cmp, next);
104
+ * }
105
+ * @endcode
106
+ * @param cmp compare function used to compare elements in the tree, API identical
107
+ * to that of Standard C's qsort
108
+ * @return If no insertion happened, the found element; if an insertion or
109
+ * removal happened, then either key or NULL will be returned.
110
+ * Which one it is depends on the tree state and the implementation. You
111
+ * should make no assumptions that it's one or the other in the code.
112
+ */
113
+ void *av_tree_insert(struct AVTreeNode **rootp, void *key,
114
+ int (*cmp)(const void *key, const void *b),
115
+ struct AVTreeNode **next);
116
+
117
+ void av_tree_destroy(struct AVTreeNode *t);
118
+
119
+ /**
120
+ * Apply enu(opaque, &elem) to all the elements in the tree in a given range.
121
+ *
122
+ * @param cmp a comparison function that returns < 0 for an element below the
123
+ * range, > 0 for an element above the range and == 0 for an
124
+ * element inside the range
125
+ *
126
+ * @note The cmp function should use the same ordering used to construct the
127
+ * tree.
128
+ */
129
+ void av_tree_enumerate(struct AVTreeNode *t, void *opaque,
130
+ int (*cmp)(void *opaque, void *elem),
131
+ int (*enu)(void *opaque, void *elem));
132
+
133
+ /**
134
+ * @}
135
+ */
136
+
137
+ #endif /* AVUTIL_TREE_H */
ffmpeg/include/libavutil/twofish.h ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * An implementation of the TwoFish algorithm
3
+ * Copyright (c) 2015 Supraja Meedinti
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_TWOFISH_H
23
+ #define AVUTIL_TWOFISH_H
24
+
25
+ #include <stdint.h>
26
+
27
+
28
+ /**
29
+ * @file
30
+ * @brief Public header for libavutil TWOFISH algorithm
31
+ * @defgroup lavu_twofish TWOFISH
32
+ * @ingroup lavu_crypto
33
+ * @{
34
+ */
35
+
36
+ extern const int av_twofish_size;
37
+
38
+ struct AVTWOFISH;
39
+
40
+ /**
41
+ * Allocate an AVTWOFISH context
42
+ * To free the struct: av_free(ptr)
43
+ */
44
+ struct AVTWOFISH *av_twofish_alloc(void);
45
+
46
+ /**
47
+ * Initialize an AVTWOFISH context.
48
+ *
49
+ * @param ctx an AVTWOFISH context
50
+ * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption
51
+ * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise
52
+ */
53
+ int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits);
54
+
55
+ /**
56
+ * Encrypt or decrypt a buffer using a previously initialized context
57
+ *
58
+ * @param ctx an AVTWOFISH context
59
+ * @param dst destination array, can be equal to src
60
+ * @param src source array, can be equal to dst
61
+ * @param count number of 16 byte blocks
62
+ * @param iv initialization vector for CBC mode, NULL for ECB mode
63
+ * @param decrypt 0 for encryption, 1 for decryption
64
+ */
65
+ void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt);
66
+
67
+ /**
68
+ * @}
69
+ */
70
+ #endif /* AVUTIL_TWOFISH_H */
ffmpeg/include/libavutil/tx.h ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_TX_H
20
+ #define AVUTIL_TX_H
21
+
22
+ #include <stdint.h>
23
+ #include <stddef.h>
24
+
25
+ typedef struct AVTXContext AVTXContext;
26
+
27
+ typedef struct AVComplexFloat {
28
+ float re, im;
29
+ } AVComplexFloat;
30
+
31
+ typedef struct AVComplexDouble {
32
+ double re, im;
33
+ } AVComplexDouble;
34
+
35
+ typedef struct AVComplexInt32 {
36
+ int32_t re, im;
37
+ } AVComplexInt32;
38
+
39
+ enum AVTXType {
40
+ /**
41
+ * Standard complex to complex FFT with sample data type of AVComplexFloat,
42
+ * AVComplexDouble or AVComplexInt32, for each respective variant.
43
+ *
44
+ * Output is not 1/len normalized. Scaling currently unsupported.
45
+ * The stride parameter must be set to the size of a single sample in bytes.
46
+ */
47
+ AV_TX_FLOAT_FFT = 0,
48
+ AV_TX_DOUBLE_FFT = 2,
49
+ AV_TX_INT32_FFT = 4,
50
+
51
+ /**
52
+ * Standard MDCT with a sample data type of float, double or int32_t,
53
+ * respecively. For the float and int32 variants, the scale type is
54
+ * 'float', while for the double variant, it's 'double'.
55
+ * If scale is NULL, 1.0 will be used as a default.
56
+ *
57
+ * Length is the frame size, not the window size (which is 2x frame).
58
+ * For forward transforms, the stride specifies the spacing between each
59
+ * sample in the output array in bytes. The input must be a flat array.
60
+ *
61
+ * For inverse transforms, the stride specifies the spacing between each
62
+ * sample in the input array in bytes. The output must be a flat array.
63
+ *
64
+ * NOTE: the inverse transform is half-length, meaning the output will not
65
+ * contain redundant data. This is what most codecs work with. To do a full
66
+ * inverse transform, set the AV_TX_FULL_IMDCT flag on init.
67
+ */
68
+ AV_TX_FLOAT_MDCT = 1,
69
+ AV_TX_DOUBLE_MDCT = 3,
70
+ AV_TX_INT32_MDCT = 5,
71
+
72
+ /**
73
+ * Real to complex and complex to real DFTs.
74
+ * For the float and int32 variants, the scale type is 'float', while for
75
+ * the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
76
+ * as a default.
77
+ *
78
+ * For forward transforms (R2C), stride must be the spacing between two
79
+ * samples in bytes. For inverse transforms, the stride must be set
80
+ * to the spacing between two complex values in bytes.
81
+ *
82
+ * The forward transform performs a real-to-complex DFT of N samples to
83
+ * N/2+1 complex values.
84
+ *
85
+ * The inverse transform performs a complex-to-real DFT of N/2+1 complex
86
+ * values to N real samples. The output is not normalized, but can be
87
+ * made so by setting the scale value to 1.0/len.
88
+ * NOTE: the inverse transform always overwrites the input.
89
+ */
90
+ AV_TX_FLOAT_RDFT = 6,
91
+ AV_TX_DOUBLE_RDFT = 7,
92
+ AV_TX_INT32_RDFT = 8,
93
+
94
+ /**
95
+ * Real to real (DCT) transforms.
96
+ *
97
+ * The forward transform is a DCT-II.
98
+ * The inverse transform is a DCT-III.
99
+ *
100
+ * The input array is always overwritten. DCT-III requires that the
101
+ * input be padded with 2 extra samples. Stride must be set to the
102
+ * spacing between two samples in bytes.
103
+ */
104
+ AV_TX_FLOAT_DCT = 9,
105
+ AV_TX_DOUBLE_DCT = 10,
106
+ AV_TX_INT32_DCT = 11,
107
+
108
+ /**
109
+ * Discrete Cosine Transform I
110
+ *
111
+ * The forward transform is a DCT-I.
112
+ * The inverse transform is a DCT-I multiplied by 2/(N + 1).
113
+ *
114
+ * The input array is always overwritten.
115
+ */
116
+ AV_TX_FLOAT_DCT_I = 12,
117
+ AV_TX_DOUBLE_DCT_I = 13,
118
+ AV_TX_INT32_DCT_I = 14,
119
+
120
+ /**
121
+ * Discrete Sine Transform I
122
+ *
123
+ * The forward transform is a DST-I.
124
+ * The inverse transform is a DST-I multiplied by 2/(N + 1).
125
+ *
126
+ * The input array is always overwritten.
127
+ */
128
+ AV_TX_FLOAT_DST_I = 15,
129
+ AV_TX_DOUBLE_DST_I = 16,
130
+ AV_TX_INT32_DST_I = 17,
131
+
132
+ /* Not part of the API, do not use */
133
+ AV_TX_NB,
134
+ };
135
+
136
+ /**
137
+ * Function pointer to a function to perform the transform.
138
+ *
139
+ * @note Using a different context than the one allocated during av_tx_init()
140
+ * is not allowed.
141
+ *
142
+ * @param s the transform context
143
+ * @param out the output array
144
+ * @param in the input array
145
+ * @param stride the input or output stride in bytes
146
+ *
147
+ * The out and in arrays must be aligned to the maximum required by the CPU
148
+ * architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init().
149
+ * The stride must follow the constraints the transform type has specified.
150
+ */
151
+ typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
152
+
153
+ /**
154
+ * Flags for av_tx_init()
155
+ */
156
+ enum AVTXFlags {
157
+ /**
158
+ * Allows for in-place transformations, where input == output.
159
+ * May be unsupported or slower for some transform types.
160
+ */
161
+ AV_TX_INPLACE = 1ULL << 0,
162
+
163
+ /**
164
+ * Relaxes alignment requirement for the in and out arrays of av_tx_fn().
165
+ * May be slower with certain transform types.
166
+ */
167
+ AV_TX_UNALIGNED = 1ULL << 1,
168
+
169
+ /**
170
+ * Performs a full inverse MDCT rather than leaving out samples that can be
171
+ * derived through symmetry. Requires an output array of 'len' floats,
172
+ * rather than the usual 'len/2' floats.
173
+ * Ignored for all transforms but inverse MDCTs.
174
+ */
175
+ AV_TX_FULL_IMDCT = 1ULL << 2,
176
+
177
+ /**
178
+ * Perform a real to half-complex RDFT.
179
+ * Only the real, or imaginary coefficients will
180
+ * be output, depending on the flag used. Only available for forward RDFTs.
181
+ * Output array must have enough space to hold N complex values
182
+ * (regular size for a real to complex transform).
183
+ */
184
+ AV_TX_REAL_TO_REAL = 1ULL << 3,
185
+ AV_TX_REAL_TO_IMAGINARY = 1ULL << 4,
186
+ };
187
+
188
+ /**
189
+ * Initialize a transform context with the given configuration
190
+ * (i)MDCTs with an odd length are currently not supported.
191
+ *
192
+ * @param ctx the context to allocate, will be NULL on error
193
+ * @param tx pointer to the transform function pointer to set
194
+ * @param type type the type of transform
195
+ * @param inv whether to do an inverse or a forward transform
196
+ * @param len the size of the transform in samples
197
+ * @param scale pointer to the value to scale the output if supported by type
198
+ * @param flags a bitmask of AVTXFlags or 0
199
+ *
200
+ * @return 0 on success, negative error code on failure
201
+ */
202
+ int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
203
+ int inv, int len, const void *scale, uint64_t flags);
204
+
205
+ /**
206
+ * Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
207
+ */
208
+ void av_tx_uninit(AVTXContext **ctx);
209
+
210
+ #endif /* AVUTIL_TX_H */
ffmpeg/include/libavutil/uuid.h ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (c) 2022 Pierre-Anthony Lemieux <pal@palemieux.com>
3
+ * Zane van Iperen <zane@zanevaniperen.com>
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ /**
23
+ * @file
24
+ * UUID parsing and serialization utilities.
25
+ * The library treats the UUID as an opaque sequence of 16 unsigned bytes,
26
+ * i.e. ignoring the internal layout of the UUID, which depends on the type
27
+ * of the UUID.
28
+ *
29
+ * @author Pierre-Anthony Lemieux <pal@palemieux.com>
30
+ * @author Zane van Iperen <zane@zanevaniperen.com>
31
+ */
32
+
33
+ #ifndef AVUTIL_UUID_H
34
+ #define AVUTIL_UUID_H
35
+
36
+ #include <stdint.h>
37
+ #include <string.h>
38
+
39
+ #define AV_PRI_UUID \
40
+ "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
41
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
42
+
43
+ #define AV_PRI_URN_UUID \
44
+ "urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
45
+ "%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
46
+
47
+ /* AV_UUID_ARG() is used together with AV_PRI_UUID() or AV_PRI_URN_UUID
48
+ * to print UUIDs, e.g.
49
+ * av_log(NULL, AV_LOG_DEBUG, "UUID: " AV_PRI_UUID, AV_UUID_ARG(uuid));
50
+ */
51
+ #define AV_UUID_ARG(x) \
52
+ (x)[ 0], (x)[ 1], (x)[ 2], (x)[ 3], \
53
+ (x)[ 4], (x)[ 5], (x)[ 6], (x)[ 7], \
54
+ (x)[ 8], (x)[ 9], (x)[10], (x)[11], \
55
+ (x)[12], (x)[13], (x)[14], (x)[15]
56
+
57
+ #define AV_UUID_LEN 16
58
+
59
+ /* Binary representation of a UUID */
60
+ typedef uint8_t AVUUID[AV_UUID_LEN];
61
+
62
+ /**
63
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
64
+ * into an AVUUID. The parsing is case-insensitive. The string must be 37
65
+ * characters long, including the terminating NUL character.
66
+ *
67
+ * Example string representation: "2fceebd0-7017-433d-bafb-d073a7116696"
68
+ *
69
+ * @param[in] in String representation of a UUID,
70
+ * e.g. 2fceebd0-7017-433d-bafb-d073a7116696
71
+ * @param[out] uu AVUUID
72
+ * @return A non-zero value in case of an error.
73
+ */
74
+ int av_uuid_parse(const char *in, AVUUID uu);
75
+
76
+ /**
77
+ * Parses a URN representation of a UUID, as specified at IETF RFC 4122,
78
+ * into an AVUUID. The parsing is case-insensitive. The string must be 46
79
+ * characters long, including the terminating NUL character.
80
+ *
81
+ * Example string representation: "urn:uuid:2fceebd0-7017-433d-bafb-d073a7116696"
82
+ *
83
+ * @param[in] in URN UUID
84
+ * @param[out] uu AVUUID
85
+ * @return A non-zero value in case of an error.
86
+ */
87
+ int av_uuid_urn_parse(const char *in, AVUUID uu);
88
+
89
+ /**
90
+ * Parses a string representation of a UUID formatted according to IETF RFC 4122
91
+ * into an AVUUID. The parsing is case-insensitive.
92
+ *
93
+ * @param[in] in_start Pointer to the first character of the string representation
94
+ * @param[in] in_end Pointer to the character after the last character of the
95
+ * string representation. That memory location is never
96
+ * accessed. It is an error if `in_end - in_start != 36`.
97
+ * @param[out] uu AVUUID
98
+ * @return A non-zero value in case of an error.
99
+ */
100
+ int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu);
101
+
102
+ /**
103
+ * Serializes a AVUUID into a string representation according to IETF RFC 4122.
104
+ * The string is lowercase and always 37 characters long, including the
105
+ * terminating NUL character.
106
+ *
107
+ * @param[in] uu AVUUID
108
+ * @param[out] out Pointer to an array of no less than 37 characters.
109
+ */
110
+ void av_uuid_unparse(const AVUUID uu, char *out);
111
+
112
+ /**
113
+ * Compares two UUIDs for equality.
114
+ *
115
+ * @param[in] uu1 AVUUID
116
+ * @param[in] uu2 AVUUID
117
+ * @return Nonzero if uu1 and uu2 are identical, 0 otherwise
118
+ */
119
+ static inline int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
120
+ {
121
+ return memcmp(uu1, uu2, AV_UUID_LEN) == 0;
122
+ }
123
+
124
+ /**
125
+ * Copies the bytes of src into dest.
126
+ *
127
+ * @param[out] dest AVUUID
128
+ * @param[in] src AVUUID
129
+ */
130
+ static inline void av_uuid_copy(AVUUID dest, const AVUUID src)
131
+ {
132
+ memcpy(dest, src, AV_UUID_LEN);
133
+ }
134
+
135
+ /**
136
+ * Sets a UUID to the nil UUID, i.e. a UUID with have all
137
+ * its 128 bits set to zero.
138
+ *
139
+ * @param[in,out] uu UUID to be set to the nil UUID
140
+ */
141
+ static inline void av_uuid_nil(AVUUID uu)
142
+ {
143
+ memset(uu, 0, AV_UUID_LEN);
144
+ }
145
+
146
+ #endif /* AVUTIL_UUID_H */
ffmpeg/include/libavutil/version.h ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * copyright (c) 2003 Fabrice Bellard
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ /**
22
+ * @file
23
+ * @ingroup lavu
24
+ * Libavutil version macros
25
+ */
26
+
27
+ #ifndef AVUTIL_VERSION_H
28
+ #define AVUTIL_VERSION_H
29
+
30
+ #include "macros.h"
31
+
32
+ /**
33
+ * @addtogroup version_utils
34
+ *
35
+ * Useful to check and match library version in order to maintain
36
+ * backward compatibility.
37
+ *
38
+ * The FFmpeg libraries follow a versioning sheme very similar to
39
+ * Semantic Versioning (http://semver.org/)
40
+ * The difference is that the component called PATCH is called MICRO in FFmpeg
41
+ * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
42
+ * Also we do not increase MICRO for every bugfix or change in git master.
43
+ *
44
+ * Prior to FFmpeg 3.2 point releases did not change any lib version number to
45
+ * avoid aliassing different git master checkouts.
46
+ * Starting with FFmpeg 3.2, the released library versions will occupy
47
+ * a separate MAJOR.MINOR that is not used on the master development branch.
48
+ * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
49
+ * for the release and master will continue at 55.12.100 after it. Each new
50
+ * point release will then bump the MICRO improving the usefulness of the lib
51
+ * versions.
52
+ *
53
+ * @{
54
+ */
55
+
56
+ #define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
57
+ #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
58
+ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
59
+
60
+ /**
61
+ * Extract version components from the full ::AV_VERSION_INT int as returned
62
+ * by functions like ::avformat_version() and ::avcodec_version()
63
+ */
64
+ #define AV_VERSION_MAJOR(a) ((a) >> 16)
65
+ #define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
66
+ #define AV_VERSION_MICRO(a) ((a) & 0xFF)
67
+
68
+ /**
69
+ * @}
70
+ */
71
+
72
+ /**
73
+ * @defgroup lavu_ver Version and Build diagnostics
74
+ *
75
+ * Macros and function useful to check at compiletime and at runtime
76
+ * which version of libavutil is in use.
77
+ *
78
+ * @{
79
+ */
80
+
81
+ #define LIBAVUTIL_VERSION_MAJOR 59
82
+ #define LIBAVUTIL_VERSION_MINOR 54
83
+ #define LIBAVUTIL_VERSION_MICRO 101
84
+
85
+ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
86
+ LIBAVUTIL_VERSION_MINOR, \
87
+ LIBAVUTIL_VERSION_MICRO)
88
+ #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
89
+ LIBAVUTIL_VERSION_MINOR, \
90
+ LIBAVUTIL_VERSION_MICRO)
91
+ #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
92
+
93
+ #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
94
+
95
+ /**
96
+ * @defgroup lavu_depr_guards Deprecation Guards
97
+ * FF_API_* defines may be placed below to indicate public API that will be
98
+ * dropped at a future version bump. The defines themselves are not part of
99
+ * the public API and may change, break or disappear at any time.
100
+ *
101
+ * @note, when bumping the major version it is recommended to manually
102
+ * disable each FF_API_* in its own commit instead of disabling them all
103
+ * at once through the bump. This improves the git bisect-ability of the change.
104
+ *
105
+ * @{
106
+ */
107
+
108
+ #define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 60)
109
+ #define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 60)
110
+ #define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 60)
111
+ #define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60)
112
+ #define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60)
113
+ #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60)
114
+ #define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60)
115
+ #define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60)
116
+ #define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 60)
117
+ #define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 60)
118
+ #define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 60)
119
+ #define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 60)
120
+
121
+ /**
122
+ * @}
123
+ * @}
124
+ */
125
+
126
+ #endif /* AVUTIL_VERSION_H */
ffmpeg/include/libavutil/video_enc_params.h ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef AVUTIL_VIDEO_ENC_PARAMS_H
20
+ #define AVUTIL_VIDEO_ENC_PARAMS_H
21
+
22
+ #include <stddef.h>
23
+ #include <stdint.h>
24
+
25
+ #include "libavutil/avassert.h"
26
+ #include "libavutil/frame.h"
27
+
28
+ enum AVVideoEncParamsType {
29
+ AV_VIDEO_ENC_PARAMS_NONE = -1,
30
+ /**
31
+ * VP9 stores:
32
+ * - per-frame base (luma AC) quantizer index, exported as AVVideoEncParams.qp
33
+ * - deltas for luma DC, chroma AC and chroma DC, exported in the
34
+ * corresponding entries in AVVideoEncParams.delta_qp
35
+ * - per-segment delta, exported as for each block as AVVideoBlockParams.delta_qp
36
+ *
37
+ * To compute the resulting quantizer index for a block:
38
+ * - for luma AC, add the base qp and the per-block delta_qp, saturating to
39
+ * unsigned 8-bit.
40
+ * - for luma DC and chroma AC/DC, add the corresponding
41
+ * AVVideoBlockParams.delta_qp to the luma AC index, again saturating to
42
+ * unsigned 8-bit.
43
+ */
44
+ AV_VIDEO_ENC_PARAMS_VP9,
45
+
46
+ /**
47
+ * H.264 stores:
48
+ * - in PPS (per-picture):
49
+ * * initial QP_Y (luma) value, exported as AVVideoEncParams.qp
50
+ * * delta(s) for chroma QP values (same for both, or each separately),
51
+ * exported as in the corresponding entries in AVVideoEncParams.delta_qp
52
+ * - per-slice QP delta, not exported directly, added to the per-MB value
53
+ * - per-MB delta; not exported directly; the final per-MB quantizer
54
+ * parameter - QP_Y - minus the value in AVVideoEncParams.qp is exported
55
+ * as AVVideoBlockParams.qp_delta.
56
+ */
57
+ AV_VIDEO_ENC_PARAMS_H264,
58
+
59
+ /*
60
+ * MPEG-2-compatible quantizer.
61
+ *
62
+ * Summing the frame-level qp with the per-block delta_qp gives the
63
+ * resulting quantizer for the block.
64
+ */
65
+ AV_VIDEO_ENC_PARAMS_MPEG2,
66
+ };
67
+
68
+ /**
69
+ * Video encoding parameters for a given frame. This struct is allocated along
70
+ * with an optional array of per-block AVVideoBlockParams descriptors.
71
+ * Must be allocated with av_video_enc_params_alloc().
72
+ */
73
+ typedef struct AVVideoEncParams {
74
+ /**
75
+ * Number of blocks in the array.
76
+ *
77
+ * May be 0, in which case no per-block information is present. In this case
78
+ * the values of blocks_offset / block_size are unspecified and should not
79
+ * be accessed.
80
+ */
81
+ unsigned int nb_blocks;
82
+ /**
83
+ * Offset in bytes from the beginning of this structure at which the array
84
+ * of blocks starts.
85
+ */
86
+ size_t blocks_offset;
87
+ /*
88
+ * Size of each block in bytes. May not match sizeof(AVVideoBlockParams).
89
+ */
90
+ size_t block_size;
91
+
92
+ /**
93
+ * Type of the parameters (the codec they are used with).
94
+ */
95
+ enum AVVideoEncParamsType type;
96
+
97
+ /**
98
+ * Base quantisation parameter for the frame. The final quantiser for a
99
+ * given block in a given plane is obtained from this value, possibly
100
+ * combined with {@code delta_qp} and the per-block delta in a manner
101
+ * documented for each type.
102
+ */
103
+ int32_t qp;
104
+
105
+ /**
106
+ * Quantisation parameter offset from the base (per-frame) qp for a given
107
+ * plane (first index) and AC/DC coefficients (second index).
108
+ */
109
+ int32_t delta_qp[4][2];
110
+ } AVVideoEncParams;
111
+
112
+ /**
113
+ * Data structure for storing block-level encoding information.
114
+ * It is allocated as a part of AVVideoEncParams and should be retrieved with
115
+ * av_video_enc_params_block().
116
+ *
117
+ * sizeof(AVVideoBlockParams) is not a part of the ABI and new fields may be
118
+ * added to it.
119
+ */
120
+ typedef struct AVVideoBlockParams {
121
+ /**
122
+ * Distance in luma pixels from the top-left corner of the visible frame
123
+ * to the top-left corner of the block.
124
+ * Can be negative if top/right padding is present on the coded frame.
125
+ */
126
+ int src_x, src_y;
127
+ /**
128
+ * Width and height of the block in luma pixels.
129
+ */
130
+ int w, h;
131
+
132
+ /**
133
+ * Difference between this block's final quantization parameter and the
134
+ * corresponding per-frame value.
135
+ */
136
+ int32_t delta_qp;
137
+ } AVVideoBlockParams;
138
+
139
+ /**
140
+ * Get the block at the specified {@code idx}. Must be between 0 and nb_blocks - 1.
141
+ */
142
+ static av_always_inline AVVideoBlockParams*
143
+ av_video_enc_params_block(AVVideoEncParams *par, unsigned int idx)
144
+ {
145
+ av_assert0(idx < par->nb_blocks);
146
+ return (AVVideoBlockParams *)((uint8_t *)par + par->blocks_offset +
147
+ idx * par->block_size);
148
+ }
149
+
150
+ /**
151
+ * Allocates memory for AVVideoEncParams of the given type, plus an array of
152
+ * {@code nb_blocks} AVVideoBlockParams and initializes the variables. Can be
153
+ * freed with a normal av_free() call.
154
+ *
155
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
156
+ * written here.
157
+ */
158
+ AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type,
159
+ unsigned int nb_blocks, size_t *out_size);
160
+
161
+ /**
162
+ * Allocates memory for AVEncodeInfoFrame plus an array of
163
+ * {@code nb_blocks} AVEncodeInfoBlock in the given AVFrame {@code frame}
164
+ * as AVFrameSideData of type AV_FRAME_DATA_VIDEO_ENC_PARAMS
165
+ * and initializes the variables.
166
+ */
167
+ AVVideoEncParams*
168
+ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType type,
169
+ unsigned int nb_blocks);
170
+
171
+ #endif /* AVUTIL_VIDEO_ENC_PARAMS_H */
ffmpeg/include/libavutil/video_hint.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Copyright 2023 Elias Carotti <eliascrt at amazon dot it>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef AVUTIL_VIDEO_HINT_H
22
+ #define AVUTIL_VIDEO_HINT_H
23
+
24
+ #include <stddef.h>
25
+ #include <stdint.h>
26
+ #include "libavutil/avassert.h"
27
+ #include "libavutil/frame.h"
28
+
29
+ typedef struct AVVideoRect {
30
+ uint32_t x, y;
31
+ uint32_t width, height;
32
+ } AVVideoRect;
33
+
34
+ typedef enum AVVideoHintType {
35
+ /* rectangled delimit the constant areas (unchanged), default is changed */
36
+ AV_VIDEO_HINT_TYPE_CONSTANT,
37
+
38
+ /* rectangled delimit the constant areas (changed), default is not changed */
39
+ AV_VIDEO_HINT_TYPE_CHANGED,
40
+ } AVVideoHintType;
41
+
42
+ typedef struct AVVideoHint {
43
+ /**
44
+ * Number of AVVideoRect present.
45
+ *
46
+ * May be 0, in which case no per-rectangle information is present. In this
47
+ * case the values of rect_offset / rect_size are unspecified and should
48
+ * not be accessed.
49
+ */
50
+ size_t nb_rects;
51
+
52
+ /**
53
+ * Offset in bytes from the beginning of this structure at which the array
54
+ * of AVVideoRect starts.
55
+ */
56
+ size_t rect_offset;
57
+
58
+ /**
59
+ * Size in bytes of AVVideoRect.
60
+ */
61
+ size_t rect_size;
62
+
63
+ AVVideoHintType type;
64
+ } AVVideoHint;
65
+
66
+ static av_always_inline AVVideoRect *
67
+ av_video_hint_rects(const AVVideoHint *hints) {
68
+ return (AVVideoRect *)((uint8_t *)hints + hints->rect_offset);
69
+ }
70
+
71
+ static av_always_inline AVVideoRect *
72
+ av_video_hint_get_rect(const AVVideoHint *hints, size_t idx) {
73
+ return (AVVideoRect *)((uint8_t *)hints + hints->rect_offset + idx * hints->rect_size);
74
+ }
75
+
76
+ /**
77
+ * Allocate memory for the AVVideoHint struct along with an nb_rects-sized
78
+ * arrays of AVVideoRect.
79
+ *
80
+ * The side data contains a list of rectangles for the portions of the frame
81
+ * which changed from the last encoded one (and the remainder are assumed to be
82
+ * changed), or, alternately (depending on the type parameter) the unchanged
83
+ * ones (and the remanining ones are those which changed).
84
+ * Macroblocks will thus be hinted either to be P_SKIP-ped or go through the
85
+ * regular encoding procedure.
86
+ *
87
+ * It's responsibility of the caller to fill the AVRects accordingly, and to set
88
+ * the proper AVVideoHintType field.
89
+ *
90
+ * @param out_size if non-NULL, the size in bytes of the resulting data array is
91
+ * written here
92
+ *
93
+ * @return newly allocated AVVideoHint struct (must be freed by the caller using
94
+ * av_free()) on success, NULL on memory allocation failure
95
+ */
96
+ AVVideoHint *av_video_hint_alloc(size_t nb_rects,
97
+ size_t *out_size);
98
+
99
+ /**
100
+ * Same as av_video_hint_alloc(), except newly-allocated AVVideoHint is attached
101
+ * as side data of type AV_FRAME_DATA_VIDEO_HINT_INFO to frame.
102
+ */
103
+ AVVideoHint *av_video_hint_create_side_data(AVFrame *frame,
104
+ size_t nb_rects);
105
+
106
+
107
+ #endif /* AVUTIL_VIDEO_HINT_H */
ffmpeg/include/libavutil/xtea.h ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * A 32-bit implementation of the XTEA algorithm
3
+ * Copyright (c) 2012 Samuel Pitoiset
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef AVUTIL_XTEA_H
23
+ #define AVUTIL_XTEA_H
24
+
25
+ #include <stdint.h>
26
+
27
+ /**
28
+ * @file
29
+ * @brief Public header for libavutil XTEA algorithm
30
+ * @defgroup lavu_xtea XTEA
31
+ * @ingroup lavu_crypto
32
+ * @{
33
+ */
34
+
35
+ typedef struct AVXTEA {
36
+ uint32_t key[16];
37
+ } AVXTEA;
38
+
39
+ /**
40
+ * Allocate an AVXTEA context.
41
+ */
42
+ AVXTEA *av_xtea_alloc(void);
43
+
44
+ /**
45
+ * Initialize an AVXTEA context.
46
+ *
47
+ * @param ctx an AVXTEA context
48
+ * @param key a key of 16 bytes used for encryption/decryption,
49
+ * interpreted as big endian 32 bit numbers
50
+ */
51
+ void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
52
+
53
+ /**
54
+ * Initialize an AVXTEA context.
55
+ *
56
+ * @param ctx an AVXTEA context
57
+ * @param key a key of 16 bytes used for encryption/decryption,
58
+ * interpreted as little endian 32 bit numbers
59
+ */
60
+ void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]);
61
+
62
+ /**
63
+ * Encrypt or decrypt a buffer using a previously initialized context,
64
+ * in big endian format.
65
+ *
66
+ * @param ctx an AVXTEA context
67
+ * @param dst destination array, can be equal to src
68
+ * @param src source array, can be equal to dst
69
+ * @param count number of 8 byte blocks
70
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
71
+ * @param decrypt 0 for encryption, 1 for decryption
72
+ */
73
+ void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
74
+ int count, uint8_t *iv, int decrypt);
75
+
76
+ /**
77
+ * Encrypt or decrypt a buffer using a previously initialized context,
78
+ * in little endian format.
79
+ *
80
+ * @param ctx an AVXTEA context
81
+ * @param dst destination array, can be equal to src
82
+ * @param src source array, can be equal to dst
83
+ * @param count number of 8 byte blocks
84
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
85
+ * @param decrypt 0 for encryption, 1 for decryption
86
+ */
87
+ void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
88
+ int count, uint8_t *iv, int decrypt);
89
+
90
+ /**
91
+ * @}
92
+ */
93
+
94
+ #endif /* AVUTIL_XTEA_H */
ffmpeg/include/libpostproc/postprocess.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef POSTPROC_POSTPROCESS_H
22
+ #define POSTPROC_POSTPROCESS_H
23
+
24
+ /**
25
+ * @file
26
+ * @ingroup lpp
27
+ * external API header
28
+ */
29
+
30
+ /**
31
+ * @defgroup lpp libpostproc
32
+ * Video postprocessing library.
33
+ *
34
+ * @{
35
+ */
36
+
37
+ #include "libpostproc/version_major.h"
38
+ #ifndef HAVE_AV_CONFIG_H
39
+ /* When included as part of the ffmpeg build, only include the major version
40
+ * to avoid unnecessary rebuilds. When included externally, keep including
41
+ * the full version information. */
42
+ #include "libpostproc/version.h"
43
+ #endif
44
+
45
+ /**
46
+ * Return the LIBPOSTPROC_VERSION_INT constant.
47
+ */
48
+ unsigned postproc_version(void);
49
+
50
+ /**
51
+ * Return the libpostproc build-time configuration.
52
+ */
53
+ const char *postproc_configuration(void);
54
+
55
+ /**
56
+ * Return the libpostproc license.
57
+ */
58
+ const char *postproc_license(void);
59
+
60
+ #define PP_QUALITY_MAX 6
61
+
62
+ #include <inttypes.h>
63
+
64
+ typedef void pp_context;
65
+ typedef void pp_mode;
66
+
67
+ extern const char pp_help[]; ///< a simple help text
68
+
69
+ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
70
+ uint8_t * dst[3], const int dstStride[3],
71
+ int horizontalSize, int verticalSize,
72
+ const int8_t *QP_store, int QP_stride,
73
+ pp_mode *mode, pp_context *ppContext, int pict_type);
74
+
75
+
76
+ /**
77
+ * Return a pp_mode or NULL if an error occurred.
78
+ *
79
+ * @param name the string after "-pp" on the command line
80
+ * @param quality a number from 0 to PP_QUALITY_MAX
81
+ */
82
+ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);
83
+ void pp_free_mode(pp_mode *mode);
84
+
85
+ pp_context *pp_get_context(int width, int height, int flags);
86
+ void pp_free_context(pp_context *ppContext);
87
+
88
+ #define PP_CPU_CAPS_MMX 0x80000000
89
+ #define PP_CPU_CAPS_MMX2 0x20000000
90
+ #define PP_CPU_CAPS_3DNOW 0x40000000
91
+ #define PP_CPU_CAPS_ALTIVEC 0x10000000
92
+ #define PP_CPU_CAPS_AUTO 0x00080000
93
+
94
+ #define PP_FORMAT 0x00000008
95
+ #define PP_FORMAT_420 (0x00000011|PP_FORMAT)
96
+ #define PP_FORMAT_422 (0x00000001|PP_FORMAT)
97
+ #define PP_FORMAT_411 (0x00000002|PP_FORMAT)
98
+ #define PP_FORMAT_444 (0x00000000|PP_FORMAT)
99
+ #define PP_FORMAT_440 (0x00000010|PP_FORMAT)
100
+
101
+ #define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale
102
+
103
+ /**
104
+ * @}
105
+ */
106
+
107
+ #endif /* POSTPROC_POSTPROCESS_H */
ffmpeg/include/libpostproc/version.h ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Version macros.
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef POSTPROC_VERSION_H
22
+ #define POSTPROC_VERSION_H
23
+
24
+ /**
25
+ * @file
26
+ * Libpostproc version macros
27
+ */
28
+
29
+ #include "libavutil/version.h"
30
+
31
+ #include "version_major.h"
32
+
33
+ #define LIBPOSTPROC_VERSION_MINOR 4
34
+ #define LIBPOSTPROC_VERSION_MICRO 100
35
+
36
+ #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
37
+ LIBPOSTPROC_VERSION_MINOR, \
38
+ LIBPOSTPROC_VERSION_MICRO)
39
+ #define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
40
+ LIBPOSTPROC_VERSION_MINOR, \
41
+ LIBPOSTPROC_VERSION_MICRO)
42
+ #define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
43
+
44
+ #define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
45
+
46
+ #endif /* POSTPROC_VERSION_H */
ffmpeg/include/libpostproc/version_major.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Version macros.
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef POSTPROC_VERSION_MAJOR_H
22
+ #define POSTPROC_VERSION_MAJOR_H
23
+
24
+ /**
25
+ * @file
26
+ * Libpostproc version macros
27
+ */
28
+
29
+ #define LIBPOSTPROC_VERSION_MAJOR 58
30
+
31
+ #endif /* POSTPROC_VERSION_MAJOR_H */
ffmpeg/include/libswresample/swresample.h ADDED
@@ -0,0 +1,587 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (C) 2011-2013 Michael Niedermayer (michaelni@gmx.at)
3
+ *
4
+ * This file is part of libswresample
5
+ *
6
+ * libswresample is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * libswresample is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with libswresample; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef SWRESAMPLE_SWRESAMPLE_H
22
+ #define SWRESAMPLE_SWRESAMPLE_H
23
+
24
+ /**
25
+ * @file
26
+ * @ingroup lswr
27
+ * libswresample public header
28
+ */
29
+
30
+ /**
31
+ * @defgroup lswr libswresample
32
+ * @{
33
+ *
34
+ * Audio resampling, sample format conversion and mixing library.
35
+ *
36
+ * Interaction with lswr is done through SwrContext, which is
37
+ * allocated with swr_alloc() or swr_alloc_set_opts2(). It is opaque, so all parameters
38
+ * must be set with the @ref avoptions API.
39
+ *
40
+ * The first thing you will need to do in order to use lswr is to allocate
41
+ * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts2(). If you
42
+ * are using the former, you must set options through the @ref avoptions API.
43
+ * The latter function provides the same feature, but it allows you to set some
44
+ * common options in the same statement.
45
+ *
46
+ * For example the following code will setup conversion from planar float sample
47
+ * format to interleaved signed 16-bit integer, downsampling from 48kHz to
48
+ * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing
49
+ * matrix). This is using the swr_alloc() function.
50
+ * @code
51
+ * SwrContext *swr = swr_alloc();
52
+ * av_opt_set_chlayout(swr, "in_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1, 0);
53
+ * av_opt_set_chlayout(swr, "out_chlayout", &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, 0);
54
+ * av_opt_set_int(swr, "in_sample_rate", 48000, 0);
55
+ * av_opt_set_int(swr, "out_sample_rate", 44100, 0);
56
+ * av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
57
+ * av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
58
+ * @endcode
59
+ *
60
+ * The same job can be done using swr_alloc_set_opts2() as well:
61
+ * @code
62
+ * SwrContext *swr = NULL;
63
+ * int ret = swr_alloc_set_opts2(&swr, // we're allocating a new context
64
+ * &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, // out_ch_layout
65
+ * AV_SAMPLE_FMT_S16, // out_sample_fmt
66
+ * 44100, // out_sample_rate
67
+ * &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1, // in_ch_layout
68
+ * AV_SAMPLE_FMT_FLTP, // in_sample_fmt
69
+ * 48000, // in_sample_rate
70
+ * 0, // log_offset
71
+ * NULL); // log_ctx
72
+ * @endcode
73
+ *
74
+ * Once all values have been set, it must be initialized with swr_init(). If
75
+ * you need to change the conversion parameters, you can change the parameters
76
+ * using @ref avoptions, as described above in the first example; or by using
77
+ * swr_alloc_set_opts2(), but with the first argument the allocated context.
78
+ * You must then call swr_init() again.
79
+ *
80
+ * The conversion itself is done by repeatedly calling swr_convert().
81
+ * Note that the samples may get buffered in swr if you provide insufficient
82
+ * output space or if sample rate conversion is done, which requires "future"
83
+ * samples. Samples that do not require future input can be retrieved at any
84
+ * time by using swr_convert() (in_count can be set to 0).
85
+ * At the end of conversion the resampling buffer can be flushed by calling
86
+ * swr_convert() with NULL in and 0 in_count.
87
+ *
88
+ * The samples used in the conversion process can be managed with the libavutil
89
+ * @ref lavu_sampmanip "samples manipulation" API, including av_samples_alloc()
90
+ * function used in the following example.
91
+ *
92
+ * The delay between input and output, can at any time be found by using
93
+ * swr_get_delay().
94
+ *
95
+ * The following code demonstrates the conversion loop assuming the parameters
96
+ * from above and caller-defined functions get_input() and handle_output():
97
+ * @code
98
+ * uint8_t **input;
99
+ * int in_samples;
100
+ *
101
+ * while (get_input(&input, &in_samples)) {
102
+ * uint8_t *output;
103
+ * int out_samples = av_rescale_rnd(swr_get_delay(swr, 48000) +
104
+ * in_samples, 44100, 48000, AV_ROUND_UP);
105
+ * av_samples_alloc(&output, NULL, 2, out_samples,
106
+ * AV_SAMPLE_FMT_S16, 0);
107
+ * out_samples = swr_convert(swr, &output, out_samples,
108
+ * input, in_samples);
109
+ * handle_output(output, out_samples);
110
+ * av_freep(&output);
111
+ * }
112
+ * @endcode
113
+ *
114
+ * When the conversion is finished, the conversion
115
+ * context and everything associated with it must be freed with swr_free().
116
+ * A swr_close() function is also available, but it exists mainly for
117
+ * compatibility with libavresample, and is not required to be called.
118
+ *
119
+ * There will be no memory leak if the data is not completely flushed before
120
+ * swr_free().
121
+ */
122
+
123
+ #include <stdint.h>
124
+ #include "libavutil/channel_layout.h"
125
+ #include "libavutil/frame.h"
126
+ #include "libavutil/samplefmt.h"
127
+
128
+ #include "libswresample/version_major.h"
129
+ #ifndef HAVE_AV_CONFIG_H
130
+ /* When included as part of the ffmpeg build, only include the major version
131
+ * to avoid unnecessary rebuilds. When included externally, keep including
132
+ * the full version information. */
133
+ #include "libswresample/version.h"
134
+ #endif
135
+
136
+ /**
137
+ * @name Option constants
138
+ * These constants are used for the @ref avoptions interface for lswr.
139
+ * @{
140
+ *
141
+ */
142
+
143
+ #define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate
144
+ //TODO use int resample ?
145
+ //long term TODO can we enable this dynamically?
146
+
147
+ /** Dithering algorithms */
148
+ enum SwrDitherType {
149
+ SWR_DITHER_NONE = 0,
150
+ SWR_DITHER_RECTANGULAR,
151
+ SWR_DITHER_TRIANGULAR,
152
+ SWR_DITHER_TRIANGULAR_HIGHPASS,
153
+
154
+ SWR_DITHER_NS = 64, ///< not part of API/ABI
155
+ SWR_DITHER_NS_LIPSHITZ,
156
+ SWR_DITHER_NS_F_WEIGHTED,
157
+ SWR_DITHER_NS_MODIFIED_E_WEIGHTED,
158
+ SWR_DITHER_NS_IMPROVED_E_WEIGHTED,
159
+ SWR_DITHER_NS_SHIBATA,
160
+ SWR_DITHER_NS_LOW_SHIBATA,
161
+ SWR_DITHER_NS_HIGH_SHIBATA,
162
+ SWR_DITHER_NB, ///< not part of API/ABI
163
+ };
164
+
165
+ /** Resampling Engines */
166
+ enum SwrEngine {
167
+ SWR_ENGINE_SWR, /**< SW Resampler */
168
+ SWR_ENGINE_SOXR, /**< SoX Resampler */
169
+ SWR_ENGINE_NB, ///< not part of API/ABI
170
+ };
171
+
172
+ /** Resampling Filter Types */
173
+ enum SwrFilterType {
174
+ SWR_FILTER_TYPE_CUBIC, /**< Cubic */
175
+ SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall windowed sinc */
176
+ SWR_FILTER_TYPE_KAISER, /**< Kaiser windowed sinc */
177
+ };
178
+
179
+ /**
180
+ * @}
181
+ */
182
+
183
+ /**
184
+ * The libswresample context. Unlike libavcodec and libavformat, this structure
185
+ * is opaque. This means that if you would like to set options, you must use
186
+ * the @ref avoptions API and cannot directly set values to members of the
187
+ * structure.
188
+ */
189
+ typedef struct SwrContext SwrContext;
190
+
191
+ /**
192
+ * Get the AVClass for SwrContext. It can be used in combination with
193
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
194
+ *
195
+ * @see av_opt_find().
196
+ * @return the AVClass of SwrContext
197
+ */
198
+ const AVClass *swr_get_class(void);
199
+
200
+ /**
201
+ * @name SwrContext constructor functions
202
+ * @{
203
+ */
204
+
205
+ /**
206
+ * Allocate SwrContext.
207
+ *
208
+ * If you use this function you will need to set the parameters (manually or
209
+ * with swr_alloc_set_opts2()) before calling swr_init().
210
+ *
211
+ * @see swr_alloc_set_opts2(), swr_init(), swr_free()
212
+ * @return NULL on error, allocated context otherwise
213
+ */
214
+ struct SwrContext *swr_alloc(void);
215
+
216
+ /**
217
+ * Initialize context after user parameters have been set.
218
+ * @note The context must be configured using the AVOption API.
219
+ *
220
+ * @see av_opt_set_int()
221
+ * @see av_opt_set_dict()
222
+ *
223
+ * @param[in,out] s Swr context to initialize
224
+ * @return AVERROR error code in case of failure.
225
+ */
226
+ int swr_init(struct SwrContext *s);
227
+
228
+ /**
229
+ * Check whether an swr context has been initialized or not.
230
+ *
231
+ * @param[in] s Swr context to check
232
+ * @see swr_init()
233
+ * @return positive if it has been initialized, 0 if not initialized
234
+ */
235
+ int swr_is_initialized(struct SwrContext *s);
236
+
237
+ /**
238
+ * Allocate SwrContext if needed and set/reset common parameters.
239
+ *
240
+ * This function does not require *ps to be allocated with swr_alloc(). On the
241
+ * other hand, swr_alloc() can use swr_alloc_set_opts2() to set the parameters
242
+ * on the allocated context.
243
+ *
244
+ * @param ps Pointer to an existing Swr context if available, or to NULL if not.
245
+ * On success, *ps will be set to the allocated context.
246
+ * @param out_ch_layout output channel layout (e.g. AV_CHANNEL_LAYOUT_*)
247
+ * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*).
248
+ * @param out_sample_rate output sample rate (frequency in Hz)
249
+ * @param in_ch_layout input channel layout (e.g. AV_CHANNEL_LAYOUT_*)
250
+ * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*).
251
+ * @param in_sample_rate input sample rate (frequency in Hz)
252
+ * @param log_offset logging level offset
253
+ * @param log_ctx parent logging context, can be NULL
254
+ *
255
+ * @see swr_init(), swr_free()
256
+ * @return 0 on success, a negative AVERROR code on error.
257
+ * On error, the Swr context is freed and *ps set to NULL.
258
+ */
259
+ int swr_alloc_set_opts2(struct SwrContext **ps,
260
+ const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
261
+ const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
262
+ int log_offset, void *log_ctx);
263
+ /**
264
+ * @}
265
+ *
266
+ * @name SwrContext destructor functions
267
+ * @{
268
+ */
269
+
270
+ /**
271
+ * Free the given SwrContext and set the pointer to NULL.
272
+ *
273
+ * @param[in] s a pointer to a pointer to Swr context
274
+ */
275
+ void swr_free(struct SwrContext **s);
276
+
277
+ /**
278
+ * Closes the context so that swr_is_initialized() returns 0.
279
+ *
280
+ * The context can be brought back to life by running swr_init(),
281
+ * swr_init() can also be used without swr_close().
282
+ * This function is mainly provided for simplifying the usecase
283
+ * where one tries to support libavresample and libswresample.
284
+ *
285
+ * @param[in,out] s Swr context to be closed
286
+ */
287
+ void swr_close(struct SwrContext *s);
288
+
289
+ /**
290
+ * @}
291
+ *
292
+ * @name Core conversion functions
293
+ * @{
294
+ */
295
+
296
+ /** Convert audio.
297
+ *
298
+ * in and in_count can be set to 0 to flush the last few samples out at the
299
+ * end.
300
+ *
301
+ * If more input is provided than output space, then the input will be buffered.
302
+ * You can avoid this buffering by using swr_get_out_samples() to retrieve an
303
+ * upper bound on the required number of output samples for the given number of
304
+ * input samples. Conversion will run directly without copying whenever possible.
305
+ *
306
+ * @param s allocated Swr context, with parameters set
307
+ * @param out output buffers, only the first one need be set in case of packed audio
308
+ * @param out_count amount of space available for output in samples per channel
309
+ * @param in input buffers, only the first one need to be set in case of packed audio
310
+ * @param in_count number of input samples available in one channel
311
+ *
312
+ * @return number of samples output per channel, negative value on error
313
+ */
314
+ int swr_convert(struct SwrContext *s, uint8_t * const *out, int out_count,
315
+ const uint8_t * const *in , int in_count);
316
+
317
+ /**
318
+ * Convert the next timestamp from input to output
319
+ * timestamps are in 1/(in_sample_rate * out_sample_rate) units.
320
+ *
321
+ * @note There are 2 slightly differently behaving modes.
322
+ * @li When automatic timestamp compensation is not used, (min_compensation >= FLT_MAX)
323
+ * in this case timestamps will be passed through with delays compensated
324
+ * @li When automatic timestamp compensation is used, (min_compensation < FLT_MAX)
325
+ * in this case the output timestamps will match output sample numbers.
326
+ * See ffmpeg-resampler(1) for the two modes of compensation.
327
+ *
328
+ * @param[in] s initialized Swr context
329
+ * @param[in] pts timestamp for the next input sample, INT64_MIN if unknown
330
+ * @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are
331
+ * function used internally for timestamp compensation.
332
+ * @return the output timestamp for the next output sample
333
+ */
334
+ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
335
+
336
+ /**
337
+ * @}
338
+ *
339
+ * @name Low-level option setting functions
340
+ * These functons provide a means to set low-level options that is not possible
341
+ * with the AVOption API.
342
+ * @{
343
+ */
344
+
345
+ /**
346
+ * Activate resampling compensation ("soft" compensation). This function is
347
+ * internally called when needed in swr_next_pts().
348
+ *
349
+ * @param[in,out] s allocated Swr context. If it is not initialized,
350
+ * or SWR_FLAG_RESAMPLE is not set, swr_init() is
351
+ * called with the flag set.
352
+ * @param[in] sample_delta delta in PTS per sample
353
+ * @param[in] compensation_distance number of samples to compensate for
354
+ * @return >= 0 on success, AVERROR error codes if:
355
+ * @li @c s is NULL,
356
+ * @li @c compensation_distance is less than 0,
357
+ * @li @c compensation_distance is 0 but sample_delta is not,
358
+ * @li compensation unsupported by resampler, or
359
+ * @li swr_init() fails when called.
360
+ */
361
+ int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
362
+
363
+ /**
364
+ * Set a customized input channel mapping.
365
+ *
366
+ * @param[in,out] s allocated Swr context, not yet initialized
367
+ * @param[in] channel_map customized input channel mapping (array of channel
368
+ * indexes, -1 for a muted channel)
369
+ * @return >= 0 on success, or AVERROR error code in case of failure.
370
+ */
371
+ int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
372
+
373
+ /**
374
+ * Generate a channel mixing matrix.
375
+ *
376
+ * This function is the one used internally by libswresample for building the
377
+ * default mixing matrix. It is made public just as a utility function for
378
+ * building custom matrices.
379
+ *
380
+ * @param in_layout input channel layout
381
+ * @param out_layout output channel layout
382
+ * @param center_mix_level mix level for the center channel
383
+ * @param surround_mix_level mix level for the surround channel(s)
384
+ * @param lfe_mix_level mix level for the low-frequency effects channel
385
+ * @param rematrix_maxval if 1.0, coefficients will be normalized to prevent
386
+ * overflow. if INT_MAX, coefficients will not be
387
+ * normalized.
388
+ * @param[out] matrix mixing coefficients; matrix[i + stride * o] is
389
+ * the weight of input channel i in output channel o.
390
+ * @param stride distance between adjacent input channels in the
391
+ * matrix array
392
+ * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii)
393
+ * @param log_ctx parent logging context, can be NULL
394
+ * @return 0 on success, negative AVERROR code on failure
395
+ */
396
+ int swr_build_matrix2(const AVChannelLayout *in_layout, const AVChannelLayout *out_layout,
397
+ double center_mix_level, double surround_mix_level,
398
+ double lfe_mix_level, double maxval,
399
+ double rematrix_volume, double *matrix,
400
+ ptrdiff_t stride, enum AVMatrixEncoding matrix_encoding,
401
+ void *log_context);
402
+
403
+ /**
404
+ * Set a customized remix matrix.
405
+ *
406
+ * @param s allocated Swr context, not yet initialized
407
+ * @param matrix remix coefficients; matrix[i + stride * o] is
408
+ * the weight of input channel i in output channel o
409
+ * @param stride offset between lines of the matrix
410
+ * @return >= 0 on success, or AVERROR error code in case of failure.
411
+ */
412
+ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
413
+
414
+ /**
415
+ * @}
416
+ *
417
+ * @name Sample handling functions
418
+ * @{
419
+ */
420
+
421
+ /**
422
+ * Drops the specified number of output samples.
423
+ *
424
+ * This function, along with swr_inject_silence(), is called by swr_next_pts()
425
+ * if needed for "hard" compensation.
426
+ *
427
+ * @param s allocated Swr context
428
+ * @param count number of samples to be dropped
429
+ *
430
+ * @return >= 0 on success, or a negative AVERROR code on failure
431
+ */
432
+ int swr_drop_output(struct SwrContext *s, int count);
433
+
434
+ /**
435
+ * Injects the specified number of silence samples.
436
+ *
437
+ * This function, along with swr_drop_output(), is called by swr_next_pts()
438
+ * if needed for "hard" compensation.
439
+ *
440
+ * @param s allocated Swr context
441
+ * @param count number of samples to be dropped
442
+ *
443
+ * @return >= 0 on success, or a negative AVERROR code on failure
444
+ */
445
+ int swr_inject_silence(struct SwrContext *s, int count);
446
+
447
+ /**
448
+ * Gets the delay the next input sample will experience relative to the next output sample.
449
+ *
450
+ * Swresample can buffer data if more input has been provided than available
451
+ * output space, also converting between sample rates needs a delay.
452
+ * This function returns the sum of all such delays.
453
+ * The exact delay is not necessarily an integer value in either input or
454
+ * output sample rate. Especially when downsampling by a large value, the
455
+ * output sample rate may be a poor choice to represent the delay, similarly
456
+ * for upsampling and the input sample rate.
457
+ *
458
+ * @param s swr context
459
+ * @param base timebase in which the returned delay will be:
460
+ * @li if it's set to 1 the returned delay is in seconds
461
+ * @li if it's set to 1000 the returned delay is in milliseconds
462
+ * @li if it's set to the input sample rate then the returned
463
+ * delay is in input samples
464
+ * @li if it's set to the output sample rate then the returned
465
+ * delay is in output samples
466
+ * @li if it's the least common multiple of in_sample_rate and
467
+ * out_sample_rate then an exact rounding-free delay will be
468
+ * returned
469
+ * @returns the delay in 1 / @c base units.
470
+ */
471
+ int64_t swr_get_delay(struct SwrContext *s, int64_t base);
472
+
473
+ /**
474
+ * Find an upper bound on the number of samples that the next swr_convert
475
+ * call will output, if called with in_samples of input samples. This
476
+ * depends on the internal state, and anything changing the internal state
477
+ * (like further swr_convert() calls) will may change the number of samples
478
+ * swr_get_out_samples() returns for the same number of input samples.
479
+ *
480
+ * @param in_samples number of input samples.
481
+ * @note any call to swr_inject_silence(), swr_convert(), swr_next_pts()
482
+ * or swr_set_compensation() invalidates this limit
483
+ * @note it is recommended to pass the correct available buffer size
484
+ * to all functions like swr_convert() even if swr_get_out_samples()
485
+ * indicates that less would be used.
486
+ * @returns an upper bound on the number of samples that the next swr_convert
487
+ * will output or a negative value to indicate an error
488
+ */
489
+ int swr_get_out_samples(struct SwrContext *s, int in_samples);
490
+
491
+ /**
492
+ * @}
493
+ *
494
+ * @name Configuration accessors
495
+ * @{
496
+ */
497
+
498
+ /**
499
+ * Return the @ref LIBSWRESAMPLE_VERSION_INT constant.
500
+ *
501
+ * This is useful to check if the build-time libswresample has the same version
502
+ * as the run-time one.
503
+ *
504
+ * @returns the unsigned int-typed version
505
+ */
506
+ unsigned swresample_version(void);
507
+
508
+ /**
509
+ * Return the swr build-time configuration.
510
+ *
511
+ * @returns the build-time @c ./configure flags
512
+ */
513
+ const char *swresample_configuration(void);
514
+
515
+ /**
516
+ * Return the swr license.
517
+ *
518
+ * @returns the license of libswresample, determined at build-time
519
+ */
520
+ const char *swresample_license(void);
521
+
522
+ /**
523
+ * @}
524
+ *
525
+ * @name AVFrame based API
526
+ * @{
527
+ */
528
+
529
+ /**
530
+ * Convert the samples in the input AVFrame and write them to the output AVFrame.
531
+ *
532
+ * Input and output AVFrames must have channel_layout, sample_rate and format set.
533
+ *
534
+ * If the output AVFrame does not have the data pointers allocated the nb_samples
535
+ * field will be set using av_frame_get_buffer()
536
+ * is called to allocate the frame.
537
+ *
538
+ * The output AVFrame can be NULL or have fewer allocated samples than required.
539
+ * In this case, any remaining samples not written to the output will be added
540
+ * to an internal FIFO buffer, to be returned at the next call to this function
541
+ * or to swr_convert().
542
+ *
543
+ * If converting sample rate, there may be data remaining in the internal
544
+ * resampling delay buffer. swr_get_delay() tells the number of
545
+ * remaining samples. To get this data as output, call this function or
546
+ * swr_convert() with NULL input.
547
+ *
548
+ * If the SwrContext configuration does not match the output and
549
+ * input AVFrame settings the conversion does not take place and depending on
550
+ * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED
551
+ * or the result of a bitwise-OR of them is returned.
552
+ *
553
+ * @see swr_delay()
554
+ * @see swr_convert()
555
+ * @see swr_get_delay()
556
+ *
557
+ * @param swr audio resample context
558
+ * @param output output AVFrame
559
+ * @param input input AVFrame
560
+ * @return 0 on success, AVERROR on failure or nonmatching
561
+ * configuration.
562
+ */
563
+ int swr_convert_frame(SwrContext *swr,
564
+ AVFrame *output, const AVFrame *input);
565
+
566
+ /**
567
+ * Configure or reconfigure the SwrContext using the information
568
+ * provided by the AVFrames.
569
+ *
570
+ * The original resampling context is reset even on failure.
571
+ * The function calls swr_close() internally if the context is open.
572
+ *
573
+ * @see swr_close();
574
+ *
575
+ * @param swr audio resample context
576
+ * @param out output AVFrame
577
+ * @param in input AVFrame
578
+ * @return 0 on success, AVERROR on failure.
579
+ */
580
+ int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
581
+
582
+ /**
583
+ * @}
584
+ * @}
585
+ */
586
+
587
+ #endif /* SWRESAMPLE_SWRESAMPLE_H */
ffmpeg/include/libswresample/version.h ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Version macros.
3
+ *
4
+ * This file is part of libswresample
5
+ *
6
+ * libswresample is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * libswresample is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with libswresample; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef SWRESAMPLE_VERSION_H
22
+ #define SWRESAMPLE_VERSION_H
23
+
24
+ /**
25
+ * @file
26
+ * Libswresample version macros
27
+ */
28
+
29
+ #include "libavutil/version.h"
30
+
31
+ #include "version_major.h"
32
+
33
+ #define LIBSWRESAMPLE_VERSION_MINOR 4
34
+ #define LIBSWRESAMPLE_VERSION_MICRO 100
35
+
36
+ #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
37
+ LIBSWRESAMPLE_VERSION_MINOR, \
38
+ LIBSWRESAMPLE_VERSION_MICRO)
39
+ #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \
40
+ LIBSWRESAMPLE_VERSION_MINOR, \
41
+ LIBSWRESAMPLE_VERSION_MICRO)
42
+ #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT
43
+
44
+ #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION)
45
+
46
+ #endif /* SWRESAMPLE_VERSION_H */
ffmpeg/include/libswresample/version_major.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Version macros.
3
+ *
4
+ * This file is part of libswresample
5
+ *
6
+ * libswresample is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * libswresample is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with libswresample; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+ #ifndef SWRESAMPLE_VERSION_MAJOR_H
22
+ #define SWRESAMPLE_VERSION_MAJOR_H
23
+
24
+ /**
25
+ * @file
26
+ * Libswresample version macros
27
+ */
28
+
29
+ #define LIBSWRESAMPLE_VERSION_MAJOR 5
30
+
31
+ #endif /* SWRESAMPLE_VERSION_MAJOR_H */
ffmpeg/include/libswscale/swscale.h ADDED
@@ -0,0 +1,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright (C) 2024 Niklas Haas
3
+ * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+ #ifndef SWSCALE_SWSCALE_H
23
+ #define SWSCALE_SWSCALE_H
24
+
25
+ /**
26
+ * @file
27
+ * @ingroup libsws
28
+ * external API header
29
+ */
30
+
31
+ #include <stdint.h>
32
+
33
+ #include "libavutil/avutil.h"
34
+ #include "libavutil/frame.h"
35
+ #include "libavutil/log.h"
36
+ #include "libavutil/pixfmt.h"
37
+ #include "version_major.h"
38
+ #ifndef HAVE_AV_CONFIG_H
39
+ /* When included as part of the ffmpeg build, only include the major version
40
+ * to avoid unnecessary rebuilds. When included externally, keep including
41
+ * the full version information. */
42
+ #include "version.h"
43
+ #endif
44
+
45
+ /**
46
+ * @defgroup libsws libswscale
47
+ * Color conversion and scaling library.
48
+ *
49
+ * @{
50
+ *
51
+ * Return the LIBSWSCALE_VERSION_INT constant.
52
+ */
53
+ unsigned swscale_version(void);
54
+
55
+ /**
56
+ * Return the libswscale build-time configuration.
57
+ */
58
+ const char *swscale_configuration(void);
59
+
60
+ /**
61
+ * Return the libswscale license.
62
+ */
63
+ const char *swscale_license(void);
64
+
65
+ /**
66
+ * Get the AVClass for SwsContext. It can be used in combination with
67
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
68
+ *
69
+ * @see av_opt_find().
70
+ */
71
+ const AVClass *sws_get_class(void);
72
+
73
+ /******************************
74
+ * Flags and quality settings *
75
+ ******************************/
76
+
77
+ typedef enum SwsDither {
78
+ SWS_DITHER_NONE = 0, /* disable dithering */
79
+ SWS_DITHER_AUTO, /* auto-select from preset */
80
+ SWS_DITHER_BAYER, /* ordered dither matrix */
81
+ SWS_DITHER_ED, /* error diffusion */
82
+ SWS_DITHER_A_DITHER, /* arithmetic addition */
83
+ SWS_DITHER_X_DITHER, /* arithmetic xor */
84
+ SWS_DITHER_NB, /* not part of the ABI */
85
+ } SwsDither;
86
+
87
+ typedef enum SwsAlphaBlend {
88
+ SWS_ALPHA_BLEND_NONE = 0,
89
+ SWS_ALPHA_BLEND_UNIFORM,
90
+ SWS_ALPHA_BLEND_CHECKERBOARD,
91
+ SWS_ALPHA_BLEND_NB, /* not part of the ABI */
92
+ } SwsAlphaBlend;
93
+
94
+ typedef enum SwsFlags {
95
+ /**
96
+ * Scaler selection options. Only one may be active at a time.
97
+ */
98
+ SWS_FAST_BILINEAR = 1 << 0, ///< fast bilinear filtering
99
+ SWS_BILINEAR = 1 << 1, ///< bilinear filtering
100
+ SWS_BICUBIC = 1 << 2, ///< 2-tap cubic B-spline
101
+ SWS_X = 1 << 3, ///< experimental
102
+ SWS_POINT = 1 << 4, ///< nearest neighbor
103
+ SWS_AREA = 1 << 5, ///< area averaging
104
+ SWS_BICUBLIN = 1 << 6, ///< bicubic luma, bilinear chroma
105
+ SWS_GAUSS = 1 << 7, ///< gaussian approximation
106
+ SWS_SINC = 1 << 8, ///< unwindowed sinc
107
+ SWS_LANCZOS = 1 << 9, ///< 3-tap sinc/sinc
108
+ SWS_SPLINE = 1 << 10, ///< cubic Keys spline
109
+
110
+ /**
111
+ * Return an error on underspecified conversions. Without this flag,
112
+ * unspecified fields are defaulted to sensible values.
113
+ */
114
+ SWS_STRICT = 1 << 11,
115
+
116
+ /**
117
+ * Emit verbose log of scaling parameters.
118
+ */
119
+ SWS_PRINT_INFO = 1 << 12,
120
+
121
+ /**
122
+ * Perform full chroma upsampling when upscaling to RGB.
123
+ *
124
+ * For example, when converting 50x50 yuv420p to 100x100 rgba, setting this flag
125
+ * will scale the chroma plane from 25x25 to 100x100 (4:4:4), and then convert
126
+ * the 100x100 yuv444p image to rgba in the final output step.
127
+ *
128
+ * Without this flag, the chroma plane is instead scaled to 50x100 (4:2:2),
129
+ * with a single chroma sample being re-used for both of the horizontally
130
+ * adjacent RGBA output pixels.
131
+ */
132
+ SWS_FULL_CHR_H_INT = 1 << 13,
133
+
134
+ /**
135
+ * Perform full chroma interpolation when downscaling RGB sources.
136
+ *
137
+ * For example, when converting a 100x100 rgba source to 50x50 yuv444p, setting
138
+ * this flag will generate a 100x100 (4:4:4) chroma plane, which is then
139
+ * downscaled to the required 50x50.
140
+ *
141
+ * Without this flag, the chroma plane is instead generated at 50x100 (dropping
142
+ * every other pixel), before then being downscaled to the required 50x50
143
+ * resolution.
144
+ */
145
+ SWS_FULL_CHR_H_INP = 1 << 14,
146
+
147
+ /**
148
+ * Force bit-exact output. This will prevent the use of platform-specific
149
+ * optimizations that may lead to slight difference in rounding, in favor
150
+ * of always maintaining exact bit output compatibility with the reference
151
+ * C code.
152
+ *
153
+ * Note: It is recommended to set both of these flags simultaneously.
154
+ */
155
+ SWS_ACCURATE_RND = 1 << 18,
156
+ SWS_BITEXACT = 1 << 19,
157
+
158
+ /**
159
+ * Deprecated flags.
160
+ */
161
+ SWS_DIRECT_BGR = 1 << 15, ///< This flag has no effect
162
+ SWS_ERROR_DIFFUSION = 1 << 23, ///< Set `SwsContext.dither` instead
163
+ } SwsFlags;
164
+
165
+ typedef enum SwsIntent {
166
+ SWS_INTENT_PERCEPTUAL = 0, ///< Perceptual tone mapping
167
+ SWS_INTENT_RELATIVE_COLORIMETRIC = 1, ///< Relative colorimetric clipping
168
+ SWS_INTENT_SATURATION = 2, ///< Saturation mapping
169
+ SWS_INTENT_ABSOLUTE_COLORIMETRIC = 3, ///< Absolute colorimetric clipping
170
+ SWS_INTENT_NB, ///< not part of the ABI
171
+ } SwsIntent;
172
+
173
+ /***********************************
174
+ * Context creation and management *
175
+ ***********************************/
176
+
177
+ /**
178
+ * Main external API structure. New fields can be added to the end with
179
+ * minor version bumps. Removal, reordering and changes to existing fields
180
+ * require a major version bump. sizeof(SwsContext) is not part of the ABI.
181
+ */
182
+ typedef struct SwsContext {
183
+ const AVClass *av_class;
184
+
185
+ /**
186
+ * Private data of the user, can be used to carry app specific stuff.
187
+ */
188
+ void *opaque;
189
+
190
+ /**
191
+ * Bitmask of SWS_*. See `SwsFlags` for details.
192
+ */
193
+ unsigned flags;
194
+
195
+ /**
196
+ * Extra parameters for fine-tuning certain scalers.
197
+ */
198
+ double scaler_params[2];
199
+
200
+ /**
201
+ * How many threads to use for processing, or 0 for automatic selection.
202
+ */
203
+ int threads;
204
+
205
+ /**
206
+ * Dither mode.
207
+ */
208
+ SwsDither dither;
209
+
210
+ /**
211
+ * Alpha blending mode. See `SwsAlphaBlend` for details.
212
+ */
213
+ SwsAlphaBlend alpha_blend;
214
+
215
+ /**
216
+ * Use gamma correct scaling.
217
+ */
218
+ int gamma_flag;
219
+
220
+ /**
221
+ * Deprecated frame property overrides, for the legacy API only.
222
+ *
223
+ * Ignored by sws_scale_frame() when used in dynamic mode, in which
224
+ * case all properties are instead taken from the frame directly.
225
+ */
226
+ int src_w, src_h; ///< Width and height of the source frame
227
+ int dst_w, dst_h; ///< Width and height of the destination frame
228
+ int src_format; ///< Source pixel format
229
+ int dst_format; ///< Destination pixel format
230
+ int src_range; ///< Source is full range
231
+ int dst_range; ///< Destination is full range
232
+ int src_v_chr_pos; ///< Source vertical chroma position in luma grid / 256
233
+ int src_h_chr_pos; ///< Source horizontal chroma position
234
+ int dst_v_chr_pos; ///< Destination vertical chroma position
235
+ int dst_h_chr_pos; ///< Destination horizontal chroma position
236
+
237
+ /**
238
+ * Desired ICC intent for color space conversions.
239
+ */
240
+ int intent;
241
+
242
+ /* Remember to add new fields to graph.c:opts_equal() */
243
+ } SwsContext;
244
+
245
+ /**
246
+ * Allocate an empty SwsContext and set its fields to default values.
247
+ */
248
+ SwsContext *sws_alloc_context(void);
249
+
250
+ /**
251
+ * Free the context and everything associated with it, and write NULL
252
+ * to the provided pointer.
253
+ */
254
+ void sws_free_context(SwsContext **ctx);
255
+
256
+ /***************************
257
+ * Supported frame formats *
258
+ ***************************/
259
+
260
+ /**
261
+ * Test if a given pixel format is supported.
262
+ *
263
+ * @param output If 0, test if compatible with the source/input frame;
264
+ * otherwise, with the destination/output frame.
265
+ * @param format The format to check.
266
+ *
267
+ * @return A positive integer if supported, 0 otherwise.
268
+ */
269
+ int sws_test_format(enum AVPixelFormat format, int output);
270
+
271
+ /**
272
+ * Test if a given color space is supported.
273
+ *
274
+ * @param output If 0, test if compatible with the source/input frame;
275
+ * otherwise, with the destination/output frame.
276
+ * @param colorspace The colorspace to check.
277
+ *
278
+ * @return A positive integer if supported, 0 otherwise.
279
+ */
280
+ int sws_test_colorspace(enum AVColorSpace colorspace, int output);
281
+
282
+ /**
283
+ * Test if a given set of color primaries is supported.
284
+ *
285
+ * @param output If 0, test if compatible with the source/input frame;
286
+ * otherwise, with the destination/output frame.
287
+ * @param primaries The color primaries to check.
288
+ *
289
+ * @return A positive integer if supported, 0 otherwise.
290
+ */
291
+ int sws_test_primaries(enum AVColorPrimaries primaries, int output);
292
+
293
+ /**
294
+ * Test if a given color transfer function is supported.
295
+ *
296
+ * @param output If 0, test if compatible with the source/input frame;
297
+ * otherwise, with the destination/output frame.
298
+ * @param trc The color transfer function to check.
299
+ *
300
+ * @return A positive integer if supported, 0 otherwise.
301
+ */
302
+ int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output);
303
+
304
+ /**
305
+ * Helper function to run all sws_test_* against a frame, as well as testing
306
+ * the basic frame properties for sanity. Ignores irrelevant properties - for
307
+ * example, AVColorSpace is not checked for RGB frames.
308
+ */
309
+ int sws_test_frame(const AVFrame *frame, int output);
310
+
311
+ /**
312
+ * Like `sws_scale_frame`, but without actually scaling. It will instead
313
+ * merely initialize internal state that *would* be required to perform the
314
+ * operation, as well as returning the correct error code for unsupported
315
+ * frame combinations.
316
+ *
317
+ * @param ctx The scaling context.
318
+ * @param dst The destination frame to consider.
319
+ * @param src The source frame to consider.
320
+ * @return 0 on success, a negative AVERROR code on failure.
321
+ */
322
+ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src);
323
+
324
+ /********************
325
+ * Main scaling API *
326
+ ********************/
327
+
328
+ /**
329
+ * Check if a given conversion is a noop. Returns a positive integer if
330
+ * no operation needs to be performed, 0 otherwise.
331
+ */
332
+ int sws_is_noop(const AVFrame *dst, const AVFrame *src);
333
+
334
+ /**
335
+ * Scale source data from `src` and write the output to `dst`.
336
+ *
337
+ * This function can be used directly on an allocated context, without setting
338
+ * up any frame properties or calling `sws_init_context()`. Such usage is fully
339
+ * dynamic and does not require reallocation if the frame properties change.
340
+ *
341
+ * Alternatively, this function can be called on a context that has been
342
+ * explicitly initialized. However, this is provided only for backwards
343
+ * compatibility. In this usage mode, all frame properties must be correctly
344
+ * set at init time, and may no longer change after initialization.
345
+ *
346
+ * @param ctx The scaling context.
347
+ * @param dst The destination frame. The data buffers may either be already
348
+ * allocated by the caller or left clear, in which case they will
349
+ * be allocated by the scaler. The latter may have performance
350
+ * advantages - e.g. in certain cases some (or all) output planes
351
+ * may be references to input planes, rather than copies.
352
+ * @param src The source frame. If the data buffers are set to NULL, then
353
+ * this function behaves identically to `sws_frame_setup`.
354
+ * @return >= 0 on success, a negative AVERROR code on failure.
355
+ */
356
+ int sws_scale_frame(SwsContext *c, AVFrame *dst, const AVFrame *src);
357
+
358
+ /*************************
359
+ * Legacy (stateful) API *
360
+ *************************/
361
+
362
+ #define SWS_SRC_V_CHR_DROP_MASK 0x30000
363
+ #define SWS_SRC_V_CHR_DROP_SHIFT 16
364
+
365
+ #define SWS_PARAM_DEFAULT 123456
366
+
367
+ #define SWS_MAX_REDUCE_CUTOFF 0.002
368
+
369
+ #define SWS_CS_ITU709 1
370
+ #define SWS_CS_FCC 4
371
+ #define SWS_CS_ITU601 5
372
+ #define SWS_CS_ITU624 5
373
+ #define SWS_CS_SMPTE170M 5
374
+ #define SWS_CS_SMPTE240M 7
375
+ #define SWS_CS_DEFAULT 5
376
+ #define SWS_CS_BT2020 9
377
+
378
+ /**
379
+ * Return a pointer to yuv<->rgb coefficients for the given colorspace
380
+ * suitable for sws_setColorspaceDetails().
381
+ *
382
+ * @param colorspace One of the SWS_CS_* macros. If invalid,
383
+ * SWS_CS_DEFAULT is used.
384
+ */
385
+ const int *sws_getCoefficients(int colorspace);
386
+
387
+ // when used for filters they must have an odd number of elements
388
+ // coeffs cannot be shared between vectors
389
+ typedef struct SwsVector {
390
+ double *coeff; ///< pointer to the list of coefficients
391
+ int length; ///< number of coefficients in the vector
392
+ } SwsVector;
393
+
394
+ // vectors can be shared
395
+ typedef struct SwsFilter {
396
+ SwsVector *lumH;
397
+ SwsVector *lumV;
398
+ SwsVector *chrH;
399
+ SwsVector *chrV;
400
+ } SwsFilter;
401
+
402
+ /**
403
+ * Return a positive value if pix_fmt is a supported input format, 0
404
+ * otherwise.
405
+ */
406
+ int sws_isSupportedInput(enum AVPixelFormat pix_fmt);
407
+
408
+ /**
409
+ * Return a positive value if pix_fmt is a supported output format, 0
410
+ * otherwise.
411
+ */
412
+ int sws_isSupportedOutput(enum AVPixelFormat pix_fmt);
413
+
414
+ /**
415
+ * @param[in] pix_fmt the pixel format
416
+ * @return a positive value if an endianness conversion for pix_fmt is
417
+ * supported, 0 otherwise.
418
+ */
419
+ int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt);
420
+
421
+ /**
422
+ * Initialize the swscaler context sws_context.
423
+ *
424
+ * This function is considered deprecated, and provided only for backwards
425
+ * compatibility with sws_scale() and sws_start_frame(). The preferred way to
426
+ * use libswscale is to set all frame properties correctly and call
427
+ * sws_scale_frame() directly, without explicitly initializing the context.
428
+ *
429
+ * @return zero or positive value on success, a negative value on
430
+ * error
431
+ */
432
+ av_warn_unused_result
433
+ int sws_init_context(SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter);
434
+
435
+ /**
436
+ * Free the swscaler context swsContext.
437
+ * If swsContext is NULL, then does nothing.
438
+ */
439
+ void sws_freeContext(SwsContext *swsContext);
440
+
441
+ /**
442
+ * Allocate and return an SwsContext. You need it to perform
443
+ * scaling/conversion operations using sws_scale().
444
+ *
445
+ * @param srcW the width of the source image
446
+ * @param srcH the height of the source image
447
+ * @param srcFormat the source image format
448
+ * @param dstW the width of the destination image
449
+ * @param dstH the height of the destination image
450
+ * @param dstFormat the destination image format
451
+ * @param flags specify which algorithm and options to use for rescaling
452
+ * @param param extra parameters to tune the used scaler
453
+ * For SWS_BICUBIC param[0] and [1] tune the shape of the basis
454
+ * function, param[0] tunes f(1) and param[1] f´(1)
455
+ * For SWS_GAUSS param[0] tunes the exponent and thus cutoff
456
+ * frequency
457
+ * For SWS_LANCZOS param[0] tunes the width of the window function
458
+ * @return a pointer to an allocated context, or NULL in case of error
459
+ * @note this function is to be removed after a saner alternative is
460
+ * written
461
+ */
462
+ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
463
+ int dstW, int dstH, enum AVPixelFormat dstFormat,
464
+ int flags, SwsFilter *srcFilter,
465
+ SwsFilter *dstFilter, const double *param);
466
+
467
+ /**
468
+ * Scale the image slice in srcSlice and put the resulting scaled
469
+ * slice in the image in dst. A slice is a sequence of consecutive
470
+ * rows in an image. Requires a context that has been previously
471
+ * been initialized with sws_init_context().
472
+ *
473
+ * Slices have to be provided in sequential order, either in
474
+ * top-bottom or bottom-top order. If slices are provided in
475
+ * non-sequential order the behavior of the function is undefined.
476
+ *
477
+ * @param c the scaling context previously created with
478
+ * sws_getContext()
479
+ * @param srcSlice the array containing the pointers to the planes of
480
+ * the source slice
481
+ * @param srcStride the array containing the strides for each plane of
482
+ * the source image
483
+ * @param srcSliceY the position in the source image of the slice to
484
+ * process, that is the number (counted starting from
485
+ * zero) in the image of the first row of the slice
486
+ * @param srcSliceH the height of the source slice, that is the number
487
+ * of rows in the slice
488
+ * @param dst the array containing the pointers to the planes of
489
+ * the destination image
490
+ * @param dstStride the array containing the strides for each plane of
491
+ * the destination image
492
+ * @return the height of the output slice
493
+ */
494
+ int sws_scale(SwsContext *c, const uint8_t *const srcSlice[],
495
+ const int srcStride[], int srcSliceY, int srcSliceH,
496
+ uint8_t *const dst[], const int dstStride[]);
497
+
498
+ /**
499
+ * Initialize the scaling process for a given pair of source/destination frames.
500
+ * Must be called before any calls to sws_send_slice() and sws_receive_slice().
501
+ * Requires a context that has been previously been initialized with
502
+ * sws_init_context().
503
+ *
504
+ * This function will retain references to src and dst, so they must both use
505
+ * refcounted buffers (if allocated by the caller, in case of dst).
506
+ *
507
+ * @param c The scaling context
508
+ * @param dst The destination frame.
509
+ *
510
+ * The data buffers may either be already allocated by the caller or
511
+ * left clear, in which case they will be allocated by the scaler.
512
+ * The latter may have performance advantages - e.g. in certain cases
513
+ * some output planes may be references to input planes, rather than
514
+ * copies.
515
+ *
516
+ * Output data will be written into this frame in successful
517
+ * sws_receive_slice() calls.
518
+ * @param src The source frame. The data buffers must be allocated, but the
519
+ * frame data does not have to be ready at this point. Data
520
+ * availability is then signalled by sws_send_slice().
521
+ * @return 0 on success, a negative AVERROR code on failure
522
+ *
523
+ * @see sws_frame_end()
524
+ */
525
+ int sws_frame_start(SwsContext *c, AVFrame *dst, const AVFrame *src);
526
+
527
+ /**
528
+ * Finish the scaling process for a pair of source/destination frames previously
529
+ * submitted with sws_frame_start(). Must be called after all sws_send_slice()
530
+ * and sws_receive_slice() calls are done, before any new sws_frame_start()
531
+ * calls.
532
+ *
533
+ * @param c The scaling context
534
+ */
535
+ void sws_frame_end(SwsContext *c);
536
+
537
+ /**
538
+ * Indicate that a horizontal slice of input data is available in the source
539
+ * frame previously provided to sws_frame_start(). The slices may be provided in
540
+ * any order, but may not overlap. For vertically subsampled pixel formats, the
541
+ * slices must be aligned according to subsampling.
542
+ *
543
+ * @param c The scaling context
544
+ * @param slice_start first row of the slice
545
+ * @param slice_height number of rows in the slice
546
+ *
547
+ * @return a non-negative number on success, a negative AVERROR code on failure.
548
+ */
549
+ int sws_send_slice(SwsContext *c, unsigned int slice_start,
550
+ unsigned int slice_height);
551
+
552
+ /**
553
+ * Request a horizontal slice of the output data to be written into the frame
554
+ * previously provided to sws_frame_start().
555
+ *
556
+ * @param c The scaling context
557
+ * @param slice_start first row of the slice; must be a multiple of
558
+ * sws_receive_slice_alignment()
559
+ * @param slice_height number of rows in the slice; must be a multiple of
560
+ * sws_receive_slice_alignment(), except for the last slice
561
+ * (i.e. when slice_start+slice_height is equal to output
562
+ * frame height)
563
+ *
564
+ * @return a non-negative number if the data was successfully written into the output
565
+ * AVERROR(EAGAIN) if more input data needs to be provided before the
566
+ * output can be produced
567
+ * another negative AVERROR code on other kinds of scaling failure
568
+ */
569
+ int sws_receive_slice(SwsContext *c, unsigned int slice_start,
570
+ unsigned int slice_height);
571
+
572
+ /**
573
+ * Get the alignment required for slices. Requires a context that has been
574
+ * previously been initialized with sws_init_context().
575
+ *
576
+ * @param c The scaling context
577
+ * @return alignment required for output slices requested with sws_receive_slice().
578
+ * Slice offsets and sizes passed to sws_receive_slice() must be
579
+ * multiples of the value returned from this function.
580
+ */
581
+ unsigned int sws_receive_slice_alignment(const SwsContext *c);
582
+
583
+ /**
584
+ * @param c the scaling context
585
+ * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg)
586
+ * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg)
587
+ * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
588
+ * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]
589
+ * @param brightness 16.16 fixed point brightness correction
590
+ * @param contrast 16.16 fixed point contrast correction
591
+ * @param saturation 16.16 fixed point saturation correction
592
+ *
593
+ * @return A negative error code on error, non negative otherwise.
594
+ * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
595
+ */
596
+ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4],
597
+ int srcRange, const int table[4], int dstRange,
598
+ int brightness, int contrast, int saturation);
599
+
600
+ /**
601
+ * @return A negative error code on error, non negative otherwise.
602
+ * If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
603
+ */
604
+ int sws_getColorspaceDetails(SwsContext *c, int **inv_table,
605
+ int *srcRange, int **table, int *dstRange,
606
+ int *brightness, int *contrast, int *saturation);
607
+
608
+ /**
609
+ * Allocate and return an uninitialized vector with length coefficients.
610
+ */
611
+ SwsVector *sws_allocVec(int length);
612
+
613
+ /**
614
+ * Return a normalized Gaussian curve used to filter stuff
615
+ * quality = 3 is high quality, lower is lower quality.
616
+ */
617
+ SwsVector *sws_getGaussianVec(double variance, double quality);
618
+
619
+ /**
620
+ * Scale all the coefficients of a by the scalar value.
621
+ */
622
+ void sws_scaleVec(SwsVector *a, double scalar);
623
+
624
+ /**
625
+ * Scale all the coefficients of a so that their sum equals height.
626
+ */
627
+ void sws_normalizeVec(SwsVector *a, double height);
628
+
629
+ void sws_freeVec(SwsVector *a);
630
+
631
+ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
632
+ float lumaSharpen, float chromaSharpen,
633
+ float chromaHShift, float chromaVShift,
634
+ int verbose);
635
+ void sws_freeFilter(SwsFilter *filter);
636
+
637
+ /**
638
+ * Check if context can be reused, otherwise reallocate a new one.
639
+ *
640
+ * If context is NULL, just calls sws_getContext() to get a new
641
+ * context. Otherwise, checks if the parameters are the ones already
642
+ * saved in context. If that is the case, returns the current
643
+ * context. Otherwise, frees context and gets a new context with
644
+ * the new parameters.
645
+ *
646
+ * Be warned that srcFilter and dstFilter are not checked, they
647
+ * are assumed to remain the same.
648
+ */
649
+ SwsContext *sws_getCachedContext(SwsContext *context, int srcW, int srcH,
650
+ enum AVPixelFormat srcFormat, int dstW, int dstH,
651
+ enum AVPixelFormat dstFormat, int flags,
652
+ SwsFilter *srcFilter, SwsFilter *dstFilter,
653
+ const double *param);
654
+
655
+ /**
656
+ * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits.
657
+ *
658
+ * The output frame will have the same packed format as the palette.
659
+ *
660
+ * @param src source frame buffer
661
+ * @param dst destination frame buffer
662
+ * @param num_pixels number of pixels to convert
663
+ * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
664
+ */
665
+ void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
666
+
667
+ /**
668
+ * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits.
669
+ *
670
+ * With the palette format "ABCD", the destination frame ends up with the format "ABC".
671
+ *
672
+ * @param src source frame buffer
673
+ * @param dst destination frame buffer
674
+ * @param num_pixels number of pixels to convert
675
+ * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
676
+ */
677
+ void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette);
678
+
679
+ /**
680
+ * @}
681
+ */
682
+
683
+ #endif /* SWSCALE_SWSCALE_H */
ffmpeg/include/libswscale/version.h ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef SWSCALE_VERSION_H
20
+ #define SWSCALE_VERSION_H
21
+
22
+ /**
23
+ * @file
24
+ * swscale version macros
25
+ */
26
+
27
+ #include "libavutil/version.h"
28
+
29
+ #include "version_major.h"
30
+
31
+ #define LIBSWSCALE_VERSION_MINOR 13
32
+ #define LIBSWSCALE_VERSION_MICRO 100
33
+
34
+ #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
35
+ LIBSWSCALE_VERSION_MINOR, \
36
+ LIBSWSCALE_VERSION_MICRO)
37
+ #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
38
+ LIBSWSCALE_VERSION_MINOR, \
39
+ LIBSWSCALE_VERSION_MICRO)
40
+ #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
41
+
42
+ #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
43
+
44
+ #endif /* SWSCALE_VERSION_H */
ffmpeg/include/libswscale/version_major.h ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This file is part of FFmpeg.
3
+ *
4
+ * FFmpeg is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU Lesser General Public
6
+ * License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License, or (at your option) any later version.
8
+ *
9
+ * FFmpeg is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ * Lesser General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Lesser General Public
15
+ * License along with FFmpeg; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ #ifndef SWSCALE_VERSION_MAJOR_H
20
+ #define SWSCALE_VERSION_MAJOR_H
21
+
22
+ /**
23
+ * @file
24
+ * swscale version macros
25
+ */
26
+
27
+ #define LIBSWSCALE_VERSION_MAJOR 8
28
+
29
+ /**
30
+ * FF_API_* defines may be placed below to indicate public API that will be
31
+ * dropped at a future version bump. The defines themselves are not part of
32
+ * the public API and may change, break or disappear at any time.
33
+ */
34
+
35
+ #endif /* SWSCALE_VERSION_MAJOR_H */
ffmpeg/lib/pkgconfig/libavcodec.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libavcodec
7
+ Description: FFmpeg codec library
8
+ Version: 61.31.100
9
+ Requires:
10
+ Requires.private: libswresample >= 5.4.100, libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lavcodec
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libavdevice.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libavdevice
7
+ Description: FFmpeg device handling library
8
+ Version: 61.4.100
9
+ Requires:
10
+ Requires.private: libavfilter >= 10.6.101, libswscale >= 8.13.100, libpostproc >= 58.4.100, libavformat >= 61.9.104, libavcodec >= 61.31.100, libswresample >= 5.4.100, libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lavdevice
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libavfilter.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libavfilter
7
+ Description: FFmpeg audio/video filtering library
8
+ Version: 10.6.101
9
+ Requires:
10
+ Requires.private: libswscale >= 8.13.100, libpostproc >= 58.4.100, libavformat >= 61.9.104, libavcodec >= 61.31.100, libswresample >= 5.4.100, libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lavfilter
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libavformat.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libavformat
7
+ Description: FFmpeg container format library
8
+ Version: 61.9.104
9
+ Requires:
10
+ Requires.private: libavcodec >= 61.31.100, libswresample >= 5.4.100, libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lavformat
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libavutil.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libavutil
7
+ Description: FFmpeg utility library
8
+ Version: 59.54.101
9
+ Requires:
10
+ Requires.private:
11
+ Conflicts:
12
+ Libs: -L${libdir} -lavutil
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libpostproc.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libpostproc
7
+ Description: FFmpeg postprocessing library
8
+ Version: 58.4.100
9
+ Requires:
10
+ Requires.private: libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lpostproc
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libswresample.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libswresample
7
+ Description: FFmpeg audio resampling library
8
+ Version: 5.4.100
9
+ Requires:
10
+ Requires.private: libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lswresample
13
+ Cflags: -I${includedir}
ffmpeg/lib/pkgconfig/libswscale.pc ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ prefix=${pcfiledir}/../..
2
+ exec_prefix=${prefix}
3
+ libdir=${prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: libswscale
7
+ Description: FFmpeg image rescaling library
8
+ Version: 8.13.100
9
+ Requires:
10
+ Requires.private: libavutil >= 59.54.101
11
+ Conflicts:
12
+ Libs: -L${libdir} -lswscale
13
+ Cflags: -I${includedir}
mingw/bin/addr2line.exe ADDED
Binary file (967 kB). View file
 
mingw/bin/ar.exe ADDED
Binary file (993 kB). View file
 
mingw/bin/c++.exe ADDED
Binary file (196 kB). View file
 
mingw/bin/c++filt.exe ADDED
Binary file (955 kB). View file
 
mingw/bin/cpp.exe ADDED
Binary file (195 kB). View file
 
mingw/bin/dllwrap.exe ADDED
Binary file (163 kB). View file
 
mingw/bin/elfedit.exe ADDED
Binary file (151 kB). View file
 
mingw/bin/g++.exe ADDED
Binary file (196 kB). View file